[SCM] jigsaw packaging branch, master, updated. 5a00ac48adfe2058c031995a248cc23e27e8f592
Guillaume Mazoyer
respawneral at gmail.com
Fri Feb 3 00:06:05 UTC 2012
The following commit has been merged in the master branch:
commit 5a00ac48adfe2058c031995a248cc23e27e8f592
Author: Alan Bateman <alan.bateman at oracle.com>
Date: Fri Feb 3 00:50:27 2012 +0100
Fix for compilation.
diff --git a/hotspot/agent/src/os/solaris/dbx/Makefile b/hotspot/agent/src/os/solaris/dbx/Makefile
deleted file mode 100644
index 4b1760d..0000000
--- a/hotspot/agent/src/os/solaris/dbx/Makefile
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-
-
-# Targets are:
-# 32bit: Build the 32 bit version in ./32bit
-# 64bit: Build the 64 bit version in ./64bit
-# helloWorld: Build the helloWorld test program
-# all: Build all of the above. This is the default.
-#
-# NOTE: This makefile uses IOBuf.cpp, IOBuf.hpp, Buffer.cpp, and
-# Buffer.hpp from the src/os/win32/agent directory.
-
-.PHONY: 32bit 64bit
-
-ARCH_ORIG = $(shell uname -p)
-
-# C++ := /java/devtools/$(ARCH_ORIG)/SUNWspro/SC6.1/bin/CC
-
-C++ := CC
-RM := /usr/bin/rm
-MKDIRS := /usr/bin/mkdir -p
-
-
-WIN32_DIR := ../../win32
-ARCH := $(subst i386,i486,$(ARCH_ORIG))
-# INCLUDES := -I/net/sparcworks.eng/export/set/sparcworks5/dbx_62_intg/dev/src/dbx -I$(WIN32_DIR)
-INCLUDES := -I. -I$(WIN32_DIR)
-CFLAGS_32bit := -xarch=v8
-CFLAGS_64bit := -xarch=v9
-CFLAGS := -PIC -xO3 $(INCLUDES)
-LIBS := -lsocket -lnsl -lrtld_db
-LDFLAGS := -G
-
-ifneq "$(ARCH)" "i486"
- CFLAGS += $(CFLAGS_$(VERSION))
- LDFLAGS += $(CFLAGS_$(VERSION))
-endif
-
-# We use IOBuf.hpp, IOBuf.cpp, Buffer.hpp, and Buffer.cpp from the win32 dir.
-vpath %.cpp .:$(WIN32_DIR)
-vpath %.hpp .:$(WIN32_DIR)
-
-OBJS = $(VERSION)/svc_agent_dbx.o $(VERSION)/IOBuf.o $(VERSION)/Buffer.o
-
-
-
-# The default is to make both 32 bit and 64 bit versions.
-all:: 32bit 64bit
-
-32bit 64bit::
- $(MKDIRS) $@
- $(MAKE) $@/libsvc_agent_dbx.so helloWorld VERSION=$@
-
-$(VERSION)/IOBuf.o: IOBuf.hpp
-$(VERSION)/Buffer.o: Buffer.hpp
-$(VERSION)/svc_agent_dbx.o: svc_agent_dbx.hpp
-
-$(VERSION)/%.o: %.cpp
- $(C++) $(CFLAGS) -c $< -o $@
-
-$(VERSION)/libsvc_agent_dbx.so:: $(OBJS)
- $(C++) $(LDFLAGS) -o $(VERSION)/libsvc_agent_dbx.so $(OBJS) $(LIBS)
-
-# Would be nice to move this into a shared directory
-helloWorld:: helloWorld.cpp
- $(C++) -g $< -o $@
-
-clean::
- $(RM) -rf 32bit 64bit *.o helloWorld
diff --git a/hotspot/agent/src/os/solaris/dbx/README b/hotspot/agent/src/os/solaris/dbx/README
deleted file mode 100644
index e043f7e..0000000
--- a/hotspot/agent/src/os/solaris/dbx/README
+++ /dev/null
@@ -1,9 +0,0 @@
-shell_impl.h
-proc_service_2.h
-
-The above files are captured from the dbx build environment.
-Rather then use a -I that points to stuff in .eng domain that
-may not be accessible in other domains these files are just
-copied here so local builds in other domains will work.
-These files rarely change so the fact that we might have to
-strobe in new ones on rare occasions is no big deal.
diff --git a/hotspot/agent/src/os/solaris/dbx/README-commands.txt b/hotspot/agent/src/os/solaris/dbx/README-commands.txt
deleted file mode 100644
index 4bc22d2..0000000
--- a/hotspot/agent/src/os/solaris/dbx/README-commands.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-This import module uses a largely text-based protocol, except for
-certain bulk data transfer operations. All text is in single-byte
-US-ASCII.
-
-Commands understood:
-
-address_size ::= <int result>
-
- Returns 32 if attached to 32-bit process, 64 if 64-bit.
-
-peek_fail_fast <bool arg> ::=
-
- Indicates whether "peek" requests should "fail fast"; that is, if
- any of the addresses in the requested range are unmapped, report
- the entire range as unmapped. This is substantially faster than
- the alternative, which is to read the entire range byte-by-byte.
- However, it should only be used when it is guaranteed by the
- client application that peeks come from at most one page. The
- default is that peek_fast_fail is not enabled.
-
-peek <address addr> <unsigned int numBytes> ::=
- B<binary char success>
- [<binary unsigned int len> <binary char isMapped> [<binary char data>]...]...
-
- NOTE that the binary portion of this message is prefixed by the
- uppercase US-ASCII letter 'B', allowing easier synchronization by
- clients. There is no data between the 'B' and the rest of the
- message.
-
- May only be called once attached. Reads the address space of the
- target process starting at the given address (see below for format
- specifications) and extending the given number of bytes. Whether
- the read succeeded is indicated by a single byte containing a 1 or
- 0 (success or failure). If successful, the return result is given
- in a sequence of ranges. _len_, the length of each range, is
- indicated by a 32-bit unsigned integer transmitted with big-endian
- byte ordering (i.e., most significant byte first). _isMapped_
- indicates whether the range is mapped or unmapped in the target
- process's address space, and will contain the value 1 or 0 for
- mapped or unmapped, respectively. If the range is mapped,
- _isMapped_ is followed by _data_, containing the raw binary data
- for the range. The sum of all ranges' lengths is guaranteed to be
- equivalent to the number of bytes requested.
-
-poke <address addr> <int numBytes> B[<binary char data>]... ::= <bool result>
-
- NOTE that the binary portion of this message is prefixed by the
- uppercase US-ASCII letter 'B', allowing easier synchronization by
- clients. There is no data between the 'B' and the rest of the
- message.
-
- Writes the given data to the target process starting at the given
- address. Returns 1 on success, 0 on failure (i.e., one or more of
- target addresses were unmapped).
-
-mapped <address addr> <int numBytes> ::= <bool result>
-
- Returns 1 if entire address range [address...address + int arg) is
- mapped in target process's address space, 0 if not
-
-lookup <symbol objName> <symbol sym> ::= <address addr>
-
- First symbol is object name; second is symbol to be looked up.
- Looks up symbol in target process's symbol table and returns
- address. Returns NULL (0x0) if symbol is not found.
-
-thr_gregs <int tid> ::= <int numAddresses> <address...>
-
- Fetch the "general" (integer) register set for the given thread.
- Returned as a series of hexidecimal values. NOTE: the meaning of
- the return value is architecture-dependent. In general it is the
- contents of the prgregset_t.
-
-exit ::=
-
- Exits the serviceability agent dbx module, returning control to
- the dbx prompt.
-
-// Data formats and example values:
-<address> ::= 0x12345678[9ABCDEF0] /* up to 64-bit hex value */
-<unsigned int> ::= 5 /* up to 32-bit integer number; no leading sign */
-<bool> ::= 1 /* ASCII '0' or '1' */
diff --git a/hotspot/agent/src/os/solaris/dbx/helloWorld.cpp b/hotspot/agent/src/os/solaris/dbx/helloWorld.cpp
deleted file mode 100644
index 7fd4ea4..0000000
--- a/hotspot/agent/src/os/solaris/dbx/helloWorld.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include <stdio.h>
-#include <inttypes.h>
-
-extern "C" {
- const char* helloWorldString = "Hello, world!";
- // Do not change these values without changing TestDebugger.java as well
- // FIXME: should make these jbyte, jshort, etc...
- volatile int8_t testByte = 132;
- volatile int16_t testShort = 27890;
- volatile int32_t testInt = 1020304050;
- volatile int64_t testLong = 102030405060708090LL;
- volatile float testFloat = 35.4F;
- volatile double testDouble = 1.23456789;
-
- volatile int helloWorldTrigger = 0;
-}
-
-int
-main(int, char**) {
- while (1) {
- while (helloWorldTrigger == 0) {
- }
-
- fprintf(stderr, "%s\n", helloWorldString);
- fprintf(stderr, "testByte=%d\n", testByte);
- fprintf(stderr, "testShort=%d\n", testShort);
- fprintf(stderr, "testInt=%d\n", testInt);
- fprintf(stderr, "testLong=%d\n", testLong);
- fprintf(stderr, "testFloat=%d\n", testFloat);
- fprintf(stderr, "testDouble=%d\n", testDouble);
-
- while (helloWorldTrigger != 0) {
- }
- }
-}
diff --git a/hotspot/agent/src/os/solaris/dbx/proc_service_2.h b/hotspot/agent/src/os/solaris/dbx/proc_service_2.h
deleted file mode 100644
index 93163cb..0000000
--- a/hotspot/agent/src/os/solaris/dbx/proc_service_2.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _PROC_SERVICE_2_H
-#define _PROC_SERVICE_2_H
-
-/*
- * Types, function definitions for the provider of services beyond
- * proc_service. This interface will be used by import modules like
- * BAT/prex, NEO debugger etc.
- */
-
-/*
- CCR info
-
- Version history:
-
- 1.0 - Initial CCR release
-
- 1.1 - Changes for GLUE/neo.
- New entry points ps_svnt_generic() and ps_svc_generic()
- - New entry point ps_getpid()
-
- Release information for automatic CCR updates:
- BEGIN RELEASE NOTES: (signifies what gets put into CCR release notes)
- 1.2 - Changes to support Solaris 2.7
-
- END RELEASE NOTES: (signifies what gets put into CCR release notes)
-
- Following is used for CCR version number:
-
-#define CCR_PROC_SERVICE_2_VERSION 1.2
-
-*/
-
-
-#include <proc_service.h>
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ps_loadobj {
- int objfd; /* fd of the load object or executable
- * -1 implies its not available.
- * This file decriptor is live only during the
- * particular call to ps_iter_f(). If you
- * need it beyond that you need to dup() it.
- */
- psaddr_t
- text_base; /* address where text of loadobj was mapped */
- psaddr_t
- data_base; /* address where data of loadobj was mapped */
- const char *objname; /* loadobj name */
-};
-
-typedef int ps_iter_f(const struct ps_prochandle *, const struct ps_loadobj *,
- void *cd);
-
-/*
- * Returns the ps_prochandle for the current process under focus. Returns
- * NULL if there is none.
- */
-
-const struct ps_prochandle *
-ps_get_prochandle(void);
-
-/*
- * Returns the ps_prochandle for the current process(allows core files to
- * be specified) under focus. Returns NULL if there is none.
- */
-const struct ps_prochandle *
-ps_get_prochandle2(int cores_too);
-
-/*
- * Returns the pid of the process referred to by the ps_prochandle.
- *
- * 0 is returned in case the ps_prochandle is not valid or refers to dead
- * process.
- *
- */
-pid_t
-ps_getpid(const struct ps_prochandle *);
-
-/*
- * Iteration function that iterates over all load objects *and the
- * executable*
- *
- * If the callback routine returns:
- * 0 - continue processing link objects
- * non zero - stop calling the callback function
- *
- */
-
-ps_err_e
-ps_loadobj_iter(const struct ps_prochandle *, ps_iter_f *, void *clnt_data);
-
-/*
- * Address => function name mapping
- *
- * Given an address, returns a pointer to the function's
- * linker name (null terminated).
- */
-
-ps_err_e
-ps_find_fun_name(const struct ps_prochandle *, psaddr_t addr,
- const char **name);
-
-/*
- * Interface to LD_PRELOAD. LD_PRELOAD given library across the
- * program 'exec'.
- *
- */
-
-/*
- * Append/Prepend the 'lib' (has to be library name as understood by LD_PRELOAD)
- * to the LD_PRELOAD variable setting to be used by the debugee
- * Returns a cookie (in id).
- */
-ps_err_e
-ps_ld_preload_append(const char *lib, int *id);
-ps_err_e
-ps_ld_preload_prepend(const char *lib, int *id);
-
-/*
- * Remove the library associated with 'id' from the LD_PRELOAD setting.
- *
- */
-ps_err_e
-ps_ld_preload_remove(int id);
-
-#ifdef __cplusplus
-}
-#endif
-
-/*
- * The following are C++ only interfaces
- */
-#ifdef __cplusplus
-
-/*
- * classes ServiceDbx and ServantDbx and defined in "gp_dbx_svc.h" which is
- * accessed via CCR
- */
-extern class ServantDbx *ps_svnt_generic();
-extern class ServiceDbx *ps_svc_generic();
-
-#endif
-
-#endif /* _PROC_SERVICE_2_H */
diff --git a/hotspot/agent/src/os/solaris/dbx/shell_imp.h b/hotspot/agent/src/os/solaris/dbx/shell_imp.h
deleted file mode 100644
index 65de0ce..0000000
--- a/hotspot/agent/src/os/solaris/dbx/shell_imp.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHELL_IMP_H
-#define SHELL_IMP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-
-/*
- CCR info
-
- Vesrion history:
-
- 1.0 - Initial CCR release
-
- Release information for automatic CCR updates:
-
- BEGIN RELEASE NOTES: (signifies what gets put into CCR release notes)
- 1.1
- - Entry points for va_list style msgs; new shell_imp_vmsg()
- and shell_imp_verrmsg()
- - shell_imp_env_checker() is now shell_imp_var_checker().
- Also the var_checker callback gets passed interp.
- 1.2 - interposition framework (used by jdbx)
- - access to input FILE pointer.
-
- END RELEASE NOTES: (signifies what gets put into CCR release notes)
-
-Following is used as a CCR version number:
-#define CCR_SHELL_IMP_VERSION 1.1
-*/
-
-#include <stdarg.h>
-
-#define SHELL_IMP_MAJOR 1
-#define SHELL_IMP_MINOR 2
-#define SHELL_IMP_FLAG_GLOB 0x1
-#define SHELL_IMP_FLAG_ARGQ 0x2
-
-typedef void *shell_imp_interp_t;
-typedef void *shell_imp_command_t;
-typedef int shell_imp_fun_t(shell_imp_interp_t, int, char **, void *);
-
-int
-shell_imp_init(
- int, /* major version number */
- int, /* minor version number */
- shell_imp_interp_t, /* interpreter */
- int, /* argc */
- char *[] /* argv */
-);
-
-int
-shell_imp_fini(shell_imp_interp_t);
-
-shell_imp_command_t
-shell_imp_define_command(char *, /* command name e.g. "tnf" */
- shell_imp_fun_t *, /* callback function */
- int, /* SHELL_IMP_FLAG_* bit vector */
- void *, /* client_data Passed as last arg to
- /* callback function */
- char * /* help message, e.g. */
- /* "enable the specified tnf probes" */
- );
-
-int
-shell_imp_undefine_command(shell_imp_command_t);
-
-int
-shell_imp_var_checker(shell_imp_interp_t,
- const char *, /* var name */
- int (*)(shell_imp_interp_t, const char*) /* env checker */
- );
-
-int
-shell_imp_execute(shell_imp_interp_t, const char *);
-
-const char *
-shell_imp_get_var(shell_imp_interp_t, const char *);
-
-void
-shell_imp_msg(shell_imp_interp_t, const char *, ...);
-
-void
-shell_imp_errmsg(shell_imp_interp_t, const char *, ...);
-
-void
-shell_imp_vmsg(shell_imp_interp_t, const char *, va_list);
-
-void
-shell_imp_verrmsg(shell_imp_interp_t, const char *, va_list);
-
-
-
-/*
- * Stuff added for 1.2
- */
-
-struct shell_imp_interposition_info_t {
- shell_imp_fun_t *
- new_func;
- void * new_client_data;
- shell_imp_fun_t *
- original_func;
- void * original_client_data;
- int original_flags;
-};
-
-typedef int shell_imp_dispatcher_t(shell_imp_interp_t, int, char **,
- shell_imp_interposition_info_t *);
-
-shell_imp_command_t
-shell_imp_interpose(char *name,
- shell_imp_fun_t *new_func,
- int flags,
- void *client_data,
- char * description,
- shell_imp_dispatcher_t *);
-
-int shell_imp_uninterpose(shell_imp_command_t);
-
-int
-shell_imp_dispatch_interposition(shell_imp_interp_t,
- shell_imp_interposition_info_t *,
- int argc, char *argv[]);
-
-int
-shell_imp_dispatch_original(shell_imp_interp_t,
- shell_imp_interposition_info_t *,
- int argc, char *argv[]);
-
-FILE *
-shell_imp_cur_input(shell_imp_interp_t);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.cpp b/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.cpp
deleted file mode 100644
index 5547fdc..0000000
--- a/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.cpp
+++ /dev/null
@@ -1,1068 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// This is the implementation of a very simple dbx import module which
-// handles requests from the VM which come in over a socket. The
-// higher-level Java wrapper for dbx starts the debugger, attaches to
-// the process, imports this command, and runs it. After that, the SA
-// writes commands to this agent via its own private communications
-// channel. The intent is to move away from the text-based front-end
-// completely in the near future (no more calling "debug" by printing
-// text to dbx's stdin).
-
-#include <stdio.h>
-#include <errno.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <string.h>
-#include <stropts.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-
-#include <proc_service.h>
-#include <sys/procfs_isa.h>
-#include <rtld_db.h>
-#include "proc_service_2.h"
-#include "svc_agent_dbx.hpp"
-
-static ServiceabilityAgentDbxModule* module = NULL;
-#define NEEDS_CLEANUP
-
-// Useful for debugging
-#define VERBOSE_DEBUGGING
-
-#ifdef VERBOSE_DEBUGGING
-# define debug_only(x) x
-#else
-# define debug_only(x)
-#endif
-
-// For profiling
-//#define PROFILING
-
-#ifdef PROFILING
-#define PROFILE_COUNT 200
-static Timer scanTimer;
-static Timer workTimer;
-static Timer writeTimer;
-static int numRequests = 0;
-#endif /* PROFILING */
-
-const char* ServiceabilityAgentDbxModule::CMD_ADDRESS_SIZE = "address_size";
-const char* ServiceabilityAgentDbxModule::CMD_PEEK_FAIL_FAST = "peek_fail_fast";
-const char* ServiceabilityAgentDbxModule::CMD_PEEK = "peek";
-const char* ServiceabilityAgentDbxModule::CMD_POKE = "poke";
-const char* ServiceabilityAgentDbxModule::CMD_MAPPED = "mapped";
-const char* ServiceabilityAgentDbxModule::CMD_LOOKUP = "lookup";
-const char* ServiceabilityAgentDbxModule::CMD_THR_GREGS = "thr_gregs";
-const char* ServiceabilityAgentDbxModule::CMD_EXIT = "exit";
-
-// The initialization routines must not have C++ name mangling
-extern "C" {
-
-/** This is the initialization routine called by dbx upon importing of
- this module. Returns 0 upon successful initialization, -1 upon
- failure. */
-int shell_imp_init(int major, int minor,
- shell_imp_interp_t interp, int argc, char *argv[])
-{
- // Ensure shell interpreter data structure is laid out the way we
- // expect
- if (major != SHELL_IMP_MAJOR) {
- debug_only(fprintf(stderr, "Serviceability agent: unexpected value for SHELL_IMP_MAJOR (got %d, expected %d)\n", major, SHELL_IMP_MAJOR);)
- return -1;
- }
- if (minor < SHELL_IMP_MINOR) {
- debug_only(fprintf(stderr, "Serviceability agent: unexpected value for SHELL_IMP_MINOR (got %d, expected >= %d)\n", minor, SHELL_IMP_MINOR);)
- return -1;
- }
-
- if (module != NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: module appears to already be initialized (should not happen)\n");)
- // Already initialized. Should not happen.
- return -1;
- }
-
- module = new ServiceabilityAgentDbxModule(major, minor, interp, argc, argv);
- if (!module->install()) {
- debug_only(fprintf(stderr, "Serviceability agent: error installing import module\n");)
- delete module;
- module = NULL;
- return -1;
- }
-
- // Installation was successful. Next step will be for the user to
- // enter the appropriate command on the command line, which will
- // make the SA's dbx module wait for commands to come in over the
- // socket.
- return 0;
-}
-
-/** This is the routine called by dbx upon unloading of this module.
- Returns 0 upon success, -1 upon failure. */
-int
-shell_imp_fini(shell_imp_interp_t)
-{
- if (module == NULL) {
- return -1;
- }
-
- bool res = module->uninstall();
- delete module;
- module = NULL;
- if (!res) {
- return -1;
- }
- return 0;
-}
-
-} // extern "C"
-
-/** This is the routine which is called by the dbx shell when the user
- requests the serviceability agent module to run. This delegates to
- ServiceabilityAgentDbxModule::run. This routine's signature must
- match that of shell_imp_fun_t. */
-extern "C" {
-static int
-svc_agent_run(shell_imp_interp_t, int, char **, void *) {
- if (module == NULL) {
- return -1;
- }
-
- module->run();
- return 0;
-}
-}
-
-/*
- * Implementation of ServiceabilityAgentDbxModule class
- */
-
-// NOTE: we need to forward declare the special "ps_get_prochandle2"
-// function which allows examination of core files as well. It isn't
-// currently in proc_service_2.h. Note also that it has name mangling
-// because it isn't declared extern "C".
-//const struct ps_prochandle *ps_get_prochandle2(int cores_too);
-
-ServiceabilityAgentDbxModule::ServiceabilityAgentDbxModule(int, int, shell_imp_interp_t interp,
- int argc, char *argv[])
- :myComm(32768, 131072)
-{
- _interp = interp;
- _argc = argc;
- _argv = argv;
- _tdb_agent = NULL;
- peek_fail_fast = false;
- libThreadName = NULL;
-}
-
-ServiceabilityAgentDbxModule::~ServiceabilityAgentDbxModule() {
- if (_command != NULL) {
- uninstall();
- }
-}
-
-char*
-readCStringFromProcess(psaddr_t addr) {
- char c;
- int num = 0;
- ps_prochandle* cur_proc = (ps_prochandle*) ps_get_prochandle2(1);
-
- // Search for null terminator
- do {
- if (ps_pread(cur_proc, addr + num, &c, 1) != PS_OK) {
- return NULL;
- }
- ++num;
- } while (c != 0);
-
- // Allocate string
- char* res = new char[num];
- if (ps_pread(cur_proc, addr, res, num) != PS_OK) {
- delete[] res;
- return NULL;
- }
- return res;
-}
-
-int
-findLibThreadCB(const rd_loadobj_t* lo, void* data) {
- ServiceabilityAgentDbxModule* module = (ServiceabilityAgentDbxModule*) data;
- char* name = readCStringFromProcess(lo->rl_nameaddr);
- if (strstr(name, "libthread.so") != NULL) {
- module->libThreadName = name;
- return 0;
- } else {
- delete[] name;
- return 1;
- }
-}
-
-bool
-ServiceabilityAgentDbxModule::install() {
- // NOTE interdependency between here and Java side wrapper
- // FIXME: casts of string literal to char * to match prototype
- _command = shell_imp_define_command((char *) "svc_agent_run",
- &svc_agent_run,
- 0,
- NULL,
- (char *) "Run the serviceability agent's dbx module.\n"
- "This routine causes the module to listen on a socket for requests.\n"
- "It does not return until the Java-side code tells it to exit, at\n"
- "which point control is returned to the dbx shell.");
- if (_command == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to install svc_agent_run command\n"));
- return false;
- }
-
- // This is fairly painful. Since dbx doesn't currently load
- // libthread_db with RTLD_GLOBAL, we can't just use RTLD_DEFAULT for
- // the argument to dlsym. Instead, we have to use rtld_db to search
- // through the loaded objects in the target process for libthread.so and
-
- // Try rtld_db
- if (rd_init(RD_VERSION) != RD_OK) {
- debug_only(fprintf(stderr, "Serviceability agent: Unable to init rtld_db\n"));
- return false;
- }
-
- rd_agent_t* rda = rd_new((struct ps_prochandle*) ps_get_prochandle2(1));
- if (rda == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Unable to allocate rtld_db agent\n"));
- return false;
- }
-
- if (rd_loadobj_iter(rda, (rl_iter_f*) findLibThreadCB, this) != RD_OK) {
- debug_only(fprintf(stderr, "Serviceability agent: Loadobject iteration failed\n"));
- return false;
- }
-
- if (libThreadName == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to find pathname to libthread.so in target process\n"));
- return false;
- }
-
- // Find and open libthread_db.so
- char* slash = strrchr(libThreadName, '/');
- if (slash == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: can't parse path to libthread.so \"%s\"\n"));
- return false;
- }
-
- int slashPos = slash - libThreadName;
- char* buf = new char[slashPos + strlen("libthread_db.so") + 20]; // slop
- if (buf == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: error allocating libthread_db.so pathname\n"));
- return false;
- }
- strncpy(buf, libThreadName, slashPos + 1);
-
- // Check dbx's data model; use sparcv9/ subdirectory if 64-bit and
- // if target process is 32-bit
- if ((sizeof(void*) == 8) &&
- (strstr(libThreadName, "sparcv9") == NULL)) {
- strcpy(buf + slashPos + 1, "sparcv9/");
- slashPos += strlen("sparcv9/");
- }
-
- strcpy(buf + slashPos + 1, "libthread_db.so");
-
- libThreadDB = dlopen(buf, RTLD_LAZY);
- void* tmpDB = libThreadDB;
- if (libThreadDB == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Warning: unable to find libthread_db.so at \"%s\"\n", buf));
- // Would like to handle this case as well. Maybe dbx has a better
- // idea of where libthread_db.so lies. If the problem with dbx
- // loading libthread_db without RTLD_GLOBAL specified ever gets
- // fixed, we could run this code all the time.
- tmpDB = RTLD_DEFAULT;
- }
-
- delete[] buf;
-
- // Initialize access to libthread_db
- td_init_fn = (td_init_fn_t*) dlsym(tmpDB, "td_init");
- td_ta_new_fn = (td_ta_new_fn_t*) dlsym(tmpDB, "td_ta_new");
- td_ta_delete_fn = (td_ta_delete_fn_t*) dlsym(tmpDB, "td_ta_delete");
- td_ta_map_id2thr_fn = (td_ta_map_id2thr_fn_t*) dlsym(tmpDB, "td_ta_map_id2thr");
- td_thr_getgregs_fn = (td_thr_getgregs_fn_t*) dlsym(tmpDB, "td_thr_getgregs");
-
- if (td_init_fn == NULL ||
- td_ta_new_fn == NULL ||
- td_ta_delete_fn == NULL ||
- td_ta_map_id2thr_fn == NULL ||
- td_thr_getgregs_fn == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to find one or more libthread_db symbols:\n"));
- debug_only(if (td_init_fn == NULL) fprintf(stderr, " td_init\n"));
- debug_only(if (td_ta_new_fn == NULL) fprintf(stderr, " td_ta_new\n"));
- debug_only(if (td_ta_delete_fn == NULL) fprintf(stderr, " td_ta_delete\n"));
- debug_only(if (td_ta_map_id2thr_fn == NULL) fprintf(stderr, " td_ta_map_id2thr\n"));
- debug_only(if (td_thr_getgregs_fn == NULL) fprintf(stderr, " td_thr_getgregs\n"));
- return false;
- }
-
- if ((*td_init_fn)() != TD_OK) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to initialize libthread_db\n"));
- return false;
- }
-
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::uninstall() {
- if (_command == NULL) {
- return false;
- }
-
- if (libThreadDB != NULL) {
- dlclose(libThreadDB);
- libThreadDB = NULL;
- }
-
- int res = shell_imp_undefine_command(_command);
-
- if (res != 0) {
- return false;
- }
-
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::run() {
- // This is where most of the work gets done.
- // The command processor loop looks like the following:
- // - create listening socket
- // - accept a connection (only one for now)
- // - while that connection is open and the "exit" command has not
- // been received:
- // - read command
- // - if it's the exit command, cleanup and return
- // - otherwise, process command and write result
-
- int listening_socket = socket(AF_INET, SOCK_STREAM, 0);
- if (listening_socket < 0) {
- return false;
- }
-
- // Set the SO_REUSEADDR property on the listening socket. This
- // prevents problems with calls to bind() to the same port failing
- // after this process exits. This seems to work on all platforms.
- int reuse_address = 1;
- if (setsockopt(listening_socket, SOL_SOCKET, SO_REUSEADDR,
- (char *)&reuse_address, sizeof(reuse_address)) < 0) {
- close(listening_socket);
- return false;
- }
-
- sockaddr_in server_address;
- // Build the server address. We can bind the listening socket to the
- // INADDR_ANY internet address.
- memset((char*)&server_address, 0, sizeof(server_address));
- server_address.sin_family = AF_INET;
- server_address.sin_addr.s_addr = (unsigned long)htonl(INADDR_ANY);
- server_address.sin_port = htons((short)PORT);
-
- // Bind socket to port
- if (bind(listening_socket, (sockaddr*) &server_address,
- sizeof(server_address)) < 0) {
- close(listening_socket);
- return false;
- }
-
- // Arbitrarily chosen backlog of 5 (shouldn't matter since we expect
- // at most one connection)
- if (listen(listening_socket, 5) < 0) {
- close(listening_socket);
- return false;
- }
-
- // OK, now ready to wait for a data connection. This call to
- // accept() will block.
- struct sockaddr_in client_address;
- int address_len = sizeof(client_address);
- int client_socket = accept(listening_socket, (sockaddr*) &client_address,
- &address_len);
- // Close listening socket regardless of whether accept() succeeded.
- // (FIXME: this may be annoying, especially during debugging, but I
- // really feel that robustness and multiple connections should be
- // handled higher up, e.g., at the Java level -- multiple clients
- // could conceivably connect to the SA via RMI, and that would be a
- // more robust solution than implementing multiple connections at
- // this level)
- NEEDS_CLEANUP;
-
- // NOTE: the call to shutdown() usually fails, so don't panic if this happens
- shutdown(listening_socket, 2);
-
- if (close(listening_socket) < 0) {
- debug_only(fprintf(stderr, "Serviceability agent: Error closing listening socket\n"));
- return false;
- }
-
- if (client_socket < 0) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to open client socket\n"));
- // No more cleanup necessary
- return false;
- }
-
- // Attempt to disable TCP buffering on this socket. We send small
- // amounts of data back and forth and don't want buffering.
- int buffer_val = 1;
- if (setsockopt(client_socket, IPPROTO_IP, TCP_NODELAY, (char *) &buffer_val, sizeof(buffer_val)) < 0) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to set TCP_NODELAY option on client socket\n"));
- cleanup(client_socket);
- return false;
- }
-
- // OK, we have the data socket through which we will communicate
- // with the Java side. Wait for commands or until reading or writing
- // caused an error.
-
- bool should_continue = true;
-
- myComm.setSocket(client_socket);
-
-#ifdef PROFILING
- scanTimer.reset();
- workTimer.reset();
- writeTimer.reset();
-#endif
-
- // Allocate a new thread agent for libthread_db
- if ((*td_ta_new_fn)((ps_prochandle*) ps_get_prochandle2(1), &_tdb_agent) !=
- TD_OK) {
- debug_only(fprintf(stderr, "Serviceability agent: Failed to allocate thread agent\n"));
- cleanup(client_socket);
- return false;
- }
-
- do {
- // Decided to use text to communicate between these processes.
- // Probably will make debugging easier -- could telnet in if
- // necessary. Will make scanning harder, but probably doesn't
- // matter.
-
- // Why not just do what workshop does and parse dbx's console?
- // Probably could do that, but at least this way we are in control
- // of the text format on both ends.
-
- // FIXME: should have some way of synchronizing these commands
- // between the C and Java sources.
-
- NEEDS_CLEANUP;
-
- // Do a blocking read of a line from the socket.
- char *input_buffer = myComm.readLine();
- if (input_buffer == NULL) {
- debug_only(fprintf(stderr, "Serviceability agent: error during read: errno = %d\n", errno));
- debug_only(perror("Serviceability agent"));
- // Error occurred during read.
- // FIXME: should guard against SIGPIPE
- cleanup(client_socket);
- return false;
- }
-
- // OK, now ready to scan. See README-commands.txt for syntax
- // descriptions.
-
- bool res = false;
- if (!strncmp(input_buffer, CMD_ADDRESS_SIZE, strlen(CMD_ADDRESS_SIZE))) {
- res = handleAddressSize(input_buffer + strlen(CMD_ADDRESS_SIZE));
- } else if (!strncmp(input_buffer, CMD_PEEK_FAIL_FAST, strlen(CMD_PEEK_FAIL_FAST))) {
- res = handlePeekFailFast(input_buffer + strlen(CMD_PEEK_FAIL_FAST));
- } else if (!strncmp(input_buffer, CMD_PEEK, strlen(CMD_PEEK))) {
- res = handlePeek(input_buffer + strlen(CMD_PEEK));
- } else if (!strncmp(input_buffer, CMD_POKE, strlen(CMD_POKE))) {
- res = handlePoke(input_buffer + strlen(CMD_POKE));
- } else if (!strncmp(input_buffer, CMD_MAPPED, strlen(CMD_MAPPED))) {
- res = handleMapped(input_buffer + strlen(CMD_MAPPED));
- } else if (!strncmp(input_buffer, CMD_LOOKUP, strlen(CMD_LOOKUP))) {
- res = handleLookup(input_buffer + strlen(CMD_LOOKUP));
- } else if (!strncmp(input_buffer, CMD_THR_GREGS, strlen(CMD_THR_GREGS))) {
- res = handleThrGRegs(input_buffer + strlen(CMD_THR_GREGS));
- } else if (!strncmp(input_buffer, CMD_EXIT, strlen(CMD_EXIT))) {
- should_continue = false;
- }
-
- if (should_continue) {
- if (!res) {
- cleanup(client_socket);
- return false;
- }
- }
-
-#ifdef PROFILING
- if (++numRequests == PROFILE_COUNT) {
- fprintf(stderr, "%d requests: %d ms scanning, %d ms work, %d ms writing\n",
- PROFILE_COUNT, scanTimer.total(), workTimer.total(), writeTimer.total());
- fflush(stderr);
- scanTimer.reset();
- workTimer.reset();
- writeTimer.reset();
- numRequests = 0;
- }
-#endif
-
- } while (should_continue);
-
- // Successful exit
- cleanup(client_socket);
- return true;
-}
-
-void
-ServiceabilityAgentDbxModule::cleanup(int client_socket) {
- shutdown(client_socket, 2);
- close(client_socket);
- if (_tdb_agent != NULL) {
- (*td_ta_delete_fn)(_tdb_agent);
- }
-}
-
-bool
-ServiceabilityAgentDbxModule::handleAddressSize(char* data) {
- int data_model;
- ps_err_e result = ps_pdmodel((ps_prochandle*) ps_get_prochandle2(1),
- &data_model);
- if (result != PS_OK) {
- myComm.writeString("0");
- myComm.flush();
- return false;
- }
-
- int val;
- switch (data_model) {
- case PR_MODEL_ILP32:
- val = 32;
- break;
- case PR_MODEL_LP64:
- val = 64;
- break;
- default:
- val = 0;
- break;
- }
-
- if (!myComm.writeInt(val)) {
- return false;
- }
- if (!myComm.writeEOL()) {
- return false;
- }
- return myComm.flush();
-}
-
-bool
-ServiceabilityAgentDbxModule::handlePeekFailFast(char* data) {
- unsigned int val;
- if (!scanUnsignedInt(&data, &val)) {
- return false;
- }
- peek_fail_fast = (val ? true : false);
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::handlePeek(char* data) {
- // Scan hex address, return false if failed
- psaddr_t addr;
-#ifdef PROFILING
- scanTimer.start();
-#endif /* PROFILING */
- if (!scanAddress(&data, &addr)) {
- return false;
- }
- unsigned int num;
- if (!scanUnsignedInt(&data, &num)) {
- return false;
- }
- if (num == 0) {
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- myComm.writeBinChar('B');
- myComm.writeBinChar(1);
- myComm.writeBinUnsignedInt(0);
- myComm.writeBinChar(0);
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- return true;
- }
-#ifdef PROFILING
- scanTimer.stop();
- workTimer.start();
-#endif /* PROFILING */
- char* buf = new char[num];
- ps_prochandle* cur_proc = (ps_prochandle*) ps_get_prochandle2(1);
- ps_err_e result = ps_pread(cur_proc, addr, buf, num);
- if (result == PS_OK) {
- // Fast case; entire read succeeded.
-#ifdef PROFILING
- workTimer.stop();
- writeTimer.start();
-#endif /* PROFILING */
- myComm.writeBinChar('B');
- myComm.writeBinChar(1);
- myComm.writeBinUnsignedInt(num);
- myComm.writeBinChar(1);
- myComm.writeBinBuf(buf, num);
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- } else {
-#ifdef PROFILING
- workTimer.stop();
-#endif /* PROFILING */
-
- if (peek_fail_fast) {
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- // Fail fast
- myComm.writeBinChar('B');
- myComm.writeBinChar(1);
- myComm.writeBinUnsignedInt(num);
- myComm.writeBinChar(0);
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- } else {
- // Slow case: try to read one byte at a time
- // FIXME: need better way of handling this, a la VirtualQuery
-
- unsigned int strideLen = 0;
- int bufIdx = 0;
- bool lastByteMapped = (ps_pread(cur_proc, addr, buf, 1) == PS_OK ? true : false);
-
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- myComm.writeBinChar('B');
- myComm.writeBinChar(1);
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
-
- for (int i = 0; i < num; ++i, ++addr) {
-#ifdef PROFILING
- workTimer.start();
-#endif /* PROFILING */
- result = ps_pread(cur_proc, addr, &buf[bufIdx], 1);
-#ifdef PROFILING
- workTimer.stop();
-#endif /* PROFILING */
- bool tmpMapped = (result == PS_OK ? true : false);
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- if (tmpMapped != lastByteMapped) {
- // State change. Write the length of the last stride.
- myComm.writeBinUnsignedInt(strideLen);
- if (lastByteMapped) {
- // Stop gathering data. Write the data of the last stride.
- myComm.writeBinChar(1);
- myComm.writeBinBuf(buf, strideLen);
- bufIdx = 0;
- } else {
- // Start gathering data to write.
- myComm.writeBinChar(0);
- }
- strideLen = 0;
- lastByteMapped = tmpMapped;
- }
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- if (lastByteMapped) {
- ++bufIdx;
- }
- ++strideLen;
- }
-
- // Write last stride (must be at least one byte long by definition)
-#ifdef PROFILING
- writeTimer.start();
-#endif /* PROFILING */
- myComm.writeBinUnsignedInt(strideLen);
- if (lastByteMapped) {
- myComm.writeBinChar(1);
- myComm.writeBinBuf(buf, strideLen);
- } else {
- myComm.writeBinChar(0);
- }
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
- }
- }
- delete[] buf;
- myComm.flush();
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::handlePoke(char* data) {
- // FIXME: not yet implemented
- NEEDS_CLEANUP;
- bool res = myComm.writeBoolAsInt(false);
- myComm.flush();
- return res;
-}
-
-bool
-ServiceabilityAgentDbxModule::handleMapped(char* data) {
- // Scan address
- psaddr_t addr;
- if (!scanAddress(&data, &addr)) {
- return false;
- }
- unsigned int num;
- if (!scanUnsignedInt(&data, &num)) {
- return false;
- }
- unsigned char val;
- ps_prochandle* cur_proc = (ps_prochandle*) ps_get_prochandle2(1);
- char* buf = new char[num];
- if (ps_pread(cur_proc, addr, buf, num) == PS_OK) {
- myComm.writeBoolAsInt(true);
- } else {
- myComm.writeBoolAsInt(false);
- }
- delete[] buf;
- myComm.writeEOL();
- myComm.flush();
- return true;
-}
-
-extern "C"
-int loadobj_iterator(const rd_loadobj_t* loadobj, void *) {
- if (loadobj != NULL) {
- fprintf(stderr, "loadobj_iterator: visited loadobj \"%p\"\n", (void*) loadobj->rl_nameaddr);
- return 1;
- }
-
- fprintf(stderr, "loadobj_iterator: NULL loadobj\n");
- return 0;
-}
-
-bool
-ServiceabilityAgentDbxModule::handleLookup(char* data) {
- // Debugging: iterate over loadobjs
- /*
- rd_agent_t* rld_agent = rd_new((ps_prochandle*) ps_get_prochandle2(1));
- rd_loadobj_iter(rld_agent, &loadobj_iterator, NULL);
- rd_delete(rld_agent);
- */
-
-#ifdef PROFILING
- scanTimer.start();
-#endif /* PROFILING */
-
- char* object_name = scanSymbol(&data);
- if (object_name == NULL) {
- return false;
- }
- char* symbol_name = scanSymbol(&data);
- if (symbol_name == NULL) {
- delete[] object_name;
- return false;
- }
-
-#ifdef PROFILING
- scanTimer.stop();
- workTimer.start();
-#endif /* PROFILING */
-
- ps_sym_t sym;
- // FIXME: check return values from write routines
- ps_prochandle* process = (ps_prochandle*) ps_get_prochandle2(1);
- ps_err_e lookup_res = ps_pglobal_sym(process,
- object_name, symbol_name, &sym);
-#ifdef PROFILING
- workTimer.stop();
- writeTimer.start();
-#endif /* PROFILING */
-
- delete[] object_name;
- delete[] symbol_name;
- if (lookup_res != PS_OK) {
- // This is too noisy
- // debug_only(fprintf(stderr, "ServiceabilityAgentDbxModule::handleLookup: error %d\n", lookup_res));
- myComm.writeString("0x0");
- } else {
- myComm.writeAddress((void *)sym.st_value);
- }
- myComm.writeEOL();
- myComm.flush();
-
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
-
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::handleThrGRegs(char* data) {
-#ifdef PROFILING
- scanTimer.start();
-#endif /* PROFILING */
-
- unsigned int num;
- // Get the thread ID
- if (!scanUnsignedInt(&data, &num)) {
- return false;
- }
-
-#ifdef PROFILING
- scanTimer.stop();
- workTimer.start();
-#endif /* PROFILING */
-
- // Map tid to thread handle
- td_thrhandle_t thread_handle;
- if ((*td_ta_map_id2thr_fn)(_tdb_agent, num, &thread_handle) != TD_OK) {
- // fprintf(stderr, "Error mapping thread ID %d to thread handle\n", num);
- return false;
- }
-
- // Fetch register set
- prgregset_t reg_set;
- memset(reg_set, 0, sizeof(reg_set));
- td_err_e result = (*td_thr_getgregs_fn)(&thread_handle, reg_set);
- if ((result != TD_OK) && (result != TD_PARTIALREG)) {
- // fprintf(stderr, "Error fetching registers for thread handle %d: error = %d\n", num, result);
- return false;
- }
-
-#ifdef PROFILING
- workTimer.stop();
- writeTimer.start();
-#endif /* PROFILING */
-
-#if (defined(__sparc) || defined(__i386))
- myComm.writeInt(NPRGREG);
- myComm.writeSpace();
- for (int i = 0; i < NPRGREG; i++) {
- myComm.writeAddress((void *)reg_set[i]);
- if (i == NPRGREG - 1) {
- myComm.writeEOL();
- } else {
- myComm.writeSpace();
- }
- }
-#else
-#error Please port ServiceabilityAgentDbxModule::handleThrGRegs to your current platform
-#endif
-
- myComm.flush();
-
-#ifdef PROFILING
- writeTimer.stop();
-#endif /* PROFILING */
-
- return true;
-}
-
-//
-// Input routines
-//
-
-bool
-ServiceabilityAgentDbxModule::scanAddress(char** data, psaddr_t* addr) {
- *addr = 0;
-
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (**data == 0) {
- return false;
- }
-
- if (strncmp(*data, "0x", 2) != 0) {
- return false;
- }
-
- *data += 2;
-
- while ((**data != 0) && (!isspace(**data))) {
- int val;
- bool res = charToNibble(**data, &val);
- if (!res) {
- return false;
- }
- *addr <<= 4;
- *addr |= val;
- ++*data;
- }
-
- return true;
-}
-
-bool
-ServiceabilityAgentDbxModule::scanUnsignedInt(char** data, unsigned int* num) {
- *num = 0;
-
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (**data == 0) {
- return false;
- }
-
- while ((**data != 0) && (!isspace(**data))) {
- char cur = **data;
- if ((cur < '0') || (cur > '9')) {
- return false;
- }
- *num *= 10;
- *num += cur - '0';
- ++*data;
- }
-
- return true;
-}
-
-char*
-ServiceabilityAgentDbxModule::scanSymbol(char** data) {
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (**data == 0) {
- return NULL;
- }
-
- // First count length
- int len = 1; // Null terminator
- char* tmpData = *data;
- while ((*tmpData != 0) && (!isspace(*tmpData))) {
- ++tmpData;
- ++len;
- }
- char* buf = new char[len];
- strncpy(buf, *data, len - 1);
- buf[len - 1] = 0;
- *data += len - 1;
- return buf;
-}
-
-bool
-ServiceabilityAgentDbxModule::charToNibble(char ascii, int* value) {
- if (ascii >= '0' && ascii <= '9') {
- *value = ascii - '0';
- return true;
- } else if (ascii >= 'A' && ascii <= 'F') {
- *value = 10 + ascii - 'A';
- return true;
- } else if (ascii >= 'a' && ascii <= 'f') {
- *value = 10 + ascii - 'a';
- return true;
- }
-
- return false;
-}
-
-
-char*
-ServiceabilityAgentDbxModule::readCStringFromProcess(psaddr_t addr) {
- char c;
- int num = 0;
- ps_prochandle* cur_proc = (ps_prochandle*) ps_get_prochandle2(1);
-
- // Search for null terminator
- do {
- if (ps_pread(cur_proc, addr + num, &c, 1) != PS_OK) {
- return NULL;
- }
- ++num;
- } while (c != 0);
-
- // Allocate string
- char* res = new char[num];
- if (ps_pread(cur_proc, addr, res, num) != PS_OK) {
- delete[] res;
- return NULL;
- }
- return res;
-}
-
-
-//--------------------------------------------------------------------------------
-// Class Timer
-//
-
-Timer::Timer() {
- reset();
-}
-
-Timer::~Timer() {
-}
-
-void
-Timer::start() {
- gettimeofday(&startTime, NULL);
-}
-
-void
-Timer::stop() {
- struct timeval endTime;
- gettimeofday(&endTime, NULL);
- totalMicroseconds += timevalDiff(&startTime, &endTime);
- ++counter;
-}
-
-long
-Timer::total() {
- return (totalMicroseconds / 1000);
-}
-
-long
-Timer::average() {
- return (long) ((double) total() / (double) counter);
-}
-
-void
-Timer::reset() {
- totalMicroseconds = 0;
- counter = 0;
-}
-
-long long
-Timer::timevalDiff(struct timeval* start, struct timeval* end) {
- long long secs = end->tv_sec - start->tv_sec;
- secs *= 1000000;
- long long usecs = end->tv_usec - start->tv_usec;
- return (secs + usecs);
-}
diff --git a/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.hpp b/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.hpp
deleted file mode 100644
index 0fbe8d0..0000000
--- a/hotspot/agent/src/os/solaris/dbx/svc_agent_dbx.hpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "shell_imp.h"
-#include "IOBuf.hpp"
-#include <sys/time.h>
-#include <thread_db.h>
-
-typedef td_err_e td_init_fn_t();
-typedef td_err_e td_ta_new_fn_t(struct ps_prochandle *, td_thragent_t **);
-typedef td_err_e td_ta_delete_fn_t(td_thragent_t *);
-typedef td_err_e td_ta_map_id2thr_fn_t(const td_thragent_t *, thread_t, td_thrhandle_t *);
-typedef td_err_e td_thr_getgregs_fn_t(const td_thrhandle_t *, prgregset_t);
-
-class ServiceabilityAgentDbxModule {
-public:
- ServiceabilityAgentDbxModule(int major, int minor,
- shell_imp_interp_t interp, int argc, char *argv[]);
- ~ServiceabilityAgentDbxModule();
-
- bool install();
- bool uninstall();
-
- /* This is invoked through the dbx command interpreter. It listens
- on a socket for commands and does not return until it receives an
- "exit" command. At that point control is returned to dbx's main
- loop, at which point if the user sends an exit command to dbx's
- shell the dbx process will exit. Returns true if completed
- successfully, false if an error occurred while running (for
- example, unable to bind listening socket). */
- bool run();
-
-private:
-
- // This must be shared between the Java and C layers
- static const int PORT = 21928;
-
- // Command handlers
- bool handleAddressSize(char* data);
- bool handlePeekFailFast(char* data);
- bool handlePeek(char* data);
- bool handlePoke(char* data);
- bool handleMapped(char* data);
- bool handleLookup(char* data);
- bool handleThrGRegs(char* data);
-
- // Input routines
-
- // May mutate addr argument even if result is false
- bool scanAddress(char** data, psaddr_t* addr);
- // May mutate num argument even if result is false
- bool scanUnsignedInt(char** data, unsigned int* num);
- // Returns NULL if error occurred while scanning. Otherwise, returns
- // newly-allocated character array which must be freed with delete[].
- char* scanSymbol(char** data);
- // Helper routine: converts ASCII to 4-bit integer. Returns true if
- // character is in range, false otherwise.
- bool charToNibble(char ascii, int* value);
-
- // Output routines
-
- // Writes an int with no leading or trailing spaces
- bool writeInt(int val, int fd);
- // Writes an address in hex format with no leading or trailing
- // spaces
- bool writeAddress(psaddr_t addr, int fd);
- // Writes a register in hex format with no leading or trailing
- // spaces (addresses and registers might be of different size)
- bool writeRegister(prgreg_t reg, int fd);
- // Writes a space to given file descriptor
- bool writeSpace(int fd);
- // Writes carriage return to given file descriptor
- bool writeCR(int fd);
- // Writes a bool as [0|1]
- bool writeBoolAsInt(bool val, int fd);
- // Helper routine: converts low 4 bits to ASCII [0..9][A..F]
- char nibbleToChar(unsigned char nibble);
-
- // Base routine called by most of the above
- bool writeString(const char* str, int fd);
-
- // Writes a binary character
- bool writeBinChar(char val, int fd);
- // Writes a binary unsigned int in network (big-endian) byte order
- bool writeBinUnsignedInt(unsigned int val, int fd);
- // Writes a binary buffer
- bool writeBinBuf(char* buf, int size, int fd);
-
- // Routine to flush the socket
- bool flush(int client_socket);
-
- void cleanup(int client_socket);
-
- // The shell interpreter on which we can invoke commands (?)
- shell_imp_interp_t _interp;
-
- // The "command line" arguments passed to us by dbx (?)
- int _argc;
- char **_argv;
-
- // The installed command in the dbx shell
- shell_imp_command_t _command;
-
- // Access to libthread_db (dlsym'ed to be able to pick up the
- // version loaded by dbx)
- td_init_fn_t* td_init_fn;
- td_ta_new_fn_t* td_ta_new_fn;
- td_ta_delete_fn_t* td_ta_delete_fn;
- td_ta_map_id2thr_fn_t* td_ta_map_id2thr_fn;
- td_thr_getgregs_fn_t* td_thr_getgregs_fn;
-
- // Our "thread agent" -- access to libthread_db
- td_thragent_t* _tdb_agent;
-
- // Path to libthread.so in target process; free with delete[]
- char* libThreadName;
-
- // Handle to dlopen'ed libthread_db.so
- void* libThreadDB;
-
- // Helper callback for finding libthread_db.so
- friend int findLibThreadCB(const rd_loadobj_t* lo, void* data);
-
- // Support for reading C strings out of the target process (so we
- // can find the correct libthread_db). Returns newly-allocated char*
- // which must be freed with delete[], or null if the read failed.
- char* readCStringFromProcess(psaddr_t addr);
-
- IOBuf myComm;
-
- // Output buffer support (used by writeString, writeChar, flush)
- char* output_buffer;
- int output_buffer_size;
- int output_buffer_pos;
-
- // "Fail fast" flag
- bool peek_fail_fast;
-
- // Commands
- static const char* CMD_ADDRESS_SIZE;
- static const char* CMD_PEEK_FAIL_FAST;
- static const char* CMD_PEEK;
- static const char* CMD_POKE;
- static const char* CMD_MAPPED;
- static const char* CMD_LOOKUP;
- static const char* CMD_THR_GREGS;
- static const char* CMD_EXIT;
-};
-
-// For profiling. Times reported are in milliseconds.
-class Timer {
-public:
- Timer();
- ~Timer();
-
- void start();
- void stop();
- long total();
- long average();
- void reset();
-
-private:
- struct timeval startTime;
- long long totalMicroseconds; // stored internally in microseconds
- int counter;
- long long timevalDiff(struct timeval* startTime, struct timeval* endTime);
-};
diff --git a/hotspot/agent/src/os/win32/BasicList.hpp b/hotspot/agent/src/os/win32/BasicList.hpp
deleted file mode 100644
index 5b9164f..0000000
--- a/hotspot/agent/src/os/win32/BasicList.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _BASIC_LIST_
-#define _BASIC_LIST_
-
-#include <vector>
-
-template<class T>
-class BasicList {
-protected:
- typedef std::vector<T> InternalListType;
- InternalListType internalList;
-
-public:
- BasicList() {
- }
- virtual ~BasicList() {
- }
-
- void add(T arg) {
- internalList.push_back(arg);
- }
-
- bool remove(T arg) {
- for (InternalListType::iterator iter = internalList.begin();
- iter != internalList.end(); iter++) {
- if (*iter == arg) {
- internalList.erase(iter);
- return true;
- }
- }
- return false;
- }
-
- int size() {
- return internalList.size();
- }
-
- T get(int index) {
- return internalList[index];
- }
-};
-
-#endif // #defined _BASIC_LIST_
diff --git a/hotspot/agent/src/os/win32/Buffer.cpp b/hotspot/agent/src/os/win32/Buffer.cpp
deleted file mode 100644
index 6c14b6a..0000000
--- a/hotspot/agent/src/os/win32/Buffer.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "Buffer.hpp"
-
-#include <string.h>
-
-Buffer::Buffer(int bufSize) {
- buf = new char[bufSize];
- sz = bufSize;
- fill = 0;
- drain = 0;
-}
-
-Buffer::~Buffer() {
- delete[] buf;
-}
-
-char*
-Buffer::fillPos() {
- return buf + fill;
-}
-
-int
-Buffer::remaining() {
- return sz - fill;
-}
-
-int
-Buffer::size() {
- return sz;
-}
-
-bool
-Buffer::incrFillPos(int amt) {
- if (fill + amt >= sz) {
- return false;
- }
- fill += amt;
- return true;
-}
-
-int
-Buffer::readByte() {
- if (drain < fill) {
- return buf[drain++] & 0xFF;
- } else {
- return -1;
- }
-}
-
-int
-Buffer::readBytes(char* data, int len) {
- int numRead = 0;
- while (numRead < len) {
- int c = readByte();
- if (c < 0) break;
- data[numRead++] = (char) c;
- }
- return numRead;
-}
-
-char*
-Buffer::drainPos() {
- return buf + drain;
-}
-
-int
-Buffer::drainRemaining() {
- return fill - drain;
-}
-
-bool
-Buffer::incrDrainPos(int amt) {
- if (drainRemaining() < amt) {
- return false;
- }
- drain += amt;
- return true;
-}
-
-void
-Buffer::compact() {
- // Copy down data
- memmove(buf, buf + drain, fill - drain);
- // Adjust positions
- fill -= drain;
- drain = 0;
-}
diff --git a/hotspot/agent/src/os/win32/Buffer.hpp b/hotspot/agent/src/os/win32/Buffer.hpp
deleted file mode 100644
index c775a7a..0000000
--- a/hotspot/agent/src/os/win32/Buffer.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _BUFFER_
-#define _BUFFER_
-
-// A Buffer is the backing store for the IOBuf abstraction and
-// supports producer-consumer filling and draining.
-
-class Buffer {
-public:
- Buffer(int bufSize);
- ~Buffer();
-
- char* fillPos(); // Position of the place where buffer should be filled
- int remaining(); // Number of bytes that can be placed starting at fillPos
- int size(); // Size of the buffer
- // Move up fill position by amount (decreases remaining()); returns
- // false if not enough space
- bool incrFillPos(int amt);
-
- // Read single byte (0..255); returns -1 if no data available.
- int readByte();
- // Read multiple bytes, non-blocking (this buffer does not define a
- // fill mechanism), into provided buffer. Returns number of bytes read.
- int readBytes(char* buf, int len);
-
- // Access to drain position. Be very careful using this.
- char* drainPos();
- int drainRemaining();
- bool incrDrainPos(int amt);
-
- // Compact buffer, removing already-consumed input. This must be
- // called periodically to yield the illusion of an infinite buffer.
- void compact();
-
-private:
- Buffer(const Buffer&);
- Buffer& operator=(const Buffer&);
-
- char* buf;
- int sz;
- int fill;
- int drain;
-};
-
-#endif // #defined _BUFFER_
diff --git a/hotspot/agent/src/os/win32/Dispatcher.cpp b/hotspot/agent/src/os/win32/Dispatcher.cpp
deleted file mode 100644
index ebb85e8..0000000
--- a/hotspot/agent/src/os/win32/Dispatcher.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "dispatcher.hpp"
-
-const char* CMD_ASCII = "ascii";
-const char* CMD_UNICODE = "unicode";
-const char* CMD_PROCLIST = "proclist";
-const char* CMD_ATTACH = "attach";
-const char* CMD_DETACH = "detach";
-const char* CMD_LIBINFO = "libinfo";
-const char* CMD_PEEK = "peek";
-const char* CMD_POKE = "poke";
-const char* CMD_THREADLIST = "threadlist";
-const char* CMD_DUPHANDLE = "duphandle";
-const char* CMD_CLOSEHANDLE = "closehandle";
-const char* CMD_GETCONTEXT = "getcontext";
-const char* CMD_SETCONTEXT = "setcontext";
-const char* CMD_SELECTORENTRY = "selectorentry";
-const char* CMD_SUSPEND = "suspend";
-const char* CMD_RESUME = "resume";
-const char* CMD_POLLEVENT = "pollevent";
-const char* CMD_CONTINUEEVENT = "continueevent";
-const char* CMD_EXIT = "exit";
-
-// Uncomment the #define below to get messages on stderr
-// #define DEBUGGING
-
-void
-Dispatcher::dispatch(char* cmd, Handler* handler) {
- if (!strncmp(cmd, CMD_ASCII, strlen(CMD_ASCII))) {
- handler->ascii(cmd + strlen(CMD_ASCII));
-
- } else if (!strncmp(cmd, CMD_UNICODE, strlen(CMD_UNICODE))) {
- handler->unicode(cmd + strlen(CMD_UNICODE));
-
- } else if (!strncmp(cmd, CMD_PROCLIST, strlen(CMD_PROCLIST))) {
- handler->procList(cmd + strlen(CMD_PROCLIST));
-
- } else if (!strncmp(cmd, CMD_ATTACH, strlen(CMD_ATTACH))) {
- handler->attach(cmd + strlen(CMD_ATTACH));
-
- } else if (!strncmp(cmd, CMD_DETACH, strlen(CMD_DETACH))) {
- handler->detach(cmd + strlen(CMD_DETACH));
-
- } else if (!strncmp(cmd, CMD_LIBINFO, strlen(CMD_LIBINFO))) {
- handler->libInfo(cmd + strlen(CMD_LIBINFO));
-
- } else if (!strncmp(cmd, CMD_PEEK, strlen(CMD_PEEK))) {
- handler->peek(cmd + strlen(CMD_PEEK));
-
- } else if (!strncmp(cmd, CMD_POKE, strlen(CMD_POKE))) {
- handler->poke(cmd + strlen(CMD_POKE));
-
- } else if (!strncmp(cmd, CMD_THREADLIST, strlen(CMD_THREADLIST))) {
- handler->threadList(cmd + strlen(CMD_THREADLIST));
-
- } else if (!strncmp(cmd, CMD_DUPHANDLE, strlen(CMD_DUPHANDLE))) {
- handler->dupHandle(cmd + strlen(CMD_DUPHANDLE));
-
- } else if (!strncmp(cmd, CMD_CLOSEHANDLE, strlen(CMD_CLOSEHANDLE))) {
- handler->closeHandle(cmd + strlen(CMD_CLOSEHANDLE));
-
- } else if (!strncmp(cmd, CMD_GETCONTEXT, strlen(CMD_GETCONTEXT))) {
- handler->getContext(cmd + strlen(CMD_GETCONTEXT));
-
- } else if (!strncmp(cmd, CMD_SETCONTEXT, strlen(CMD_SETCONTEXT))) {
- handler->setContext(cmd + strlen(CMD_SETCONTEXT));
-
- } else if (!strncmp(cmd, CMD_SELECTORENTRY, strlen(CMD_SELECTORENTRY))) {
- handler->selectorEntry(cmd + strlen(CMD_SELECTORENTRY));
-
- } else if (!strncmp(cmd, CMD_SUSPEND, strlen(CMD_SUSPEND))) {
- handler->suspend(cmd + strlen(CMD_SUSPEND));
-
- } else if (!strncmp(cmd, CMD_RESUME, strlen(CMD_RESUME))) {
- handler->resume(cmd + strlen(CMD_RESUME));
-
- } else if (!strncmp(cmd, CMD_POLLEVENT, strlen(CMD_POLLEVENT))) {
- handler->pollEvent(cmd + strlen(CMD_POLLEVENT));
-
- } else if (!strncmp(cmd, CMD_CONTINUEEVENT, strlen(CMD_CONTINUEEVENT))) {
- handler->continueEvent(cmd + strlen(CMD_CONTINUEEVENT));
-
- } else if (!strcmp(cmd, CMD_EXIT)) {
- handler->exit(cmd + strlen(CMD_EXIT));
- }
-
-#ifdef DEBUGGING
- else fprintf(stderr, "Ignoring illegal command \"%s\"\n", cmd);
-#endif
-}
diff --git a/hotspot/agent/src/os/win32/Dispatcher.hpp b/hotspot/agent/src/os/win32/Dispatcher.hpp
deleted file mode 100644
index 72f9dd7..0000000
--- a/hotspot/agent/src/os/win32/Dispatcher.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _DISPATCHER_
-#define _DISPATCHER_
-
-#include "Handler.hpp"
-
-/** This class understands the commands supported by the system and
- calls the appropriate handler routines. */
-
-class Dispatcher {
-public:
- static void dispatch(char* cmd, Handler* handler);
-};
-
-#endif // #defined _DISPATCHER_
diff --git a/hotspot/agent/src/os/win32/Handler.hpp b/hotspot/agent/src/os/win32/Handler.hpp
deleted file mode 100644
index 0aa32c4..0000000
--- a/hotspot/agent/src/os/win32/Handler.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _HANDLER_
-#define _HANDLER_
-
-/** An abstract base class encapsulating the handlers for all commands
- understood by the system. */
-class Handler {
-public:
- virtual void ascii(char* arg) = 0;
- virtual void unicode(char* arg) = 0;
- virtual void procList(char* arg) = 0;
- virtual void attach(char* arg) = 0;
- virtual void detach(char* arg) = 0;
- virtual void libInfo(char* arg) = 0;
- virtual void peek(char* arg) = 0;
- virtual void poke(char* arg) = 0;
- virtual void threadList(char* arg) = 0;
- virtual void dupHandle(char* arg) = 0;
- virtual void closeHandle(char* arg) = 0;
- virtual void getContext(char* arg) = 0;
- virtual void setContext(char* arg) = 0;
- virtual void selectorEntry(char* arg) = 0;
- virtual void suspend(char* arg) = 0;
- virtual void resume(char* arg) = 0;
- virtual void pollEvent(char* arg) = 0;
- virtual void continueEvent(char* arg) = 0;
- virtual void exit(char* arg) = 0;
-};
-
-#endif // #defined _HANDLER_
diff --git a/hotspot/agent/src/os/win32/IOBuf.cpp b/hotspot/agent/src/os/win32/IOBuf.cpp
deleted file mode 100644
index 08d29b1..0000000
--- a/hotspot/agent/src/os/win32/IOBuf.cpp
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include <stdio.h>
-
-// This file is currently used for os/solaris/agent too. At some point in time
-// the source will be reorganized to avoid these ifdefs.
-
-#ifdef __sun
- #include <string.h>
- #include <inttypes.h>
- #include <sys/byteorder.h>
-#endif
-
-#include "IOBuf.hpp"
-
-// Formats for printing pointers
-#ifdef _LP64
-# define INTPTR_FORMAT "0x%016lx"
-#else /* ! _LP64 */
-# define INTPTR_FORMAT "0x%08lx"
-#endif /* _LP64 */
-
-// Uncomment the #define below to get messages on stderr
-// #define DEBUGGING
-
-IOBuf::IOBuf(int inLen, int outLen) {
- inBuf = new Buffer(inLen);
- outBuf = new Buffer(outLen);
- fd = INVALID_SOCKET;
- outHandle = NULL;
- usingSocket = true;
- reset();
-}
-
-IOBuf::~IOBuf() {
- delete inBuf;
- delete outBuf;
-}
-
-void
-IOBuf::setSocket(SOCKET sock) {
- fd = sock;
- usingSocket = true;
-}
-
-// Reading/writing files is only needed and used on windows.
-#ifdef WIN32
-void
-IOBuf::setOutputFileHandle(HANDLE handle) {
- outHandle = handle;
- usingSocket = false;
-}
-#endif
-
-void
-IOBuf::reset() {
- gotDataLastTime = false;
- state = TEXT_STATE;
- binPos = 0;
- binLength = 0;
-}
-
-IOBuf::ReadLineResult
-IOBuf::tryReadLine() {
- return doReadLine(false);
-}
-
-char*
-IOBuf::readLine() {
- ReadLineResult rr = doReadLine(true);
- if (rr != RL_GOT_DATA) {
- return NULL;
- }
- return getLine();
-}
-
-IOBuf::ReadLineResult
-IOBuf::doReadLine(bool shouldWait) {
-
- if (!usingSocket) {
- return IOBuf::RL_ERROR;
- }
-
- if (gotDataLastTime) {
- curLine.clear();
- }
-
- int c;
- do {
- c = readChar(shouldWait);
- if (c >= 0) {
- Action act = processChar((char) c);
- if (act == GOT_LINE) {
- curLine.push_back('\0');
- gotDataLastTime = true;
- return IOBuf::RL_GOT_DATA;
- } else if (act == SKIP_EOL_CHAR) {
- // Do nothing
- } else {
- curLine.push_back((char) c);
- }
- }
- } while (shouldWait || c >= 0);
-
- gotDataLastTime = false;
- return IOBuf::RL_NO_DATA;
-}
-
-bool
-IOBuf::flushImpl(bool moreDataToCome) {
- int numWritten = 0;
-
-#ifdef WIN32
- // When running on Windows and using IOBufs for inter-process
- // communication, we need to write metadata into the stream
- // indicating how many bytes are coming down. Five bytes are written
- // per flush() call, four containing the integer number of bytes
- // coming (not including the five-byte header) and one (a 0 or 1)
- // indicating whether there is more data coming.
- if (!usingSocket) {
- int numToWrite = outBuf->drainRemaining();
- char moreToCome = (moreDataToCome ? 1 : 0);
- DWORD numBytesWritten;
- if (!WriteFile(outHandle, &numToWrite, sizeof(int), &numBytesWritten, NULL)) {
- return false;
- }
- if (numBytesWritten != sizeof(int)) {
- return false;
- }
- if (!WriteFile(outHandle, &moreToCome, 1, &numBytesWritten, NULL)) {
- return false;
- }
- if (numBytesWritten != 1) {
- return false;
- }
- }
-#endif
-
- while (outBuf->drainRemaining() != 0) {
-#ifdef DEBUGGING
- fprintf(stderr, "Flushing %d bytes\n", outBuf->drainRemaining());
-#endif
- if (usingSocket) {
- numWritten = send(fd, outBuf->drainPos(), outBuf->drainRemaining(), 0);
- } else {
-#ifdef WIN32
- DWORD numBytesWritten;
- if (!WriteFile(outHandle, outBuf->drainPos(), outBuf->drainRemaining(), &numBytesWritten, NULL)) {
- numWritten = -1;
- } else {
- numWritten = numBytesWritten;
- }
-#endif
- }
- if (numWritten != -1) {
-#ifdef DEBUGGING
- fprintf(stderr, "Flushed %d bytes\n", numWritten);
-#endif
- outBuf->incrDrainPos(numWritten);
- } else {
- return false;
- }
- }
-
- outBuf->compact();
-
- return true;
-}
-
-int
-IOBuf::readChar(bool block) {
- do {
- int c = inBuf->readByte();
- if (c >= 0) {
- return c;
- }
- // See whether we need to compact the input buffer
- if (inBuf->remaining() < inBuf->size() / 2) {
- inBuf->compact();
- }
- // See whether socket is ready
- fd_set fds;
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- if (block || select(1 + fd, &fds, NULL, NULL, &timeout) > 0) {
- if (block || FD_ISSET(fd, &fds)) {
-#ifdef DEBUGGING
- int b = (block ? 1 : 0);
- fprintf(stderr, "calling recv: block = %d\n", b);
-#endif
- // Read data from socket
- int numRead = recv(fd, inBuf->fillPos(), inBuf->remaining(), 0);
- if (numRead < 0) {
-#ifdef DEBUGGING
- fprintf(stderr, "recv failed\n");
-#endif
- return -1;
- }
- inBuf->incrFillPos(numRead);
- }
- }
- } while (block);
-
- return inBuf->readByte();
-}
-
-char*
-IOBuf::getLine() {
-#ifdef DEBUGGING
- fprintf(stderr, "Returning (first 10 chars) \"%.10s\"\n", curLine.begin());
-#endif
- return curLine.begin();
-}
-
-bool
-IOBuf::flush() {
- return flushImpl(false);
-}
-
-bool
-IOBuf::writeString(const char* str) {
- int len = strlen(str);
-
- if (len > outBuf->size()) {
- return false;
- }
-
- if (len > outBuf->remaining()) {
- if (!flushImpl(true)) {
- return false;
- }
- }
-
- // NOTE we do not copy the null terminator of the string.
-
- strncpy(outBuf->fillPos(), str, len);
- outBuf->incrFillPos(len);
- return true;
-}
-
-bool
-IOBuf::writeInt(int val) {
- char buf[128];
- sprintf(buf, "%d", val);
- return writeString(buf);
-}
-
-bool
-IOBuf::writeUnsignedInt(unsigned int val) {
- char buf[128];
- sprintf(buf, "%u", val);
- return writeString(buf);
-}
-
-bool
-IOBuf::writeBoolAsInt(bool val) {
- if (val) {
- return writeString("1");
- } else {
- return writeString("0");
- }
-}
-
-bool
-IOBuf::writeAddress(void* val) {
- char buf[128];
- sprintf(buf, INTPTR_FORMAT, val);
- return writeString(buf);
-}
-
-bool
-IOBuf::writeSpace() {
- return writeString(" ");
-}
-
-bool
-IOBuf::writeEOL() {
- return writeString("\n\r");
-}
-
-bool
-IOBuf::writeBinChar(char c) {
- return writeBinBuf((char*) &c, sizeof(c));
-}
-
-bool
-IOBuf::writeBinUnsignedShort(unsigned short i) {
- i = htons(i);
- return writeBinBuf((char*) &i, sizeof(i));
-}
-
-bool
-IOBuf::writeBinUnsignedInt(unsigned int i) {
- i = htonl(i);
- return writeBinBuf((char*) &i, sizeof(i));
-}
-
-bool
-IOBuf::writeBinBuf(char* buf, int size) {
- while (size > 0) {
- int spaceRemaining = outBuf->remaining();
- if (spaceRemaining == 0) {
- if (!flushImpl(true)) {
- return false;
- }
- spaceRemaining = outBuf->remaining();
- }
- int toCopy = (size > spaceRemaining) ? spaceRemaining : size;
- memcpy(outBuf->fillPos(), buf, toCopy);
- outBuf->incrFillPos(toCopy);
- buf += toCopy;
- size -= toCopy;
- if (size > 0) {
- if (!flushImpl(true)) {
- return false;
- }
- }
- }
- return true;
-}
-
-#ifdef WIN32
-IOBuf::FillState
-IOBuf::fillFromFileHandle(HANDLE fh, DWORD* numBytesRead) {
- int totalToRead;
- char moreToCome;
-
- outBuf->compact();
-
- DWORD numRead;
- if (!ReadFile(fh, &totalToRead, sizeof(int), &numRead, NULL)) {
- return FAILED;
- }
- if (numRead != sizeof(int)) {
- return FAILED;
- }
- if (!ReadFile(fh, &moreToCome, 1, &numRead, NULL)) {
- return FAILED;
- }
- if (numRead != 1) {
- return FAILED;
- }
- if (outBuf->remaining() < totalToRead) {
- return FAILED;
- }
-
- int tmp = totalToRead;
-
- while (totalToRead > 0) {
- if (!ReadFile(fh, outBuf->fillPos(), totalToRead, &numRead, NULL)) {
- return FAILED;
- }
- outBuf->incrFillPos((int) numRead);
- totalToRead -= numRead;
- }
-
- *numBytesRead = tmp;
- return ((moreToCome == 0) ? DONE : MORE_DATA_PENDING);
-}
-#endif
-
-bool
-IOBuf::isBinEscapeChar(char c) {
- return (c == '|');
-}
-
-IOBuf::Action
-IOBuf::processChar(char c) {
- Action action = NO_ACTION;
- switch (state) {
- case TEXT_STATE: {
- // Looking for text char, bin escape char, or EOL
- if (isBinEscapeChar(c)) {
-#ifdef DEBUGGING
- fprintf(stderr, "[a: '%c'] ", inBuf[0]);
-#endif
- binPos = 0;
-#ifdef DEBUGGING
- fprintf(stderr, "[b: '%c'] ", inBuf[0]);
-#endif
- binLength = 0;
-#ifdef DEBUGGING
- fprintf(stderr, "[c: '%c'] ", inBuf[0]);
-#endif
- state = BIN_STATE;
-#ifdef DEBUGGING
- fprintf(stderr, "[d: '%c'] ", inBuf[0]);
-#endif
-#ifdef DEBUGGING
- fprintf(stderr, "\nSwitching to BIN_STATE\n");
-#endif
- } else if (isEOL(c)) {
- state = EOL_STATE;
- action = GOT_LINE;
-#ifdef DEBUGGING
- fprintf(stderr, "\nSwitching to EOL_STATE (GOT_LINE)\n");
-#endif
- }
-#ifdef DEBUGGING
- else {
- fprintf(stderr, "'%c' ", c);
- fflush(stderr);
- }
-#endif
- break;
- }
-
- case BIN_STATE: {
- // Seeking to finish read of input
- if (binPos < 4) {
- int cur = c & 0xFF;
- binLength <<= 8;
- binLength |= cur;
- ++binPos;
- } else {
-#ifdef DEBUGGING
- fprintf(stderr, "Reading binary byte %d of %d\n",
- binPos - 4, binLength);
-#endif
- ++binPos;
- if (binPos == 4 + binLength) {
- state = TEXT_STATE;
-#ifdef DEBUGGING
- fprintf(stderr, "Switching to TEXT_STATE\n");
-#endif
- }
- }
- break;
- }
-
- case EOL_STATE: {
- // More EOL characters just cause us to re-enter this state
- if (isEOL(c)) {
- action = SKIP_EOL_CHAR;
- } else if (isBinEscapeChar(c)) {
- binPos = 0;
- binLength = 0;
- state = BIN_STATE;
- } else {
- state = TEXT_STATE;
-#ifdef DEBUGGING
- fprintf(stderr, "'%c' ", c);
- fflush(stderr);
-#endif
- }
- break;
- }
-
- } // switch
-
- return action;
-}
-
-
-bool
-IOBuf::isEOL(char c) {
-#ifdef WIN32
- return ((c == '\n') || (c == '\r'));
-#elif defined(__sun)
- return c == '\n';
-#else
- #error Please port isEOL() to your platform
- return false;
-#endif
-}
diff --git a/hotspot/agent/src/os/win32/IOBuf.hpp b/hotspot/agent/src/os/win32/IOBuf.hpp
deleted file mode 100644
index 31ed391..0000000
--- a/hotspot/agent/src/os/win32/IOBuf.hpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _IO_BUF_
-#define _IO_BUF_
-
-// This file is currently used for os/solaris/agent/ too. At some point in time
-// the source will be reorganized to avoid these ifdefs.
-// Note that this class can read/write from a file as well as a socket. This
-// file capability is only implemented on win32.
-
-#ifdef WIN32
- #include <winsock2.h>
-#else
- #include <sys/types.h>
- #include <sys/socket.h>
- // These are from win32 winsock2.h
- typedef unsigned int SOCKET;
- typedef void * HANDLE;
- typedef unsigned long DWORD;
- #define INVALID_SOCKET (SOCKET)(~0)
-#endif
-
-#include <vector>
-#include "Buffer.hpp"
-
-/** Manages an input/output buffer pair for a socket or file handle. */
-class IOBuf {
-public:
- IOBuf(int inBufLen, int outBufLen);
- ~IOBuf();
-
- enum ReadLineResult {
- RL_GOT_DATA,
- RL_NO_DATA,
- RL_ERROR
- };
-
- /** Change the socket with which this buffer is associated */
- void setSocket(SOCKET sock);
-
- // Reading/writing files is only supported on windows.
-#ifdef WIN32
- /** Change the output file handle with which this buffer is
- associated. Currently IOBufs can not be used to read from a file
- handle. */
- void setOutputFileHandle(HANDLE handle);
-#endif
-
- /** Reset the input and output buffers, without flushing the output
- data to the socket */
- void reset();
-
- /** Try to read a line of data from the given socket without
- blocking. If was able to read a complete line of data, returns a
- character pointer to the beginning of the (null-terminated)
- string. If not, returns NULL, but maintains enough state that
- subsequent calls to tryReadLine() will not ignore the data
- already read. NOTE: this skips end-of-line characters (typically
- CR/LF) as defined by "isEOL()". When switching back and forth
- between binary and text modes, to be sure no data is lost, pad
- the beginning and end of the binary transmission with bytes
- which can not be confused with these characters. */
- ReadLineResult tryReadLine();
-
- /** Read a line of data from the given socket, blocking until a
- line, including EOL, appears. Return the line, or NULL if
- something goes wrong. */
- char *readLine();
-
- /** Get the pointer to the beginning of the (null-terminated) line.
- This should only be called if tryReadLine() has returned
- RL_GOT_DATA. This sets the "parsing cursor" to the beginning of
- the line. */
- char* getLine();
-
- // NOTE: any further data-acquisition routines must ALWAYS call
- // fixupData() at the beginning!
-
- //----------------------------------------------------------------------
- // Output routines
- //
-
- /** Flush the output buffer to the socket. Returns true if
- succeeded, false if write error occurred. */
- bool flush();
-
- /** Write the given string to the output buffer. May flush if output
- buffer becomes too full to store the data. Not guaranteed to
- work if string is longer than the size of the output buffer.
- Does not include the null terminator of the string. Returns true
- if succeeded, false if write error occurred. */
- bool writeString(const char* str);
-
- /** Write the given int to the output buffer. May flush if output
- buffer becomes too full to store the data. Returns true if
- succeeded, false if write error occurred. */
- bool writeInt(int val);
-
- /** Write the given unsigned int to the output buffer. May flush if
- output buffer becomes too full to store the data. Returns true
- if succeeded, false if write error occurred. */
- bool writeUnsignedInt(unsigned int val);
-
- /** Write the given boolean to the output buffer. May flush if
- output buffer becomes too full to store the data. Returns true
- if succeeded, false if write error occurred. */
- bool writeBoolAsInt(bool val);
-
- /** Write the given address to the output buffer. May flush if
- output buffer becomes too full to store the data. Returns true
- if succeeded, false if write error occurred. */
- bool writeAddress(void* val);
-
- /** Writes a space to the output buffer. May flush if output buffer
- becomes too full to store the data. Returns true if succeeded,
- false if write error occurred. */
- bool writeSpace();
-
- /** Writes an end-of-line sequence to the output buffer. May flush
- if output buffer becomes too full to store the data. Returns
- true if succeeded, false if write error occurred. */
- bool writeEOL();
-
- /** Writes a binary character to the output buffer. */
- bool writeBinChar(char c);
-
- /** Writes a binary unsigned short in network (big-endian) byte
- order to the output buffer. */
- bool writeBinUnsignedShort(unsigned short i);
-
- /** Writes a binary unsigned int in network (big-endian) byte order
- to the output buffer. */
- bool writeBinUnsignedInt(unsigned int i);
-
- /** Writes a binary buffer to the output buffer. */
- bool writeBinBuf(char* buf, int size);
-
-#ifdef WIN32
- enum FillState {
- DONE = 1,
- MORE_DATA_PENDING = 2,
- FAILED = 3
- };
-
- /** Very specialized routine; fill the output buffer from the given
- file handle. Caller is responsible for ensuring that there is
- data to be read on the file handle. */
- FillState fillFromFileHandle(HANDLE fh, DWORD* numRead);
-#endif
-
- /** Binary utility routine (for poke) */
- static bool isBinEscapeChar(char c);
-
-private:
- IOBuf(const IOBuf&);
- IOBuf& operator=(const IOBuf&);
-
- // Returns -1 if non-blocking and no data available
- int readChar(bool block);
- // Line-oriented reading
- std::vector<char> curLine;
- bool gotDataLastTime;
-
- ReadLineResult doReadLine(bool);
-
- bool flushImpl(bool moreDataToCome);
-
- SOCKET fd;
- HANDLE outHandle;
- bool usingSocket;
-
- // Buffers
- Buffer* inBuf;
- Buffer* outBuf;
-
- // Simple finite-state machine to handle binary data
- enum State {
- TEXT_STATE,
- BIN_STATE,
- EOL_STATE
- };
- enum Action {
- NO_ACTION,
- GOT_LINE, // TEXT_STATE -> EOL_STATE transition
- SKIP_EOL_CHAR // EOL_STATE -> EOL_STATE transition
- };
-
- State state;
- Action processChar(char c);
-
- // Handling incoming binary buffers (poke command)
- int binPos; // Number of binary characters read so far;
- // total number to read is binLength + 4
- int binLength; // Number of binary characters in message;
- // not valid until binPos >= 4
-
- bool isEOL(char c);
-};
-
-#endif // #defined _IO_BUF_
diff --git a/hotspot/agent/src/os/win32/LockableList.hpp b/hotspot/agent/src/os/win32/LockableList.hpp
deleted file mode 100644
index 91fc072..0000000
--- a/hotspot/agent/src/os/win32/LockableList.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _LOCKABLE_LIST_
-#define _LOCKABLE_LIST_
-
-#include <windows.h>
-#include "BasicList.hpp"
-
-template<class T>
-class LockableList : public BasicList<T> {
-private:
- CRITICAL_SECTION crit;
-
-public:
- LockableList() {
- InitializeCriticalSection(&crit);
- }
-
- ~LockableList() {
- DeleteCriticalSection(&crit);
- }
-
- void lock() {
- EnterCriticalSection(&crit);
- }
-
- void unlock() {
- LeaveCriticalSection(&crit);
- }
-};
-
-#endif // #defined _LOCKABLE_LIST_
diff --git a/hotspot/agent/src/os/win32/Makefile b/hotspot/agent/src/os/win32/Makefile
deleted file mode 100644
index 43d4507..0000000
--- a/hotspot/agent/src/os/win32/Makefile
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-
-SERVER=SwDbgSrv.exe
-SUBPROCESS=SwDbgSub.exe
-
-SERVER_SOURCES = \
- Buffer.cpp \
- Dispatcher.cpp \
- initWinsock.cpp \
- IOBuf.cpp \
- ioUtils.cpp \
- isNT4.cpp \
- nt4internals.cpp \
- procList.cpp \
- Reaper.cpp \
- SwDbgSrv.cpp \
- serverLists.cpp \
- toolHelp.cpp
-
-SUBPROCESS_SOURCES = \
- SwDbgSub.cpp \
- Buffer.cpp \
- IOBuf.cpp \
- isNT4.cpp \
- libInfo.cpp \
- Monitor.cpp \
- nt4internals.cpp \
- toolHelp.cpp
-
-SERVER_OBJS = $(SERVER_SOURCES:.cpp=.obj)
-SUBPROCESS_OBJS = $(SUBPROCESS_SOURCES:.cpp=.obj)
-
-CPP=cl.exe
-LINK32=link.exe
-
-# These do not need to be optimized (don't run a lot of code) and it
-# will be useful to have the assertion checks in place
-
-CFLAGS=/nologo /MD /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-
-LIBS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \
- ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib \
- winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib \
- odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386
-
-default: $(SERVER) $(SUBPROCESS)
-
-$(SERVER): $(SERVER_OBJS)
- $(LINK32) /out:$@ $(SERVER_OBJS) $(LIBS)
-
-$(SUBPROCESS): $(SUBPROCESS_OBJS)
- $(LINK32) /out:$@ $(SUBPROCESS_OBJS) $(LIBS)
-
-clean:
- rm -f *.obj *.idb *.pch *.pdb *.ncb *.opt *.plg *.exe *.ilk
-
-.cpp.obj:
- @ $(CPP) $(CFLAGS) /o $@ $<
diff --git a/hotspot/agent/src/os/win32/Message.hpp b/hotspot/agent/src/os/win32/Message.hpp
deleted file mode 100644
index 61c6bd0..0000000
--- a/hotspot/agent/src/os/win32/Message.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _MESSAGE_
-#define _MESSAGE_
-
-// These are the commands sent from the server to the child processes
-// over the child processes' stdin pipes. A subset of the commands
-// understood by the overall system, these require responses from the
-// child process. Having a data structure rather than sending text
-// simplifies parsing on the child side. The child replies by sending
-// back fully-formatted replies which are copied by the server process
-// to the clients' sockets.
-
-struct PeekArg {
- DWORD address;
- DWORD numBytes;
-};
-
-// NOTE: when sending a PokeArg to the child process, we handle the
-// buffer specially
-struct PokeArg {
- DWORD address;
- DWORD numBytes;
- void* data;
-};
-
-// Used for continueevent
-struct BoolArg {
- bool val;
-};
-
-// Used for duphandle, closehandle, and getcontext
-struct HandleArg {
- HANDLE handle;
-};
-
-// Used for setcontext
-const int NUM_REGS_IN_CONTEXT = 22;
-struct SetContextArg {
- HANDLE handle;
- DWORD Eax;
- DWORD Ebx;
- DWORD Ecx;
- DWORD Edx;
- DWORD Esi;
- DWORD Edi;
- DWORD Ebp;
- DWORD Esp;
- DWORD Eip;
- DWORD Ds;
- DWORD Es;
- DWORD Fs;
- DWORD Gs;
- DWORD Cs;
- DWORD Ss;
- DWORD EFlags;
- DWORD Dr0;
- DWORD Dr1;
- DWORD Dr2;
- DWORD Dr3;
- DWORD Dr6;
- DWORD Dr7;
-};
-
-// Used for selectorentry
-struct SelectorEntryArg {
- HANDLE handle;
- DWORD selector;
-};
-
-struct Message {
- typedef enum {
- ATTACH,
- DETACH,
- LIBINFO,
- PEEK,
- POKE,
- THREADLIST,
- DUPHANDLE,
- CLOSEHANDLE,
- GETCONTEXT,
- SETCONTEXT,
- SELECTORENTRY,
- SUSPEND,
- RESUME,
- POLLEVENT,
- CONTINUEEVENT
- } Type;
-
- Type type;
- union {
- PeekArg peekArg;
- PokeArg pokeArg;
- BoolArg boolArg;
- HandleArg handleArg;
- SetContextArg setContextArg;
- SelectorEntryArg selectorArg;
- };
-};
-
-#endif // #defined _MESSAGE_
diff --git a/hotspot/agent/src/os/win32/Monitor.cpp b/hotspot/agent/src/os/win32/Monitor.cpp
deleted file mode 100644
index 181c173..0000000
--- a/hotspot/agent/src/os/win32/Monitor.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include <stdio.h>
-#include <assert.h>
-#include "Monitor.hpp"
-
-Monitor::Monitor() {
- _lock_count = -1; // No threads have entered the critical section
- _owner = NULL;
- _lock_event = CreateEvent(NULL, false, false, NULL);
- _wait_event = CreateEvent(NULL, true, false, NULL);
- _counter = 0;
- _tickets = 0;
- _waiters = 0;
-}
-
-Monitor::~Monitor() {
- assert(_owner == NULL); // Otherwise, owned monitor being deleted
- assert(_lock_count == -1); // Otherwise, monitor being deleted with non -1 lock count
- CloseHandle(_lock_event);
- CloseHandle(_wait_event);
-}
-
-void
-Monitor::lock() {
- if (InterlockedIncrement(&_lock_count) == 0) {
- // Success, we now own the lock
- } else {
- DWORD dwRet = WaitForSingleObject((HANDLE)_lock_event, INFINITE);
- assert(dwRet == WAIT_OBJECT_0); // Unexpected return value from WaitForSingleObject
- }
- assert(owner() == NULL); // Otherwise, lock count and owner are inconsistent
- setOwner(GetCurrentThread());
-}
-
-void
-Monitor::unlock() {
- setOwner(NULL);
- if (InterlockedDecrement(&_lock_count) >= 0) {
- // Wake a waiting thread up
- DWORD dwRet = SetEvent(_lock_event);
- assert(dwRet != 0); // Unexpected return value from SetEvent
- }
-}
-
-bool
-Monitor::wait(long timeout) {
- assert(owner() != NULL);
- assert(owner() == GetCurrentThread());
-
- // 0 means forever. Convert to Windows specific code.
- DWORD timeout_value = (timeout == 0) ? INFINITE : timeout;
- DWORD which;
-
- long c = _counter;
- bool retry = false;
-
- _waiters++;
- // Loop until condition variable is signaled. The event object is
- // set whenever the condition variable is signaled, and tickets will
- // reflect the number of threads which have been notified. The counter
- // field is used to make sure we don't respond to notifications that
- // have occurred *before* we started waiting, and is incremented each
- // time the condition variable is signaled.
-
- while (true) {
-
- // Leave critical region
- unlock();
-
- // If this is a retry, let other low-priority threads have a chance
- // to run. Make sure that we sleep outside of the critical section.
- if (retry) {
- Sleep(1);
- } else {
- retry = true;
- }
-
- which = WaitForSingleObject(_wait_event, timeout_value);
- // Enter critical section
- lock();
-
- if (_tickets != 0 && _counter != c) break;
-
- if (which == WAIT_TIMEOUT) {
- --_waiters;
- return true;
- }
- }
- _waiters--;
-
- // If this was the last thread to be notified, then we need to reset
- // the event object.
- if (--_tickets == 0) {
- ResetEvent(_wait_event);
- }
-
- return false;
-}
-
-// Notify a single thread waiting on this monitor
-bool
-Monitor::notify() {
- assert(ownedBySelf()); // Otherwise, notify on unknown thread
-
- if (_waiters > _tickets) {
- if (!SetEvent(_wait_event)) {
- return false;
- }
- _tickets++;
- _counter++;
- }
-
- return true;
-}
-
-// Notify all threads waiting on this monitor
-bool
-Monitor::notifyAll() {
- assert(ownedBySelf()); // Otherwise, notifyAll on unknown thread
-
- if (_waiters > 0) {
- if (!SetEvent(_wait_event)) {
- return false;
- }
- _tickets = _waiters;
- _counter++;
- }
-
- return true;
-}
-
-HANDLE
-Monitor::owner() {
- return _owner;
-}
-
-void
-Monitor::setOwner(HANDLE owner) {
- if (owner != NULL) {
- assert(_owner == NULL); // Setting owner thread of already owned monitor
- assert(owner == GetCurrentThread()); // Else should not be doing this
- } else {
- HANDLE oldOwner = _owner;
- assert(oldOwner != NULL); // Removing the owner thread of an unowned mutex
- assert(oldOwner == GetCurrentThread());
- }
- _owner = owner;
-}
-
-bool
-Monitor::ownedBySelf() {
- return (_owner == GetCurrentThread());
-}
diff --git a/hotspot/agent/src/os/win32/Monitor.hpp b/hotspot/agent/src/os/win32/Monitor.hpp
deleted file mode 100644
index 1475f21..0000000
--- a/hotspot/agent/src/os/win32/Monitor.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _MONITOR_
-#define _MONITOR_
-
-#include <windows.h>
-
-class Monitor {
-public:
- Monitor();
- ~Monitor();
-
- void lock();
- void unlock();
- // Default time is forever (i.e, zero). Returns true if it times-out, otherwise
- // false.
- bool wait(long timeout = 0);
- bool notify();
- bool notifyAll();
-
-private:
- HANDLE owner();
- void setOwner(HANDLE owner);
- bool ownedBySelf();
-
- HANDLE _owner;
- long _lock_count;
- HANDLE _lock_event; // Auto-reset event for blocking in lock()
- HANDLE _wait_event; // Manual-reset event for notifications
- long _counter; // Current number of notifications
- long _waiters; // Number of threads waiting for notification
- long _tickets; // Number of waiters to be notified
-};
-
-
-#endif // #defined _MONITOR_
diff --git a/hotspot/agent/src/os/win32/README-commands.txt b/hotspot/agent/src/os/win32/README-commands.txt
deleted file mode 100644
index 0a1cb13..0000000
--- a/hotspot/agent/src/os/win32/README-commands.txt
+++ /dev/null
@@ -1,246 +0,0 @@
-This debug server uses a largely text-based protocol, except for
-certain bulk data transfer operations. All text is in single-byte
-US-ASCII except for the strings returned in "proclist".
-
-NOTE that the character '|' (vertical bar) is used as an escape
-character to switch the incoming data stream to the debug server into
-binary mode, so no text command may contain that character.
-
-Commands understood:
-
-ascii <EOL> ::=
-
- Changes to ASCII mode. This affects all outgoing strings. At
- startup the system is in unicode mode.
-
-unicode <EOL> ::=
-
- Changes to UNICODE mode. This affects all outgoing strings. This
- is the default mode upon startup.
-
-proclist <EOL> ::=
- <int num> [<unsigned int pid> <int charSize> <int numChars> [<binary char_t name>]...]... <EOL>
-
- Returns integer indicating number of processes to follow, followed
- by (pid, name) pairs. Names are given by (charSize, numChars,
- [char_t]...) tuples; charSize indicates the size of each character
- in bytes, numChars the number of characters in the string, and
- name the raw data for the string. Each individual character of the
- string, if multi-byte, is transmitted in network byte order.
- numChars and name are guaranteed to be separated by precisely one
- US-ASCII space. If process list is not available because of
- limitations of the underlying operating system, number of
- processes returned is 0.
-
-attach <int pid> <EOL> ::= <bool result> <EOL>
-
- Attempts to attach to the specified process. Returns 1 if
- successful, 0 if not. Will fail if already attached or if the
- process ID does not exist. Attaching to a process causes the
- process to be suspended.
-
-detach <EOL> ::= <bool result> <EOL>
-
- Detaches from the given process. Attaching and detaching multiple
- times during a debugging session is allowed. Detaching causes the
- process to resume execution.
-
-libinfo <EOL> ::=
- <int numLibs> [<int charSize> <int numChars> [<binary char_t name>]... <address baseAddr>]... <EOL>
-
- May only be called once attached and the target process must be
- suspended; otherwise, returns 0. Returns list of the full path
- names of all of the loaded modules (including the executable
- image) in the target process, as well as the base address at which
- each module was relocated. See proclist for format of strings, but
- NOTE that charSize is ALWAYS 1 for this particular routine,
- regardless of the setting of ASCII/UNICODE.
-
-peek <address addr> <unsigned int numBytes> <EOL> ::=
- B<binary char success>
- [<binary unsigned int len> <binary char isMapped> [<binary char data>]...]...
-
- NOTE that the binary portion of this message is prefixed by the
- uppercase US-ASCII letter 'B', allowing easier synchronization by
- clients. There is no data between the 'B' and the rest of the
- message.
-
- May only be called once attached. Reads the address space of the
- target process starting at the given address (see below for format
- specifications) and extending the given number of bytes. Whether
- the read succeeded is indicated by a single byte containing a 1 or
- 0 (success or failure). If successful, the return result is given
- in a sequence of ranges. _len_, the length of each range, is
- indicated by a 32-bit unsigned integer transmitted with big-endian
- byte ordering (i.e., most significant byte first). _isMapped_
- indicates whether the range is mapped or unmapped in the target
- process's address space, and will contain the value 1 or 0 for
- mapped or unmapped, respectively. If the range is mapped,
- _isMapped_ is followed by _data_, containing the raw binary data
- for the range. The sum of all ranges' lengths is guaranteed to be
- equivalent to the number of bytes requested.
-
-poke <address addr> |[<binary unsigned int len> [<binary char data>]] <EOL> ::=
- <bool result> <EOL>
-
- NOTE that the binary portion of this message is prefixed by the
- uppercase US-ASCII character '|' (vertical bar), allowing easier
- synchronization by the server. There is no data between the '|'
- and the rest of the message. ('B' is not used here because
- addresses can contain that letter; no alphanumeric characters are
- used because some of the parsing routines are used by the Solaris
- SA port, and in that port any alphanumeric character can show up
- as a part of a symbol being looked up.)
-
- May only be called once attached. Writes the address space of the
- target process starting at the given address (see below for format
- specifications), extending the given number of bytes, and
- containing the given data. The number of bytes is a 32-bit
- unsigned integer transmitted with big-endian byte ordering (i.e.,
- most significant byte first). This is followed by the raw binary
- data to be placed at that address. The number of bytes of data
- must match the number of bytes specified in the message.
-
- Returns true if the write succeeded; false if it failed, for
- example because a portion of the region was not mapped in the
- target address space.
-
-threadlist <EOL> ::= <int numThreads> [<address threadHandle>...] <EOL>
-
- May only be called once attached and the target process must be
- suspended; otherwise, returns 0. If available, returns handles for
- all of the threads in the target process. These handles may be
- used as arguments to the getcontext and selectorentry
- commands. They do not need to be (and should not be) duplicated
- via the duphandle command and must not be closed via the
- closehandle command.
-
-duphandle <address handle> <EOL> ::=
- <bool success> [<address duplicate>] <EOL>
-
- Duplicates a HANDLE read from the target process's address space.
- HANDLE is a Windows construct (typically typedef'd to void *).
- The returned handle should ultimately be closed via the
- closehandle command; failing to do so can cause resource leaks.
-
- The purpose of this command is to allow the debugger to read the
- value of a thread handle from the target process and query its
- register set and thread selector entries via the getcontext and
- selectorentry commands, below; such use implies that the target
- program has its own notion of the thread list, and further, that
- the debugger has a way of locating that thread list.
-
-closehandle <address handle> <EOL> ::=
-
- Closes a handle retrieved via the duphandle command, above.
-
-getcontext <address threadHandle> <EOL> ::= <bool success> [<context>] <EOL>
-
- Returns the context for the given thread. The handle must either
- be one of the handles returned from the threadlist command or the
- result of duplicating a thread handle out of the target process
- via the duphandle command. The target process must be suspended.
-
- The context is returned as a series of hex values which represent
- the following x86 registers in the following order:
- EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP, EIP, DS, ES, FS, GS,
- CS, SS, EFLAGS, DR0, DR1, DR2, DR3, DR6, DR7
-
- FIXME: needs to be generalized and/or specified for other
- architectures.
-
-setcontext <address threadHandle> <context> ::= <bool success> <EOL>
-
- Sets the context of the given thread. The target process must be
- suspended. See the getcontext command for the ordering of the
- registers in the context.
-
- Even if the setcontext command succeeds, some of the bits in some
- of the registers (like the global enable bits in the debug
- registers) may be overridden by the operating system. To ensure
- the debugger's notion of the register set is up to date, it is
- recommended to follow up a setcontext with a getcontext.
-
-selectorentry <address threadHandle> <int selector> <EOL> ::=
- <bool success>
- [<address limitLow> <address baseLow>
- <address baseMid> <address flags1>
- <address flags2> <address baseHi>] <EOL>
-
- Retrieves a descriptor table entry for the given thread and
- selector. This data structure allows conversion of a
- segment-relative address to a linear virtual address. It is most
- useful for locating the Thread Information Block for a given
- thread handle to be able to find that thread's ID, to be able to
- understand whether two different thread handles in fact refer to
- the same underlying thread.
-
- This command will only work on the X86 architecture and will
- return false for the success flag (with no additional information
- sent) on other architectures.
-
-suspend ::=
-
- Suspends the target process. Must be attached to a target process.
- A process is suspended when attached to via the attach command. If
- the target process is already suspended then this command has no
- effect.
-
-resume ::=
-
- Resumes the target process without detaching from it. Must be
- attached to a target process. After resuming a target process, the
- debugger client must be prepared to poll for events from the
- target process fairly frequently in order for execution in the
- target process to proceed normally. If the target process is
- already resumed then this command has no effect.
-
-pollevent ::=
- <bool eventPresent> [<address threadHandle> <unsigned int eventCode>]
-
- Additional entries in result for given eventCode:
-
- LOAD/UNLOAD_DLL_DEBUG_EVENT: <address baseOfDLL>
- EXCEPTION_DEBUG_EVENT: <unsigned int exceptionCode> <address faultingPC>
-
- Additional entries for given exceptionCode:
-
- EXCEPTION_ACCESS_VIOLATION: <bool wasWrite> <address faultingAddress>
-
- <EOL>
-
- Polls once to see whether a debug event has been generated by the
- target process. If none is present, returns 0 immediately.
- Otherwise, returns 1 along with a series of textual information
- about the event. The event is not cleared, and the thread resumed,
- until the continueevent command is sent, or the debugger client
- detaches from the target process.
-
- Typically a debugger client will suspend the target process upon
- reception of a debug event. Otherwise, it is not guaranteed that
- all threads will be suspended upon reception of a debug event, and
- any operations requiring that threads be suspended (including
- fetching the context for the thread which generated the event)
- will fail.
-
-continueevent <bool passEventToClient> ::= <bool success> <EOL>
-
- Indicates that the current debug event has been used by the
- debugger client and that the target process should be resumed. The
- passEventToClient flag indicates whether the event should be
- propagated to the target process. Breakpoint and single-step
- events should not be propagated to the target. Returns false if
- there was no pending event, true otherwise.
-
-exit <EOL>
-
- Exits this debugger session.
-
-Format specifications:
-
-// Data formats and example values:
-<EOL> ::= end of line (typically \n on Unix platforms, or \n\r on Windows)
-<address> ::= 0x12345678[9ABCDEF0] /* up to 64-bit hex value */
-<unsigned int> ::= 5 /* up to 32-bit integer number; no leading sign */
-<bool> ::= 1 /* ASCII '0' or '1' */
-<context> ::= <address> ...
diff --git a/hotspot/agent/src/os/win32/README.txt b/hotspot/agent/src/os/win32/README.txt
deleted file mode 100644
index e470b47..0000000
--- a/hotspot/agent/src/os/win32/README.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-This is a "Simple Windows Debug Server" written for the purpose of
-enabling the Serviceability Agent on Win32. It has backends both for
-Windows NT 4.0 (using internal Windows APIs for a few routines) as
-well as for 95/98/ME/2000 via the Tool Help APIs.
-
-The reason this debug server is necessary is that the Win32 debug APIs
-by design tear down the target process when the debugger exits (see
-knowledge base article Q164205 on msdn.microsoft.com). On Solaris, one
-can attach to and detach from a process with no effect; this is key to
-allowing dbx and gcore to work.
-
-The Simple Windows Debug Server effectively implements attach/detach
-functionality for arbitrary debug clients. This allows the SA to
-attach non-destructively to a process, and will enable gcore for Win32
-to be written shortly. While the debugger (the "client" in all of the
-source code) is attached, the target process is suspended. (Note that
-the debug server could be extended to support resumption of the target
-process and transmission of debug events over to the debugger, but
-this has been left for the future.)
-
-The makefile (type "nmake") builds two executables: SwDbgSrv.exe,
-which is the server process, and SwDbgSub.exe, which is forked by the
-server and should not be directly invoked by the user.
-
-The intent is that these two executables can be installed into
-C:\WINNT\SYSTEM32 and SwDbgSrv installed to run as a service (on NT),
-for example using ServiceInstaller (http://www.kcmultimedia.com/smaster/).
-However, SwDbgSrv can also be run from the command line. It generates
-no text output unless the source code is changed to enable debugging
-printouts. As long as any processes which have been attached to by the
-SA are alive, the SwDbgSrv and any forked SwDbgSub processes must be
-left running. Terminating them will cause termination of the target
-processes.
-
-The debug server opens port 27000 and accepts incoming connections
-from localhost only. The security model assumes that if one can run a
-process on the given machine then one basically has access to most or
-all of the machine's facilities; this seems to be in line with the
-standard Windows security model. The protocol used is text-based, so
-one can debug the debug server using telnet. See README-commands.txt
-for documentation on the supported commands.
-
-Testing indicates that the performance impact of attaching to a
-process (and therefore permanently attaching a debugger) is minimal.
-Some serious performance problems had been seen which ultimately
-appeared to be a lack of physical memory on the machine running the
-system.
-
-Bugs:
-
-This debug server is fundamentally incompatible with the Visual C++
-debugger. Once the debug server is used to attach to a process, the
-Visual C++ IDE will not be able to attach to the same process (even if
-the debug server is "detached" from that process). Note that this
-system is designed to work with the same primitives that C and C++
-debuggers use (like "symbol lookup" and "read from process memory")
-and exposes these primitives to Java, so in the long term we could
-solve this problem by implementing platform-specific debug symbol
-parsing and a platform-independent C++ debugger in Java.
-
-Note:
-
-The files IOBuf.cpp and IOBuf.hpp are also used in
-building src/os/solaris/agent.
diff --git a/hotspot/agent/src/os/win32/Reaper.cpp b/hotspot/agent/src/os/win32/Reaper.cpp
deleted file mode 100644
index 13726c5..0000000
--- a/hotspot/agent/src/os/win32/Reaper.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include <iostream>
-#include "Reaper.hpp"
-
-using namespace std;
-
-Reaper::Reaper(ReaperCB* cb) {
- InitializeCriticalSection(&crit);
- event = CreateEvent(NULL, TRUE, FALSE, NULL);
- this->cb = cb;
-
- active = false;
- shouldShutDown = false;
-}
-
-bool
-Reaper::start() {
- bool result = false;
-
- EnterCriticalSection(&crit);
-
- if (!active) {
- DWORD id;
- HANDLE reaper = CreateThread(NULL, 0, &Reaper::reaperThreadEntry,
- this, 0, &id);
- if (reaper != NULL) {
- result = true;
- }
- }
-
- LeaveCriticalSection(&crit);
-
- return result;
-}
-
-bool
-Reaper::stop() {
- bool result = false;
-
- EnterCriticalSection(&crit);
-
- if (active) {
- shouldShutDown = true;
- SetEvent(event);
- while (active) {
- Sleep(1);
- }
- shouldShutDown = false;
- result = true;
- }
-
- LeaveCriticalSection(&crit);
-
- return result;
-}
-
-void
-Reaper::registerProcess(HANDLE processHandle, void* userData) {
- ProcessInfo info;
-
- info.handle = processHandle;
- info.userData = userData;
-
- EnterCriticalSection(&crit);
-
- procInfo.push_back(info);
- SetEvent(event);
-
- LeaveCriticalSection(&crit);
-}
-
-void
-Reaper::reaperThread() {
- while (!shouldShutDown) {
- // Take atomic snapshot of the current process list and user data
- EnterCriticalSection(&crit);
-
- int num = procInfo.size();
- HANDLE* handleList = new HANDLE[1 + num];
- void** dataList = new void*[num];
- for (int i = 0; i < num; i++) {
- handleList[i] = procInfo[i].handle;
- dataList[i] = procInfo[i].userData;
- }
-
- LeaveCriticalSection(&crit);
-
- // Topmost handle becomes the event object, so other threads can
- // signal this one to notice differences in the above list (or
- // shut down)
- handleList[num] = event;
-
- // Wait for these objects
- DWORD idx = WaitForMultipleObjects(1 + num, handleList,
- FALSE, INFINITE);
- if ((idx >= WAIT_OBJECT_0) && (idx <= WAIT_OBJECT_0 + num)) {
- idx -= WAIT_OBJECT_0;
- if (idx < num) {
- // A process exited (i.e., it wasn't that we were woken up
- // just because the event went off)
- (*cb)(dataList[idx]);
- // Remove this process from the list (NOTE: requires that
- // ordering does not change, i.e., that all additions are to
- // the back of the process list)
- EnterCriticalSection(&crit);
-
- std::vector<ProcessInfo>::iterator iter = procInfo.begin();
- iter += idx;
- procInfo.erase(iter);
-
- LeaveCriticalSection(&crit);
- } else {
- // Notification from other thread
- ResetEvent(event);
- }
- } else {
- // Unexpected return value. For now, warn.
- cerr << "Reaper::reaperThread(): unexpected return value "
- << idx << " from WaitForMultipleObjects" << endl;
- }
-
- // Clean up these lists
- delete[] handleList;
- delete[] dataList;
- }
-
- // Time to shut down
- active = false;
-}
-
-DWORD WINAPI
-Reaper::reaperThreadEntry(LPVOID data) {
- Reaper* reaper = (Reaper*) data;
- reaper->reaperThread();
- return 0;
-}
diff --git a/hotspot/agent/src/os/win32/Reaper.hpp b/hotspot/agent/src/os/win32/Reaper.hpp
deleted file mode 100644
index bee0219..0000000
--- a/hotspot/agent/src/os/win32/Reaper.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _REAPER_
-#define _REAPER_
-
-#include <vector>
-#include <windows.h>
-
-typedef void ReaperCB(void* userData);
-
-/** A Reaper maintains a thread which waits for child processes to
- terminate; upon termination it calls a user-specified ReaperCB to
- clean up resources associated with those child processes. */
-
-class Reaper {
-private:
- Reaper& operator=(const Reaper&);
- Reaper(const Reaper&);
-
-public:
- Reaper(ReaperCB*);
- ~Reaper();
-
- // Start the reaper thread.
- bool start();
-
- // Stop the reaper thread. This is called automatically in the
- // reaper's destructor. It is not thread safe and should be called
- // by at most one thread at a time.
- bool stop();
-
- // Register a given child process with the reaper. This should be
- // called by the application's main thread. When that process
- // terminates, the cleanup callback will be called with the
- // specified userData in the context of the reaper thread. Callbacks
- // are guaranteed to be called serially, so they can safely refer to
- // static data as well as the given user data.
- void registerProcess(HANDLE processHandle, void* userData);
-
-private:
- // For thread safety of register()
- CRITICAL_SECTION crit;
-
- ReaperCB* cb;
-
- // State variables
- volatile bool active;
- volatile bool shouldShutDown;
-
- struct ProcessInfo {
- HANDLE handle;
- void* userData;
- };
-
- // Bookkeeping
- std::vector<ProcessInfo> procInfo;
-
- // Synchronization between application thread and reaper thread
- HANDLE event;
-
- // Entry point for reaper thread
- void reaperThread();
-
- // Static function which is actual thread entry point
- static DWORD WINAPI reaperThreadEntry(LPVOID data);
-};
-
-#endif // #defined _REAPER_
diff --git a/hotspot/agent/src/os/win32/SwDbgSrv.cpp b/hotspot/agent/src/os/win32/SwDbgSrv.cpp
deleted file mode 100644
index 7f49bae..0000000
--- a/hotspot/agent/src/os/win32/SwDbgSrv.cpp
+++ /dev/null
@@ -1,1266 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// A Simple Windows Debug Server.
-//
-// This software provides a socket-based debug server which uses
-// mostly ASCII protocols to communicate with its clients. Since the
-// Windows security model is largely based around being able to run
-// programs on the machine, this server only accepts connections
-// coming from localhost.
-//
-// When run as a service (under Windows NT), this software provides
-// clients the ability to attach to and detach from processes without
-// killing those processes. Ordinarily this is forbidden by the
-// Windows debugging APIs (although more recent debugging environments
-// from Microsoft seem to have circumvented this restriction, perhaps
-// in a different way). This is achieved by forking a persistent
-// subprocess for each debugging session which remains alive as long
-// as the target process is.
-//
-// At this point the client can read information out of the target
-// process's address space. Future work includes exposing more
-// functionality like writing to the remote address space and
-// suspending and resuming threads.
-
-#include <iostream>
-#include <vector>
-#include <stdlib.h>
-// Must come before everything else
-#include <winsock2.h>
-#include <assert.h>
-#include "Dispatcher.hpp"
-#include "Handler.hpp"
-#include "initWinsock.hpp"
-#include "ioUtils.hpp"
-#include "isNT4.hpp"
-#include "Message.hpp"
-#include "nt4internals.hpp"
-#include "ports.h"
-#include "procList.hpp"
-#include "serverLists.hpp"
-#include "Reaper.hpp"
-
-// Uncomment the #define below to get messages on stderr
-// #define DEBUGGING
-
-using namespace std;
-
-static ChildList childList;
-static ClientList clientList;
-static Reaper* reaper = NULL;
-
-// Needed prototypes
-void shutdownChild(ChildInfo* childInfo);
-void detachClient(ClientInfo* clientInfo);
-void shutdownClient(ClientInfo* clientInfo);
-
-char *
-longToDotFormat(long addr)
-{
- char *temp_s = new char[20];
-
- sprintf(temp_s, "%d.%d.%d.%d", ((addr & 0xff000000) >> 24),
- ((addr & 0x00ff0000) >> 16), ((addr & 0x0000ff00) >> 8),
- (addr & 0x000000ff));
-
- return temp_s;
-}
-
-// NOTE that we do this query every time. It is a bad idea to cache IP
-// addresses. For example, we might be hosted on a machine using DHCP
-// and the connection addresses might change over time. (Yes, this
-// actually happened.)
-bool
-isConnectionOkay(ULONG connAddr) {
- if (connAddr == INADDR_LOOPBACK) {
- return true;
- }
-
- const int MAXNAME = 1024;
- char myname[MAXNAME];
- gethostname(myname, MAXNAME);
- struct hostent* myInfo = gethostbyname(myname);
- if (myInfo == NULL) {
-#ifdef DEBUGGING
- cerr << "My host information was null" << endl;
-#endif
- } else {
- // Run down the list of IP addresses for myself
- assert(myInfo->h_length == sizeof(ULONG));
-#ifdef DEBUGGING
- cerr << "My known IP addresses: " << endl;
-#endif
- for (char** pp = myInfo->h_addr_list; *pp != NULL; pp++) {
- char* p = *pp;
- ULONG altAddr = ntohl(*((ULONG*) p));
-#ifdef DEBUGGING
- char* name = longToDotFormat(altAddr);
- cerr << name << endl;
- delete[] name;
-#endif
- if (altAddr == connAddr) {
-#ifdef DEBUGGING
- cerr << "FOUND" << endl;
-#endif
- return true;
- }
- }
-#ifdef DEBUGGING
- cerr << "Done." << endl;
-#endif
- }
-
- return false;
-}
-
-SOCKET
-setupListeningSocket(short port) {
- SOCKET listening = socket(AF_INET, SOCK_STREAM, 0);
- if (listening == INVALID_SOCKET) {
- cerr << "Error creating listening socket" << endl;
- exit(1);
- }
-
- int reuseAddress = 1;
- if (setsockopt(listening, SOL_SOCKET, SO_REUSEADDR,
- (char *)&reuseAddress, sizeof(reuseAddress)) == -1) {
- cerr << "Error reusing address" << endl;
- exit(1);
- }
-
- struct sockaddr_in serverInfo;
-
- memset((char *)&serverInfo, 0, sizeof(serverInfo));
- serverInfo.sin_addr.s_addr = INADDR_ANY;
- serverInfo.sin_family = AF_INET;
- serverInfo.sin_port = htons(port);
-
- if (bind(listening, (struct sockaddr *) &serverInfo, sizeof(serverInfo)) < 0) {
- cerr << "Error binding socket" << endl;
- exit(1);
- }
-
- if (listen(listening, 5) < 0) {
- cerr << "Error listening" << endl;
- exit(1);
- }
-
- return listening;
-}
-
-/** Accepts a connection from the given listening socket, but only if
- the connection came from localhost. Returns INVALID_SOCKET if the
- connection came from any other IP address or if an error occurred
- during the call to accept(). */
-SOCKET
-acceptFromLocalhost(SOCKET listening) {
- struct sockaddr_in peerAddr;
- int peerAddrLen = sizeof(peerAddr);
- SOCKET fd = accept(listening, (sockaddr*) &peerAddr, &peerAddrLen);
- if (fd == INVALID_SOCKET) {
- return fd;
- }
-
- if (!isConnectionOkay(ntohl(peerAddr.sin_addr.s_addr))) {
- // Reject connections from other machines for security purposes.
- // The Windows security model seems to assume one user per
- // machine, and that security is compromised if another user is
- // able to run executables on the given host. (If these
- // assumptions are not strict enough, we will have to change
- // this.)
- shutdown(fd, SD_BOTH);
- closesocket(fd);
- return INVALID_SOCKET;
- }
-
- // Disable TCP buffering on all sockets. We send small amounts of
- // data back and forth and don't want buffering.
- int buffer_val = 1;
- if (setsockopt(fd, IPPROTO_IP, TCP_NODELAY,
- (char *) &buffer_val, sizeof(buffer_val)) < 0) {
- shutdown(fd, SD_BOTH);
- closesocket(fd);
- }
-
- return fd;
-}
-
-void
-reapCB(void* arg) {
- ChildInfo* info = (ChildInfo*) arg;
- ListsLocker ll;
- DWORD pid = info->getPid();
- shutdownChild(info);
-#ifdef DEBUGGING
- cerr << "Reaped child for process " << pid << endl;
-#endif
-}
-
-/** Starts a child process with stdin and stdout redirected to pipes,
- handles to which are returned. auxHandle1 and auxHandle2 should be
- closed as well when the child process exits. Returns false if
- process creation failed. */
-bool
-startChildProcess(DWORD pidToDebug,
- DWORD childStdinBufSize,
- DWORD childStdoutBufSize,
- LPHANDLE childProcessHandle,
- LPHANDLE writeToStdinHandle,
- LPHANDLE readFromStdoutHandle,
- LPHANDLE auxHandle1,
- LPHANDLE auxHandle2) {
- // Code adapted from Microsoft example
- // "Creating a Child Process with Redirected Input and Output"
-
- SECURITY_ATTRIBUTES saAttr;
- BOOL fSuccess;
-
- HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup,
- hChildStdoutRd, hChildStdoutWr, hChildStdoutRdDup,
- hSaveStdin, hSaveStdout;
-
- // Set the bInheritHandle flag so pipe handles are inherited.
- saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
- saAttr.bInheritHandle = TRUE;
- saAttr.lpSecurityDescriptor = NULL;
-
- // The steps for redirecting child process's STDOUT:
- // 1. Save current STDOUT, to be restored later.
- // 2. Create anonymous pipe to be STDOUT for child process.
- // 3. Set STDOUT of the parent process to be write handle to
- // the pipe, so it is inherited by the child process.
- // 4. Create a noninheritable duplicate of the read handle and
- // close the inheritable read handle.
-
- // Save the handle to the current STDOUT.
- hSaveStdout = GetStdHandle(STD_OUTPUT_HANDLE);
- // Create a pipe for the child process's STDOUT.
- if (! CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, childStdoutBufSize)) {
- return false;
- }
- // Set a write handle to the pipe to be STDOUT.
- if (! SetStdHandle(STD_OUTPUT_HANDLE, hChildStdoutWr)) {
- return false;
- }
- // Create noninheritable read handle and close the inheritable read
- // handle.
- fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdoutRd,
- GetCurrentProcess(), &hChildStdoutRdDup,
- 0, FALSE,
- DUPLICATE_SAME_ACCESS);
- if( !fSuccess ) {
- return false;
- }
- CloseHandle(hChildStdoutRd);
-
- // The steps for redirecting child process's STDIN:
- // 1. Save current STDIN, to be restored later.
- // 2. Create anonymous pipe to be STDIN for child process.
- // 3. Set STDIN of the parent to be the read handle to the
- // pipe, so it is inherited by the child process.
- // 4. Create a noninheritable duplicate of the write handle,
- // and close the inheritable write handle.
- // Save the handle to the current STDIN.
- hSaveStdin = GetStdHandle(STD_INPUT_HANDLE);
- // Create a pipe for the child process's STDIN.
- if (! CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, childStdinBufSize)) {
- return false;
- }
- // Set a read handle to the pipe to be STDIN.
- if (! SetStdHandle(STD_INPUT_HANDLE, hChildStdinRd)) {
- return false;
- }
- // Duplicate the write handle to the pipe so it is not inherited.
- fSuccess = DuplicateHandle(GetCurrentProcess(), hChildStdinWr,
- GetCurrentProcess(), &hChildStdinWrDup, 0,
- FALSE, // not inherited
- DUPLICATE_SAME_ACCESS);
- if (! fSuccess) {
- return false;
- }
- CloseHandle(hChildStdinWr);
-
- // Create the child process
- char cmdLine[256];
- sprintf(cmdLine, "SwDbgSub.exe %u", pidToDebug);
- PROCESS_INFORMATION procInfo;
- STARTUPINFO startInfo;
- memset((char*) &startInfo, 0, sizeof(startInfo));
- startInfo.cb = sizeof(startInfo);
- BOOL res = CreateProcess(NULL,
- cmdLine,
- NULL,
- NULL,
- TRUE, // inherit handles: important
- 0,
- NULL,
- NULL,
- &startInfo,
- &procInfo);
- if (!res) {
- return false;
- }
- // After process creation, restore the saved STDIN and STDOUT.
- if (! SetStdHandle(STD_INPUT_HANDLE, hSaveStdin)) {
- return false;
- }
- if (! SetStdHandle(STD_OUTPUT_HANDLE, hSaveStdout)) {
- return false;
- }
-
- // hChildStdinWrDup can be used to write to the child's stdin
- // hChildStdoutRdDup can be used to read from the child's stdout
-
- // NOTE: example code closes hChildStdoutWr before reading from
- // hChildStdoutRdDup. "Close the write end of the pipe before
- // reading from the read end of the pipe"??? Looks like this is
- // example-specific.
-
- // Set up return arguments
- // hChildStdoutRd and hChildStdinWr are already closed at this point
- *childProcessHandle = procInfo.hProcess;
- *writeToStdinHandle = hChildStdinWrDup;
- *readFromStdoutHandle = hChildStdoutRdDup;
- *auxHandle1 = hChildStdinRd;
- *auxHandle2 = hChildStdoutWr;
- return true;
-}
-
-/** Clears the event and writes the message to the child process */
-bool
-sendMessage(ChildInfo* child, Message* message) {
- DWORD numBytesWritten;
- if (!WriteFile(child->getWriteToStdinHandle(),
- message, sizeof(Message), &numBytesWritten, NULL)) {
- return false;
- }
- if (numBytesWritten != sizeof(Message)) {
- return false;
- }
- // Follow up "poke" messages with the raw data
- if (message->type == Message::POKE) {
- if (!WriteFile(child->getWriteToStdinHandle(),
- message->pokeArg.data, message->pokeArg.numBytes, &numBytesWritten, NULL)) {
- return false;
- }
- if (numBytesWritten != message->pokeArg.numBytes) {
- return false;
- }
- }
- return true;
-}
-
-/** Copies data from child's stdout to the client's IOBuf and sends it
- along */
-bool
-forwardReplyToClient(ChildInfo* child, ClientInfo* client) {
- DWORD total = 0;
- IOBuf::FillState ret;
-
- do {
- DWORD temp;
- ret = client->getIOBuf()->fillFromFileHandle(child->getReadFromStdoutHandle(),
- &temp);
- if (ret == IOBuf::DONE || ret == IOBuf::MORE_DATA_PENDING) {
- if (!client->getIOBuf()->flush()) {
-#ifdef DEBUGGING
- cerr << "Forward failed because flush failed" << endl;
-#endif
- return false;
- }
- total += temp;
- }
- } while (ret == IOBuf::MORE_DATA_PENDING);
-
- return (ret == IOBuf::FAILED) ? false : true;
-}
-
-//----------------------------------------------------------------------
-// Server Handler
-//
-
-class ServerHandler : public Handler {
-public:
- ServerHandler();
-
- // Starts up in Unicode mode by default
- bool getASCII();
-
- void setIOBuf(IOBuf* ioBuf);
-
- void procList(char* arg);
-
- // Must be called before calling one of the routines below
- void setClientInfo(ClientInfo* info);
-
- // Indicates to outer loop that exit was called or that an error
- // occurred and that the client exited.
- bool exited();
- // Clears this state
- void clearExited();
-
- void ascii(char* arg);
- void unicode(char* arg);
- void attach(char* arg);
- void detach(char* arg);
- void libInfo(char* arg);
- void peek(char* arg);
- void poke(char* arg);
- void threadList(char* arg);
- void dupHandle(char* arg);
- void closeHandle(char* arg);
- void getContext(char* arg);
- void setContext(char* arg);
- void selectorEntry(char* arg);
- void suspend(char* arg);
- void resume(char* arg);
- void pollEvent(char* arg);
- void continueEvent(char* arg);
- void exit(char* arg);
-
- // This is pretty gross. Needed to make the target process know
- // about clients that have disconnected unexpectedly while attached.
- friend void shutdownClient(ClientInfo*);
-private:
- // Writes: charSize <space> numChars <space> <binary string>
- // Handles both ASCII and UNICODE modes
- void writeString(USHORT len, WCHAR* str);
-
- // Handles only ASCII mode
- void writeString(USHORT len, char* str);
-
- ClientInfo* clientInfo;
- IOBuf* ioBuf;
- bool _exited;
- bool _ascii;
-};
-
-static ServerHandler* handler;
-
-ServerHandler::ServerHandler() {
- _exited = false;
- _ascii = false;
- ioBuf = NULL;
-}
-
-bool
-ServerHandler::getASCII() {
- return _ascii;
-}
-
-void
-ServerHandler::setIOBuf(IOBuf* buf) {
- ioBuf = buf;
-}
-
-void
-ServerHandler::setClientInfo(ClientInfo* info) {
- clientInfo = info;
-}
-
-bool
-ServerHandler::exited() {
- return _exited;
-}
-
-void
-ServerHandler::clearExited() {
- _exited = false;
-}
-
-void
-ServerHandler::ascii(char* arg) {
- _ascii = true;
-}
-
-void
-ServerHandler::unicode(char* arg) {
- _ascii = false;
-}
-
-void
-ServerHandler::procList(char* arg) {
-#ifdef DEBUGGING
- cerr << "proclist" << endl;
-#endif
-
- ProcEntryList processes;
- ::procList(processes);
-
- ioBuf->writeInt(processes.size());
-
- for (ProcEntryList::iterator iter = processes.begin();
- iter != processes.end(); iter++) {
- ProcEntry& entry = *iter;
- ioBuf->writeSpace();
- ioBuf->writeUnsignedInt(entry.getPid());
- ioBuf->writeSpace();
- writeString(entry.getNameLength(), entry.getName());
- }
-
- ioBuf->writeEOL();
- ioBuf->flush();
-}
-
-void
-ServerHandler::attach(char* arg) {
- // If the client is already attached to a process, fail.
- if (clientInfo->getTarget() != NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // Try to get pid
- DWORD pid;
- if (!scanUnsignedLong(&arg, &pid)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // See whether this pid is already forked
- ListsLocker ll;
- ChildInfo* childInfo = childList.getChildByPid(pid);
- if (childInfo != NULL) {
- // If this child already has a client, return false
- if (childInfo->getClient() != NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // Otherwise, can associate this client with this child process
- childInfo->setClient(clientInfo);
- clientInfo->setTarget(childInfo);
-
- // Tell the child we are attaching so it can suspend the target
- // process
- Message msg;
- msg.type = Message::ATTACH;
- sendMessage(childInfo, &msg);
-
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- } else {
- // Have to fork a new child subprocess
- HANDLE childProcessHandle;
- HANDLE writeToStdinHandle;
- HANDLE readFromStdoutHandle;
- HANDLE auxHandle1;
- HANDLE auxHandle2;
- if (!startChildProcess(pid,
- 32768,
- 131072,
- &childProcessHandle,
- &writeToStdinHandle,
- &readFromStdoutHandle,
- &auxHandle1,
- &auxHandle2)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // See whether the child succeeded in attaching to the process
- char res;
- DWORD numRead;
- if (!ReadFile(readFromStdoutHandle,
- &res,
- sizeof(char),
- &numRead,
- NULL)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- if (!res) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // OK, success.
- childInfo = new ChildInfo(pid, childProcessHandle,
- writeToStdinHandle, readFromStdoutHandle,
- auxHandle1, auxHandle2);
- childList.addChild(childInfo);
- reaper->registerProcess(childProcessHandle, childInfo);
- // Associate this client with this child process
- childInfo->setClient(clientInfo);
- clientInfo->setTarget(childInfo);
-
- // Tell the child process to actually suspend the target process
- Message msg;
- msg.type = Message::ATTACH;
- sendMessage(childInfo, &msg);
-
- // Write result to client
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-}
-
-void
-ServerHandler::detach(char* arg) {
- // If the client is not attached, fail.
- if (clientInfo->getTarget() == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- detachClient(clientInfo);
-
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeEOL();
- ioBuf->flush();
-}
-
-void
-ServerHandler::libInfo(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeInt(0);
- ioBuf->writeEOL();
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::LIBINFO;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::peek(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeString("B");
- ioBuf->writeBinChar(0);
- ioBuf->flush();
- return;
- }
-
- // Try to get address
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeString("B");
- ioBuf->writeBinChar(0);
- ioBuf->flush();
- return;
- }
-
- // Try to get number of bytes
- DWORD numBytes;
- if (!scanUnsignedLong(&arg, &numBytes)) {
- ioBuf->writeString("B");
- ioBuf->writeBinChar(0);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::PEEK;
- msg.peekArg.address = address;
- msg.peekArg.numBytes = numBytes;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::poke(char* arg) {
-#ifdef DEBUGGING
- cerr << "ServerHandler::poke" << endl;
-#endif
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get address
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get number of bytes
- if (!scanAndSkipBinEscapeChar(&arg)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
- DWORD numBytes;
- if (!scanBinUnsignedLong(&arg, &numBytes)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Raw data is now in "arg"
- // Send message to child
- Message msg;
- msg.type = Message::POKE;
- msg.pokeArg.address = address;
- msg.pokeArg.numBytes = numBytes;
- msg.pokeArg.data = arg;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::threadList(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::THREADLIST;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::dupHandle(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::DUPHANDLE;
- msg.handleArg.handle = (HANDLE) address;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::closeHandle(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- return;
- }
-
- // Try to get handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::CLOSEHANDLE;
- msg.handleArg.handle = (HANDLE) address;
- sendMessage(child, &msg);
-
- // No reply
-}
-
-void
-ServerHandler::getContext(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::GETCONTEXT;
- msg.handleArg.handle = (HANDLE) address;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::setContext(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get context
- DWORD regs[NUM_REGS_IN_CONTEXT];
- for (int i = 0; i < NUM_REGS_IN_CONTEXT; i++) {
- if (!scanAddress(&arg, ®s[i])) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::SETCONTEXT;
- msg.setContextArg.handle = (HANDLE) address;
- msg.setContextArg.Eax = regs[0];
- msg.setContextArg.Ebx = regs[1];
- msg.setContextArg.Ecx = regs[2];
- msg.setContextArg.Edx = regs[3];
- msg.setContextArg.Esi = regs[4];
- msg.setContextArg.Edi = regs[5];
- msg.setContextArg.Ebp = regs[6];
- msg.setContextArg.Esp = regs[7];
- msg.setContextArg.Eip = regs[8];
- msg.setContextArg.Ds = regs[9];
- msg.setContextArg.Es = regs[10];
- msg.setContextArg.Fs = regs[11];
- msg.setContextArg.Gs = regs[12];
- msg.setContextArg.Cs = regs[13];
- msg.setContextArg.Ss = regs[14];
- msg.setContextArg.EFlags = regs[15];
- msg.setContextArg.Dr0 = regs[16];
- msg.setContextArg.Dr1 = regs[17];
- msg.setContextArg.Dr2 = regs[18];
- msg.setContextArg.Dr3 = regs[19];
- msg.setContextArg.Dr6 = regs[20];
- msg.setContextArg.Dr7 = regs[21];
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::selectorEntry(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get thread handle
- DWORD address;
- if (!scanAddress(&arg, &address)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get selector
- DWORD selector;
- if (!scanUnsignedLong(&arg, &selector)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::SELECTORENTRY;
- msg.selectorArg.handle = (HANDLE) address;
- msg.selectorArg.selector = selector;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::suspend(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::SUSPEND;
- sendMessage(child, &msg);
-
- // No reply
-}
-
-void
-ServerHandler::resume(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::RESUME;
- sendMessage(child, &msg);
-
- // No reply
-}
-
-void
-ServerHandler::pollEvent(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::POLLEVENT;
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::continueEvent(char* arg) {
- ListsLocker ll;
- ChildInfo* child = clientInfo->getTarget();
- if (child == NULL) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Try to get bool arg
- int passEventToClient;
- if (!scanInt(&arg, &passEventToClient)) {
- ioBuf->writeBoolAsInt(false);
- ioBuf->flush();
- return;
- }
-
- // Send message to child
- Message msg;
- msg.type = Message::CONTINUEEVENT;
- msg.boolArg.val = ((passEventToClient != 0) ? true : false);
- sendMessage(child, &msg);
-
- // Forward reply to client
- forwardReplyToClient(child, clientInfo);
-}
-
-void
-ServerHandler::exit(char* arg) {
- shutdownClient(clientInfo);
- _exited = true;
-}
-
-void
-ServerHandler::writeString(USHORT len, WCHAR* str) {
- if (_ascii) {
- char* cStr = new char[len + 1];
- sprintf(cStr, "%.*ls", len, str);
- writeString(len, cStr);
- delete[] cStr;
- } else {
- ioBuf->writeInt(sizeof(unsigned short));
- ioBuf->writeSpace();
- ioBuf->writeInt(len);
- ioBuf->writeSpace();
- for (int i = 0; i < len; i++) {
- ioBuf->writeBinUnsignedShort(str[i]);
- }
- }
-}
-
-void
-ServerHandler::writeString(USHORT len, char* str) {
- ioBuf->writeInt(1);
- ioBuf->writeSpace();
- ioBuf->writeInt(len);
- ioBuf->writeSpace();
- ioBuf->writeString(str);
-}
-
-//
-//----------------------------------------------------------------------
-
-//----------------------------------------------------------------------
-// Shutdown routines
-//
-
-void
-shutdownChild(ChildInfo* childInfo) {
- childList.removeChild(childInfo);
- childInfo->closeAll();
- if (childInfo->getClient() != NULL) {
- shutdownClient(childInfo->getClient());
- }
- delete childInfo;
-}
-
-void
-detachClient(ClientInfo* info) {
- ListsLocker ll;
- // May have been dissociated while not under cover of lock
- if (info->getTarget() == NULL) {
- return;
- }
-
- // Tell the child that we have detached to let the target process
- // continue running
- Message msg;
- msg.type = Message::DETACH;
- sendMessage(info->getTarget(), &msg);
-
- // Dissociate the client and the target
- info->getTarget()->setClient(NULL);
- info->setTarget(NULL);
-}
-
-void
-shutdownClient(ClientInfo* clientInfo) {
-#ifdef DEBUGGING
- cerr << "Shutting down client" << endl;
-#endif
-
- // If we're connected, inform the target process that we're
- // disconnecting
- detachClient(clientInfo);
-
- // Remove this client from the list and delete it
- clientList.removeClient(clientInfo);
- if (clientInfo->getTarget() != NULL) {
- clientInfo->getTarget()->setClient(NULL);
- }
- clientInfo->closeAll();
- delete clientInfo;
-}
-
-//
-//----------------------------------------------------------------------
-
-
-/** Main dispatcher for client commands. NOTE: do not refer to this
- clientInfo data structure after calling this routine, as it may be
- deleted internally. */
-void
-readAndDispatch(ClientInfo* clientInfo) {
- IOBuf::ReadLineResult res;
- IOBuf* ioBuf = clientInfo->getIOBuf();
- unsigned long howMany;
- ioctlsocket(clientInfo->getDataSocket(), FIONREAD, &howMany);
- if (howMany == 0) {
- // Client closed down.
- shutdownClient(clientInfo);
- return;
- }
- // Read and process as much data as possible
- do {
- res = ioBuf->tryReadLine();
- if (res == IOBuf::RL_ERROR) {
-#ifdef DEBUGGING
- cerr << "Error while reading line" << endl;
-#endif
- shutdownClient(clientInfo);
- return;
- } else if (res == IOBuf::RL_GOT_DATA) {
-#ifdef DEBUGGING
- cerr << "Got data: \"" << ioBuf->getLine() << "\"" << endl;
-#endif
- handler->setIOBuf(ioBuf);
- handler->setClientInfo(clientInfo);
- handler->clearExited();
- Dispatcher::dispatch(ioBuf->getLine(), handler);
- }
- } while (res == IOBuf::RL_GOT_DATA && (!handler->exited()));
-#ifdef DEBUGGING
- cerr << "Exiting readAndDispatch" << endl;
-#endif
-}
-
-int
-main(int argc, char **argv)
-{
- initWinsock();
-
- if (isNT4()) {
- loadPSAPIDLL(); // Will exit if not present
- }
-
- SOCKET clientListeningSock = setupListeningSocket(CLIENT_PORT);
-
- handler = new ServerHandler();
- Lists::init();
-
- reaper = new Reaper(&reapCB);
- if (!reaper->start()) {
- exit(1);
- }
-
- while (true) {
- // Select on all sockets:
- // - client listening socket
- // - sockets for all client connections
-
- // When one of the client connections closes, close its socket
- // handles.
-
- fd_set set;
- SOCKET maxSock = 0;
-
- // Set up fd_set
- {
- int i;
- FD_ZERO(&set);
- FD_SET(clientListeningSock, &set);
- if (clientListeningSock > maxSock) {
- maxSock = clientListeningSock;
- }
- for (i = 0; i < clientList.size(); i++) {
- ClientInfo* info = clientList.get(i);
- if (info->getDataSocket() > maxSock) {
- maxSock = info->getDataSocket();
- }
- FD_SET(info->getDataSocket(), &set);
- }
- }
- struct timeval timeout;
- timeout.tv_sec = 300; // 5 minutes
- timeout.tv_usec = 0;
- int res = select(maxSock, &set, NULL, NULL, &timeout);
- if (res > 0) {
-
- ////////////////
- // New client //
- ////////////////
- if (FD_ISSET(clientListeningSock, &set)) {
- SOCKET fd = acceptFromLocalhost(clientListeningSock);
- if (fd != INVALID_SOCKET) {
- // Create new client information object
- ClientInfo* info = new ClientInfo(fd);
- // Add to list of clients
- clientList.addClient(info);
-#ifdef DEBUGGING
- cerr << "New client" << endl;
-#endif
- }
- }
-
- ///////////////////////////
- // Commands from clients //
- ///////////////////////////
- ClientInfo* clientInfo;
- if (clientList.isAnyDataSocketSet(&set, &clientInfo)) {
- readAndDispatch(clientInfo);
- }
- } else if (res < 0) {
- // Looks like one of the clients was killed. Try to figure out which one.
- bool found = false;
- fd_set set;
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- for (int i = 0; i < clientList.size(); i++) {
- ClientInfo* info = clientList.get(i);
- FD_ZERO(&set);
- FD_SET(info->getDataSocket(), &set);
- if (select(1 + info->getDataSocket(), &set, NULL, NULL, &timeout) < 0) {
- found = true;
- clientList.removeClient(info);
- info->closeAll();
- delete info;
- break;
- }
- }
- if (!found) {
- // This indicates trouble -- one of our listening sockets died.
- exit(1);
- }
- }
- }
-
- return 0;
-}
diff --git a/hotspot/agent/src/os/win32/SwDbgSrv.dsp b/hotspot/agent/src/os/win32/SwDbgSrv.dsp
deleted file mode 100644
index 4257278..0000000
--- a/hotspot/agent/src/os/win32/SwDbgSrv.dsp
+++ /dev/null
@@ -1,146 +0,0 @@
-# Microsoft Developer Studio Project File - Name="SwDbgSrv" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=SwDbgSrv - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "SwDbgSrv.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "SwDbgSrv.mak" CFG="SwDbgSrv - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "SwDbgSrv - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "SwDbgSrv - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "SwDbgSrv - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "SwDbgSrv - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "SwDbgSrv___Win32_Debug"
-# PROP BASE Intermediate_Dir "SwDbgSrv___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "SwDbgSrv - Win32 Release"
-# Name "SwDbgSrv - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\Buffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Dispatcher.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\initWinsock.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\IOBuf.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\ioUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\isNT4.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\nt4internals.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\procList.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Reaper.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\serverLists.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\SwDbgSrv.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\toolHelp.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/hotspot/agent/src/os/win32/SwDbgSrv.dsw b/hotspot/agent/src/os/win32/SwDbgSrv.dsw
deleted file mode 100644
index a1570e4..0000000
--- a/hotspot/agent/src/os/win32/SwDbgSrv.dsw
+++ /dev/null
@@ -1,41 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "SwDbgSrv"=.\SwDbgSrv.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "SwDbgSub"=.\SwDbgSub.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/hotspot/agent/src/os/win32/SwDbgSub.cpp b/hotspot/agent/src/os/win32/SwDbgSub.cpp
deleted file mode 100644
index 7acae51..0000000
--- a/hotspot/agent/src/os/win32/SwDbgSub.cpp
+++ /dev/null
@@ -1,883 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// This is the source code for the subprocess forked by the Simple
-// Windows Debug Server. It assumes most of the responsibility for the
-// debug session, and processes all of the commands sent by clients.
-
-// Disable too-long symbol warnings
-#pragma warning ( disable : 4786 )
-
-#include <iostream>
-#include <vector>
-#include <stdlib.h>
-#include <assert.h>
-// Must come before windows.h
-#include <winsock2.h>
-#include <windows.h>
-#include "IOBuf.hpp"
-#include "libInfo.hpp"
-#include "LockableList.hpp"
-#include "Message.hpp"
-#include "Monitor.hpp"
-#include "nt4internals.hpp"
-
-// Uncomment the #define below to get messages on stderr
-// #define DEBUGGING
-
-using namespace std;
-
-DWORD pid;
-HANDLE procHandle;
-IOBuf* ioBuf;
-
-// State flags indicating whether the attach to the remote process
-// definitively succeeded or failed
-volatile bool attachFailed = false;
-volatile bool attachSucceeded = false;
-
-// State flag indicating whether the target process is suspended.
-// Modified by suspend()/resume(), viewed by debug thread, but only
-// under cover of the threads lock.
-volatile bool suspended = false;
-
-// State flags indicating whether we are considered to be attached to
-// the target process and are therefore queuing up events to be sent
-// back to the debug server. These flags are only accessed and
-// modified under the cover of the eventLock.
-Monitor* eventLock;
-// The following is set to true when a client is attached to this process
-volatile bool generateDebugEvents = false;
-// Pointer to current debug event; non-NULL indicates a debug event is
-// waiting to be sent to the client. Main thread sets this to NULL to
-// indicate that the event has been consumed; also sets
-// passEventToClient, below.
-volatile DEBUG_EVENT* curDebugEvent = NULL;
-// Set by main thread to indicate whether the most recently posted
-// debug event should be passed on to the target process.
-volatile bool passEventToClient = true;
-
-void conditionalPostDebugEvent(DEBUG_EVENT* ev, DWORD* continueOrNotHandledFlag) {
- // FIXME: make it possible for the client to enable and disable
- // certain types of events (have to do so in a platform-independent
- // manner)
- switch (ev->dwDebugEventCode) {
- case EXCEPTION_DEBUG_EVENT:
- switch (ev->u.Exception.ExceptionRecord.ExceptionCode) {
- case EXCEPTION_BREAKPOINT: break;
- case EXCEPTION_SINGLE_STEP: break;
- case EXCEPTION_ACCESS_VIOLATION: break;
- default: return;
- }
- }
- eventLock->lock();
- if (generateDebugEvents) {
- curDebugEvent = ev;
- while (curDebugEvent != NULL) {
- eventLock->wait();
- }
- if (passEventToClient) {
- *continueOrNotHandledFlag = DBG_EXCEPTION_NOT_HANDLED;
- } else {
- *continueOrNotHandledFlag = DBG_CONTINUE;
- }
- }
- eventLock->unlock();
-}
-
-
-//----------------------------------------------------------------------
-// Module list
-//
-
-vector<LibInfo> libs;
-
-//----------------------------------------------------------------------
-// Thread list
-//
-
-struct ThreadInfo {
- DWORD tid;
- HANDLE thread;
-
- ThreadInfo(DWORD tid, HANDLE thread) {
- this->tid = tid;
- this->thread = thread;
- }
-};
-
-class ThreadList : public LockableList<ThreadInfo> {
-public:
- bool removeByThreadID(DWORD tid) {
- for (InternalListType::iterator iter = internalList.begin();
- iter != internalList.end(); iter++) {
- if ((*iter).tid == tid) {
- internalList.erase(iter);
- return true;
- }
- }
- return false;
- }
- HANDLE threadIDToHandle(DWORD tid) {
- for (InternalListType::iterator iter = internalList.begin();
- iter != internalList.end(); iter++) {
- if ((*iter).tid == tid) {
- return (*iter).thread;
- }
- }
- return NULL;
- }
-};
-
-ThreadList threads;
-
-//----------------------------------------------------------------------
-// INITIALIZATION AND TERMINATION
-//
-
-void
-printError(const char* prefix) {
- DWORD detail = GetLastError();
- LPTSTR message;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM,
- 0,
- detail,
- 0,
- (LPTSTR) &message,
- 1,
- NULL);
- // FIXME: This is signaling an error: "The handle is invalid." ?
- // Do I have to do all of my WaitForDebugEvent calls from the same thread?
- cerr << prefix << ": " << message << endl;
- LocalFree(message);
-}
-
-void
-endProcess(bool waitForProcess = true) {
- NT4::unloadNTDLL();
- if (waitForProcess) {
- // Though we're exiting because of an error, do not tear down the
- // target process.
- WaitForSingleObject(procHandle, INFINITE);
- }
- CloseHandle(procHandle);
- exit(0);
-}
-
-DWORD WINAPI
-debugThreadEntry(void*) {
-#ifdef DEBUGGING
- DWORD lastMsgId = 0;
- int count = 0;
-#endif
-
- if (!DebugActiveProcess(pid)) {
- attachFailed = true;
- return 0;
- }
-
- // Wait for debug events. We keep the information from some of these
- // on the side in anticipation of later queries by the client. NOTE
- // that we leave the process running. The main thread is responsible
- // for suspending and resuming all currently-active threads upon
- // client attach and detach.
-
- while (true) {
- DEBUG_EVENT ev;
- if (!WaitForDebugEvent(&ev, INFINITE)) {
-#ifdef DEBUGGING
- if (++count < 10) {
- // FIXME: This is signaling an error: "The handle is invalid." ?
- // Do I have to do all of my WaitForDebugEvent calls from the same thread?
- printError("WaitForDebugEvent failed");
- }
-#endif
- } else {
-
-#ifdef DEBUGGING
- if (ev.dwDebugEventCode != lastMsgId) {
- lastMsgId = ev.dwDebugEventCode;
- count = 0;
- cerr << "Debug thread received event " << ev.dwDebugEventCode << endl;
- } else {
- if (++count < 10) {
- cerr << "Debug thread received event " << ev.dwDebugEventCode << endl;
- }
- }
-#endif
-
- DWORD dbgContinueMode = DBG_CONTINUE;
-
- switch (ev.dwDebugEventCode) {
- case LOAD_DLL_DEBUG_EVENT:
- conditionalPostDebugEvent(&ev, &dbgContinueMode);
- break;
-
- case UNLOAD_DLL_DEBUG_EVENT:
- conditionalPostDebugEvent(&ev, &dbgContinueMode);
- break;
-
- case CREATE_PROCESS_DEBUG_EVENT:
- threads.lock();
- // FIXME: will this deal properly with child processes? If
- // not, is it possible to make it do so?
-#ifdef DEBUGGING
- cerr << "CREATE_PROCESS_DEBUG_EVENT " << ev.dwThreadId
- << " " << ev.u.CreateProcessInfo.hThread << endl;
-#endif
- if (ev.u.CreateProcessInfo.hThread != NULL) {
- threads.add(ThreadInfo(ev.dwThreadId, ev.u.CreateProcessInfo.hThread));
- }
- threads.unlock();
- break;
-
- case CREATE_THREAD_DEBUG_EVENT:
- threads.lock();
-#ifdef DEBUGGING
- cerr << "CREATE_THREAD_DEBUG_EVENT " << ev.dwThreadId
- << " " << ev.u.CreateThread.hThread << endl;
-#endif
- if (suspended) {
- // Suspend this thread before adding it to the thread list
- SuspendThread(ev.u.CreateThread.hThread);
- }
- threads.add(ThreadInfo(ev.dwThreadId, ev.u.CreateThread.hThread));
- threads.unlock();
- break;
-
- case EXIT_THREAD_DEBUG_EVENT:
- threads.lock();
-#ifdef DEBUGGING
- cerr << "EXIT_THREAD_DEBUG_EVENT " << ev.dwThreadId << endl;
-#endif
- threads.removeByThreadID(ev.dwThreadId);
- threads.unlock();
- break;
-
- case EXCEPTION_DEBUG_EVENT:
- // cerr << "EXCEPTION_DEBUG_EVENT" << endl;
- switch (ev.u.Exception.ExceptionRecord.ExceptionCode) {
- case EXCEPTION_BREAKPOINT:
- // cerr << "EXCEPTION_BREAKPOINT" << endl;
- if (!attachSucceeded && !attachFailed) {
- attachSucceeded = true;
- }
- break;
-
- default:
- dbgContinueMode = DBG_EXCEPTION_NOT_HANDLED;
- break;
- }
- conditionalPostDebugEvent(&ev, &dbgContinueMode);
- break;
-
- case EXIT_PROCESS_DEBUG_EVENT:
- endProcess(false);
- // NOT REACHED
- break;
-
- default:
-#ifdef DEBUGGING
- cerr << "Received debug event " << ev.dwDebugEventCode << endl;
-#endif
- break;
- }
-
- ContinueDebugEvent(ev.dwProcessId, ev.dwThreadId, dbgContinueMode);
- }
- }
-}
-
-bool
-attachToProcess() {
- // Create event lock
- eventLock = new Monitor();
-
- // Get a process handle for later
- procHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
- if (procHandle == NULL) {
- return false;
- }
-
- // Start up the debug thread
- DWORD debugThreadId;
- if (CreateThread(NULL, 0, &debugThreadEntry, NULL, 0, &debugThreadId) == NULL) {
- // Failed to make background debug thread. Fail.
- return false;
- }
-
- while ((!attachSucceeded) && (!attachFailed)) {
- Sleep(1);
- }
-
- if (attachFailed) {
- return false;
- }
-
- assert(attachSucceeded);
-
- return true;
-}
-
-bool
-readMessage(Message* msg) {
- DWORD numRead;
- if (!ReadFile(GetStdHandle(STD_INPUT_HANDLE),
- msg,
- sizeof(Message),
- &numRead,
- NULL)) {
- return false;
- }
- if (numRead != sizeof(Message)) {
- return false;
- }
- // For "poke" messages, must follow up by reading raw data
- if (msg->type == Message::POKE) {
- char* dataBuf = new char[msg->pokeArg.numBytes];
- if (dataBuf == NULL) {
- return false;
- }
- if (!ReadFile(GetStdHandle(STD_INPUT_HANDLE),
- dataBuf,
- msg->pokeArg.numBytes,
- &numRead,
- NULL)) {
- delete[] dataBuf;
- return false;
- }
- if (numRead != msg->pokeArg.numBytes) {
- delete[] dataBuf;
- return false;
- }
- msg->pokeArg.data = (void *) dataBuf;
- }
- return true;
-}
-
-void
-handlePeek(Message* msg) {
-#ifdef DEBUGGING
- cerr << "Entering handlePeek()" << endl;
-#endif
-
- char* memBuf = new char[msg->peekArg.numBytes];
- if (memBuf == NULL) {
- ioBuf->writeString("B");
- ioBuf->writeBinChar(0);
- ioBuf->flush();
- delete[] memBuf;
- return;
- }
-
- // Try fast case first
- DWORD numRead;
- BOOL res = ReadProcessMemory(procHandle,
- (LPCVOID) msg->peekArg.address,
- memBuf,
- msg->peekArg.numBytes,
- &numRead);
- if (res && (numRead == msg->peekArg.numBytes)) {
-
- // OK, complete success. Phew.
-#ifdef DEBUGGING
- cerr << "Peek success case" << endl;
-#endif
- ioBuf->writeString("B");
- ioBuf->writeBinChar(1);
- ioBuf->writeBinUnsignedInt(numRead);
- ioBuf->writeBinChar(1);
- ioBuf->writeBinBuf(memBuf, numRead);
- } else {
-#ifdef DEBUGGING
- cerr << "*** Peek slow case ***" << endl;
-#endif
-
- ioBuf->writeString("B");
- ioBuf->writeBinChar(1);
-
- // Use VirtualQuery to speed things up a bit
- DWORD numLeft = msg->peekArg.numBytes;
- char* curAddr = (char*) msg->peekArg.address;
- while (numLeft > 0) {
- MEMORY_BASIC_INFORMATION memInfo;
- VirtualQueryEx(procHandle, curAddr, &memInfo, sizeof(memInfo));
- DWORD numToRead = memInfo.RegionSize;
- if (numToRead > numLeft) {
- numToRead = numLeft;
- }
- DWORD numRead;
- if (memInfo.State == MEM_COMMIT) {
- // Read the process memory at this address for this length
- // FIXME: should check the result of this read
- ReadProcessMemory(procHandle, curAddr, memBuf,
- numToRead, &numRead);
- // Write this out
-#ifdef DEBUGGING
- cerr << "*** Writing " << numToRead << " bytes as mapped ***" << endl;
-#endif
- ioBuf->writeBinUnsignedInt(numToRead);
- ioBuf->writeBinChar(1);
- ioBuf->writeBinBuf(memBuf, numToRead);
- } else {
- // Indicate region is free
-#ifdef DEBUGGING
- cerr << "*** Writing " << numToRead << " bytes as unmapped ***" << endl;
-#endif
- ioBuf->writeBinUnsignedInt(numToRead);
- ioBuf->writeBinChar(0);
- }
- curAddr += numToRead;
- numLeft -= numToRead;
- }
- }
-
- ioBuf->flush();
- delete[] memBuf;
-#ifdef DEBUGGING
- cerr << "Exiting handlePeek()" << endl;
-#endif
-}
-
-void
-handlePoke(Message* msg) {
-#ifdef DEBUGGING
- cerr << "Entering handlePoke()" << endl;
-#endif
- DWORD numWritten;
- BOOL res = WriteProcessMemory(procHandle,
- (LPVOID) msg->pokeArg.address,
- msg->pokeArg.data,
- msg->pokeArg.numBytes,
- &numWritten);
- if (res && (numWritten == msg->pokeArg.numBytes)) {
- // Success
- ioBuf->writeBoolAsInt(true);
-#ifdef DEBUGGING
- cerr << " (Succeeded)" << endl;
-#endif
- } else {
- // Failure
- ioBuf->writeBoolAsInt(false);
-#ifdef DEBUGGING
- cerr << " (Failed)" << endl;
-#endif
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- // We clean up the data
- char* dataBuf = (char*) msg->pokeArg.data;
- delete[] dataBuf;
-#ifdef DEBUGGING
- cerr << "Exiting handlePoke()" << endl;
-#endif
-}
-
-bool
-suspend() {
- if (suspended) {
- return false;
- }
- // Before we suspend, we must take a snapshot of the loaded module
- // names and base addresses, since acquiring this snapshot requires
- // starting and exiting a thread in the remote process (at least on
- // NT 4).
- libs.clear();
-#ifdef DEBUGGING
- cerr << "Starting suspension" << endl;
-#endif
- libInfo(pid, libs);
-#ifdef DEBUGGING
- cerr << " Got lib info" << endl;
-#endif
- threads.lock();
-#ifdef DEBUGGING
- cerr << " Got thread lock" << endl;
-#endif
- suspended = true;
- int j = 0;
- for (int i = 0; i < threads.size(); i++) {
- j++;
- SuspendThread(threads.get(i).thread);
- }
-#ifdef DEBUGGING
- cerr << "Suspended " << j << " threads" << endl;
-#endif
- threads.unlock();
- return true;
-}
-
-bool
-resume() {
- if (!suspended) {
- return false;
- }
- threads.lock();
- suspended = false;
- for (int i = 0; i < threads.size(); i++) {
- ResumeThread(threads.get(i).thread);
- }
- threads.unlock();
-#ifdef DEBUGGING
- cerr << "Resumed process" << endl;
-#endif
- return true;
-}
-
-int
-main(int argc, char **argv)
-{
- if (argc != 2) {
- // Should only be used by performing CreateProcess within SwDbgSrv
- exit(1);
- }
-
- if (sscanf(argv[1], "%u", &pid) != 1) {
- exit(1);
- }
-
- // Try to attach to process
- if (!attachToProcess()) {
- // Attach failed. Notify parent by writing result to stdout file
- // handle.
- char res = 0;
- DWORD numBytes;
- WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), &res, sizeof(res),
- &numBytes, NULL);
- exit(1);
- }
-
- // Server is expecting success result back.
- char res = 1;
- DWORD numBytes;
- WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), &res, sizeof(res),
- &numBytes, NULL);
-
- // Initialize our I/O buffer
- ioBuf = new IOBuf(32768, 131072);
- ioBuf->setOutputFileHandle(GetStdHandle(STD_OUTPUT_HANDLE));
-
- // At this point we are attached. Enter our main loop which services
- // requests from the server. Note that in order to handle attach/
- // detach properly (i.e., resumption of process upon "detach") we
- // will need another thread which handles debug events.
- while (true) {
- // Read a message from the server
- Message msg;
- if (!readMessage(&msg)) {
- endProcess();
- }
-
-#ifdef DEBUGGING
- cerr << "Main thread read message: " << msg.type << endl;
-#endif
-
- switch (msg.type) {
- // ATTACH and DETACH messages MUST come in pairs
- case Message::ATTACH:
- suspend();
- eventLock->lock();
- generateDebugEvents = true;
- eventLock->unlock();
- break;
-
- case Message::DETACH:
- eventLock->lock();
- generateDebugEvents = false;
- // Flush remaining event if any
- if (curDebugEvent != NULL) {
- curDebugEvent = NULL;
- eventLock->notifyAll();
- }
- eventLock->unlock();
- resume();
- break;
-
- case Message::LIBINFO:
- {
- if (!suspended) {
- ioBuf->writeInt(0);
- } else {
- // Send back formatted text
- ioBuf->writeInt(libs.size());
- for (int i = 0; i < libs.size(); i++) {
- ioBuf->writeSpace();
- ioBuf->writeInt(1);
- ioBuf->writeSpace();
- ioBuf->writeInt(libs[i].name.size());
- ioBuf->writeSpace();
- ioBuf->writeString(libs[i].name.c_str());
- ioBuf->writeSpace();
- ioBuf->writeAddress(libs[i].base);
- }
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::PEEK:
- handlePeek(&msg);
- break;
-
- case Message::POKE:
- handlePoke(&msg);
- break;
-
- case Message::THREADLIST:
- {
- if (!suspended) {
- ioBuf->writeInt(0);
- } else {
- threads.lock();
- ioBuf->writeInt(threads.size());
- for (int i = 0; i < threads.size(); i++) {
- ioBuf->writeSpace();
- ioBuf->writeAddress((void*) threads.get(i).thread);
- }
- threads.unlock();
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::DUPHANDLE:
- {
- HANDLE dup;
- if (DuplicateHandle(procHandle,
- msg.handleArg.handle,
- GetCurrentProcess(),
- &dup,
- 0,
- FALSE,
- DUPLICATE_SAME_ACCESS)) {
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeSpace();
- ioBuf->writeAddress((void*) dup);
- } else {
- ioBuf->writeBoolAsInt(false);
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::CLOSEHANDLE:
- {
- CloseHandle(msg.handleArg.handle);
- break;
- }
-
- case Message::GETCONTEXT:
- {
- if (!suspended) {
- ioBuf->writeBoolAsInt(false);
- } else {
- CONTEXT context;
- context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
- if (GetThreadContext(msg.handleArg.handle, &context)) {
- ioBuf->writeBoolAsInt(true);
- // EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP, EIP, DS, ES, FS, GS,
- // CS, SS, EFLAGS, DR0, DR1, DR2, DR3, DR6, DR7
- // See README-commands.txt
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Eax);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Ebx);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Ecx);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Edx);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Esi);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Edi);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Ebp);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Esp);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Eip);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegDs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegEs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegFs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegGs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegCs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.SegSs);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.EFlags);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr0);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr1);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr2);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr3);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr6);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) context.Dr7);
- } else {
- ioBuf->writeBoolAsInt(false);
- }
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::SETCONTEXT:
- {
- if (!suspended) {
- ioBuf->writeBoolAsInt(false);
- } else {
- CONTEXT context;
- context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
- context.Eax = msg.setContextArg.Eax;
- context.Ebx = msg.setContextArg.Ebx;
- context.Ecx = msg.setContextArg.Ecx;
- context.Edx = msg.setContextArg.Edx;
- context.Esi = msg.setContextArg.Esi;
- context.Edi = msg.setContextArg.Edi;
- context.Ebp = msg.setContextArg.Ebp;
- context.Esp = msg.setContextArg.Esp;
- context.Eip = msg.setContextArg.Eip;
- context.SegDs = msg.setContextArg.Ds;
- context.SegEs = msg.setContextArg.Es;
- context.SegFs = msg.setContextArg.Fs;
- context.SegGs = msg.setContextArg.Gs;
- context.SegCs = msg.setContextArg.Cs;
- context.SegSs = msg.setContextArg.Ss;
- context.EFlags = msg.setContextArg.EFlags;
- context.Dr0 = msg.setContextArg.Dr0;
- context.Dr1 = msg.setContextArg.Dr1;
- context.Dr2 = msg.setContextArg.Dr2;
- context.Dr3 = msg.setContextArg.Dr3;
- context.Dr6 = msg.setContextArg.Dr6;
- context.Dr7 = msg.setContextArg.Dr7;
- if (SetThreadContext(msg.setContextArg.handle, &context)) {
- ioBuf->writeBoolAsInt(true);
- } else {
- ioBuf->writeBoolAsInt(false);
- }
- }
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::SELECTORENTRY:
- {
- LDT_ENTRY entry;
-
- if (GetThreadSelectorEntry(msg.selectorArg.handle,
- msg.selectorArg.selector,
- &entry)) {
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.LimitLow);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.BaseLow);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.HighWord.Bytes.BaseMid);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.HighWord.Bytes.Flags1);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.HighWord.Bytes.Flags2);
- ioBuf->writeSpace(); ioBuf->writeAddress((void*) entry.HighWord.Bytes.BaseHi);
- } else {
- ioBuf->writeBoolAsInt(false);
- }
-
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
-
- case Message::SUSPEND:
- suspend();
- break;
-
- case Message::RESUME:
- resume();
- break;
-
- case Message::POLLEVENT:
- eventLock->lock();
- if (curDebugEvent == NULL) {
- ioBuf->writeBoolAsInt(false);
- } else {
- ioBuf->writeBoolAsInt(true);
- ioBuf->writeSpace();
- threads.lock();
- ioBuf->writeAddress((void*) threads.threadIDToHandle(curDebugEvent->dwThreadId));
- threads.unlock();
- ioBuf->writeSpace();
- ioBuf->writeUnsignedInt(curDebugEvent->dwDebugEventCode);
- // Figure out what else to write
- switch (curDebugEvent->dwDebugEventCode) {
- case LOAD_DLL_DEBUG_EVENT:
- ioBuf->writeSpace();
- ioBuf->writeAddress(curDebugEvent->u.LoadDll.lpBaseOfDll);
- break;
-
- case UNLOAD_DLL_DEBUG_EVENT:
- ioBuf->writeSpace();
- ioBuf->writeAddress(curDebugEvent->u.UnloadDll.lpBaseOfDll);
- break;
-
- case EXCEPTION_DEBUG_EVENT:
- {
- DWORD code = curDebugEvent->u.Exception.ExceptionRecord.ExceptionCode;
- ioBuf->writeSpace();
- ioBuf->writeUnsignedInt(code);
- ioBuf->writeSpace();
- ioBuf->writeAddress(curDebugEvent->u.Exception.ExceptionRecord.ExceptionAddress);
- switch (curDebugEvent->u.Exception.ExceptionRecord.ExceptionCode) {
- case EXCEPTION_ACCESS_VIOLATION:
- ioBuf->writeSpace();
- ioBuf->writeBoolAsInt(curDebugEvent->u.Exception.ExceptionRecord.ExceptionInformation[0] != 0);
- ioBuf->writeSpace();
- ioBuf->writeAddress((void*) curDebugEvent->u.Exception.ExceptionRecord.ExceptionInformation[1]);
- break;
-
- default:
- break;
- }
- break;
- }
-
- default:
- break;
- }
- }
- eventLock->unlock();
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
-
- case Message::CONTINUEEVENT:
- eventLock->lock();
- if (curDebugEvent == NULL) {
- ioBuf->writeBoolAsInt(false);
- } else {
- curDebugEvent = NULL;
- passEventToClient = msg.boolArg.val;
- ioBuf->writeBoolAsInt(true);
- eventLock->notify();
- }
- eventLock->unlock();
- ioBuf->writeEOL();
- ioBuf->flush();
- break;
- }
- }
-
- endProcess();
-
- // NOT REACHED
- return 0;
-}
diff --git a/hotspot/agent/src/os/win32/SwDbgSub.dsp b/hotspot/agent/src/os/win32/SwDbgSub.dsp
deleted file mode 100644
index a918a66..0000000
--- a/hotspot/agent/src/os/win32/SwDbgSub.dsp
+++ /dev/null
@@ -1,130 +0,0 @@
-# Microsoft Developer Studio Project File - Name="SwDbgSub" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=SwDbgSub - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "SwDbgSub.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "SwDbgSub.mak" CFG="SwDbgSub - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "SwDbgSub - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "SwDbgSub - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "SwDbgSub - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "SwDbgSub - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "SwDbgSub___Win32_Debug"
-# PROP BASE Intermediate_Dir "SwDbgSub___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "SwDbgSub - Win32 Release"
-# Name "SwDbgSub - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\Buffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\IOBuf.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\isNT4.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\libInfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Monitor.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\nt4internals.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\SwDbgSub.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\toolHelp.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/hotspot/agent/src/os/win32/initWinsock.cpp b/hotspot/agent/src/os/win32/initWinsock.cpp
deleted file mode 100644
index 42e481f..0000000
--- a/hotspot/agent/src/os/win32/initWinsock.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include <iostream>
-#include <winsock2.h>
-
-using namespace std;
-
-void
-initWinsock()
-{
- static int initted = 0;
- WORD wVersionRequested;
- WSADATA wsaData;
- int err;
-
- if (!initted) {
- wVersionRequested = MAKEWORD( 2, 0 );
-
- err = WSAStartup( wVersionRequested, &wsaData );
- if ( err != 0 ) {
- {
- /* Tell the user that we couldn't find a usable */
- /* WinSock DLL. */
- cerr << "SocketBase::SocketBase: unable to find usable "
- << "WinSock DLL" << endl;
- exit(1);
- }
- }
-
- /* Confirm that the WinSock DLL supports 2.0.*/
- /* Note that if the DLL supports versions greater */
- /* than 2.0 in addition to 2.0, it will still return */
- /* 2.0 in wVersion since that is the version we */
- /* requested. */
-
- if ( LOBYTE( wsaData.wVersion ) != 2 ||
- HIBYTE( wsaData.wVersion ) != 0 ) {
- /* Tell the user that we couldn't find a usable */
- /* WinSock DLL. */
- {
- cerr << "Unable to find suitable version of WinSock DLL" << endl;
- WSACleanup( );
- exit(1);
- }
- }
-
- initted = 1;
- }
-}
diff --git a/hotspot/agent/src/os/win32/initWinsock.hpp b/hotspot/agent/src/os/win32/initWinsock.hpp
deleted file mode 100644
index 9d07795..0000000
--- a/hotspot/agent/src/os/win32/initWinsock.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _INIT_WINSOCK_
-#define _INIT_WINSOCK_
-
-void initWinsock();
-
-#endif // #defined _INIT_WINSOCK_
diff --git a/hotspot/agent/src/os/win32/ioUtils.cpp b/hotspot/agent/src/os/win32/ioUtils.cpp
deleted file mode 100644
index e7c7274..0000000
--- a/hotspot/agent/src/os/win32/ioUtils.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include <ctype.h>
-#include <string.h>
-#include "ioUtils.hpp"
-#include "IOBuf.hpp"
-
-bool
-scanInt(char** data, int* num) {
- *num = 0;
-
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (**data == 0) {
- return false;
- }
-
- while ((**data != 0) && (!isspace(**data))) {
- char cur = **data;
- if ((cur < '0') || (cur > '9')) {
- return false;
- }
- *num *= 10;
- *num += cur - '0';
- ++*data;
- }
-
- return true;
-}
-
-bool
-scanUnsignedLong(char** data, unsigned long* num) {
- *num = 0;
-
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (**data == 0) {
- return false;
- }
-
- while ((**data != 0) && (!isspace(**data))) {
- char cur = **data;
- if ((cur < '0') || (cur > '9')) {
- return false;
- }
- *num *= 10;
- *num += cur - '0';
- ++*data;
- }
-
- return true;
-}
-
-bool
-charToNibble(char ascii, int* value) {
- if (ascii >= '0' && ascii <= '9') {
- *value = ascii - '0';
- return true;
- } else if (ascii >= 'A' && ascii <= 'F') {
- *value = 10 + ascii - 'A';
- return true;
- } else if (ascii >= 'a' && ascii <= 'f') {
- *value = 10 + ascii - 'a';
- return true;
- }
-
- return false;
-}
-
-bool
-scanAddress(char** data, unsigned long* addr) {
- *addr = 0;
-
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (**data == 0) {
- return false;
- }
-
- if (strncmp(*data, "0x", 2) != 0) {
- return false;
- }
-
- *data += 2;
-
- while ((**data != 0) && (!isspace(**data))) {
- int val;
- bool res = charToNibble(**data, &val);
- if (!res) {
- return false;
- }
- *addr <<= 4;
- *addr |= val;
- ++*data;
- }
-
- return true;
-}
-
-bool
-scanAndSkipBinEscapeChar(char** data) {
- // Skip whitespace
- while ((**data != 0) && (isspace(**data))) {
- ++*data;
- }
-
- if (!IOBuf::isBinEscapeChar(**data)) {
- return false;
- }
-
- ++*data;
-
- return true;
-}
-
-bool
-scanBinUnsignedLong(char** data, unsigned long* num) {
- *num = 0;
- for (int i = 0; i < 4; i++) {
- unsigned char val = (unsigned char) **data;
- *num = (*num << 8) | val;
- ++*data;
- }
- return true;
-}
diff --git a/hotspot/agent/src/os/win32/ioUtils.hpp b/hotspot/agent/src/os/win32/ioUtils.hpp
deleted file mode 100644
index 2857acf..0000000
--- a/hotspot/agent/src/os/win32/ioUtils.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _IO_UTILS_
-#define _IO_UTILS_
-
-bool scanInt(char** data, int* num);
-bool scanUnsignedLong(char** data, unsigned long* num);
-bool scanAddress(char** data, unsigned long* addr);
-
-// Binary utils (for poke)
-bool scanAndSkipBinEscapeChar(char** data);
-bool scanBinUnsignedLong(char** data, unsigned long* num);
-
-#endif // #defined _IO_UTILS_
diff --git a/hotspot/agent/src/os/win32/isNT4.cpp b/hotspot/agent/src/os/win32/isNT4.cpp
deleted file mode 100644
index 9d68add..0000000
--- a/hotspot/agent/src/os/win32/isNT4.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "isNT4.hpp"
-#include <windows.h>
-
-bool
-isNT4() {
- OSVERSIONINFO info;
- info.dwOSVersionInfoSize = sizeof(info);
-
- if (!GetVersionEx(&info)) {
- return false;
- }
-
- return ((info.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
- (info.dwMajorVersion == 4));
-}
diff --git a/hotspot/agent/src/os/win32/isNT4.hpp b/hotspot/agent/src/os/win32/isNT4.hpp
deleted file mode 100644
index f68430f..0000000
--- a/hotspot/agent/src/os/win32/isNT4.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _ISNT4_H_
-#define _ISNT4_H_
-
-// We need to special-case the Windows NT 4.0 implementations of some
-// of the debugging routines because the Tool Help API is not
-// available on this platform.
-
-bool isNT4();
-
-#endif // #defined _ISNT4_H_
diff --git a/hotspot/agent/src/os/win32/libInfo.cpp b/hotspot/agent/src/os/win32/libInfo.cpp
deleted file mode 100644
index dc9d3da..0000000
--- a/hotspot/agent/src/os/win32/libInfo.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// Disable too-long symbol warnings
-#pragma warning ( disable : 4786 )
-
-#include "libInfo.hpp"
-#include "nt4internals.hpp"
-#include "isNT4.hpp"
-#include "toolHelp.hpp"
-#include <assert.h>
-
-using namespace std;
-
-typedef void LibInfoImplFunc(DWORD pid, vector<LibInfo>& info);
-
-static void libInfoImplNT4(DWORD pid, vector<LibInfo>& info);
-static void libInfoImplToolHelp(DWORD pid, vector<LibInfo>& info);
-
-void
-libInfo(DWORD pid, vector<LibInfo>& info) {
- static LibInfoImplFunc* impl = NULL;
-
- if (impl == NULL) {
- // See which operating system we're on
- impl = (isNT4() ? &libInfoImplNT4 : &libInfoImplToolHelp);
- }
-
- assert(impl != NULL);
-
- (*impl)(pid, info);
-}
-
-static ULONG
-ModuleCount(NT4::PDEBUG_BUFFER db) {
- return db->ModuleInformation ? *PULONG(db->ModuleInformation) : 0;
-}
-
-#define MAX2(a, b) (((a) < (b)) ? (b) : (a))
-
-static void
-libInfoImplNT4(DWORD pid, vector<LibInfo>& info) {
- static EnumProcessModulesFunc* enumFunc = NULL;
- static GetModuleFileNameExFunc* fnFunc = NULL;
- static GetModuleInformationFunc* infoFunc = NULL;
-
- if (enumFunc == NULL) {
- HMODULE dll = loadPSAPIDLL();
-
- enumFunc = (EnumProcessModulesFunc*) GetProcAddress(dll, "EnumProcessModules");
- fnFunc = (GetModuleFileNameExFunc*) GetProcAddress(dll, "GetModuleFileNameExA");
- infoFunc = (GetModuleInformationFunc*) GetProcAddress(dll, "GetModuleInformation");
-
- assert(enumFunc != NULL);
- assert(fnFunc != NULL);
- assert(infoFunc != NULL);
- }
-
- static HMODULE* mods = new HMODULE[256];
- static int numMods = 256;
-
- if (mods == NULL) {
- mods = new HMODULE[numMods];
- if (mods == NULL) {
- return;
- }
- }
-
- bool done = false;
-
- HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
- if (proc == NULL) {
- return;
- }
-
- do {
- DWORD bufSize = numMods * sizeof(HMODULE);
- DWORD neededSize;
-
- if (!(*enumFunc)(proc, mods, bufSize, &neededSize)) {
- // Enum failed
- CloseHandle(proc);
- return;
- }
-
- int numFetched = neededSize / sizeof(HMODULE);
-
- if (numMods < numFetched) {
- // Grow buffer
- numMods = MAX2(numFetched, 2 * numMods);
- delete[] mods;
- mods = new HMODULE[numMods];
- if (mods == NULL) {
- CloseHandle(proc);
- return;
- }
- } else {
- char filename[MAX_PATH];
- MODULEINFO modInfo;
-
- // Iterate through and fetch each one's info
- for (int i = 0; i < numFetched; i++) {
- if (!(*fnFunc)(proc, mods[i], filename, MAX_PATH)) {
- CloseHandle(proc);
- return;
- }
-
- if (!(*infoFunc)(proc, mods[i], &modInfo, sizeof(MODULEINFO))) {
- CloseHandle(proc);
- return;
- }
-
- info.push_back(LibInfo(string(filename), (void*) modInfo.lpBaseOfDll));
- }
-
- done = true;
- }
- } while (!done);
-
- CloseHandle(proc);
- return;
-}
-
-void
-libInfoImplToolHelp(DWORD pid, vector<LibInfo>& info) {
- using namespace ToolHelp;
-
- static CreateToolhelp32SnapshotFunc* snapshotFunc = NULL;
- static Module32FirstFunc* firstFunc = NULL;
- static Module32NextFunc* nextFunc = NULL;
-
- if (snapshotFunc == NULL) {
- HMODULE dll = loadDLL();
-
- snapshotFunc =
- (CreateToolhelp32SnapshotFunc*) GetProcAddress(dll,
- "CreateToolhelp32Snapshot");
-
- firstFunc = (Module32FirstFunc*) GetProcAddress(dll,
- "Module32First");
-
- nextFunc = (Module32NextFunc*) GetProcAddress(dll,
- "Module32Next");
-
- assert(snapshotFunc != NULL);
- assert(firstFunc != NULL);
- assert(nextFunc != NULL);
- }
-
- HANDLE snapshot = (*snapshotFunc)(TH32CS_SNAPMODULE, pid);
- if (snapshot == (HANDLE) -1) {
- // Error occurred during snapshot
- return;
- }
-
- // Iterate
- MODULEENTRY32 module;
- if ((*firstFunc)(snapshot, &module)) {
- do {
- info.push_back(LibInfo(string(module.szExePath), (void*) module.modBaseAddr));
- } while ((*nextFunc)(snapshot, &module));
- }
-
- CloseHandle(snapshot);
-}
diff --git a/hotspot/agent/src/os/win32/libInfo.hpp b/hotspot/agent/src/os/win32/libInfo.hpp
deleted file mode 100644
index 4b24edc..0000000
--- a/hotspot/agent/src/os/win32/libInfo.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _LIBINFO_
-#define _LIBINFO_
-
-#include <vector>
-#include <string>
-#include <windows.h>
-
-struct LibInfo {
- std::string name;
- void* base;
-
- LibInfo(const std::string& name, void* base) {
- this->name = name;
- this->base = base;
- }
-};
-
-void libInfo(DWORD pid, std::vector<LibInfo>& info);
-
-#endif // #defined _LIBINFO_
diff --git a/hotspot/agent/src/os/win32/nt4internals.cpp b/hotspot/agent/src/os/win32/nt4internals.cpp
deleted file mode 100644
index e16dcf8..0000000
--- a/hotspot/agent/src/os/win32/nt4internals.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "nt4internals.hpp"
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-namespace NT4 {
-
-static HMODULE ntDLL = NULL;
-
-HMODULE loadNTDLL() {
- if (ntDLL == NULL) {
- ntDLL = LoadLibrary("NTDLL.DLL");
- }
-
- assert(ntDLL != NULL);
- return ntDLL;
-}
-
-void unloadNTDLL() {
- if (ntDLL != NULL) {
- FreeLibrary(ntDLL);
- ntDLL = NULL;
- }
-}
-
-} // namespace NT4
-
-static HMODULE psapiDLL = NULL;
-
-HMODULE
-loadPSAPIDLL() {
- if (psapiDLL == NULL) {
- psapiDLL = LoadLibrary("PSAPI.DLL");
- }
-
- if (psapiDLL == NULL) {
- fprintf(stderr, "Simple Windows Debug Server requires PSAPI.DLL on Windows NT 4.0.\n");
- fprintf(stderr, "Please install this DLL from the SDK and restart the server.\n");
- exit(1);
- }
-
- return psapiDLL;
-}
-
-void
-unloadPSAPIDLL() {
- if (psapiDLL != NULL) {
- FreeLibrary(psapiDLL);
- psapiDLL = NULL;
- }
-}
diff --git a/hotspot/agent/src/os/win32/nt4internals.hpp b/hotspot/agent/src/os/win32/nt4internals.hpp
deleted file mode 100644
index eb1513c..0000000
--- a/hotspot/agent/src/os/win32/nt4internals.hpp
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _NT4INTERNALS_H_
-#define _NT4INTERNALS_H_
-
-#include <windows.h>
-
-namespace NT4 {
-extern "C" {
-
-// Data structures and constants required to be able to get necessary
-// debugging-related information on Windows NT 4.0 through internal
-// (i.e., non-public) APIs. These are adapted from those in the
-// _Windows NT/2000 Native API Reference_ by Gary Nebbett, Macmillan
-// Technical Publishing, 201 West 103rd Street, Indianapolis, IN
-// 46290, 2000.
-
-typedef LONG NTSTATUS;
-typedef LONG KPRIORITY;
-
-#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
-#define NTAPI __stdcall
-#else
-#define _cdecl
-#define NTAPI
-#endif
-
-#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
-
-typedef enum _SYSTEM_INFORMATION_CLASS {
- SystemProcessesAndThreadsInformation = 5
-} SYSTEM_INFORMATION_CLASS;
-
-typedef struct _UNICODE_STRING {
- USHORT Length;
- USHORT MaximumLength;
- PWSTR Buffer;
-} UNICODE_STRING;
-
-typedef struct _VM_COUNTERS {
- ULONG PeakVirtualSize;
- ULONG VirtualSize;
- ULONG PageFaultCount;
- ULONG PeakWorkingSetSize;
- ULONG WorkingSetSize;
- ULONG QuotaPeakPagedPoolUsage;
- ULONG QuotaPagedPoolUsage;
- ULONG QuotaPeakNonPagedPoolUsage;
- ULONG QuotaNonPagedPoolUsage;
- ULONG PagefileUsage;
- ULONG PeakPagefileUsage;
-} VM_COUNTERS, *PVM_COUNTERS;
-
-typedef struct _IO_COUNTERS {
- LARGE_INTEGER ReadOperationCount;
- LARGE_INTEGER WriteOperationCount;
- LARGE_INTEGER OtherOperationCount;
- LARGE_INTEGER ReadTransferCount;
- LARGE_INTEGER WriteTransferCount;
- LARGE_INTEGER OtherTransferCount;
-} IO_COUNTERS, *PIO_COUNTERS;
-
-typedef struct _CLIENT_ID {
- HANDLE UniqueProcess;
- HANDLE UniqueThread;
-} CLIENT_ID, *PCLIENT_ID;
-
-typedef enum {
- StateInitialized,
- StateReady,
- StateRunning,
- StateStandby,
- StateTerminated,
- StateWait,
- StateTransition,
- StateUnknown
-} THREAD_STATE;
-
-typedef enum {
- Executive,
- FreePage,
- PageIn,
- PoolAllocation,
- DelayExecution,
- Suspended,
- UserRequest,
- WrExecutive,
- WrFreePage,
- WrPageIn,
- WrPoolAllocation,
- WrDelayExecution,
- WrSuspended,
- WrUserRequest,
- WrEventPair,
- WrQueue,
- WrLpcReceive,
- WrLpcReply,
- WrVirtualMemory,
- WrPageOut,
- WrRendezvous,
- Spare2,
- Spare3,
- Spare4,
- Spare5,
- Spare6,
- WrKernel
-} KWAIT_REASON;
-
-typedef struct _SYSTEM_THREADS {
- LARGE_INTEGER KernelTime;
- LARGE_INTEGER UserTime;
- LARGE_INTEGER CreateTime;
- ULONG WaitTime;
- PVOID StartAddress;
- CLIENT_ID ClientId;
- KPRIORITY Priority;
- KPRIORITY BasePriority;
- ULONG ContextSwitchCount;
- THREAD_STATE State;
- KWAIT_REASON WaitReason;
-} SYSTEM_THREADS, *PSYSTEM_THREADS;
-
-typedef struct _SYSTEM_PROCESSES { // Information class 5
- ULONG NextEntryDelta;
- ULONG ThreadCount;
- ULONG Reserved1[6];
- LARGE_INTEGER CreateTime;
- LARGE_INTEGER UserTime;
- LARGE_INTEGER KernelTime;
- UNICODE_STRING ProcessName;
- KPRIORITY BasePriority;
- ULONG ProcessId;
- ULONG InheritedFromProcessId;
- ULONG HandleCount;
- ULONG Reserved2[2];
- ULONG PrivatePageCount;
- VM_COUNTERS VmCounters;
- IO_COUNTERS IoCounters; // Windows 2000 only
- SYSTEM_THREADS Threads[1];
-} SYSTEM_PROCESSES, *PSYSTEM_PROCESSES;
-
-typedef NTSTATUS NTAPI
-ZwQuerySystemInformationFunc(IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
- IN OUT PVOID SystemInformation,
- IN ULONG SystemInformationLength,
- OUT PULONG ReturnLength OPTIONAL
- );
-
-typedef struct _DEBUG_BUFFER {
- HANDLE SectionHandle;
- PVOID SectionBase;
- PVOID RemoteSectionBase;
- ULONG SectionBaseDelta;
- HANDLE EventPairHandle;
- ULONG Unknown[2];
- HANDLE RemoteThreadHandle;
- ULONG InfoClassMask;
- ULONG SizeOfInfo;
- ULONG AllocatedSize;
- ULONG SectionSize;
- PVOID ModuleInformation;
- PVOID BackTraceInformation;
- PVOID HeapInformation;
- PVOID LockInformation;
- PVOID Reserved[8];
-} DEBUG_BUFFER, *PDEBUG_BUFFER;
-
-typedef PDEBUG_BUFFER NTAPI
-RtlCreateQueryDebugBufferFunc(IN ULONG Size,
- IN BOOLEAN EventPair);
-
-#define PDI_MODULES 0x01 // The loaded modules of the process
-#define PDI_BACKTRACE 0x02 // The heap stack back traces
-#define PDI_HEAPS 0x04 // The heaps of the process
-#define PDI_HEAP_TAGS 0x08 // The heap tags
-#define PDI_HEAP_BLOCKS 0x10 // The heap blocks
-#define PDI_LOCKS 0x20 // The locks created by the process
-
-typedef struct _DEBUG_MODULE_INFORMATION { // c.f. SYSTEM_MODULE_INFORMATION
- ULONG Reserved[2];
- ULONG Base;
- ULONG Size;
- ULONG Flags;
- USHORT Index;
- USHORT Unknown;
- USHORT LoadCount;
- USHORT ModuleNameOffset;
- CHAR ImageName[256];
-} DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
-
-// Flags
-#define LDRP_STATIC_LINK 0x00000002
-#define LDRP_IMAGE_DLL 0x00000004
-#define LDRP_LOAD_IN_PROGRESS 0x00001000
-#define LDRP_UNLOAD_IN_PROGRESS 0x00002000
-#define LDRP_ENTRY_PROCESSED 0x00004000
-#define LDRP_ENTRY_INSERTED 0x00008000
-#define LDRP_CURRENT_LOAD 0x00010000
-#define LDRP_FAILED_BUILTIN_LOAD 0x00020000
-#define LDRP_DONT_CALL_FOR_THREADS 0x00040000
-#define LDRP_PROCESS_ATTACH_CALLED 0x00080000
-#define LDRP_DEBUG_SYMBOLS_LOADED 0x00100000
-#define LDRP_IMAGE_NOT_AT_BASE 0x00200000
-#define LDRP_WX86_IGNORE_MACHINETYPE 0x00400000
-
-// NOTE that this will require creating a thread in the target
-// process, implying that we can not call this while the process is
-// suspended. May have to run this command in the child processes
-// rather than the server.
-
-typedef NTSTATUS NTAPI
-RtlQueryProcessDebugInformationFunc(IN ULONG ProcessId,
- IN ULONG DebugInfoClassMask,
- IN OUT PDEBUG_BUFFER DebugBuffer);
-
-typedef NTSTATUS NTAPI
-RtlDestroyQueryDebugBufferFunc(IN PDEBUG_BUFFER DebugBuffer);
-
-// Routines to load and unload NTDLL.DLL.
-HMODULE loadNTDLL();
-// Safe to call even if has not been loaded
-void unloadNTDLL();
-
-} // extern "C"
-} // namespace NT4
-
-//----------------------------------------------------------------------
-
-// On NT 4 only, we now use PSAPI to enumerate the loaded modules in
-// the target processes. RtlQueryProcessDebugInformation creates a
-// thread in the target process, which causes problems when we are
-// handling events like breakpoints in the debugger. The dependence on
-// an external DLL which might not be present is unfortunate, but we
-// can either redistribute this DLL (if allowed) or refuse to start on
-// NT 4 if it is not present.
-
-typedef struct _MODULEINFO {
- LPVOID lpBaseOfDll;
- DWORD SizeOfImage;
- LPVOID EntryPoint;
-} MODULEINFO, *LPMODULEINFO;
-
-typedef BOOL (WINAPI EnumProcessModulesFunc)(HANDLE, HMODULE *, DWORD, LPDWORD);
-typedef DWORD (WINAPI GetModuleFileNameExFunc)(HANDLE, HMODULE, LPTSTR, DWORD);
-typedef BOOL (WINAPI GetModuleInformationFunc)(HANDLE, HMODULE, LPMODULEINFO, DWORD);
-// Routines to load and unload PSAPI.DLL.
-HMODULE loadPSAPIDLL();
-// Safe to call even if has not been loaded
-void unloadPSAPIDLL();
-
-#endif // #defined _NT4INTERNALS_H_
diff --git a/hotspot/agent/src/os/win32/ports.h b/hotspot/agent/src/os/win32/ports.h
deleted file mode 100644
index 682190f..0000000
--- a/hotspot/agent/src/os/win32/ports.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _PORTS_H_
-#define _PORTS_H_
-
-// This is the "public" port which end-user clients can connect to
-// with an arbitrary application, including telnet.
-const short CLIENT_PORT = 27000;
-
-#endif // #defined _PORTS_H_
diff --git a/hotspot/agent/src/os/win32/procList.cpp b/hotspot/agent/src/os/win32/procList.cpp
deleted file mode 100644
index 6763bb1..0000000
--- a/hotspot/agent/src/os/win32/procList.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "procList.hpp"
-#include "nt4internals.hpp"
-#include "isNT4.hpp"
-#include "toolHelp.hpp"
-#include <assert.h>
-
-using namespace std;
-using namespace NT4;
-
-typedef void ProcListImplFunc(ProcEntryList& processes);
-
-void procListImplNT4(ProcEntryList& processes);
-void procListImplToolHelp(ProcEntryList& processes);
-
-ProcEntry::ProcEntry(ULONG pid, USHORT nameLength, WCHAR* name) {
- this->pid = pid;
- this->nameLength = nameLength;
- this->name = new WCHAR[nameLength];
- memcpy(this->name, name, nameLength * sizeof(WCHAR));
-}
-
-ProcEntry::ProcEntry(ULONG pid, USHORT nameLength, char* name) {
- this->pid = pid;
- this->nameLength = nameLength;
- this->name = new WCHAR[nameLength];
- int j = 0;
- for (int i = 0; i < nameLength; i++) {
- // FIXME: what is the proper promotion from ASCII to UNICODE?
- this->name[i] = name[i] & 0xFF;
- }
-}
-
-ProcEntry::ProcEntry(const ProcEntry& arg) {
- name = NULL;
- copyFrom(arg);
-}
-
-ProcEntry&
-ProcEntry::operator=(const ProcEntry& arg) {
- copyFrom(arg);
- return *this;
-}
-
-ProcEntry::~ProcEntry() {
- delete[] name;
-}
-
-void
-ProcEntry::copyFrom(const ProcEntry& arg) {
- if (name != NULL) {
- delete[] name;
- }
- pid = arg.pid;
- nameLength = arg.nameLength;
- name = new WCHAR[nameLength];
- memcpy(name, arg.name, nameLength * sizeof(WCHAR));
-}
-
-ULONG
-ProcEntry::getPid() {
- return pid;
-}
-
-USHORT
-ProcEntry::getNameLength() {
- return nameLength;
-}
-
-WCHAR*
-ProcEntry::getName() {
- return name;
-}
-
-void
-procList(ProcEntryList& processes) {
- static ProcListImplFunc* impl = NULL;
-
- if (impl == NULL) {
- // See which operating system we're on
- impl = (isNT4() ? &procListImplNT4 : &procListImplToolHelp);
- }
-
- assert(impl != NULL);
-
- (*impl)(processes);
-}
-
-void
-procListImplNT4(ProcEntryList& processes) {
- using namespace NT4;
-
- static ZwQuerySystemInformationFunc* query = NULL;
-
- if (query == NULL) {
- HMODULE ntDLL = loadNTDLL();
- query =
- (ZwQuerySystemInformationFunc*) GetProcAddress(ntDLL,
- "ZwQuerySystemInformation");
- assert(query != NULL);
- }
-
- ULONG n = 0x100;
- PSYSTEM_PROCESSES sp = new SYSTEM_PROCESSES[n];
- while ((*query)(SystemProcessesAndThreadsInformation,
- sp, n * sizeof(SYSTEM_PROCESSES), 0) == STATUS_INFO_LENGTH_MISMATCH) {
- delete[] sp;
- n *= 2;
- sp = new SYSTEM_PROCESSES[n];
- }
-
- bool done = false;
- for (PSYSTEM_PROCESSES p = sp; !done;
- p = PSYSTEM_PROCESSES(PCHAR(p) + p->NextEntryDelta)) {
- processes.push_back(ProcEntry(p->ProcessId,
- p->ProcessName.Length / 2,
- p->ProcessName.Buffer));
- done = p->NextEntryDelta == 0;
- }
-}
-
-void
-procListImplToolHelp(ProcEntryList& processes) {
- using namespace ToolHelp;
-
- static CreateToolhelp32SnapshotFunc* snapshotFunc = NULL;
- static Process32FirstFunc* firstFunc = NULL;
- static Process32NextFunc* nextFunc = NULL;
-
- if (snapshotFunc == NULL) {
- HMODULE dll = loadDLL();
-
- snapshotFunc =
- (CreateToolhelp32SnapshotFunc*) GetProcAddress(dll,
- "CreateToolhelp32Snapshot");
-
- firstFunc = (Process32FirstFunc*) GetProcAddress(dll,
- "Process32First");
-
- nextFunc = (Process32NextFunc*) GetProcAddress(dll,
- "Process32Next");
-
- assert(snapshotFunc != NULL);
- assert(firstFunc != NULL);
- assert(nextFunc != NULL);
- }
-
- HANDLE snapshot = (*snapshotFunc)(TH32CS_SNAPPROCESS, 0 /* ignored */);
- if (snapshot == (HANDLE) -1) {
- // Error occurred during snapshot
- return;
- }
-
- // Iterate
- PROCESSENTRY32 proc;
- if ((*firstFunc)(snapshot, &proc)) {
- do {
- // FIXME: could make this uniform to the NT version by cutting
- // off the path name just before the executable name
- processes.push_back(ProcEntry(proc.th32ProcessID,
- strlen(proc.szExeFile),
- proc.szExeFile));
- } while ((*nextFunc)(snapshot, &proc));
- }
-
- CloseHandle(snapshot);
-}
diff --git a/hotspot/agent/src/os/win32/procList.hpp b/hotspot/agent/src/os/win32/procList.hpp
deleted file mode 100644
index 962c7b2..0000000
--- a/hotspot/agent/src/os/win32/procList.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _PROCLIST_
-#define _PROCLIST_
-
-#include <windows.h>
-#include <vector>
-
-class ProcEntry {
-public:
- /** name may not be NULL */
- ProcEntry(ULONG pid, USHORT nameLength, wchar_t* name);
- ProcEntry(ULONG pid, USHORT nameLength, char* name);
- ~ProcEntry();
- ProcEntry(const ProcEntry& arg);
- ProcEntry& operator=(const ProcEntry& arg);
-
- ULONG getPid();
- /** Returns number of WCHAR characters in getName() */
- USHORT getNameLength();
- WCHAR* getName();
-
-private:
- ULONG pid;
- USHORT nameLength;
- WCHAR* name;
- void copyFrom(const ProcEntry& arg);
-};
-
-typedef std::vector<ProcEntry> ProcEntryList;
-void procList(ProcEntryList& processes);
-
-#endif // #defined _PROCLIST_
diff --git a/hotspot/agent/src/os/win32/serverLists.cpp b/hotspot/agent/src/os/win32/serverLists.cpp
deleted file mode 100644
index 209d291..0000000
--- a/hotspot/agent/src/os/win32/serverLists.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include <assert.h>
-#include "serverLists.hpp"
-
-//----------------------------------------------------------------------
-// Lists
-//
-
-CRITICAL_SECTION Lists::crit;
-
-void
-Lists::init() {
- InitializeCriticalSection(&crit);
-}
-
-void
-Lists::lock() {
- EnterCriticalSection(&crit);
-}
-
-void
-Lists::unlock() {
- LeaveCriticalSection(&crit);
-}
-
-//----------------------------------------------------------------------
-// ListsLocker
-//
-
-ListsLocker::ListsLocker() {
- Lists::lock();
-}
-
-ListsLocker::~ListsLocker() {
- Lists::unlock();
-}
-
-//----------------------------------------------------------------------
-// ChildInfo
-//
-
-ChildInfo::ChildInfo(DWORD pid, HANDLE childProcessHandle,
- HANDLE writeToStdinHandle, HANDLE readFromStdoutHandle,
- HANDLE auxHandle1, HANDLE auxHandle2) {
- this->pid = pid;
- this->childProcessHandle = childProcessHandle;
- this->writeToStdinHandle = writeToStdinHandle;
- this->readFromStdoutHandle = readFromStdoutHandle;
- this->auxHandle1 = auxHandle1;
- this->auxHandle2 = auxHandle2;
- client = NULL;
-}
-
-DWORD
-ChildInfo::getPid() {
- return pid;
-}
-
-HANDLE
-ChildInfo::getChildProcessHandle() {
- return childProcessHandle;
-}
-
-HANDLE
-ChildInfo::getWriteToStdinHandle() {
- return writeToStdinHandle;
-}
-
-HANDLE
-ChildInfo::getReadFromStdoutHandle() {
- return readFromStdoutHandle;
-}
-
-void
-ChildInfo::setClient(ClientInfo* clientInfo) {
- client = clientInfo;
-}
-
-ClientInfo*
-ChildInfo::getClient() {
- return client;
-}
-
-void
-ChildInfo::closeAll() {
- CloseHandle(childProcessHandle);
- CloseHandle(writeToStdinHandle);
- CloseHandle(readFromStdoutHandle);
- CloseHandle(auxHandle1);
- CloseHandle(auxHandle2);
-}
-
-//----------------------------------------------------------------------
-// ChildList
-//
-
-ChildList::ChildList() {
-}
-
-ChildList::~ChildList() {
-}
-
-void
-ChildList::addChild(ChildInfo* info) {
- // Could store these in binary sorted order by pid for efficiency
- childList.push_back(info);
-}
-
-ChildInfo*
-ChildList::removeChild(HANDLE childProcessHandle) {
- for (ChildInfoList::iterator iter = childList.begin(); iter != childList.end();
- iter++) {
- ChildInfo* info = *iter;
- if (info->getChildProcessHandle() == childProcessHandle) {
- childList.erase(iter);
- return info;
- }
- }
- assert(false);
- return NULL;
-}
-
-void
-ChildList::removeChild(ChildInfo* info) {
- for (ChildInfoList::iterator iter = childList.begin(); iter != childList.end();
- iter++) {
- if (*iter == info) {
- childList.erase(iter);
- return;
- }
- }
- assert(false);
-}
-
-ChildInfo*
-ChildList::getChildByPid(DWORD pid) {
- for (ChildInfoList::iterator iter = childList.begin(); iter != childList.end();
- iter++) {
- ChildInfo* info = *iter;
- if (info->getPid() == pid) {
- return info;
- }
- }
- return NULL;
-}
-
-int
-ChildList::size() {
- return childList.size();
-}
-
-ChildInfo*
-ChildList::getChildByIndex(int index) {
- return childList[index];
-}
-
-//----------------------------------------------------------------------
-// ClientInfo
-//
-
-ClientInfo::ClientInfo(SOCKET dataSocket) {
- this->dataSocket = dataSocket;
- buf = new IOBuf(32768, 131072);
- buf->setSocket(dataSocket);
- target = NULL;
-}
-
-ClientInfo::~ClientInfo() {
- delete buf;
-}
-
-SOCKET
-ClientInfo::getDataSocket() {
- return dataSocket;
-}
-
-IOBuf*
-ClientInfo::getIOBuf() {
- return buf;
-}
-
-void
-ClientInfo::setTarget(ChildInfo* childInfo) {
- target = childInfo;
-}
-
-ChildInfo*
-ClientInfo::getTarget() {
- return target;
-}
-
-void
-ClientInfo::closeAll() {
- shutdown(dataSocket, SD_BOTH);
- closesocket(dataSocket);
- dataSocket = INVALID_SOCKET;
-}
-
-//----------------------------------------------------------------------
-// ClientList
-//
-
-ClientList::ClientList() {
-}
-
-ClientList::~ClientList() {
-}
-
-void
-ClientList::addClient(ClientInfo* info) {
- clientList.push_back(info);
-}
-
-bool
-ClientList::isAnyDataSocketSet(fd_set* fds, ClientInfo** out) {
- for (ClientInfoList::iterator iter = clientList.begin(); iter != clientList.end();
- iter++) {
- ClientInfo* info = *iter;
- if (FD_ISSET(info->getDataSocket(), fds)) {
- *out = info;
- return true;
- }
- }
- return false;
-}
-
-void
-ClientList::removeClient(ClientInfo* client) {
- for (ClientInfoList::iterator iter = clientList.begin(); iter != clientList.end();
- iter++) {
- if (*iter == client) {
- clientList.erase(iter);
- return;
- }
- }
- assert(false);
-}
-
-int
-ClientList::size() {
- return clientList.size();
-}
-
-ClientInfo*
-ClientList::get(int num) {
- return clientList[num];
-}
diff --git a/hotspot/agent/src/os/win32/serverLists.hpp b/hotspot/agent/src/os/win32/serverLists.hpp
deleted file mode 100644
index 7e293d9..0000000
--- a/hotspot/agent/src/os/win32/serverLists.hpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _SERVER_LISTS_
-#define _SERVER_LISTS_
-
-#include <vector>
-#include <winsock2.h>
-#include "IOBuf.hpp"
-
-//
-// NOTE:
-//
-// All of these lists are guarded by the global lock managed by the
-// Lists class. Lists::init() must be called at the start of the
-// program.
-//
-
-class Lists {
- friend class ListsLocker;
-public:
- static void init();
-private:
- static void lock();
- static void unlock();
- static CRITICAL_SECTION crit;
-};
-
-// Should be allocated on stack. Ensures proper locking/unlocking
-// pairing.
-class ListsLocker {
-public:
- ListsLocker();
- ~ListsLocker();
-};
-
-// We must keep track of all of the child processes we have forked to
-// handle attaching to a target process. This is necessary because we
-// allow clients to detach from processes, but the child processes we
-// fork must necessarily stay alive for the duration of the target
-// application. A subsequent attach operation to the target process
-// results in the same child process being reused. For this reason,
-// child processes are known to be in one of two states: attached and
-// detached.
-
-class ClientInfo;
-
-class ChildInfo {
-public:
- /** The pid of the ChildInfo indicates the process ID of the target
- process which the subprocess was created to debug, not the pid
- of the subprocess itself. */
- ChildInfo(DWORD pid, HANDLE childProcessHandle,
- HANDLE writeToStdinHandle, HANDLE readFromStdoutHandle,
- HANDLE auxHandle1, HANDLE auxHandle2);
-
- DWORD getPid();
- HANDLE getChildProcessHandle();
- HANDLE getWriteToStdinHandle();
- HANDLE getReadFromStdoutHandle();
-
- /** Set the client which is currently attached to the target process
- via this child process. Set this to NULL to indicate that the
- child process is ready to accept another attachment. */
- void setClient(ClientInfo* clientInfo);
-
- ClientInfo* getClient();
-
- /** This is NOT automatically called in the destructor */
- void closeAll();
-
-private:
- DWORD pid;
- HANDLE childProcessHandle;
- HANDLE writeToStdinHandle;
- HANDLE readFromStdoutHandle;
- HANDLE auxHandle1;
- HANDLE auxHandle2;
- ClientInfo* client;
-};
-
-// We keep track of a list of child debugger processes, each of which
-// is responsible for debugging a certain target process. These
-// debugger processes can serve multiple clients during their
-// lifetime. When a client detaches from a given process or tells the
-// debugger to "exit", the debug server is notified that the child
-// process is once again available to accept connections from clients.
-
-class ChildList {
-private:
- typedef std::vector<ChildInfo*> ChildInfoList;
-
-public:
- ChildList();
- ~ChildList();
-
- void addChild(ChildInfo*);
-
- /** Removes and returns the ChildInfo* associated with the given
- child process handle. */
- ChildInfo* removeChild(HANDLE childProcessHandle);
-
- /** Removes the given ChildInfo. */
- void removeChild(ChildInfo* info);
-
- /** Return the ChildInfo* associated with a given process ID without
- removing it from the list. */
- ChildInfo* getChildByPid(DWORD pid);
-
- /** Iteration support */
- int size();
-
- /** Iteration support */
- ChildInfo* getChildByIndex(int index);
-
-private:
- ChildInfoList childList;
-};
-
-// We also keep a list of clients whose requests we are responsible
-// for serving. Clients can attach and detach from child processes.
-
-class ClientInfo {
-public:
- ClientInfo(SOCKET dataSocket);
- ~ClientInfo();
-
- SOCKET getDataSocket();
- /** Gets an IOBuf configured for the data socket, which should be
- used for all communication with the client. */
- IOBuf* getIOBuf();
-
- /** Set the information for the process to which this client is
- attached. Set this to NULL to indicate that the client is not
- currently attached to any target process. */
- void setTarget(ChildInfo* childInfo);
-
- /** Get the information for the process to which this client is
- currently attached, or NULL if none. */
- ChildInfo* getTarget();
-
- /** Close down the socket connection to this client. This is NOT
- automatically called by the destructor. */
- void closeAll();
-
-private:
- SOCKET dataSocket;
- IOBuf* buf;
- ChildInfo* target;
-};
-
-class ClientList {
-private:
- typedef std::vector<ClientInfo*> ClientInfoList;
-
-public:
- ClientList();
- ~ClientList();
-
- /** Adds a client to the list. */
- void addClient(ClientInfo* info);
-
- /** Check to see whether the parent socket of any of the ClientInfo
- objects is readable in the given fd_set. If so, returns TRUE and
- sets the given ClientInfo* (a non-NULL pointer to which must be
- given) appropriately. */
- bool isAnyDataSocketSet(fd_set* fds, ClientInfo** info);
-
- /** Removes a client from the list. User is responsible for deleting
- the ClientInfo* using operator delete. */
- void removeClient(ClientInfo* client);
-
- /** Iteration support. */
- int size();
-
- /** Iteration support. */
- ClientInfo* get(int num);
-
-private:
- ClientInfoList clientList;
-};
-
-#endif // #defined _SERVER_LISTS_
diff --git a/hotspot/agent/src/os/win32/toolHelp.cpp b/hotspot/agent/src/os/win32/toolHelp.cpp
deleted file mode 100644
index be4dca7..0000000
--- a/hotspot/agent/src/os/win32/toolHelp.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "toolHelp.hpp"
-#include <assert.h>
-
-namespace ToolHelp {
-
-static HMODULE kernelDLL = NULL;
-
-HMODULE loadDLL() {
- if (kernelDLL == NULL) {
- kernelDLL = LoadLibrary("KERNEL32.DLL");
- }
-
- assert(kernelDLL != NULL);
- return kernelDLL;
-}
-
-void unloadDLL() {
- if (kernelDLL != NULL) {
- FreeLibrary(kernelDLL);
- kernelDLL = NULL;
- }
-}
-
-} // namespace ToolHelp
diff --git a/hotspot/agent/src/os/win32/toolHelp.hpp b/hotspot/agent/src/os/win32/toolHelp.hpp
deleted file mode 100644
index deb3455..0000000
--- a/hotspot/agent/src/os/win32/toolHelp.hpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef _TOOLHELP_H_
-#define _TOOLHELP_H_
-
-#include <windows.h>
-#include <tlhelp32.h>
-
-namespace ToolHelp {
-extern "C" {
-
- ///////////////
- // Snapshots //
- ///////////////
- typedef HANDLE WINAPI
- CreateToolhelp32SnapshotFunc(DWORD dwFlags, DWORD th32ProcessID);
-
- //////////////////
- // Process List //
- //////////////////
- typedef BOOL WINAPI Process32FirstFunc(HANDLE hSnapshot,
- LPPROCESSENTRY32 lppe);
-
- typedef BOOL WINAPI Process32NextFunc(HANDLE hSnapshot,
- LPPROCESSENTRY32 lppe);
-
- // NOTE: although these routines are defined in TLHELP32.H, they
- // seem to always return false (maybe only under US locales)
- typedef BOOL WINAPI Process32FirstWFunc(HANDLE hSnapshot,
- LPPROCESSENTRY32W lppe);
-
- typedef BOOL WINAPI Process32NextWFunc(HANDLE hSnapshot,
- LPPROCESSENTRY32W lppe);
-
- /////////////////
- // Module List //
- /////////////////
- typedef BOOL WINAPI
- Module32FirstFunc(HANDLE hSnapshot, LPMODULEENTRY32 lpme);
-
- typedef BOOL WINAPI
- Module32NextFunc (HANDLE hSnapshot, LPMODULEENTRY32 lpme);
-
-
- // Routines to load and unload KERNEL32.DLL.
- HMODULE loadDLL();
- // Safe to call even if has not been loaded
- void unloadDLL();
-
-} // extern "C"
-} // namespace "ToolHelp"
-
-#endif // #defined _TOOLHELP_H_
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxAddress.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxAddress.java
deleted file mode 100644
index a75a7a7..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxAddress.java
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx;
-
-import sun.jvm.hotspot.debugger.*;
-
-class DbxAddress implements Address {
- protected DbxDebugger debugger;
- protected long addr;
-
- DbxAddress(DbxDebugger debugger, long addr) {
- this.debugger = debugger;
- this.addr = addr;
- }
-
- //
- // Basic Java routines
- //
-
- public boolean equals(Object arg) {
- if (arg == null) {
- return false;
- }
-
- if (!(arg instanceof DbxAddress)) {
- return false;
- }
-
- return (addr == ((DbxAddress) arg).addr);
- }
-
- public int hashCode() {
- // FIXME: suggestions on a better hash code?
- return (int) addr;
- }
-
- public String toString() {
- return debugger.addressValueToString(addr);
- }
-
- //
- // C/C++-related routines
- //
-
- public long getCIntegerAt(long offset, long numBytes, boolean isUnsigned) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readCInteger(addr + offset, numBytes, isUnsigned);
- }
-
- public Address getAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readAddress(addr + offset);
- }
- public Address getCompOopAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readCompOopAddress(addr + offset);
- }
-
- //
- // Java-related routines
- //
-
- public boolean getJBooleanAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJBoolean(addr + offset);
- }
-
- public byte getJByteAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJByte(addr + offset);
- }
-
- public char getJCharAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJChar(addr + offset);
- }
-
- public double getJDoubleAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJDouble(addr + offset);
- }
-
- public float getJFloatAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJFloat(addr + offset);
- }
-
- public int getJIntAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJInt(addr + offset);
- }
-
- public long getJLongAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJLong(addr + offset);
- }
-
- public short getJShortAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJShort(addr + offset);
- }
-
- public OopHandle getOopHandleAt(long offset)
- throws UnalignedAddressException, UnmappedAddressException, NotInHeapException {
- return debugger.readOopHandle(addr + offset);
- }
-
- public OopHandle getCompOopHandleAt(long offset)
- throws UnalignedAddressException, UnmappedAddressException, NotInHeapException {
- return debugger.readCompOopHandle(addr + offset);
- }
-
- // Mutators -- not implemented for now (FIXME)
- public void setCIntegerAt(long offset, long numBytes, long value) {
- throw new DebuggerException("Unimplemented");
- }
- public void setAddressAt(long offset, Address value) {
- throw new DebuggerException("Unimplemented");
- }
- public void setJBooleanAt (long offset, boolean value)
- throws UnmappedAddressException, UnalignedAddressException {
- throw new DebuggerException("Unimplemented");
- }
- public void setJByteAt (long offset, byte value)
- throws UnmappedAddressException, UnalignedAddressException {
- throw new DebuggerException("Unimplemented");
- }
- public void setJCharAt (long offset, char value)
- throws UnmappedAddressException, UnalignedAddressException {
- throw new DebuggerException("Unimplemented");
- }
- public void setJDoubleAt (long offset, double value)
- throws UnmappedAddressException, UnalignedAddressException {
- throw new DebuggerException("Unimplemented");
- }
- public void setJFloatAt (long offset, float value)
- throws UnmappedAddressException, UnalignedAddressException {
- throw new DebuggerException("Unimplemented");
- }
- public void setJIntAt (long offset, int value)
- throws UnmappedAddressException, UnalignedAddressException {
- throw new DebuggerException("Unimplemented");
- }
- public void setJLongAt (long offset, long value)
- throws UnmappedAddressException, UnalignedAddressException {
- throw new DebuggerException("Unimplemented");
- }
- public void setJShortAt (long offset, short value)
- throws UnmappedAddressException, UnalignedAddressException {
- throw new DebuggerException("Unimplemented");
- }
- public void setOopHandleAt (long offset, OopHandle value)
- throws UnmappedAddressException, UnalignedAddressException {
- throw new DebuggerException("Unimplemented");
- }
-
- //
- // Arithmetic operations -- necessary evil.
- //
-
- public Address addOffsetTo (long offset) throws UnsupportedOperationException {
- long value = addr + offset;
- if (value == 0) {
- return null;
- }
- return new DbxAddress(debugger, value);
- }
-
- public OopHandle addOffsetToAsOopHandle(long offset) throws UnsupportedOperationException {
- long value = addr + offset;
- if (value == 0) {
- return null;
- }
- return new DbxOopHandle(debugger, value);
- }
-
- /** (FIXME: any signed/unsigned issues? Should this work for
- OopHandles?) */
- public long minus(Address arg) {
- if (arg == null) {
- return addr;
- }
- return addr - ((DbxAddress) arg).addr;
- }
-
- // Two's complement representation.
- // All negative numbers are larger than positive numbers.
- // Numbers with the same sign can be compared normally.
- // Test harness is below in main().
-
- public boolean lessThan (Address arg) {
- if (arg == null) {
- return false;
- }
- DbxAddress dbxArg = (DbxAddress) arg;
- if ((addr >= 0) && (dbxArg.addr < 0)) {
- return true;
- }
- if ((addr < 0) && (dbxArg.addr >= 0)) {
- return false;
- }
- return (addr < dbxArg.addr);
- }
-
- public boolean lessThanOrEqual (Address arg) {
- if (arg == null) {
- return false;
- }
- DbxAddress dbxArg = (DbxAddress) arg;
- if ((addr >= 0) && (dbxArg.addr < 0)) {
- return true;
- }
- if ((addr < 0) && (dbxArg.addr >= 0)) {
- return false;
- }
- return (addr <= dbxArg.addr);
- }
-
- public boolean greaterThan (Address arg) {
- if (arg == null) {
- return true;
- }
- DbxAddress dbxArg = (DbxAddress) arg;
- if ((addr >= 0) && (dbxArg.addr < 0)) {
- return false;
- }
- if ((addr < 0) && (dbxArg.addr >= 0)) {
- return true;
- }
- return (addr > dbxArg.addr);
- }
-
- public boolean greaterThanOrEqual(Address arg) {
- if (arg == null) {
- return true;
- }
- DbxAddress dbxArg = (DbxAddress) arg;
- if ((addr >= 0) && (dbxArg.addr < 0)) {
- return false;
- }
- if ((addr < 0) && (dbxArg.addr >= 0)) {
- return true;
- }
- return (addr >= dbxArg.addr);
- }
-
- public Address andWithMask(long mask) throws UnsupportedOperationException {
- long value = addr & mask;
- if (value == 0) {
- return null;
- }
- return new DbxAddress(debugger, value);
- }
-
- public Address orWithMask(long mask) throws UnsupportedOperationException {
- long value = addr | mask;
- if (value == 0) {
- return null;
- }
- return new DbxAddress(debugger, value);
- }
-
- public Address xorWithMask(long mask) throws UnsupportedOperationException {
- long value = addr ^ mask;
- if (value == 0) {
- return null;
- }
- return new DbxAddress(debugger, value);
- }
-
-
- //--------------------------------------------------------------------------------
- // Internals only below this point
- //
-
- long getValue() {
- return addr;
- }
-
-
- private static void check(boolean arg, String failMessage) {
- if (!arg) {
- System.err.println(failMessage + ": FAILED");
- System.exit(1);
- }
- }
-
- // Test harness
- public static void main(String[] args) {
- // p/n indicates whether the interior address is really positive
- // or negative. In unsigned terms, p1 < p2 < n1 < n2.
-
- DbxAddress p1 = new DbxAddress(null, 0x7FFFFFFFFFFFFFF0L);
- DbxAddress p2 = (DbxAddress) p1.addOffsetTo(10);
- DbxAddress n1 = (DbxAddress) p2.addOffsetTo(10);
- DbxAddress n2 = (DbxAddress) n1.addOffsetTo(10);
-
- // lessThan positive tests
- check(p1.lessThan(p2), "lessThan 1");
- check(p1.lessThan(n1), "lessThan 2");
- check(p1.lessThan(n2), "lessThan 3");
- check(p2.lessThan(n1), "lessThan 4");
- check(p2.lessThan(n2), "lessThan 5");
- check(n1.lessThan(n2), "lessThan 6");
-
- // lessThan negative tests
- check(!p1.lessThan(p1), "lessThan 7");
- check(!p2.lessThan(p2), "lessThan 8");
- check(!n1.lessThan(n1), "lessThan 9");
- check(!n2.lessThan(n2), "lessThan 10");
-
- check(!p2.lessThan(p1), "lessThan 11");
- check(!n1.lessThan(p1), "lessThan 12");
- check(!n2.lessThan(p1), "lessThan 13");
- check(!n1.lessThan(p2), "lessThan 14");
- check(!n2.lessThan(p2), "lessThan 15");
- check(!n2.lessThan(n1), "lessThan 16");
-
- // lessThanOrEqual positive tests
- check(p1.lessThanOrEqual(p1), "lessThanOrEqual 1");
- check(p2.lessThanOrEqual(p2), "lessThanOrEqual 2");
- check(n1.lessThanOrEqual(n1), "lessThanOrEqual 3");
- check(n2.lessThanOrEqual(n2), "lessThanOrEqual 4");
-
- check(p1.lessThanOrEqual(p2), "lessThanOrEqual 5");
- check(p1.lessThanOrEqual(n1), "lessThanOrEqual 6");
- check(p1.lessThanOrEqual(n2), "lessThanOrEqual 7");
- check(p2.lessThanOrEqual(n1), "lessThanOrEqual 8");
- check(p2.lessThanOrEqual(n2), "lessThanOrEqual 9");
- check(n1.lessThanOrEqual(n2), "lessThanOrEqual 10");
-
- // lessThanOrEqual negative tests
- check(!p2.lessThanOrEqual(p1), "lessThanOrEqual 11");
- check(!n1.lessThanOrEqual(p1), "lessThanOrEqual 12");
- check(!n2.lessThanOrEqual(p1), "lessThanOrEqual 13");
- check(!n1.lessThanOrEqual(p2), "lessThanOrEqual 14");
- check(!n2.lessThanOrEqual(p2), "lessThanOrEqual 15");
- check(!n2.lessThanOrEqual(n1), "lessThanOrEqual 16");
-
- // greaterThan positive tests
- check(n2.greaterThan(p1), "greaterThan 1");
- check(n2.greaterThan(p2), "greaterThan 2");
- check(n2.greaterThan(n1), "greaterThan 3");
- check(n1.greaterThan(p1), "greaterThan 4");
- check(n1.greaterThan(p2), "greaterThan 5");
- check(p2.greaterThan(p1), "greaterThan 6");
-
- // greaterThan negative tests
- check(!p1.greaterThan(p1), "greaterThan 7");
- check(!p2.greaterThan(p2), "greaterThan 8");
- check(!n1.greaterThan(n1), "greaterThan 9");
- check(!n2.greaterThan(n2), "greaterThan 10");
-
- check(!p1.greaterThan(n2), "greaterThan 11");
- check(!p2.greaterThan(n2), "greaterThan 12");
- check(!n1.greaterThan(n2), "greaterThan 13");
- check(!p1.greaterThan(n1), "greaterThan 14");
- check(!p2.greaterThan(n1), "greaterThan 15");
- check(!p1.greaterThan(p2), "greaterThan 16");
-
- // greaterThanOrEqual positive tests
- check(p1.greaterThanOrEqual(p1), "greaterThanOrEqual 1");
- check(p2.greaterThanOrEqual(p2), "greaterThanOrEqual 2");
- check(n1.greaterThanOrEqual(n1), "greaterThanOrEqual 3");
- check(n2.greaterThanOrEqual(n2), "greaterThanOrEqual 4");
-
- check(n2.greaterThanOrEqual(p1), "greaterThanOrEqual 5");
- check(n2.greaterThanOrEqual(p2), "greaterThanOrEqual 6");
- check(n2.greaterThanOrEqual(n1), "greaterThanOrEqual 7");
- check(n1.greaterThanOrEqual(p1), "greaterThanOrEqual 8");
- check(n1.greaterThanOrEqual(p2), "greaterThanOrEqual 9");
- check(p2.greaterThanOrEqual(p1), "greaterThanOrEqual 10");
-
- // greaterThanOrEqual negative tests
- check(!p1.greaterThanOrEqual(n2), "greaterThanOrEqual 11");
- check(!p2.greaterThanOrEqual(n2), "greaterThanOrEqual 12");
- check(!n1.greaterThanOrEqual(n2), "greaterThanOrEqual 13");
- check(!p1.greaterThanOrEqual(n1), "greaterThanOrEqual 14");
- check(!p2.greaterThanOrEqual(n1), "greaterThanOrEqual 15");
- check(!p1.greaterThanOrEqual(p2), "greaterThanOrEqual 16");
-
- System.err.println("DbxAddress: all tests passed successfully.");
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxDebugger.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxDebugger.java
deleted file mode 100644
index 9bf32d5..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxDebugger.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx;
-
-import sun.jvm.hotspot.debugger.*;
-
-/** An extension of the JVMDebugger interface with a few additions to
- support 32-bit vs. 64-bit debugging as well as features required
- by the architecture-specific subpackages. */
-
-public interface DbxDebugger extends JVMDebugger {
- public String addressValueToString(long address) throws DebuggerException;
- public boolean readJBoolean(long address) throws DebuggerException;
- public byte readJByte(long address) throws DebuggerException;
- public char readJChar(long address) throws DebuggerException;
- public double readJDouble(long address) throws DebuggerException;
- public float readJFloat(long address) throws DebuggerException;
- public int readJInt(long address) throws DebuggerException;
- public long readJLong(long address) throws DebuggerException;
- public short readJShort(long address) throws DebuggerException;
- public long readCInteger(long address, long numBytes, boolean isUnsigned)
- throws DebuggerException;
- public DbxAddress readAddress(long address) throws DebuggerException;
- public DbxAddress readCompOopAddress(long address) throws DebuggerException;
- public DbxOopHandle readOopHandle(long address) throws DebuggerException;
- public DbxOopHandle readCompOopHandle(long address) throws DebuggerException;
- public long[] getThreadIntegerRegisterSet(int tid) throws DebuggerException;
- public Address newAddress(long value) throws DebuggerException;
-
- // NOTE: this interface implicitly contains the following methods:
- // From the Debugger interface via JVMDebugger
- // public void attach(int processID) throws DebuggerException;
- // public void attach(String executableName, String coreFileName) throws DebuggerException;
- // public boolean detach();
- // public Address parseAddress(String addressString) throws NumberFormatException;
- // public long getAddressValue(Address addr) throws DebuggerException;
- // public String getOS();
- // public String getCPU();
- // From the SymbolLookup interface via Debugger and JVMDebugger
- // public Address lookup(String objectName, String symbol);
- // public OopHandle lookupOop(String objectName, String symbol);
- // From the JVMDebugger interface
- // public void configureJavaPrimitiveTypeSizes(long jbooleanSize,
- // long jbyteSize,
- // long jcharSize,
- // long jdoubleSize,
- // long jfloatSize,
- // long jintSize,
- // long jlongSize,
- // long jshortSize);
- // From the ThreadAccess interface via Debugger and JVMDebugger
- // public ThreadProxy getThreadForIdentifierAddress(Address addr);
- // public ThreadProxy getThreadForThreadId(long id);
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxDebuggerLocal.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxDebuggerLocal.java
deleted file mode 100644
index b11c019..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxDebuggerLocal.java
+++ /dev/null
@@ -1,744 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.dbx.sparc.*;
-import sun.jvm.hotspot.debugger.dbx.x86.*;
-import sun.jvm.hotspot.debugger.cdbg.CDebugger;
-import sun.jvm.hotspot.utilities.*;
-
-/** <P> An implementation of the JVMDebugger interface which sits on
- top of dbx and relies on the SA's dbx import module for
- communication with the debugger. </P>
-
- <P> <B>NOTE</B> that since we have the notion of fetching "Java
- primitive types" from the remote process (which might have
- different sizes than we expect) we have a bootstrapping
- problem. We need to know the sizes of these types before we can
- fetch them. The current implementation solves this problem by
- requiring that it be configured with these type sizes before they
- can be fetched. The readJ(Type) routines here will throw a
- RuntimeException if they are called before the debugger is
- configured with the Java primitive type sizes. </P>
-*/
-
-public class DbxDebuggerLocal extends DebuggerBase implements DbxDebugger {
- // These may be set by DbxDebuggerRemote
- protected boolean unalignedAccessesOkay;
- protected DbxThreadFactory threadFactory;
-
- private String dbxPathName;
- private String[] dbxSvcAgentDSOPathNames;
- private Process dbxProcess;
- private StreamMonitor dbxOutStreamMonitor;
- private StreamMonitor dbxErrStreamMonitor;
- private PrintWriter dbxOstr;
- private PrintWriter out;
- private InputLexer in;
- private Socket importModuleSocket;
- private static final int PORT = 21928;
- private static final int LONG_TIMEOUT = 60000;
- private static final int DBX_MODULE_NOT_FOUND = 101;
- private static final int DBX_MODULE_LOADED = 102;
-
- //--------------------------------------------------------------------------------
- // Implementation of Debugger interface
- //
-
- /** <P> machDesc may be null if it couldn't be determined yet; i.e.,
- if we're on SPARC, we need to ask the remote process whether
- we're in 32- or 64-bit mode. </P>
-
- <P> useCache should be set to true if debugging is being done
- locally, and to false if the debugger is being created for the
- purpose of supporting remote debugging. </P> */
- public DbxDebuggerLocal(MachineDescription machDesc,
- String dbxPathName,
- String[] dbxSvcAgentDSOPathNames,
- boolean useCache) {
- this.machDesc = machDesc;
- this.dbxPathName = dbxPathName;
- this.dbxSvcAgentDSOPathNames = dbxSvcAgentDSOPathNames;
- int cacheNumPages;
- int cachePageSize;
- if (PlatformInfo.getCPU().equals("sparc")) {
- cacheNumPages = parseCacheNumPagesProperty(2048);
- cachePageSize = 8192;
- threadFactory = new DbxSPARCThreadFactory(this);
- } else if (PlatformInfo.getCPU().equals("x86")) {
- cacheNumPages = 4096;
- cachePageSize = 4096;
- threadFactory = new DbxX86ThreadFactory(this);
- unalignedAccessesOkay = true;
- } else {
- throw new RuntimeException("Thread access for CPU architecture " + PlatformInfo.getCPU() + " not yet supported");
- }
- if (useCache) {
- // Cache portion of the remote process's address space.
- // Fetching data over the socket connection to dbx is relatively
- // slow. For now, this cache works best if it covers the entire
- // heap of the remote process. FIXME: at least should make this
- // tunable from the outside, i.e., via the UI. This is a 16 MB
- // cache divided on SPARC into 2048 8K pages and on x86 into
- // 4096 4K pages; the page size must be adjusted to be the OS's
- // page size. (FIXME: should pick this up from the debugger.)
- initCache(cachePageSize, cacheNumPages);
- }
- }
-
- /** Only called by DbxDebuggerRemote */
- protected DbxDebuggerLocal() {
- }
-
- /** FIXME: implement this with a Runtime.exec() of ps followed by
- parsing of its output */
- public boolean hasProcessList() throws DebuggerException {
- return false;
- }
-
- public List getProcessList() throws DebuggerException {
- throw new DebuggerException("Not yet supported");
- }
-
- /** From the Debugger interface via JVMDebugger */
- public synchronized void attach(int processID) throws DebuggerException {
- try {
- launchProcess();
- dbxErrStreamMonitor.addTrigger("dbx: no process", 1);
- dbxErrStreamMonitor.addTrigger("dbx: Cannot open", 1);
- dbxErrStreamMonitor.addTrigger("dbx: Cannot find", DBX_MODULE_NOT_FOUND);
- dbxOstr = new PrintWriter(dbxProcess.getOutputStream(), true);
- dbxOstr.println("debug - " + processID);
- dbxOstr.println("kprint -u2 \\(ready\\)");
- boolean seen = dbxErrStreamMonitor.waitFor("(ready)", LONG_TIMEOUT);
- if (!seen) {
- detach();
- throw new DebuggerException("Timed out while connecting to process " + processID);
- }
- List retVals = dbxErrStreamMonitor.getTriggersSeen();
- if (retVals.contains(new Integer(1))) {
- detach();
- throw new DebuggerException("No such process " + processID);
- }
-
- // Throws DebuggerException upon failure
- importDbxModule();
-
- dbxOstr.println("svc_agent_run");
-
- connectToImportModule();
-
- // Set "fail fast" mode on process memory reads
- printlnToOutput("peek_fail_fast 1");
- }
- catch (IOException e) {
- detach();
- throw new DebuggerException("Error while connecting to dbx process", e);
- }
- }
-
- /** From the Debugger interface via JVMDebugger */
- public synchronized void attach(String executableName, String coreFileName) throws DebuggerException {
- try {
- launchProcess();
- // Missing executable
- dbxErrStreamMonitor.addTrigger("dbx: Cannot open", 1);
- // Missing core file
- dbxErrStreamMonitor.addTrigger("dbx: can't read", 2);
- // Corrupt executable
- dbxErrStreamMonitor.addTrigger("dbx: File", 3);
- // Corrupt core file
- dbxErrStreamMonitor.addTrigger("dbx: Unable to read", 4);
- // Mismatched core and executable
- dbxErrStreamMonitor.addTrigger("dbx: core object name", 5);
- // Missing loadobject
- dbxErrStreamMonitor.addTrigger("dbx: can't stat", 6);
- // Successful load of svc module
- dbxOstr = new PrintWriter(dbxProcess.getOutputStream(), true);
- dbxOstr.println("debug " + executableName + " " + coreFileName);
- dbxOstr.println("kprint -u2 \\(ready\\)");
- boolean seen = dbxErrStreamMonitor.waitFor("(ready)", LONG_TIMEOUT);
- if (!seen) {
- detach();
- throw new DebuggerException("Timed out while attaching to core file");
- }
- List retVals = dbxErrStreamMonitor.getTriggersSeen();
- if (retVals.size() > 0) {
- detach();
-
- if (retVals.contains(new Integer(1))) {
- throw new DebuggerException("Can not find executable \"" + executableName + "\"");
- } else if (retVals.contains(new Integer(2))) {
- throw new DebuggerException("Can not find core file \"" + coreFileName + "\"");
- } else if (retVals.contains(new Integer(3))) {
- throw new DebuggerException("Corrupt executable \"" + executableName + "\"");
- } else if (retVals.contains(new Integer(4))) {
- throw new DebuggerException("Corrupt core file \"" + coreFileName + "\"");
- } else if (retVals.contains(new Integer(5))) {
- throw new DebuggerException("Mismatched core file/executable \"" + coreFileName + "\"/\"" + executableName + "\"");
- } else {
- throw new DebuggerException("Couldn't find all loaded libraries for executable \"" + executableName + "\"");
- }
- }
-
- // Throws DebuggerException upon failure
- importDbxModule();
-
- dbxOstr.println("svc_agent_run");
-
- connectToImportModule();
-
- // Set "fail fast" mode on process memory reads
- printlnToOutput("peek_fail_fast 1");
- }
- catch (IOException e) {
- detach();
- throw new DebuggerException("Error while connecting to dbx process", e);
- }
- }
-
- /** From the Debugger interface via JVMDebugger */
- public synchronized boolean detach() {
- try {
- if (dbxProcess == null) {
- return false;
- }
-
- if (out != null && dbxOstr != null) {
- printlnToOutput("exit");
- dbxOstr.println("exit");
-
- // Wait briefly for the process to exit (FIXME: should make this
- // nicer)
- try {
- Thread.sleep(500);
- }
- catch (InterruptedException e) {
- }
- }
-
- shutdown();
-
- return true;
- } catch (IOException e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /** From the Debugger interface via JVMDebugger */
- public Address parseAddress(String addressString) throws NumberFormatException {
- long addr = utils.scanAddress(addressString);
- if (addr == 0) {
- return null;
- }
- return new DbxAddress(this, addr);
- }
-
- /** From the Debugger interface via JVMDebugger */
- public String getOS() {
- return PlatformInfo.getOS();
- }
-
- /** From the Debugger interface via JVMDebugger */
- public String getCPU() {
- return PlatformInfo.getCPU();
- }
-
- public boolean hasConsole() throws DebuggerException {
- return true;
- }
-
- public synchronized String consoleExecuteCommand(String cmd) throws DebuggerException {
- try {
- // A little tricky. We need to cause the dbx import module to
- // exit, then print our command on dbx's stdin along with a
- // command which will allow our StreamMonitors to
- // resynchronize. We need save the output from the StreamMonitors
- // along the way.
- printlnToOutput("exit");
- importModuleSocket.close();
- importModuleSocket = null;
- out = null;
- in = null;
- dbxOstr.println("kprint \\(ready\\)");
- dbxOstr.flush();
- dbxOutStreamMonitor.waitFor("(ready)", LONG_TIMEOUT);
-
- dbxOutStreamMonitor.startCapture();
- dbxErrStreamMonitor.startCapture();
- dbxOstr.println(cmd);
- dbxOstr.println("kprint \\(ready\\)");
- dbxOutStreamMonitor.waitFor("(ready)", LONG_TIMEOUT);
- String result = dbxOutStreamMonitor.stopCapture();
- String result2 = dbxErrStreamMonitor.stopCapture();
- result = result + result2;
- // Cut out the "(ready)" string
- StringBuffer outBuf = new StringBuffer(result.length());
- BufferedReader reader = new BufferedReader(new StringReader(result));
- // FIXME: bug in BufferedReader? readLine returns null when
- // ready() returns true.
- String line = null;
- do {
- line = reader.readLine();
- if ((line != null) && (!line.equals("(ready)"))) {
- outBuf.append(line);
- outBuf.append("\n");
- }
- } while (line != null);
- dbxOstr.println("svc_agent_run");
- dbxOstr.flush();
-
- connectToImportModule();
-
- return outBuf.toString();
- }
- catch (IOException e) {
- detach();
- throw new DebuggerException("Error while executing command on dbx console", e);
- }
- }
-
- public String getConsolePrompt() throws DebuggerException {
- return "(dbx) ";
- }
-
- public CDebugger getCDebugger() throws DebuggerException {
- return null;
- }
-
- /** From the SymbolLookup interface via Debugger and JVMDebugger */
- public synchronized Address lookup(String objectName, String symbol) {
- long addr = lookupInProcess(objectName, symbol);
- if (addr == 0) {
- return null;
- }
- return new DbxAddress(this, addr);
- }
-
- /** From the SymbolLookup interface via Debugger and JVMDebugger */
- public synchronized OopHandle lookupOop(String objectName, String symbol) {
- long addr = lookupInProcess(objectName, symbol);
- if (addr == 0) {
- return null;
- }
- return new DbxOopHandle(this, addr);
- }
-
- /** From the Debugger interface */
- public MachineDescription getMachineDescription() {
- return machDesc;
- }
-
- /** Internal routine supporting lazy setting of MachineDescription,
- since on SPARC we will need to query the remote process to ask
- it what its data model is (32- or 64-bit). NOTE that this is NOT
- present in the DbxDebugger interface because it should not be
- called across the wire (until we support attaching to multiple
- remote processes via RMI -- see the documentation for
- DbxDebuggerRemoteIntf.) */
- public void setMachineDescription(MachineDescription machDesc) {
- this.machDesc = machDesc;
- setBigEndian(machDesc.isBigEndian());
- utils = new DebuggerUtilities(machDesc.getAddressSize(), machDesc.isBigEndian());
- }
-
- /** Internal routine which queries the remote process about its data
- model -- i.e., size of addresses. Returns -1 upon error.
- Currently supported return values are 32 and 64. NOTE that this
- is NOT present in the DbxDebugger interface because it should
- not be called across the wire (until we support attaching to
- multiple remote processes via RMI -- see the documentation for
- DbxDebuggerRemoteIntf.) */
- public int getRemoteProcessAddressSize() {
- if (dbxProcess == null) {
- throw new RuntimeException("Not attached to remote process");
- }
-
- try {
- printlnToOutput("address_size");
- int i = in.parseInt();
- return i;
- }
- catch (IOException e) {
- return -1;
- }
- }
-
- //--------------------------------------------------------------------------------
- // Implementation of ThreadAccess interface
- //
-
- /** From the ThreadAccess interface via Debugger and JVMDebugger */
- public ThreadProxy getThreadForIdentifierAddress(Address addr) {
- return threadFactory.createThreadWrapper(addr);
- }
-
- public ThreadProxy getThreadForThreadId(long id) {
- return threadFactory.createThreadWrapper(id);
- }
-
- //----------------------------------------------------------------------
- // Overridden from DebuggerBase because we need to relax alignment
- // constraints on x86
-
- public long readJLong(long address)
- throws UnmappedAddressException, UnalignedAddressException {
- checkJavaConfigured();
- // FIXME: allow this to be configurable. Undesirable to add a
- // dependency on the runtime package here, though, since this
- // package should be strictly underneath it.
- if (unalignedAccessesOkay) {
- utils.checkAlignment(address, jintSize);
- } else {
- utils.checkAlignment(address, jlongSize);
- }
- byte[] data = readBytes(address, jlongSize);
- return utils.dataToJLong(data, jlongSize);
- }
-
- //--------------------------------------------------------------------------------
- // Internal routines (for implementation of DbxAddress).
- // These must not be called until the MachineDescription has been set up.
- //
-
- /** From the DbxDebugger interface */
- public String addressValueToString(long address) {
- return utils.addressValueToString(address);
- }
-
- /** Need to override this to relax alignment checks on Solaris/x86. */
- public long readCInteger(long address, long numBytes, boolean isUnsigned)
- throws UnmappedAddressException, UnalignedAddressException {
- checkConfigured();
- if (!unalignedAccessesOkay) {
- utils.checkAlignment(address, numBytes);
- } else {
- // Only slightly relaxed semantics -- this is a hack, but is
- // necessary on Solaris/x86 where it seems the compiler is
- // putting some global 64-bit data on 32-bit boundaries
- if (numBytes == 8) {
- utils.checkAlignment(address, 4);
- } else {
- utils.checkAlignment(address, numBytes);
- }
- }
- byte[] data = readBytes(address, numBytes);
- return utils.dataToCInteger(data, isUnsigned);
- }
-
- /** From the DbxDebugger interface */
- public DbxAddress readAddress(long address)
- throws UnmappedAddressException, UnalignedAddressException {
- long value = readAddressValue(address);
- return (value == 0 ? null : new DbxAddress(this, value));
- }
-
- public DbxAddress readCompOopAddress(long address)
- throws UnmappedAddressException, UnalignedAddressException {
- long value = readCompOopAddressValue(address);
- return (value == 0 ? null : new DbxAddress(this, value));
- }
-
- /** From the DbxDebugger interface */
- public DbxOopHandle readOopHandle(long address)
- throws UnmappedAddressException, UnalignedAddressException, NotInHeapException {
- long value = readAddressValue(address);
- return (value == 0 ? null : new DbxOopHandle(this, value));
- }
- public DbxOopHandle readCompOopHandle(long address)
- throws UnmappedAddressException, UnalignedAddressException, NotInHeapException {
- long value = readCompOopAddressValue(address);
- return (value == 0 ? null : new DbxOopHandle(this, value));
- }
-
- //--------------------------------------------------------------------------------
- // Thread context access. Can not be package private, but should
- // only be accessed by the architecture-specific subpackages.
-
- /** From the DbxDebugger interface. May have to redefine this later. */
- public synchronized long[] getThreadIntegerRegisterSet(int tid) {
- try {
- printlnToOutput("thr_gregs " + tid);
- int num = in.parseInt();
- long[] res = new long[num];
- for (int i = 0; i < num; i++) {
- res[i] = in.parseAddress();
- }
- return res;
- }
- catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-
- //--------------------------------------------------------------------------------
- // Address access. Can not be package private, but should only be
- // accessed by the architecture-specific subpackages.
-
- /** From the Debugger interface */
- public long getAddressValue(Address addr) {
- if (addr == null) return 0;
- return ((DbxAddress) addr).getValue();
- }
-
- /** From the DbxDebugger interface */
- public Address newAddress(long value) {
- if (value == 0) return null;
- return new DbxAddress(this, value);
- }
-
- //--------------------------------------------------------------------------------
- // Internals only below this point
- //
-
- private void launchProcess() throws IOException {
- dbxProcess = Runtime.getRuntime().exec(dbxPathName);
- // dbxOutStreamMonitor = new StreamMonitor(dbxProcess.getInputStream());
- // dbxErrStreamMonitor = new StreamMonitor(dbxProcess.getErrorStream());
- dbxOutStreamMonitor = new StreamMonitor(dbxProcess.getInputStream(), "dbx stdout", true);
- dbxErrStreamMonitor = new StreamMonitor(dbxProcess.getErrorStream(), "dbx stderr", true);
- }
-
- /** Requires that dbxErrStreamMonitor has a trigger on "dbx: Cannot
- find" with number DBX_MODULE_NOT_FOUND as well as one on "dbx:
- warning:" (plus the serviceability agent's dbx module path name,
- to avoid conflation with inability to load individual object
- files) with number DBX_MODULE_FAILED_TO_LOAD. The former
- indicates an absence of libsvc_agent_dbx.so, while the latter
- indicates that the module failed to load, specifically because
- the architecture was mismatched. (I don't see a way to detect
- from the dbx command prompt whether it's running the v8 or v9
- executbale, so we try to import both flavors of the import
- module; the "v8" file name convention doesn't actually include
- the v8 prefix, so this code should work for Intel as well.) */
- private void importDbxModule() throws DebuggerException {
- // Trigger for a successful load
- dbxOutStreamMonitor.addTrigger("Defining svc_agent_run", DBX_MODULE_LOADED);
- for (int i = 0; i < dbxSvcAgentDSOPathNames.length; i++) {
- dbxOstr.println("import " + dbxSvcAgentDSOPathNames[i]);
- dbxOstr.println("kprint -u2 \\(Ready\\)");
- boolean seen = dbxErrStreamMonitor.waitFor("(Ready)", LONG_TIMEOUT);
- if (!seen) {
- detach();
- throw new DebuggerException("Timed out while importing dbx module from file\n" + dbxSvcAgentDSOPathNames[i]);
- }
- List retVals = dbxErrStreamMonitor.getTriggersSeen();
- if (retVals.contains(new Integer(DBX_MODULE_NOT_FOUND))) {
- detach();
- throw new DebuggerException("Unable to find the Serviceability Agent's dbx import module at pathname \"" +
- dbxSvcAgentDSOPathNames[i] + "\"");
- } else {
- retVals = dbxOutStreamMonitor.getTriggersSeen();
- if (retVals.contains(new Integer(DBX_MODULE_LOADED))) {
- System.out.println("importDbxModule: imported " + dbxSvcAgentDSOPathNames[i]);
- return;
- }
- }
- }
-
- // Failed to load all flavors
- detach();
- String errMsg = ("Unable to find a version of the Serviceability Agent's dbx import module\n" +
- "matching the architecture of dbx at any of the following locations:");
- for (int i = 0; i < dbxSvcAgentDSOPathNames.length; i++) {
- errMsg = errMsg + "\n" + dbxSvcAgentDSOPathNames[i];
- }
- throw new DebuggerException(errMsg);
- }
-
- /** Terminate the debugger forcibly */
- private void shutdown() {
-
- if (dbxProcess != null) {
- // See whether the process has exited and, if not, terminate it
- // forcibly
- try {
- dbxProcess.exitValue();
- }
- catch (IllegalThreadStateException e) {
- dbxProcess.destroy();
- }
- }
-
- try {
- if (importModuleSocket != null) {
- importModuleSocket.close();
- }
- }
- catch (IOException e) {
- }
-
- // Release references to all objects
- clear();
- clearCache();
- }
-
- /** Looks up an address in the remote process's address space.
- Returns 0 if symbol not found or upon error. Package private to
- allow DbxDebuggerRemoteIntfImpl access. */
- synchronized long lookupInProcess(String objectName, String symbol) {
- try {
- printlnToOutput("lookup " + objectName + " " + symbol);
- return in.parseAddress();
- }
- catch (Exception e) {
- return 0;
- }
- }
-
- /** This reads bytes from the remote process. */
- public synchronized ReadResult readBytesFromProcess(long address, long numBytes)
- throws DebuggerException {
- if (numBytes < 0) {
- throw new DebuggerException("Can not read negative number (" + numBytes + ") of bytes from process");
- }
- try {
- String cmd = "peek " + utils.addressValueToString(address) + " " + numBytes;
- printlnToOutput(cmd);
- while (in.readByte() != 'B') {
- }
- byte res = in.readByte();
- if (res == 0) {
- System.err.println("Failing command: " + cmd);
- throw new DebuggerException("Read of remote process address space failed");
- }
- // NOTE: must read ALL of the data regardless of whether we need
- // to throw an UnmappedAddressException. Otherwise will corrupt
- // the input stream each time we have a failure. Not good. Do
- // not want to risk "flushing" the input stream in case a huge
- // read has a hangup in the middle and we leave data on the
- // stream.
- byte[] buf = new byte[(int) numBytes];
- boolean bailOut = false;
- long failureAddress = 0;
- int numReads = 0;
- while (numBytes > 0) {
- long len = in.readUnsignedInt();
- boolean isMapped = ((in.readByte() == 0) ? false : true);
- if (!isMapped) {
- if (!bailOut) {
- bailOut = true;
- failureAddress = address;
- }
- } else {
- // This won't work if we have unmapped regions, but if we do
- // then we're going to throw an exception anyway
-
- // NOTE: there is a factor of 20 speed difference between
- // these two ways of doing this read.
- in.readBytes(buf, 0, (int) len);
- }
-
- // Do NOT do this:
- // for (int i = 0; i < (int) len; i++) {
- // buf[i] = in.readByte();
- // }
-
- numBytes -= len;
- address += len;
- ++numReads;
- }
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(numBytes == 0, "Bug in debug server's implementation of peek: numBytesLeft == " +
- numBytes + ", should be 0 (did " + numReads + " reads)");
- }
- if (bailOut) {
- return new ReadResult(failureAddress);
- }
- return new ReadResult(buf);
- }
- catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- public void writeBytesToProcess(long address, long numBytes, byte[] data)
- throws UnmappedAddressException, DebuggerException {
- // FIXME
- throw new DebuggerException("Unimplemented");
- }
-
- /** This provides DbxDebuggerRemoteIntfImpl access to readBytesFromProcess */
- ReadResult readBytesFromProcessInternal(long address, long numBytes)
- throws DebuggerException {
- return readBytesFromProcess(address, numBytes);
- }
-
- /** Convenience routine */
- private void printlnToOutput(String s) throws IOException {
- out.println(s);
- if (out.checkError()) {
- throw new IOException("Error occurred while writing to debug server");
- }
- }
-
- private void clear() {
- dbxProcess = null;
- dbxOstr = null;
- out = null;
- in = null;
- importModuleSocket = null;
- }
-
- /** Connects to the dbx import module, setting up out and in
- streams. Factored out to allow access to the dbx console. */
- private void connectToImportModule() throws IOException {
- // Try for 20 seconds to connect to dbx import module; time out
- // with failure if didn't succeed
- importModuleSocket = null;
- long endTime = System.currentTimeMillis() + LONG_TIMEOUT;
-
- while ((importModuleSocket == null) && (System.currentTimeMillis() < endTime)) {
- try {
- importModuleSocket = new Socket(InetAddress.getLocalHost(), PORT);
- importModuleSocket.setTcpNoDelay(true);
- }
- catch (IOException e) {
- // Swallow IO exceptions while attempting connection
- try {
- // Don't swamp the CPU
- Thread.sleep(1000);
- }
- catch (InterruptedException ex) {
- }
- }
- }
-
- if (importModuleSocket == null) {
- // Failed to connect because of timeout
- detach();
- throw new DebuggerException("Timed out while attempting to connect to remote dbx process");
- }
-
- out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(importModuleSocket.getOutputStream(), "US-ASCII")), true);
- in = new InputLexer(new BufferedInputStream(importModuleSocket.getInputStream()));
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxOopHandle.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxOopHandle.java
deleted file mode 100644
index 5329008..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxOopHandle.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx;
-
-import sun.jvm.hotspot.debugger.*;
-
-class DbxOopHandle extends DbxAddress implements OopHandle {
- DbxOopHandle(DbxDebugger debugger, long addr) {
- super(debugger, addr);
- }
-
- public Address addOffsetTo (long offset) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("addOffsetTo not applicable to OopHandles (interior object pointers not allowed)");
- }
-
- public Address andWithMask(long mask) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("andWithMask not applicable to OopHandles (i.e., anything but C addresses)");
- }
-
- public Address orWithMask(long mask) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("orWithMask not applicable to OopHandles (i.e., anything but C addresses)");
- }
-
- public Address xorWithMask(long mask) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("xorWithMask not applicable to OopHandles (i.e., anything but C addresses)");
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxThreadFactory.java
deleted file mode 100644
index ea7dc6e..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/DbxThreadFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx;
-
-import sun.jvm.hotspot.debugger.*;
-
-/** An interface used only internally by the DbxDebugger to be able to
- create platform-specific Thread objects */
-
-public interface DbxThreadFactory {
- public ThreadProxy createThreadWrapper(Address threadIdentifierAddr);
- public ThreadProxy createThreadWrapper(long id);
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/sparc/DbxSPARCThread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/sparc/DbxSPARCThread.java
deleted file mode 100644
index b753c23..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/sparc/DbxSPARCThread.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx.sparc;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.sparc.*;
-import sun.jvm.hotspot.debugger.dbx.*;
-import sun.jvm.hotspot.utilities.*;
-
-public class DbxSPARCThread implements ThreadProxy {
- private DbxDebugger debugger;
- private int id;
-
- public DbxSPARCThread(DbxDebugger debugger, Address addr) {
- this.debugger = debugger;
-
- // FIXME: the size here should be configurable. However, making it
- // so would produce a dependency on the "types" package from the
- // debugger package, which is not desired.
- this.id = (int) addr.getCIntegerAt(0, 4, true);
- }
-
- public DbxSPARCThread(DbxDebugger debugger, long id) {
- this.debugger = debugger;
- this.id = (int) id;
- }
-
- public boolean equals(Object obj) {
- if ((obj == null) || !(obj instanceof DbxSPARCThread)) {
- return false;
- }
-
- return (((DbxSPARCThread) obj).id == id);
- }
-
- public int hashCode() {
- return id;
- }
-
- public ThreadContext getContext() throws IllegalThreadStateException {
- DbxSPARCThreadContext context = new DbxSPARCThreadContext(debugger);
- long[] regs = debugger.getThreadIntegerRegisterSet(id);
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(regs.length == SPARCThreadContext.NPRGREG, "size of register set must match");
- }
- for (int i = 0; i < regs.length; i++) {
- context.setRegister(i, regs[i]);
- }
- return context;
- }
-
- public boolean canSetContext() throws DebuggerException {
- return false;
- }
-
- public void setContext(ThreadContext context)
- throws IllegalThreadStateException, DebuggerException {
- throw new DebuggerException("Unimplemented");
- }
-
- public String toString() {
- return "t@" + id;
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/sparc/DbxSPARCThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/sparc/DbxSPARCThreadContext.java
deleted file mode 100644
index 80e5cda..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/sparc/DbxSPARCThreadContext.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx.sparc;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.sparc.*;
-import sun.jvm.hotspot.debugger.dbx.*;
-
-public class DbxSPARCThreadContext extends SPARCThreadContext {
- private DbxDebugger debugger;
-
- public DbxSPARCThreadContext(DbxDebugger debugger) {
- super();
- this.debugger = debugger;
- }
-
- public void setRegisterAsAddress(int index, Address value) {
- setRegister(index, debugger.getAddressValue(value));
- }
-
- public Address getRegisterAsAddress(int index) {
- return debugger.newAddress(getRegister(index));
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/sparc/DbxSPARCThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/sparc/DbxSPARCThreadFactory.java
deleted file mode 100644
index 89564cb..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/sparc/DbxSPARCThreadFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx.sparc;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.dbx.*;
-
-public class DbxSPARCThreadFactory implements DbxThreadFactory {
- private DbxDebugger debugger;
-
- public DbxSPARCThreadFactory(DbxDebugger debugger) {
- this.debugger = debugger;
- }
-
- public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) {
- return new DbxSPARCThread(debugger, threadIdentifierAddr);
- }
-
- public ThreadProxy createThreadWrapper(long id) {
- return new DbxSPARCThread(debugger, id);
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/x86/DbxX86Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/x86/DbxX86Thread.java
deleted file mode 100644
index 8dcb9c4..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/x86/DbxX86Thread.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx.x86;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.x86.*;
-import sun.jvm.hotspot.debugger.dbx.*;
-import sun.jvm.hotspot.utilities.*;
-
-public class DbxX86Thread implements ThreadProxy {
- private DbxDebugger debugger;
- private int id;
-
- public DbxX86Thread(DbxDebugger debugger, Address addr) {
- this.debugger = debugger;
-
- // FIXME: the size here should be configurable. However, making it
- // so would produce a dependency on the "types" package from the
- // debugger package, which is not desired.
- this.id = (int) addr.getCIntegerAt(0, 4, true);
- }
-
- public DbxX86Thread(DbxDebugger debugger, long id) {
- this.debugger = debugger;
- this.id = (int) id;
- }
-
- public boolean equals(Object obj) {
- if ((obj == null) || !(obj instanceof DbxX86Thread)) {
- return false;
- }
-
- return (((DbxX86Thread) obj).id == id);
- }
-
- public int hashCode() {
- return id;
- }
-
- public ThreadContext getContext() throws IllegalThreadStateException {
- DbxX86ThreadContext context = new DbxX86ThreadContext(debugger);
- long[] regs = debugger.getThreadIntegerRegisterSet(id);
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(regs.length == 19, "unknown size of register set -- adjust this code");
- }
- for (int i = 0; i < regs.length; i++) {
- context.setRegister(i, regs[i]);
- }
- return context;
- }
-
- public boolean canSetContext() throws DebuggerException {
- return false;
- }
-
- public void setContext(ThreadContext context)
- throws IllegalThreadStateException, DebuggerException {
- throw new DebuggerException("Unimplemented");
- }
-
- public String toString() {
- return "t@" + id;
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/x86/DbxX86ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/x86/DbxX86ThreadContext.java
deleted file mode 100644
index 565c020..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/x86/DbxX86ThreadContext.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx.x86;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.x86.*;
-import sun.jvm.hotspot.debugger.dbx.*;
-
-public class DbxX86ThreadContext extends X86ThreadContext {
- private DbxDebugger debugger;
-
- public DbxX86ThreadContext(DbxDebugger debugger) {
- super();
- this.debugger = debugger;
- }
-
- public void setRegisterAsAddress(int index, Address value) {
- setRegister(index, debugger.getAddressValue(value));
- }
-
- public Address getRegisterAsAddress(int index) {
- return debugger.newAddress(getRegister(index));
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/x86/DbxX86ThreadFactory.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/x86/DbxX86ThreadFactory.java
deleted file mode 100644
index 74c91c8..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dbx/x86/DbxX86ThreadFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.dbx.x86;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.dbx.*;
-
-public class DbxX86ThreadFactory implements DbxThreadFactory {
- private DbxDebugger debugger;
-
- public DbxX86ThreadFactory(DbxDebugger debugger) {
- this.debugger = debugger;
- }
-
- public ThreadProxy createThreadWrapper(Address threadIdentifierAddr) {
- return new DbxX86Thread(debugger, threadIdentifierAddr);
- }
-
- public ThreadProxy createThreadWrapper(long id) {
- return new DbxX86Thread(debugger, id);
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/AddressDataSource.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/AddressDataSource.java
deleted file mode 100644
index 2e2fa10..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/AddressDataSource.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import java.io.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.win32.coff.*;
-
-class AddressDataSource implements DataSource {
- AddressDataSource(Address addr) {
- this.addr = addr;
- offset = 0;
- }
-
- public byte readByte() throws IOException {
- try {
- byte res = (byte) addr.getCIntegerAt(offset, 1, false);
- ++offset;
- return res;
- } catch (UnmappedAddressException e) {
- throw (IOException) new IOException("Unmapped address at 0x" + Long.toHexString(e.getAddress())).initCause(e);
- } catch (DebuggerException e) {
- throw (IOException) new IOException(e.toString()).initCause(e);
- }
- }
-
- public short readShort() throws IOException {
- // NOTE: byte swapping is taken care of at the COFFFileImpl level
- int b1 = readByte() & 0xFF;
- int b2 = readByte() & 0xFF;
- return (short) ((b1 << 8) | b2);
- }
-
- public int readInt() throws IOException {
- // NOTE: byte swapping is taken care of at the COFFFileImpl level
- int b1 = ((int) readByte()) & 0xFF;
- int b2 = ((int) readByte()) & 0xFF;
- int b3 = ((int) readByte()) & 0xFF;
- int b4 = ((int) readByte()) & 0xFF;
- return ((b1 << 24) | (b2 << 16) | (b3 << 8) | b4);
- }
-
- public long readLong() throws IOException {
- // NOTE: byte swapping is taken care of at the COFFFileImpl level
- long b1 = ((long) readByte()) & 0xFFL;
- long b2 = ((long) readByte()) & 0xFFL;
- long b3 = ((long) readByte()) & 0xFFL;
- long b4 = ((long) readByte()) & 0xFFL;
- long b5 = ((long) readByte()) & 0xFFL;
- long b6 = ((long) readByte()) & 0xFFL;
- long b7 = ((long) readByte()) & 0xFFL;
- long b8 = ((long) readByte()) & 0xFFL;
- return (((((b1 << 24) | (b2 << 16) | (b3 << 8) | b4)) << 32) |
- ((((b5 << 24) | (b6 << 16) | (b7 << 8) | b8))));
- }
-
- public int read(byte[] b) throws IOException {
- for (int i = 0; i < b.length; i++) {
- b[i] = readByte();
- }
- return b.length;
- }
-
- public void seek(long pos) throws IOException {
- offset = pos;
- }
-
- public long getFilePointer() throws IOException {
- return offset;
- }
-
- public void close() throws IOException {
- }
-
- private Address addr;
- private long offset;
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/DLL.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/DLL.java
deleted file mode 100644
index 70007b4..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/DLL.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.win32.coff.*;
-import sun.jvm.hotspot.debugger.cdbg.*;
-import sun.jvm.hotspot.utilities.Assert;
-import sun.jvm.hotspot.utilities.memo.*;
-
-/** Provides a simple wrapper around the COFF library which handles
- relocation. A DLL can represent either a DLL or an EXE file. */
-
-class DLL implements LoadObject {
-
- DLL(Win32Debugger dbg, String filename, long size, Address relocation) throws COFFException {
- this.dbg = dbg;
- fullPathName = filename;
- this.size = size;
- file = new MemoizedObject() {
- public Object computeValue() {
- return COFFFileParser.getParser().parse(fullPathName);
- }
- };
- addr = relocation;
- }
-
- /** This constructor was originally used to fetch the DLL's name out
- of the target process to match it up with the known DLL names,
- before the fetching of the DLL names and bases was folded into
- one command. It is no longer used. If it is used, getName() will
- return null and getSize() will return 0. */
- DLL(Address base) throws COFFException {
- this.addr = base;
- file = new MemoizedObject() {
- public Object computeValue() {
- return COFFFileParser.getParser().parse(new AddressDataSource(addr));
- }
- };
- }
-
- /** Indicates whether this is really a DLL or actually a .EXE
- file. */
- boolean isDLL() {
- return getFile().getHeader().hasCharacteristic(Characteristics.IMAGE_FILE_DLL);
- }
-
- /** Look up a symbol; returns absolute address or null if symbol was
- not found. */
- Address lookupSymbol(String symbol) throws COFFException {
- if (!isDLL()) {
- return null;
- }
- ExportDirectoryTable exports = getExportDirectoryTable();
- return lookupSymbol(symbol, exports,
- 0, exports.getNumberOfNamePointers() - 1);
- }
-
- public Address getBase() {
- return addr;
- }
-
- /** Returns the full path name of this DLL/EXE, or null if this DLL
- object was created by parsing the target process's address
- space. */
- public String getName() {
- return fullPathName;
- }
-
- public long getSize() {
- return size;
- }
-
- public CDebugInfoDataBase getDebugInfoDataBase() throws DebuggerException {
- if (db != null) {
- return db;
- }
-
- // Try to parse
- if (dbg == null) {
- return null; // Need Win32Debugger
- }
-
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(fullPathName != null, "Need full path name to build debug info database");
- }
-
- db = new Win32CDebugInfoBuilder(dbg).buildDataBase(fullPathName, addr);
- return db;
- }
-
- public BlockSym debugInfoForPC(Address pc) throws DebuggerException {
- CDebugInfoDataBase db = getDebugInfoDataBase();
- if (db == null) {
- return null;
- }
- return db.debugInfoForPC(pc);
- }
-
- public ClosestSymbol closestSymbolToPC(Address pcAsAddr) throws DebuggerException {
- ExportDirectoryTable exports = getExportDirectoryTable();
- if (exports == null) {
- return null;
- }
- String name = null;
- long pc = dbg.getAddressValue(pcAsAddr);
- long diff = Long.MAX_VALUE;
- long base = dbg.getAddressValue(addr);
- for (int i = 0; i < exports.getNumberOfNamePointers(); i++) {
- if (!exports.isExportAddressForwarder(exports.getExportOrdinal(i))) {
- long tmp = base + (exports.getExportAddress(exports.getExportOrdinal(i)) & 0xFFFFFFFF);
- if ((tmp <= pc) && ((pc - tmp) < diff)) {
- diff = pc - tmp;
- name = exports.getExportName(i);
- }
- }
- }
- if (name == null) {
- return null;
- }
- return new ClosestSymbol(name, diff);
- }
-
- public LineNumberInfo lineNumberForPC(Address pc) throws DebuggerException {
- CDebugInfoDataBase db = getDebugInfoDataBase();
- if (db == null) {
- return null;
- }
- return db.lineNumberForPC(pc);
- }
-
- void close() {
- getFile().close();
- file = null;
- }
-
- //----------------------------------------------------------------------
- // Internals only below this point
- //
-
- private COFFFile getFile() {
- return (COFFFile) file.getValue();
- }
-
- private Address lookupSymbol(String symbol, ExportDirectoryTable exports,
- int loIdx, int hiIdx) {
- do {
- int curIdx = ((loIdx + hiIdx) >> 1);
- String cur = exports.getExportName(curIdx);
- if (symbol.equals(cur)) {
- return addr.addOffsetTo(
- ((long) exports.getExportAddress(exports.getExportOrdinal(curIdx))) & 0xFFFFFFFFL
- );
- }
- if (symbol.compareTo(cur) < 0) {
- if (hiIdx == curIdx) {
- hiIdx = curIdx - 1;
- } else {
- hiIdx = curIdx;
- }
- } else {
- if (loIdx == curIdx) {
- loIdx = curIdx + 1;
- } else {
- loIdx = curIdx;
- }
- }
- } while (loIdx <= hiIdx);
-
- return null;
- }
-
- private ExportDirectoryTable getExportDirectoryTable() {
- return
- getFile().getHeader().getOptionalHeader().getDataDirectories().getExportDirectoryTable();
- }
-
- private Win32Debugger dbg;
- private String fullPathName;
- private long size;
- // MemoizedObject contains a COFFFile
- private MemoizedObject file;
- // Base address of module in target process
- private Address addr;
- // Debug info database for this DLL
- private CDebugInfoDataBase db;
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/TestDebugger.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/TestDebugger.java
deleted file mode 100644
index ec97a87..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/TestDebugger.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-
-public class TestDebugger {
- private static void usage() {
- System.out.println("usage: java TestDebugger [pid]");
- System.exit(1);
- }
-
- public static void main(String[] args) {
- try {
- if (args.length != 1) {
- usage();
- }
-
- int pid = 0;
- try {
- pid = Integer.parseInt(args[0]);
- }
- catch (NumberFormatException e) {
- usage();
- }
-
- JVMDebugger debugger = new Win32DebuggerLocal(new MachineDescriptionIntelX86(), true);
- System.err.println("Process list: ");
- List processes = debugger.getProcessList();
- for (Iterator iter = processes.iterator(); iter.hasNext(); ) {
- ProcessInfo info = (ProcessInfo) iter.next();
- System.err.println(info.getPid() + " " + info.getName());
- }
- System.err.println("Trying to attach...");
- debugger.attach(pid);
- System.err.println("Attach succeeded.");
- System.err.println("Trying to detach...");
- if (!debugger.detach()) {
- System.err.println("ERROR: detach failed.");
- System.exit(0);
- }
- System.err.println("Detach succeeded.");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/TestHelloWorld.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/TestHelloWorld.java
deleted file mode 100644
index 8a56766..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/TestHelloWorld.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-
-/** Tests to see whether we can find the "Hello, World" string in a
- target process */
-
-public class TestHelloWorld {
- private static void usage() {
- System.out.println("usage: java TestHelloWorld [pid]");
- System.out.println("pid must be the process ID of the HelloWorldDLL programs");
- System.exit(1);
- }
-
- public static void main(String[] args) {
- try {
- if (args.length != 1) {
- usage();
- }
-
- int pid = 0;
- try {
- pid = Integer.parseInt(args[0]);
- }
- catch (NumberFormatException e) {
- usage();
- }
-
- JVMDebugger debugger = new Win32DebuggerLocal(new MachineDescriptionIntelX86(), true);
- System.err.println("Trying to attach...");
- debugger.attach(pid);
- System.err.println("Attach succeeded.");
- Address addr = debugger.lookup("helloworld.dll", "helloWorldString");
- System.err.println("helloWorldString address = " + addr);
- System.err.println("Trying to detach...");
- if (!debugger.detach()) {
- System.err.println("ERROR: detach failed.");
- System.exit(0);
- }
- System.err.println("Detach succeeded.");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32Address.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32Address.java
deleted file mode 100644
index 6d465ab..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32Address.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import sun.jvm.hotspot.debugger.*;
-
-class Win32Address implements Address {
- protected Win32Debugger debugger;
- protected long addr;
-
- Win32Address(Win32Debugger debugger, long addr) {
- this.debugger = debugger;
- this.addr = addr;
- }
-
- //
- // Basic Java routines
- //
-
- public boolean equals(Object arg) {
- if (arg == null) {
- return false;
- }
-
- if (!(arg instanceof Win32Address)) {
- return false;
- }
-
- return (addr == ((Win32Address) arg).addr);
- }
-
- public int hashCode() {
- // FIXME: suggestions on a better hash code?
- return (int) addr;
- }
-
- public String toString() {
- return debugger.addressValueToString(addr);
- }
-
- //
- // C/C++-related routines
- //
-
- public long getCIntegerAt(long offset, long numBytes, boolean isUnsigned) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readCInteger(addr + offset, numBytes, isUnsigned);
- }
-
- public Address getAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readAddress(addr + offset);
- }
-
- public Address getCompOopAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readCompOopAddress(addr + offset);
- }
-
- //
- // Java-related routines
- //
-
- public boolean getJBooleanAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJBoolean(addr + offset);
- }
-
- public byte getJByteAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJByte(addr + offset);
- }
-
- public char getJCharAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJChar(addr + offset);
- }
-
- public double getJDoubleAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJDouble(addr + offset);
- }
-
- public float getJFloatAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJFloat(addr + offset);
- }
-
- public int getJIntAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJInt(addr + offset);
- }
-
- public long getJLongAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJLong(addr + offset);
- }
-
- public short getJShortAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
- return debugger.readJShort(addr + offset);
- }
-
- public OopHandle getOopHandleAt(long offset)
- throws UnalignedAddressException, UnmappedAddressException, NotInHeapException {
- return debugger.readOopHandle(addr + offset);
- }
- public OopHandle getCompOopHandleAt(long offset)
- throws UnalignedAddressException, UnmappedAddressException, NotInHeapException {
- return debugger.readCompOopHandle(addr + offset);
- }
-
- //
- // C/C++-related mutators
- //
-
- public void setCIntegerAt(long offset, long numBytes, long value) {
- debugger.writeCInteger(addr + offset, numBytes, value);
- }
- public void setAddressAt(long offset, Address value) {
- debugger.writeAddress(addr + offset, (Win32Address) value);
- }
-
- //
- // Java-related mutators
- //
-
- public void setJBooleanAt (long offset, boolean value)
- throws UnmappedAddressException, UnalignedAddressException {
- debugger.writeJBoolean(addr + offset, value);
- }
- public void setJByteAt (long offset, byte value)
- throws UnmappedAddressException, UnalignedAddressException {
- debugger.writeJByte(addr + offset, value);
- }
- public void setJCharAt (long offset, char value)
- throws UnmappedAddressException, UnalignedAddressException {
- debugger.writeJChar(addr + offset, value);
- }
- public void setJDoubleAt (long offset, double value)
- throws UnmappedAddressException, UnalignedAddressException {
- debugger.writeJDouble(addr + offset, value);
- }
- public void setJFloatAt (long offset, float value)
- throws UnmappedAddressException, UnalignedAddressException {
- debugger.writeJFloat(addr + offset, value);
- }
- public void setJIntAt (long offset, int value)
- throws UnmappedAddressException, UnalignedAddressException {
- debugger.writeJInt(addr + offset, value);
- }
- public void setJLongAt (long offset, long value)
- throws UnmappedAddressException, UnalignedAddressException {
- debugger.writeJLong(addr + offset, value);
- }
- public void setJShortAt (long offset, short value)
- throws UnmappedAddressException, UnalignedAddressException {
- debugger.writeJShort(addr + offset, value);
- }
- public void setOopHandleAt (long offset, OopHandle value)
- throws UnmappedAddressException, UnalignedAddressException {
- debugger.writeOopHandle(addr + offset, (Win32OopHandle) value);
- }
-
- //
- // Arithmetic operations -- necessary evil.
- //
-
- public Address addOffsetTo (long offset) throws UnsupportedOperationException {
- long value = addr + offset;
- if (value == 0) {
- return null;
- }
- return new Win32Address(debugger, value);
- }
-
- public OopHandle addOffsetToAsOopHandle(long offset) throws UnsupportedOperationException {
- long value = addr + offset;
- if (value == 0) {
- return null;
- }
- return new Win32OopHandle(debugger, value);
- }
-
- /** (FIXME: any signed/unsigned issues? Should this work for
- OopHandles?) */
- public long minus(Address arg) {
- if (arg == null) {
- return addr;
- }
- return addr - ((Win32Address) arg).addr;
- }
-
- // Two's complement representation.
- // All negative numbers are larger than positive numbers.
- // Numbers with the same sign can be compared normally.
- // Test harness is below in main().
-
- public boolean lessThan (Address a) {
- if (a == null) {
- return false;
- }
- Win32Address arg = (Win32Address) a;
- if ((addr >= 0) && (arg.addr < 0)) {
- return true;
- }
- if ((addr < 0) && (arg.addr >= 0)) {
- return false;
- }
- return (addr < arg.addr);
- }
-
- public boolean lessThanOrEqual (Address a) {
- if (a == null) {
- return false;
- }
- Win32Address arg = (Win32Address) a;
- if ((addr >= 0) && (arg.addr < 0)) {
- return true;
- }
- if ((addr < 0) && (arg.addr >= 0)) {
- return false;
- }
- return (addr <= arg.addr);
- }
-
- public boolean greaterThan (Address a) {
- if (a == null) {
- return true;
- }
- Win32Address arg = (Win32Address) a;
- if ((addr >= 0) && (arg.addr < 0)) {
- return false;
- }
- if ((addr < 0) && (arg.addr >= 0)) {
- return true;
- }
- return (addr > arg.addr);
- }
-
- public boolean greaterThanOrEqual(Address a) {
- if (a == null) {
- return true;
- }
- Win32Address arg = (Win32Address) a;
- if ((addr >= 0) && (arg.addr < 0)) {
- return false;
- }
- if ((addr < 0) && (arg.addr >= 0)) {
- return true;
- }
- return (addr >= arg.addr);
- }
-
- public Address andWithMask(long mask) throws UnsupportedOperationException {
- long value = addr & mask;
- if (value == 0) {
- return null;
- }
- return new Win32Address(debugger, value);
- }
-
- public Address orWithMask(long mask) throws UnsupportedOperationException {
- long value = addr | mask;
- if (value == 0) {
- return null;
- }
- return new Win32Address(debugger, value);
- }
-
- public Address xorWithMask(long mask) throws UnsupportedOperationException {
- long value = addr ^ mask;
- if (value == 0) {
- return null;
- }
- return new Win32Address(debugger, value);
- }
-
-
- //--------------------------------------------------------------------------------
- // Internals only below this point
- //
-
- long getValue() {
- return addr;
- }
-
-
- private static void check(boolean arg, String failMessage) {
- if (!arg) {
- System.err.println(failMessage + ": FAILED");
- System.exit(1);
- }
- }
-
- // Test harness
- public static void main(String[] args) {
- // p/n indicates whether the interior address is really positive
- // or negative. In unsigned terms, p1 < p2 < n1 < n2.
-
- Win32Address p1 = new Win32Address(null, 0x7FFFFFFFFFFFFFF0L);
- Win32Address p2 = (Win32Address) p1.addOffsetTo(10);
- Win32Address n1 = (Win32Address) p2.addOffsetTo(10);
- Win32Address n2 = (Win32Address) n1.addOffsetTo(10);
-
- // lessThan positive tests
- check(p1.lessThan(p2), "lessThan 1");
- check(p1.lessThan(n1), "lessThan 2");
- check(p1.lessThan(n2), "lessThan 3");
- check(p2.lessThan(n1), "lessThan 4");
- check(p2.lessThan(n2), "lessThan 5");
- check(n1.lessThan(n2), "lessThan 6");
-
- // lessThan negative tests
- check(!p1.lessThan(p1), "lessThan 7");
- check(!p2.lessThan(p2), "lessThan 8");
- check(!n1.lessThan(n1), "lessThan 9");
- check(!n2.lessThan(n2), "lessThan 10");
-
- check(!p2.lessThan(p1), "lessThan 11");
- check(!n1.lessThan(p1), "lessThan 12");
- check(!n2.lessThan(p1), "lessThan 13");
- check(!n1.lessThan(p2), "lessThan 14");
- check(!n2.lessThan(p2), "lessThan 15");
- check(!n2.lessThan(n1), "lessThan 16");
-
- // lessThanOrEqual positive tests
- check(p1.lessThanOrEqual(p1), "lessThanOrEqual 1");
- check(p2.lessThanOrEqual(p2), "lessThanOrEqual 2");
- check(n1.lessThanOrEqual(n1), "lessThanOrEqual 3");
- check(n2.lessThanOrEqual(n2), "lessThanOrEqual 4");
-
- check(p1.lessThanOrEqual(p2), "lessThanOrEqual 5");
- check(p1.lessThanOrEqual(n1), "lessThanOrEqual 6");
- check(p1.lessThanOrEqual(n2), "lessThanOrEqual 7");
- check(p2.lessThanOrEqual(n1), "lessThanOrEqual 8");
- check(p2.lessThanOrEqual(n2), "lessThanOrEqual 9");
- check(n1.lessThanOrEqual(n2), "lessThanOrEqual 10");
-
- // lessThanOrEqual negative tests
- check(!p2.lessThanOrEqual(p1), "lessThanOrEqual 11");
- check(!n1.lessThanOrEqual(p1), "lessThanOrEqual 12");
- check(!n2.lessThanOrEqual(p1), "lessThanOrEqual 13");
- check(!n1.lessThanOrEqual(p2), "lessThanOrEqual 14");
- check(!n2.lessThanOrEqual(p2), "lessThanOrEqual 15");
- check(!n2.lessThanOrEqual(n1), "lessThanOrEqual 16");
-
- // greaterThan positive tests
- check(n2.greaterThan(p1), "greaterThan 1");
- check(n2.greaterThan(p2), "greaterThan 2");
- check(n2.greaterThan(n1), "greaterThan 3");
- check(n1.greaterThan(p1), "greaterThan 4");
- check(n1.greaterThan(p2), "greaterThan 5");
- check(p2.greaterThan(p1), "greaterThan 6");
-
- // greaterThan negative tests
- check(!p1.greaterThan(p1), "greaterThan 7");
- check(!p2.greaterThan(p2), "greaterThan 8");
- check(!n1.greaterThan(n1), "greaterThan 9");
- check(!n2.greaterThan(n2), "greaterThan 10");
-
- check(!p1.greaterThan(n2), "greaterThan 11");
- check(!p2.greaterThan(n2), "greaterThan 12");
- check(!n1.greaterThan(n2), "greaterThan 13");
- check(!p1.greaterThan(n1), "greaterThan 14");
- check(!p2.greaterThan(n1), "greaterThan 15");
- check(!p1.greaterThan(p2), "greaterThan 16");
-
- // greaterThanOrEqual positive tests
- check(p1.greaterThanOrEqual(p1), "greaterThanOrEqual 1");
- check(p2.greaterThanOrEqual(p2), "greaterThanOrEqual 2");
- check(n1.greaterThanOrEqual(n1), "greaterThanOrEqual 3");
- check(n2.greaterThanOrEqual(n2), "greaterThanOrEqual 4");
-
- check(n2.greaterThanOrEqual(p1), "greaterThanOrEqual 5");
- check(n2.greaterThanOrEqual(p2), "greaterThanOrEqual 6");
- check(n2.greaterThanOrEqual(n1), "greaterThanOrEqual 7");
- check(n1.greaterThanOrEqual(p1), "greaterThanOrEqual 8");
- check(n1.greaterThanOrEqual(p2), "greaterThanOrEqual 9");
- check(p2.greaterThanOrEqual(p1), "greaterThanOrEqual 10");
-
- // greaterThanOrEqual negative tests
- check(!p1.greaterThanOrEqual(n2), "greaterThanOrEqual 11");
- check(!p2.greaterThanOrEqual(n2), "greaterThanOrEqual 12");
- check(!n1.greaterThanOrEqual(n2), "greaterThanOrEqual 13");
- check(!p1.greaterThanOrEqual(n1), "greaterThanOrEqual 14");
- check(!p2.greaterThanOrEqual(n1), "greaterThanOrEqual 15");
- check(!p1.greaterThanOrEqual(p2), "greaterThanOrEqual 16");
-
- System.err.println("Win32Address: all tests passed successfully.");
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32CDebugInfoBuilder.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32CDebugInfoBuilder.java
deleted file mode 100644
index ed15384..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32CDebugInfoBuilder.java
+++ /dev/null
@@ -1,824 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import java.util.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.win32.coff.*;
-import sun.jvm.hotspot.debugger.cdbg.*;
-import sun.jvm.hotspot.debugger.cdbg.basic.*;
-import sun.jvm.hotspot.utilities.Assert;
-
-class Win32CDebugInfoBuilder
- implements DebugVC50SubsectionTypes, DebugVC50TypeLeafIndices, DebugVC50TypeEnums, DebugVC50SymbolTypes, DebugVC50MemberAttributes, CVAttributes, AccessControl {
- private Win32Debugger dbg;
- private Address base;
-
- private DebugVC50 vc50;
- private BasicCDebugInfoDataBase db;
- private DebugVC50TypeIterator iter;
-
- private DebugVC50SymbolIterator symIter;
-
- // Logical->physical segment mapping
- private COFFFile file;
- private DebugVC50SSSegMap segMap;
-
- // Canonicalization of primitive types
- private Map primIndexToTypeMap;
-
- // Global unnamed enumeration
- // (FIXME: must figure out how to handle nested type descriptions)
- private BasicEnumType unnamedEnum;
-
- private Stack blockStack;
- private int endsToSkip;
-
- private static final int POINTER_SIZE = 4;
-
- Win32CDebugInfoBuilder(Win32Debugger dbg) {
- this.dbg = dbg;
- }
-
- CDebugInfoDataBase buildDataBase(String dllName, Address base) {
- this.base = base;
- file = COFFFileParser.getParser().parse(dllName);
- vc50 = getDebugVC50(file);
-
- if (vc50 == null) return null;
-
- segMap = getSegMap();
-
- primIndexToTypeMap = new HashMap();
- blockStack = new Stack();
- endsToSkip = 0;
-
- db = new BasicCDebugInfoDataBase();
- db.beginConstruction();
-
- // Get global types and add them to the database
- DebugVC50SSGlobalTypes types = getGlobalTypes();
- for (iter = types.getTypeIterator(); !iter.done(); iter.next()) {
- while (!iter.typeStringDone()) {
- switch (iter.typeStringLeaf()) {
- case LF_MODIFIER: {
- int idx = iter.getModifierIndex();
- BasicType target = getTypeByIndex(idx);
- short windowsMods = iter.getModifierAttribute();
- short mods = 0;
- if ((windowsMods & MODIFIER_CONST_MASK) != 0) mods |= CONST;
- if ((windowsMods & MODIFIER_VOLATILE_MASK) != 0) mods |= VOLATILE;
- putType(target.getCVVariant(mods));
- break;
- }
- case LF_POINTER: {
- int idx = iter.getPointerType();
- BasicType target = getTypeByIndex(idx);
- short windowsMods = iter.getModifierAttribute();
- short mods = 0;
- if ((windowsMods & POINTER_CONST_MASK) != 0) mods |= CONST;
- if ((windowsMods & POINTER_VOLATILE_MASK) != 0) mods |= VOLATILE;
- BasicPointerType ptrType = new BasicPointerType(POINTER_SIZE, target);
- if (mods != 0) {
- ptrType = (BasicPointerType) ptrType.getCVVariant(mods);
- }
-
- putType(ptrType);
- break;
- }
- case LF_ARRAY: {
- BasicType elemType = getTypeByIndex(iter.getArrayElementType());
- putType(new BasicArrayType(iter.getArrayName(), elemType, iter.getArrayLength()));
- break;
- }
- case LF_CLASS:
- case LF_STRUCTURE: {
- CompoundTypeKind kind = ((iter.typeStringLeaf() == LF_CLASS) ? CompoundTypeKind.CLASS
- : CompoundTypeKind.STRUCT);
- BasicCompoundType type = new BasicCompoundType(iter.getClassName(),
- iter.getClassSize(),
- kind);
- // Skip parsing of forward references to types
- // FIXME: do we have to resolve these later?
- if ((iter.getClassProperty() & PROPERTY_FWDREF) == 0) {
- DebugVC50TypeIterator fieldIter = iter.getClassFieldListIterator();
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(fieldIter.typeStringLeaf() == LF_FIELDLIST, "Expected field list");
- }
- boolean advance = false;
- while (!fieldIter.typeStringDone()) {
- advance = true;
- switch (fieldIter.typeStringLeaf()) {
- case LF_FIELDLIST: break;
- case LF_BCLASS: {
- int accessControl = memberAttributeToAccessControl(fieldIter.getBClassAttribute());
- Type baseType = getTypeByIndex(fieldIter.getBClassType());
- // FIXME: take offset into account
- type.addBaseClass(new BasicBaseClass(accessControl, false, baseType));
- break;
- }
- case LF_VBCLASS: {
- int accessControl = memberAttributeToAccessControl(fieldIter.getVBClassAttribute());
- Type baseType = getTypeByIndex(fieldIter.getVBClassBaseClassType());
- // FIXME: take offset and virtual base offset into account
- type.addBaseClass(new BasicBaseClass(accessControl, true, baseType));
- break;
- }
- // I don't think we need to handle indirect virtual base
- // classes since they should be handled indirectly through
- // the modeling of the type hierarchy
- case LF_IVBCLASS: break;
- case LF_INDEX: {
- fieldIter = fieldIter.getIndexIterator();
- advance = false;
- break;
- }
- case LF_MEMBER: {
- BasicField field = new BasicField(fieldIter.getMemberName(),
- getTypeByIndex(fieldIter.getMemberType()),
- memberAttributeToAccessControl(fieldIter.getMemberAttribute()),
- false);
- field.setOffset(fieldIter.getMemberOffset());
- type.addField(field);
- break;
- }
- case LF_STMEMBER: {
- BasicField field = new BasicField(fieldIter.getStaticName(),
- getTypeByIndex(fieldIter.getStaticType()),
- memberAttributeToAccessControl(fieldIter.getStaticAttribute()),
- true);
- // The field's address will be found during resolution
- // of the debug info database
- type.addField(field);
- break;
- }
- // FIXME: handle methods
- case LF_METHOD: break;
- case LF_ONEMETHOD: break;
- // FIXME: handle nested types
- case LF_NESTTYPE: break;
- case LF_NESTTYPEEX: break;
- // NOTE: virtual functions not needed/handled yet for
- // this debugging system (because we are not planning to
- // handle calling methods in the target process at
- // runtime)
- case LF_VFUNCTAB: break;
- case LF_FRIENDCLS: break;
- case LF_VFUNCOFF: break;
- case LF_MEMBERMODIFY: break;
- case LF_PAD0: case LF_PAD1: case LF_PAD2: case LF_PAD3:
- case LF_PAD4: case LF_PAD5: case LF_PAD6: case LF_PAD7:
- case LF_PAD8: case LF_PAD9: case LF_PAD10: case LF_PAD11:
- case LF_PAD12: case LF_PAD13: case LF_PAD14: case LF_PAD15: break;
- default: System.err.println("WARNING: unexpected leaf index " +
- fieldIter.typeStringLeaf() +
- " in field list for type " + iter.getTypeIndex());
- }
- if (advance) {
- fieldIter.typeStringNext();
- }
- }
- }
- putType(type);
- break;
- }
- case LF_UNION: {
- BasicCompoundType type = new BasicCompoundType(iter.getUnionName(),
- iter.getUnionSize(),
- CompoundTypeKind.UNION);
- // Skip parsing of forward references to types
- // FIXME: do we have to resolve these later?
- if ((iter.getClassProperty() & PROPERTY_FWDREF) == 0) {
- DebugVC50TypeIterator fieldIter = iter.getUnionFieldListIterator();
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(fieldIter.typeStringLeaf() == LF_FIELDLIST, "Expected field list");
- }
- boolean advance = false;
- while (!fieldIter.typeStringDone()) {
- advance = true;
- switch (fieldIter.typeStringLeaf()) {
- case LF_FIELDLIST: break;
- case LF_BCLASS: break;
- case LF_VBCLASS: break;
- case LF_IVBCLASS: break;
- case LF_INDEX: {
- fieldIter = fieldIter.getIndexIterator();
- advance = false;
- break;
- }
- case LF_MEMBER: {
- BasicField field = new BasicField(fieldIter.getMemberName(),
- getTypeByIndex(fieldIter.getMemberType()),
- memberAttributeToAccessControl(fieldIter.getMemberAttribute()),
- false);
- field.setOffset(fieldIter.getMemberOffset());
- type.addField(field);
- break;
- }
- case LF_STMEMBER: {
- System.err.println("WARNING: I didn't think unions could contain static fields...");
- BasicField field = new BasicField(fieldIter.getStaticName(),
- getTypeByIndex(fieldIter.getStaticType()),
- memberAttributeToAccessControl(fieldIter.getStaticAttribute()),
- true);
- // The field's address will be found during resolution
- // of the debug info database
- type.addField(field);
- break;
- }
- case LF_METHOD: break;
- case LF_ONEMETHOD: break;
- // FIXME: handle nested types
- case LF_NESTTYPE: break;
- case LF_NESTTYPEEX: break;
- case LF_VFUNCTAB: break;
- case LF_FRIENDCLS: break;
- case LF_VFUNCOFF: break;
- case LF_MEMBERMODIFY: break;
- case LF_PAD0: case LF_PAD1: case LF_PAD2: case LF_PAD3:
- case LF_PAD4: case LF_PAD5: case LF_PAD6: case LF_PAD7:
- case LF_PAD8: case LF_PAD9: case LF_PAD10: case LF_PAD11:
- case LF_PAD12: case LF_PAD13: case LF_PAD14: case LF_PAD15: break;
-
- default: System.err.println("WARNING: unexpected leaf index " +
- fieldIter.typeStringLeaf() +
- " in field list for union of type " + iter.getTypeIndex());
- }
- if (advance) {
- fieldIter.typeStringNext();
- }
- }
- }
- putType(type);
- break;
- }
- case LF_ENUM: {
- String name = iter.getEnumName();
- BasicEnumType enumType = null;
- if ((name == null) || (name.equals(""))) {
- if (unnamedEnum == null) {
- unnamedEnum = new BasicEnumType(null, getTypeByIndex(iter.getEnumType()));
- }
- enumType = unnamedEnum;
- } else {
- enumType = new BasicEnumType(name, getTypeByIndex(iter.getEnumType()));
- }
- DebugVC50TypeIterator fieldIter = iter.getEnumFieldListIterator();
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(fieldIter.typeStringLeaf() == LF_FIELDLIST, "Expected field list");
- }
- boolean advance = false;
- while (!fieldIter.typeStringDone()) {
- advance = true;
- switch (fieldIter.typeStringLeaf()) {
- case LF_FIELDLIST: break;
- case LF_ENUMERATE: {
- String enumName = fieldIter.getEnumerateName();
- long enumVal = fieldIter.getEnumerateValue();
- enumType.addEnum(enumName, enumVal);
- break;
- }
- case LF_INDEX: {
- fieldIter = fieldIter.getIndexIterator();
- advance = false;
- break;
- }
-
- case LF_PAD0: case LF_PAD1: case LF_PAD2: case LF_PAD3:
- case LF_PAD4: case LF_PAD5: case LF_PAD6: case LF_PAD7:
- case LF_PAD8: case LF_PAD9: case LF_PAD10: case LF_PAD11:
- case LF_PAD12: case LF_PAD13: case LF_PAD14: case LF_PAD15: break;
-
- default: System.err.println("WARNING: unexpected leaf index " +
- fieldIter.typeStringLeaf() +
- " in field list for enum of type " + iter.getTypeIndex());
- }
-
- if (advance) {
- fieldIter.typeStringNext();
- }
- }
-
- putType(enumType);
- break;
- }
- case LF_PROCEDURE: {
- Type retType = getTypeByIndex(iter.getProcedureReturnType());
- BasicFunctionType func = new BasicFunctionType(null, POINTER_SIZE, retType);
- DebugVC50TypeIterator argIter = iter.getProcedureArgumentListIterator();
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(argIter.typeStringLeaf() == LF_ARGLIST, "Expected argument list");
- }
- for (int i = 0; i < argIter.getArgListCount(); i++) {
- func.addArgumentType(getTypeByIndex(argIter.getArgListType(i)));
- }
- putType(func);
- break;
- }
- case LF_MFUNCTION: {
- Type retType = getTypeByIndex(iter.getMFunctionReturnType());
- Type container = getTypeByIndex(iter.getMFunctionContainingClass());
- Type thisType = getTypeByIndex(iter.getMFunctionThis());
- long thisAdjust = iter.getMFunctionThisAdjust();
- BasicMemberFunctionType func = new BasicMemberFunctionType(null,
- POINTER_SIZE,
- retType,
- container,
- thisType,
- thisAdjust);
- DebugVC50TypeIterator argIter = iter.getMFunctionArgumentListIterator();
- for (int i = 0; i < argIter.getArgListCount(); i++) {
- func.addArgumentType(getTypeByIndex(argIter.getArgListType(i)));
- }
- putType(func);
- break;
- }
- // FIXME: handle virtual function table shape description
- case LF_VTSHAPE: break;
- case LF_BARRAY: System.err.println("FIXME: don't know what to do with LF_BARRAY leaves (convert to pointers?"); break;
- case LF_LABEL: break;
- case LF_NULL: break; // FIXME: do we need to handle this? With what?
- case LF_DIMARRAY: System.err.println("FIXME: don't know what to do with LF_DIMARRAY leaves yet"); break;
- case LF_VFTPATH: break;
- case LF_PRECOMP: break;
- case LF_ENDPRECOMP: break;
- case LF_OEM: break;
- case LF_TYPESERVER: break;
-
- // Type records referenced from other type records
-
- case LF_SKIP: break;
- case LF_ARGLIST: skipTypeRecord(); break;
- case LF_DEFARG: System.err.println("FIXME: handle default arguments (dereference the type)"); break;
- case LF_FIELDLIST: skipTypeRecord(); break;
- case LF_DERIVED: break;
- case LF_BITFIELD: {
- Type underlyingType = getTypeByIndex(iter.getBitfieldFieldType());
- BasicBitType bit = new BasicBitType(underlyingType,
- (iter.getBitfieldLength() & 0xFF),
- (iter.getBitfieldPosition() & 0xFF));
- putType(bit);
- break;
- }
- case LF_METHODLIST: break;
- case LF_DIMCONU:
- case LF_DIMCONLU:
- case LF_DIMVARU:
- case LF_DIMVARLU: break;
- case LF_REFSYM: break;
-
- case LF_PAD0: case LF_PAD1: case LF_PAD2: case LF_PAD3:
- case LF_PAD4: case LF_PAD5: case LF_PAD6: case LF_PAD7:
- case LF_PAD8: case LF_PAD9: case LF_PAD10: case LF_PAD11:
- case LF_PAD12: case LF_PAD13: case LF_PAD14: case LF_PAD15: break;
-
- default: {
- System.err.println("Unexpected leaf index " +
- iter.typeStringLeaf() + " at offset 0x" +
- Integer.toHexString(iter.typeStringOffset()));
- break;
- }
- }
-
-
- if (!iter.typeStringDone()) {
- iter.typeStringNext();
- }
- }
- }
-
- // Add all symbol directories to debug info
- // (FIXME: must figure out how to handle module-by-module
- // arrangement of at least the static symbols to have proper
- // lookup -- should probably also take advantage of the PROCREF
- // and UDT references to understand how to build the global
- // database vs. the module-by-module one)
- DebugVC50SubsectionDirectory dir = vc50.getSubsectionDirectory();
- int moduleNumber = 0; // Debugging
- for (int i = 0; i < dir.getNumEntries(); i++) {
- DebugVC50Subsection ss = dir.getSubsection(i);
- int ssType = ss.getSubsectionType();
- boolean process = false;
-
- if ((ssType == SST_GLOBAL_SYM) ||
- (ssType == SST_GLOBAL_PUB) ||
- (ssType == SST_STATIC_SYM)) {
- DebugVC50SSSymbolBase syms = (DebugVC50SSSymbolBase) ss;
- symIter = syms.getSymbolIterator();
- process = true;
- }
-
- if (ssType == SST_ALIGN_SYM) {
- DebugVC50SSAlignSym syms = (DebugVC50SSAlignSym) ss;
- symIter = syms.getSymbolIterator();
- process = true;
- }
-
- if (process) {
- for (; !symIter.done(); symIter.next()) {
- switch (symIter.getType()) {
- case S_COMPILE: break;
- case S_SSEARCH: break; // FIXME: may need this later
- case S_END: {
- try {
- // FIXME: workaround for warnings until we figure out
- // what to do with THUNK32 symbols
- if (endsToSkip == 0) {
- blockStack.pop();
- } else {
- --endsToSkip;
- }
- } catch (EmptyStackException e) {
- System.err.println("WARNING: mismatched block begins/ends in debug information");
- }
- break;
- }
- case S_SKIP: break;
- case S_CVRESERVE: break;
- case S_OBJNAME: break; // FIXME: may need this later
- case S_ENDARG: break;
- case S_COBOLUDT: break;
- case S_MANYREG: break; // FIXME: may need to add support for this
- case S_RETURN: break; // NOTE: would need this if adding support for calling functions
- case S_ENTRYTHIS: break; // FIXME: may need to add support for this
- case S_REGISTER: break; // FIXME: may need to add support for this
- case S_CONSTANT: break; // FIXME: will need to add support for this
- case S_UDT: break; // FIXME: need to see how these are used; are
- // they redundant, or are they used to describe
- // global variables as opposed to types?
- case S_COBOLUDT2: break;
- case S_MANYREG2: break;
- case S_BPREL32: {
- LocalSym sym = new BasicLocalSym(symIter.getBPRelName(),
- getTypeByIndex(symIter.getBPRelType()),
- symIter.getBPRelOffset());
- addLocalToCurBlock(sym);
- break;
- }
- case S_LDATA32:
- case S_GDATA32: {
- // FIXME: must handle these separately from global data (have
- // module scoping and only add these at the module level)
- boolean isModuleLocal = (symIter.getType() == S_LDATA32);
-
- GlobalSym sym = new BasicGlobalSym(symIter.getLGDataName(),
- getTypeByIndex(symIter.getLGDataType()),
- newAddress(symIter.getLGDataOffset(), symIter.getLGDataSegment()),
- isModuleLocal);
- // FIXME: must handle module-local symbols differently
- addGlobalSym(sym);
- break;
- }
- case S_PUB32: break; // FIXME: figure out how these differ from
- // above and how they are used
- case S_LPROC32:
- case S_GPROC32: {
- BasicFunctionSym sym = new BasicFunctionSym(newLazyBlockSym(symIter.getLGProcParentOffset()),
- symIter.getLGProcLength(),
- newAddress(symIter.getLGProcOffset(), symIter.getLGProcSegment()),
- symIter.getLGProcName(),
- getTypeByIndex(symIter.getLGProcType()),
- (symIter.getType() == S_LPROC32));
-
- // FIXME: have to handle local procedures differently (have
- // notion of modules and only add those procedures to the
- // module they are defined in)
- addBlock(sym);
- break;
- }
- case S_THUNK32: {
- // FIXME: see whether we need to handle these
- skipEnd();
- break;
- }
- case S_BLOCK32: {
- BasicBlockSym sym = new BasicBlockSym(newLazyBlockSym(symIter.getBlockParentOffset()),
- symIter.getBlockLength(),
- newAddress(symIter.getBlockOffset(), symIter.getBlockSegment()),
- symIter.getBlockName());
- addBlock(sym);
- break;
- }
- case S_WITH32: break;
- case S_LABEL32: break;
- case S_CEXMODEL32: break;
- case S_VFTTABLE32: break; // FIXME: may need to handle this
- // (most likely for run-time type determination)
- case S_REGREL32: break; // FIXME: may need to add support for this
- case S_LTHREAD32: break;
- case S_GTHREAD32: break; // FIXME: may need to add support for these
- case S_PROCREF: break;
- case S_DATAREF: break;
- case S_ALIGN: break;
- default:
- // These two unknown symbol types show up very frequently.
- // Symbol type 0 appears to always be a no-op symbol of
- // length 2 (i.e., length just covers the symbol type.)
- // Symbol type 4115 appears to be a copyright notice for
- // the Microsoft linker.
- if ((symIter.getType() != 0) && (symIter.getType() != 4115)) {
- System.err.println(" NOTE: Unexpected symbol of type " +
- symIter.getType() + " at offset 0x" +
- Integer.toHexString(symIter.getOffset()));
- }
- break;
- }
- }
- }
- }
-
- // Add line number information for all modules
- for (int i = 0; i < dir.getNumEntries(); i++) {
- DebugVC50Subsection ss = dir.getSubsection(i);
- if (ss.getSubsectionType() == SST_SRC_MODULE) {
- DebugVC50SSSrcModule srcMod = (DebugVC50SSSrcModule) ss;
- for (int sf = 0; sf < srcMod.getNumSourceFiles(); sf++) {
- DebugVC50SrcModFileDesc desc = srcMod.getSourceFileDesc(sf);
- // Uniquify these to save space
- String name = desc.getSourceFileName().intern();
- for (int cs = 0; cs < desc.getNumCodeSegments(); cs++) {
- DebugVC50SrcModLineNumberMap map = desc.getLineNumberMap(cs);
- SectionHeader seg = file.getHeader().getSectionHeader(map.getSegment());
- for (int lp = 0; lp < map.getNumSourceLinePairs(); lp++) {
- Address startPC = base.addOffsetTo(seg.getVirtualAddress() + map.getCodeOffset(lp));
- // Fake address for endPC -- will be filled in by BasicLineNumberMapping
- Address endPC = base.addOffsetTo(seg.getSize());
- db.addLineNumberInfo(new BasicLineNumberInfo(name, map.getLineNumber(lp), startPC, endPC));
- }
- }
- }
- }
- }
-
- // Finish assembly of database
- db.resolve(new ResolveListener() {
- public void resolveFailed(Type containingType, LazyType failedResolve, String detail) {
- System.err.println("WARNING: failed to resolve type of index " +
- ((Integer) failedResolve.getKey()).intValue() +
- " in type " + containingType.getName() + " (class " +
- containingType.getClass().getName() + ") while " + detail);
- }
-
- public void resolveFailed(Type containingType, String staticFieldName) {
- System.err.println("WARNING: failed to resolve address of static field \"" +
- staticFieldName + "\" in type " + containingType.getName());
- }
-
- public void resolveFailed(Sym containingSymbol, LazyType failedResolve, String detail) {
- System.err.println("WARNING: failed to resolve type of index " +
- ((Integer) failedResolve.getKey()).intValue() +
- " in symbol of type " + containingSymbol.getClass().getName() +
- " while " + detail);
- }
-
- public void resolveFailed(Sym containingSymbol, LazyBlockSym failedResolve, String detail) {
- System.err.println("WARNING: failed to resolve block at offset 0x" +
- Integer.toHexString(((Integer) failedResolve.getKey()).intValue()) +
- " in symbol of type " + containingSymbol.getClass().getName() +
- " while " + detail);
- }
- });
-
- db.endConstruction();
-
- return db;
- }
-
-
- //----------------------------------------------------------------------
- // Internals only below this point
- //
-
- private static DebugVC50 getDebugVC50(COFFFile file) {
- COFFHeader header = file.getHeader();
- OptionalHeader opt = header.getOptionalHeader();
- if (opt == null) {
- // Optional header not found
- return null;
- }
- OptionalHeaderDataDirectories dd = opt.getDataDirectories();
- if (dd == null) {
- // Optional header data directories not found
- return null;
- }
- DebugDirectory debug = dd.getDebugDirectory();
- if (debug == null) {
- // Debug directory not found
- return null;
- }
- for (int i = 0; i < debug.getNumEntries(); i++) {
- DebugDirectoryEntry entry = debug.getEntry(i);
- if (entry.getType() == DebugTypes.IMAGE_DEBUG_TYPE_CODEVIEW) {
- return entry.getDebugVC50();
- }
- }
-
- // CodeView information not found in debug directory
- return null;
- }
-
- private DebugVC50SSSegMap getSegMap() {
- return (DebugVC50SSSegMap) findSubsection(SST_SEG_MAP);
- }
-
- private DebugVC50SSGlobalTypes getGlobalTypes() {
- return (DebugVC50SSGlobalTypes) findSubsection(SST_GLOBAL_TYPES);
- }
-
- private DebugVC50SSGlobalSym getGlobalSymbols() {
- return (DebugVC50SSGlobalSym) findSubsection(SST_GLOBAL_SYM);
- }
-
- private DebugVC50Subsection findSubsection(short ssType) {
- DebugVC50SubsectionDirectory dir = vc50.getSubsectionDirectory();
- for (int i = 0; i < dir.getNumEntries(); i++) {
- DebugVC50Subsection ss = dir.getSubsection(i);
- if (ss.getSubsectionType() == ssType) {
- return ss;
- }
- }
- throw new DebuggerException("Unable to find subsection of type " + ssType);
- }
-
- private void putType(Type t) {
- db.addType(new Integer(iter.getTypeIndex()), t);
- }
-
- private Address newAddress(int offset, short segment) {
- int seg = segment & 0xFFFF;
- // NOTE: it isn't clear how to use the segMap to map from logical
- // to physical segments. It seems it would make more sense if the
- // SegDescs contained a physical segment number in addition to the
- // offset within the physical segment of the logical one.
-
- // Get the section header corresponding to this segment
- SectionHeader section = file.getHeader().getSectionHeader(seg);
-
- // Result is relative to image base
- return base.addOffsetTo(section.getVirtualAddress() + offset);
- }
-
- private BasicType getTypeByIndex(int intIndex) {
- Integer index = new Integer(intIndex);
-
- // Handle primitive types here.
- if (intIndex <= 0x0FFF) {
- BasicType type = (BasicType) primIndexToTypeMap.get(index);
- if (type != null) {
- return type;
- }
- // Construct appropriate new primitive type
- int primMode = intIndex & RESERVED_MODE_MASK;
- if (primMode == RESERVED_MODE_DIRECT) {
- int primType = intIndex & RESERVED_TYPE_MASK;
- switch (primType) {
- case RESERVED_TYPE_SIGNED_INT:
- case RESERVED_TYPE_UNSIGNED_INT: {
- boolean unsigned = (primType == RESERVED_TYPE_UNSIGNED_INT);
- int size = 0;
- String name = null;
- switch (intIndex & RESERVED_SIZE_MASK) {
- case RESERVED_SIZE_INT_1_BYTE: size = 1; name = "char"; break;
- case RESERVED_SIZE_INT_2_BYTE: size = 2; name = "short"; break;
- case RESERVED_SIZE_INT_4_BYTE: size = 4; name = "int"; break;
- case RESERVED_SIZE_INT_8_BYTE: size = 8; name = "__int64"; break;
- default: throw new DebuggerException("Illegal size of integer type " + intIndex);
- }
- type = new BasicIntType(name, size, unsigned);
- break;
- }
- case RESERVED_TYPE_BOOLEAN: {
- int size = 0;
- switch (intIndex & RESERVED_SIZE_MASK) {
- case RESERVED_SIZE_INT_1_BYTE: size = 1; break;
- case RESERVED_SIZE_INT_2_BYTE: size = 2; break;
- case RESERVED_SIZE_INT_4_BYTE: size = 4; break;
- case RESERVED_SIZE_INT_8_BYTE: size = 8; break;
- default: throw new DebuggerException("Illegal size of boolean type " + intIndex);
- }
- type = new BasicIntType("bool", size, false);
- break;
- }
- case RESERVED_TYPE_REAL: {
- switch (intIndex & RESERVED_SIZE_MASK) {
- case RESERVED_SIZE_REAL_32_BIT:
- type = new BasicFloatType("float", 4);
- break;
- case RESERVED_SIZE_REAL_64_BIT:
- type = new BasicDoubleType("double", 8);
- break;
- default:
- throw new DebuggerException("Unsupported floating-point size in type " + intIndex);
- }
- break;
- }
- case RESERVED_TYPE_REALLY_INT: {
- switch (intIndex & RESERVED_SIZE_MASK) {
- case RESERVED_SIZE_REALLY_INT_CHAR: type = new BasicIntType("char", 1, false); break;
- case RESERVED_SIZE_REALLY_INT_WCHAR: type = new BasicIntType("wchar", 2, false); break;
- case RESERVED_SIZE_REALLY_INT_2_BYTE: type = new BasicIntType("short", 2, false); break;
- case RESERVED_SIZE_REALLY_INT_2_BYTE_U: type = new BasicIntType("short", 2, true); break;
- case RESERVED_SIZE_REALLY_INT_4_BYTE: type = new BasicIntType("int", 4, false); break;
- case RESERVED_SIZE_REALLY_INT_4_BYTE_U: type = new BasicIntType("int", 4, true); break;
- case RESERVED_SIZE_REALLY_INT_8_BYTE: type = new BasicIntType("__int64", 8, false); break;
- case RESERVED_SIZE_REALLY_INT_8_BYTE_U: type = new BasicIntType("__int64", 8, true); break;
- default: throw new DebuggerException("Illegal REALLY_INT size in type " + intIndex);
- }
- break;
- }
- case RESERVED_TYPE_SPECIAL: {
- switch (intIndex & RESERVED_SIZE_MASK) {
- case RESERVED_SIZE_SPECIAL_NO_TYPE:
- case RESERVED_SIZE_SPECIAL_VOID: type = new BasicVoidType(); break;
- default: throw new DebuggerException("Don't know how to handle reserved special type " + intIndex);
- }
- break;
- }
-
- default:
- throw new DebuggerException("Don't know how to handle reserved type " + intIndex);
- }
- } else {
- // Fold all pointer types together since we only support
- // flat-mode addressing anyway
- Type targetType = getTypeByIndex(intIndex & (~RESERVED_MODE_MASK));
-
- type = new BasicPointerType(POINTER_SIZE, targetType);
- }
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(type != null, "Got null Type for primitive type " + intIndex);
- }
- primIndexToTypeMap.put(index, type);
- return type;
- }
-
- // Not primitive type. Construct lazy reference to target type.
- // (Is it worth canonicalizing these as well to save space?)
- return new LazyType(index);
- }
-
- private void addBlock(BlockSym block) {
- db.addBlock(new Integer(symIter.getOffset()), block);
- blockStack.push(block);
- }
-
- private void skipEnd() {
- ++endsToSkip;
- }
-
- private BlockSym newLazyBlockSym(int offset) {
- if (offset == 0) {
- return null;
- }
-
- return new LazyBlockSym(new Integer(offset));
- }
-
- private int memberAttributeToAccessControl(short memberAttribute) {
- int acc = memberAttribute & MEMATTR_ACCESS_MASK;
- switch (acc) {
- case MEMATTR_ACCESS_NO_PROTECTION: return NO_PROTECTION;
- case MEMATTR_ACCESS_PRIVATE: return PRIVATE;
- case MEMATTR_ACCESS_PROTECTED: return PROTECTED;
- case MEMATTR_ACCESS_PUBLIC: return PUBLIC;
- default: throw new RuntimeException("Should not reach here");
- }
- }
-
- private void addLocalToCurBlock(LocalSym local) {
- ((BasicBlockSym) blockStack.peek()).addLocal(local);
- }
-
- private void addGlobalSym(GlobalSym sym) {
- db.addGlobalSym(sym);
- }
-
- private void skipTypeRecord() {
- while (!iter.typeStringDone()) {
- iter.typeStringNext();
- }
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32CDebugger.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32CDebugger.java
deleted file mode 100644
index 488440f..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32CDebugger.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import java.io.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.cdbg.*;
-import sun.jvm.hotspot.debugger.cdbg.basic.x86.*;
-import sun.jvm.hotspot.debugger.x86.*;
-import sun.jvm.hotspot.utilities.AddressOps;
-
-class Win32CDebugger implements CDebugger, ProcessControl {
- // FIXME: think about how to make this work in a remote debugging
- // scenario; who should keep open DLLs? Need local copies of these
- // DLLs on the debugging machine?
- private Win32Debugger dbg;
-
- Win32CDebugger(Win32Debugger dbg) {
- this.dbg = dbg;
- }
-
- public List getThreadList() throws DebuggerException {
- return dbg.getThreadList();
- }
-
- public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException{
- return dbg.getLoadObjectList();
- }
-
- public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
- // FIXME: could keep sorted list of these to be able to do binary
- // searches, for better scalability
- if (pc == null) {
- return null;
- }
- List objs = getLoadObjectList();
- for (Iterator iter = objs.iterator(); iter.hasNext(); ) {
- LoadObject obj = (LoadObject) iter.next();
- if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) {
- return obj;
- }
- }
- return null;
- }
-
- public CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException {
- X86ThreadContext context = (X86ThreadContext) thread.getContext();
- Address ebp = context.getRegisterAsAddress(X86ThreadContext.EBP);
- if (ebp == null) return null;
- Address pc = context.getRegisterAsAddress(X86ThreadContext.EIP);
- if (pc == null) return null;
- return new X86CFrame(this, ebp, pc);
- }
-
- public String getNameOfFile(String fileName) {
- return new File(fileName).getName();
- }
-
- public ProcessControl getProcessControl() throws DebuggerException {
- return this;
- }
-
- // C++ name demangling
- public boolean canDemangle() {
- return false;
- }
-
- public String demangle(String sym) {
- throw new UnsupportedOperationException();
- }
-
- //
- // Support for ProcessControl interface
- //
-
- public void suspend() throws DebuggerException {
- dbg.suspend();
- }
- public void resume() throws DebuggerException {
- dbg.resume();
- }
- public boolean isSuspended() throws DebuggerException {
- return dbg.isSuspended();
- }
- public void setBreakpoint(Address addr) throws DebuggerException {
- dbg.setBreakpoint(addr);
- }
- public void clearBreakpoint(Address addr) throws DebuggerException {
- dbg.clearBreakpoint(addr);
- }
- public boolean isBreakpointSet(Address addr) throws DebuggerException {
- return dbg.isBreakpointSet(addr);
- }
- public DebugEvent debugEventPoll() throws DebuggerException {
- return dbg.debugEventPoll();
- }
- public void debugEventContinue() throws DebuggerException {
- dbg.debugEventContinue();
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32Debugger.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32Debugger.java
deleted file mode 100644
index 160c8e1..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32Debugger.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import java.util.List;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.cdbg.*;
-
-/** An extension of the JVMDebugger interface with a few additions to
- support 32-bit vs. 64-bit debugging as well as features required
- by the architecture-specific subpackages. */
-
-public interface Win32Debugger extends JVMDebugger {
- public String addressValueToString(long address) throws DebuggerException;
- public boolean readJBoolean(long address) throws DebuggerException;
- public byte readJByte(long address) throws DebuggerException;
- public char readJChar(long address) throws DebuggerException;
- public double readJDouble(long address) throws DebuggerException;
- public float readJFloat(long address) throws DebuggerException;
- public int readJInt(long address) throws DebuggerException;
- public long readJLong(long address) throws DebuggerException;
- public short readJShort(long address) throws DebuggerException;
- public long readCInteger(long address, long numBytes, boolean isUnsigned)
- throws DebuggerException;
- public Win32Address readAddress(long address) throws DebuggerException;
- public Win32Address readCompOopAddress(long address) throws DebuggerException;
- public Win32OopHandle readOopHandle(long address) throws DebuggerException;
- public Win32OopHandle readCompOopHandle(long address) throws DebuggerException;
- public void writeJBoolean(long address, boolean value) throws DebuggerException;
- public void writeJByte(long address, byte value) throws DebuggerException;
- public void writeJChar(long address, char value) throws DebuggerException;
- public void writeJDouble(long address, double value) throws DebuggerException;
- public void writeJFloat(long address, float value) throws DebuggerException;
- public void writeJInt(long address, int value) throws DebuggerException;
- public void writeJLong(long address, long value) throws DebuggerException;
- public void writeJShort(long address, short value) throws DebuggerException;
- public void writeCInteger(long address, long numBytes, long value) throws DebuggerException;
- public void writeAddress(long address, Win32Address value) throws DebuggerException;
- public void writeOopHandle(long address, Win32OopHandle value) throws DebuggerException;
-
- // On Windows the int is actually the value of a HANDLE which
- // currently must be read from the target process; that is, the
- // target process must maintain its own thread list, each element of
- // which holds a HANDLE to its underlying OS thread. FIXME: should
- // add access to the OS-level thread list, but there are too many
- // limitations imposed by Windows to usefully do so; see
- // src/os/win32/agent/README-commands.txt, command "duphandle".
- //
- // The returned array of register contents is guaranteed to be in
- // the same order as in the DbxDebugger for Solaris/x86; that is,
- // the indices match those in debugger/x86/X86ThreadContext.java.
- public long[] getThreadIntegerRegisterSet(int threadHandleValue,
- boolean mustDuplicateHandle) throws DebuggerException;
- // Implmentation of setContext
- public void setThreadIntegerRegisterSet(int threadHandleValue,
- boolean mustDuplicateHandle,
- long[] contents) throws DebuggerException;
-
- public Address newAddress(long value) throws DebuggerException;
-
- // Routine supporting the ThreadProxy implementation, in particular
- // the ability to get a thread ID from a thread handle via
- // examination of the Thread Information Block. Fetch the LDT entry
- // for a given selector.
- public Win32LDTEntry getThreadSelectorEntry(int threadHandleValue,
- boolean mustDuplicateHandle,
- int selector) throws DebuggerException;
-
- // Support for the CDebugger interface. Retrieves the thread list of
- // the target process as a List of ThreadProxy objects.
- public List/*<ThreadProxy>*/ getThreadList() throws DebuggerException;
-
- // Support for the CDebugger interface. Retrieves a List of the
- // loadobjects in the target process.
- public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException;
-
- // Support for the ProcessControl interface
- public void writeBytesToProcess(long startAddress, long numBytes, byte[] data) throws UnmappedAddressException, DebuggerException;
- public void suspend() throws DebuggerException;
- public void resume() throws DebuggerException;
- public boolean isSuspended() throws DebuggerException;
- public void setBreakpoint(Address addr) throws DebuggerException;
- public void clearBreakpoint(Address addr) throws DebuggerException;
- public boolean isBreakpointSet(Address addr) throws DebuggerException;
- // FIXME: do not want to expose complicated data structures (like
- // the DebugEvent) in this interface due to serialization issues
- public DebugEvent debugEventPoll() throws DebuggerException;
- public void debugEventContinue() throws DebuggerException;
-
- // NOTE: this interface implicitly contains the following methods:
- // From the Debugger interface via JVMDebugger
- // public void attach(int processID) throws DebuggerException;
- // public void attach(String executableName, String coreFileName) throws DebuggerException;
- // public boolean detach();
- // public Address parseAddress(String addressString) throws NumberFormatException;
- // public long getAddressValue(Address addr) throws DebuggerException;
- // public String getOS();
- // public String getCPU();
- // From the SymbolLookup interface via Debugger and JVMDebugger
- // public Address lookup(String objectName, String symbol);
- // public OopHandle lookupOop(String objectName, String symbol);
- // From the JVMDebugger interface
- // public void configureJavaPrimitiveTypeSizes(long jbooleanSize,
- // long jbyteSize,
- // long jcharSize,
- // long jdoubleSize,
- // long jfloatSize,
- // long jintSize,
- // long jlongSize,
- // long jshortSize);
- // From the ThreadAccess interface via Debugger and JVMDebugger
- // public ThreadProxy getThreadForIdentifierAddress(Address addr);
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32DebuggerLocal.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32DebuggerLocal.java
deleted file mode 100644
index c45bd6f..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32DebuggerLocal.java
+++ /dev/null
@@ -1,1083 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.x86.*;
-import sun.jvm.hotspot.debugger.win32.coff.*;
-import sun.jvm.hotspot.debugger.cdbg.*;
-import sun.jvm.hotspot.debugger.cdbg.basic.BasicDebugEvent;
-import sun.jvm.hotspot.utilities.*;
-import sun.jvm.hotspot.utilities.memo.*;
-
-/** <P> An implementation of the JVMDebugger interface which talks to
- the Free Windows Debug Server (FwDbgSrv) over a socket to
- implement attach/detach and read from process memory. All DLL and
- symbol table management is done in Java. </P>
-
- <P> <B>NOTE</B> that since we have the notion of fetching "Java
- primitive types" from the remote process (which might have
- different sizes than we expect) we have a bootstrapping
- problem. We need to know the sizes of these types before we can
- fetch them. The current implementation solves this problem by
- requiring that it be configured with these type sizes before they
- can be fetched. The readJ(Type) routines here will throw a
- RuntimeException if they are called before the debugger is
- configured with the Java primitive type sizes. </P> */
-
-public class Win32DebuggerLocal extends DebuggerBase implements Win32Debugger {
- private Socket debuggerSocket;
- private boolean attached;
- // FIXME: update when core files supported
- private long pid;
- // Communication with debug server
- private PrintWriter out;
- private DataOutputStream rawOut;
- private InputLexer in;
- private static final int PORT = 27000;
- private PageCache cache;
- private static final long SHORT_TIMEOUT = 2000;
- private static final long LONG_TIMEOUT = 20000;
-
- // Symbol lookup support
- // This is a map of library names to DLLs
- private Map nameToDllMap;
-
- // C/C++ debugging support
- private List/*<LoadObject>*/ loadObjects;
- private CDebugger cdbg;
-
- // ProcessControl support
- private boolean suspended;
- // Maps Long objects (addresses) to Byte objects (original instructions)
- // (Longs used instead of Addresses to properly represent breakpoints at 0x0 if needed)
- private Map breakpoints;
- // Current debug event, if any
- private DebugEvent curDebugEvent;
-
- //--------------------------------------------------------------------------------
- // Implementation of Debugger interface
- //
-
- /** <P> machDesc may not be null. </P>
-
- <P> useCache should be set to true if debugging is being done
- locally, and to false if the debugger is being created for the
- purpose of supporting remote debugging. </P> */
- public Win32DebuggerLocal(MachineDescription machDesc,
- boolean useCache) throws DebuggerException {
- this.machDesc = machDesc;
- utils = new DebuggerUtilities(machDesc.getAddressSize(), machDesc.isBigEndian());
- if (useCache) {
- // Cache portion of the remote process's address space.
- // Fetching data over the socket connection to dbx is slow.
- // Might be faster if we were using a binary protocol to talk to
- // dbx, but would have to test. For now, this cache works best
- // if it covers the entire heap of the remote process. FIXME: at
- // least should make this tunable from the outside, i.e., via
- // the UI. This is a cache of 4096 4K pages, or 16 MB. The page
- // size must be adjusted to be the hardware's page size.
- // (FIXME: should pick this up from the debugger.)
- initCache(4096, parseCacheNumPagesProperty(4096));
- }
- // FIXME: add instantiation of thread factory
-
- try {
- connectToDebugServer();
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- /** From the Debugger interface via JVMDebugger */
- public boolean hasProcessList() throws DebuggerException {
- return true;
- }
-
- /** From the Debugger interface via JVMDebugger */
- public List getProcessList() throws DebuggerException {
- List processes = new ArrayList();
-
- try {
- printlnToOutput("proclist");
- int num = in.parseInt();
- for (int i = 0; i < num; i++) {
- int pid = in.parseInt();
- String name = parseString();
- // NOTE: Win32 hack
- if (name.equals("")) {
- name = "System Idle Process";
- }
- processes.add(new ProcessInfo(name, pid));
- }
- return processes;
- }
- catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- /** From the Debugger interface via JVMDebugger */
- public synchronized void attach(int processID) throws DebuggerException {
- if (attached) {
- // FIXME: update when core files supported
- throw new DebuggerException("Already attached to process " + pid);
- }
-
- try {
- printlnToOutput("attach " + processID);
- if (!in.parseBoolean()) {
- throw new DebuggerException("Error attaching to process, or no such process");
- }
-
- attached = true;
- pid = processID;
- suspended = true;
- breakpoints = new HashMap();
- curDebugEvent = null;
- nameToDllMap = null;
- loadObjects = null;
- }
- catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- /** From the Debugger interface via JVMDebugger */
- public synchronized void attach(String executableName, String coreFileName) throws DebuggerException {
- throw new DebuggerException("Core files not yet supported on Win32");
- }
-
- /** From the Debugger interface via JVMDebugger */
- public synchronized boolean detach() {
- if (!attached) {
- return false;
- }
-
- attached = false;
- suspended = false;
- breakpoints = null;
-
- // Close all open DLLs
- if (nameToDllMap != null) {
- for (Iterator iter = nameToDllMap.values().iterator(); iter.hasNext(); ) {
- DLL dll = (DLL) iter.next();
- dll.close();
- }
- nameToDllMap = null;
- loadObjects = null;
- }
-
- cdbg = null;
- clearCache();
-
- try {
- printlnToOutput("detach");
- return in.parseBoolean();
- }
- catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- /** From the Debugger interface via JVMDebugger */
- public Address parseAddress(String addressString) throws NumberFormatException {
- return newAddress(utils.scanAddress(addressString));
- }
-
- /** From the Debugger interface via JVMDebugger */
- public String getOS() {
- return PlatformInfo.getOS();
- }
-
- /** From the Debugger interface via JVMDebugger */
- public String getCPU() {
- return PlatformInfo.getCPU();
- }
-
- public boolean hasConsole() throws DebuggerException {
- return false;
- }
-
- public String consoleExecuteCommand(String cmd) throws DebuggerException {
- throw new DebuggerException("No debugger console available on Win32");
- }
-
- public String getConsolePrompt() throws DebuggerException {
- return null;
- }
-
- public CDebugger getCDebugger() throws DebuggerException {
- if (cdbg == null) {
- cdbg = new Win32CDebugger(this);
- }
- return cdbg;
- }
-
- /** From the SymbolLookup interface via Debugger and JVMDebugger */
- public synchronized Address lookup(String objectName, String symbol) {
- if (!attached) {
- return null;
- }
- return newAddress(lookupInProcess(objectName, symbol));
- }
-
- /** From the SymbolLookup interface via Debugger and JVMDebugger */
- public synchronized OopHandle lookupOop(String objectName, String symbol) {
- Address addr = lookup(objectName, symbol);
- if (addr == null) {
- return null;
- }
- return addr.addOffsetToAsOopHandle(0);
- }
-
- /** From the Debugger interface */
- public MachineDescription getMachineDescription() {
- return machDesc;
- }
-
- //--------------------------------------------------------------------------------
- // Implementation of ThreadAccess interface
- //
-
- /** From the ThreadAccess interface via Debugger and JVMDebugger */
- public ThreadProxy getThreadForIdentifierAddress(Address addr) {
- return new Win32Thread(this, addr);
- }
-
- public ThreadProxy getThreadForThreadId(long handle) {
- return new Win32Thread(this, handle);
- }
-
- //----------------------------------------------------------------------
- // Overridden from DebuggerBase because we need to relax alignment
- // constraints on x86
-
- public long readJLong(long address)
- throws UnmappedAddressException, UnalignedAddressException {
- checkJavaConfigured();
- // FIXME: allow this to be configurable. Undesirable to add a
- // dependency on the runtime package here, though, since this
- // package should be strictly underneath it.
- // utils.checkAlignment(address, jlongSize);
- utils.checkAlignment(address, jintSize);
- byte[] data = readBytes(address, jlongSize);
- return utils.dataToJLong(data, jlongSize);
- }
-
- //--------------------------------------------------------------------------------
- // Internal routines (for implementation of Win32Address).
- // These must not be called until the MachineDescription has been set up.
- //
-
- /** From the Win32Debugger interface */
- public String addressValueToString(long address) {
- return utils.addressValueToString(address);
- }
-
- /** From the Win32Debugger interface */
- public Win32Address readAddress(long address)
- throws UnmappedAddressException, UnalignedAddressException {
- return (Win32Address) newAddress(readAddressValue(address));
- }
-
- public Win32Address readCompOopAddress(long address)
- throws UnmappedAddressException, UnalignedAddressException {
- return (Win32Address) newAddress(readCompOopAddressValue(address));
- }
-
- /** From the Win32Debugger interface */
- public Win32OopHandle readOopHandle(long address)
- throws UnmappedAddressException, UnalignedAddressException, NotInHeapException {
- long value = readAddressValue(address);
- return (value == 0 ? null : new Win32OopHandle(this, value));
- }
- public Win32OopHandle readCompOopHandle(long address)
- throws UnmappedAddressException, UnalignedAddressException, NotInHeapException {
- long value = readCompOopAddressValue(address);
- return (value == 0 ? null : new Win32OopHandle(this, value));
- }
-
- /** From the Win32Debugger interface */
- public void writeAddress(long address, Win32Address value) {
- writeAddressValue(address, getAddressValue(value));
- }
-
- /** From the Win32Debugger interface */
- public void writeOopHandle(long address, Win32OopHandle value) {
- writeAddressValue(address, getAddressValue(value));
- }
-
- //--------------------------------------------------------------------------------
- // Thread context access
- //
-
- public synchronized long[] getThreadIntegerRegisterSet(int threadHandleValue,
- boolean mustDuplicateHandle)
- throws DebuggerException {
- if (!suspended) {
- throw new DebuggerException("Process not suspended");
- }
-
- try {
- int handle = threadHandleValue;
- if (mustDuplicateHandle) {
- printlnToOutput("duphandle 0x" + Integer.toHexString(threadHandleValue));
- if (!in.parseBoolean()) {
- throw new DebuggerException("Error duplicating thread handle 0x" + threadHandleValue);
- }
- handle = (int) in.parseAddress(); // Must close to avoid leaks
- }
- printlnToOutput("getcontext 0x" + Integer.toHexString(handle));
- if (!in.parseBoolean()) {
- if (mustDuplicateHandle) {
- printlnToOutput("closehandle 0x" + Integer.toHexString(handle));
- }
- String failMessage = "GetThreadContext failed for thread handle 0x" +
- Integer.toHexString(handle);
- if (mustDuplicateHandle) {
- failMessage = failMessage + ", duplicated from thread handle " +
- Integer.toHexString(threadHandleValue);
- }
- throw new DebuggerException(failMessage);
- }
- // Otherwise, parse all registers. See
- // src/os/win32/agent/README-commands.txt for the format.
- // Note the array we have to return has to match that specified by
- // X86ThreadContext.java.
- int numRegs = 22;
- long[] winRegs = new long[numRegs];
- for (int i = 0; i < numRegs; i++) {
- winRegs[i] = in.parseAddress();
- }
- if (mustDuplicateHandle) {
- // Clean up after ourselves
- printlnToOutput("closehandle 0x" + Integer.toHexString(handle));
- }
- // Now create the real return value
- long[] retval = new long[X86ThreadContext.NPRGREG];
- retval[X86ThreadContext.EAX] = winRegs[0];
- retval[X86ThreadContext.EBX] = winRegs[1];
- retval[X86ThreadContext.ECX] = winRegs[2];
- retval[X86ThreadContext.EDX] = winRegs[3];
- retval[X86ThreadContext.ESI] = winRegs[4];
- retval[X86ThreadContext.EDI] = winRegs[5];
- retval[X86ThreadContext.EBP] = winRegs[6];
- retval[X86ThreadContext.ESP] = winRegs[7];
- retval[X86ThreadContext.EIP] = winRegs[8];
- retval[X86ThreadContext.DS] = winRegs[9];
- retval[X86ThreadContext.ES] = winRegs[10];
- retval[X86ThreadContext.FS] = winRegs[11];
- retval[X86ThreadContext.GS] = winRegs[12];
- retval[X86ThreadContext.CS] = winRegs[13];
- retval[X86ThreadContext.SS] = winRegs[14];
- retval[X86ThreadContext.EFL] = winRegs[15];
- retval[X86ThreadContext.DR0] = winRegs[16];
- retval[X86ThreadContext.DR1] = winRegs[17];
- retval[X86ThreadContext.DR2] = winRegs[18];
- retval[X86ThreadContext.DR3] = winRegs[19];
- retval[X86ThreadContext.DR6] = winRegs[20];
- retval[X86ThreadContext.DR7] = winRegs[21];
- return retval;
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- public synchronized void setThreadIntegerRegisterSet(int threadHandleValue,
- boolean mustDuplicateHandle,
- long[] context)
- throws DebuggerException {
- if (!suspended) {
- throw new DebuggerException("Process not suspended");
- }
-
- try {
- int handle = threadHandleValue;
- if (mustDuplicateHandle) {
- printlnToOutput("duphandle 0x" + Integer.toHexString(threadHandleValue));
- if (!in.parseBoolean()) {
- throw new DebuggerException("Error duplicating thread handle 0x" + threadHandleValue);
- }
- handle = (int) in.parseAddress(); // Must close to avoid leaks
- }
- // Change order of registers to match that of debug server
- long[] winRegs = new long[context.length];
- winRegs[0] = context[X86ThreadContext.EAX];
- winRegs[1] = context[X86ThreadContext.EBX];
- winRegs[2] = context[X86ThreadContext.ECX];
- winRegs[3] = context[X86ThreadContext.EDX];
- winRegs[4] = context[X86ThreadContext.ESI];
- winRegs[5] = context[X86ThreadContext.EDI];
- winRegs[6] = context[X86ThreadContext.EBP];
- winRegs[7] = context[X86ThreadContext.ESP];
- winRegs[8] = context[X86ThreadContext.EIP];
- winRegs[9] = context[X86ThreadContext.DS];
- winRegs[10] = context[X86ThreadContext.ES];
- winRegs[11] = context[X86ThreadContext.FS];
- winRegs[12] = context[X86ThreadContext.GS];
- winRegs[13] = context[X86ThreadContext.CS];
- winRegs[14] = context[X86ThreadContext.SS];
- winRegs[15] = context[X86ThreadContext.EFL];
- winRegs[16] = context[X86ThreadContext.DR0];
- winRegs[17] = context[X86ThreadContext.DR1];
- winRegs[18] = context[X86ThreadContext.DR2];
- winRegs[19] = context[X86ThreadContext.DR3];
- winRegs[20] = context[X86ThreadContext.DR6];
- winRegs[21] = context[X86ThreadContext.DR7];
- StringBuffer cmd = new StringBuffer();
- cmd.append("setcontext 0x");
- cmd.append(Integer.toHexString(threadHandleValue));
- for (int i = 0; i < context.length; i++) {
- cmd.append(" 0x");
- cmd.append(Long.toHexString(winRegs[i]));
- }
- printlnToOutput(cmd.toString());
- boolean res = in.parseBoolean();
- if (mustDuplicateHandle) {
- printlnToOutput("closehandle 0x" + Integer.toHexString(handle));
- }
- if (!res) {
- String failMessage = "SetThreadContext failed for thread handle 0x" +
- Integer.toHexString(handle);
- if (mustDuplicateHandle) {
- failMessage = failMessage + ", duplicated from thread handle " +
- Integer.toHexString(threadHandleValue);
- }
- throw new DebuggerException(failMessage);
- }
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- /** Fetches the Win32 LDT_ENTRY for the given thread and selector.
- This data structure allows the conversion of a segment-relative
- address to a linear virtual address. For example, it allows the
- expression of operations like "mov eax, fs:[18h]", which fetches
- the thread information block, allowing access to the thread
- ID. */
- public synchronized Win32LDTEntry getThreadSelectorEntry(int threadHandleValue,
- boolean mustDuplicateHandle,
- int selector)
- throws DebuggerException {
- try {
- int handle = threadHandleValue;
- if (mustDuplicateHandle) {
- printlnToOutput("duphandle 0x" + Integer.toHexString(threadHandleValue));
- if (!in.parseBoolean()) {
- throw new DebuggerException("Error duplicating thread handle 0x" + threadHandleValue);
- }
- handle = (int) in.parseAddress(); // Must close to avoid leaks
- }
- printlnToOutput("selectorentry 0x" + Integer.toHexString(handle) + " " + selector);
- if (!in.parseBoolean()) {
- if (mustDuplicateHandle) {
- printlnToOutput("closehandle 0x" + Integer.toHexString(handle));
- }
- throw new DebuggerException("GetThreadContext failed for thread handle 0x" + handle +
- ", duplicated from thread handle " + threadHandleValue);
- }
- // Parse result. See
- // src/os/win32/agent/README-commands.txt for the format.
- short limitLow = (short) in.parseAddress();
- short baseLow = (short) in.parseAddress();
- byte baseMid = (byte) in.parseAddress();
- byte flags1 = (byte) in.parseAddress();
- byte flags2 = (byte) in.parseAddress();
- byte baseHi = (byte) in.parseAddress();
- return new Win32LDTEntry(limitLow, baseLow, baseMid, flags1, flags2, baseHi);
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- public synchronized List getThreadList() throws DebuggerException {
- if (!suspended) {
- throw new DebuggerException("Process not suspended");
- }
-
- try {
- printlnToOutput("threadlist");
- List ret = new ArrayList();
- int numThreads = in.parseInt();
- for (int i = 0; i < numThreads; i++) {
- int handle = (int) in.parseAddress();
- ret.add(new Win32Thread(this, handle));
- }
- return ret;
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- public synchronized List getLoadObjectList() throws DebuggerException {
- if (!suspended) {
- throw new DebuggerException("Process not suspended");
- }
-
- try {
- if (loadObjects == null) {
- loadObjects = new ArrayList();
- nameToDllMap = new HashMap();
- // Get list of library names and base addresses
- printlnToOutput("libinfo");
- int numInfo = in.parseInt();
-
- for (int i = 0; i < numInfo; i++) {
- // NOTE: because Win32 is case insensitive, we standardize on
- // lowercase file names.
- String fullPathName = parseString().toLowerCase();
- Address base = newAddress(in.parseAddress());
-
- File file = new File(fullPathName);
- long size = file.length();
- DLL dll = new DLL(this, fullPathName, size, base);
- String name = file.getName();
- nameToDllMap.put(name, dll);
- loadObjects.add(dll);
- }
- }
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
-
- return loadObjects;
- }
-
- //----------------------------------------------------------------------
- // Process control access
- //
-
- public synchronized void writeBytesToProcess(long startAddress, long numBytes, byte[] data)
- throws UnmappedAddressException, DebuggerException {
- try {
- printToOutput("poke 0x" + Long.toHexString(startAddress) +
- " |");
- writeIntToOutput((int) numBytes);
- writeToOutput(data, 0, (int) numBytes);
- printlnToOutput("");
- if (!in.parseBoolean()) {
- throw new UnmappedAddressException(startAddress);
- }
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- public synchronized void suspend() throws DebuggerException {
- try {
- if (suspended) {
- throw new DebuggerException("Process already suspended");
- }
- printlnToOutput("suspend");
- suspended = true;
- enableCache();
- reresolveLoadObjects();
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- public synchronized void resume() throws DebuggerException {
- try {
- if (!suspended) {
- throw new DebuggerException("Process not suspended");
- }
- disableCache();
- printlnToOutput("resume");
- suspended = false;
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- public synchronized boolean isSuspended() throws DebuggerException {
- return suspended;
- }
-
- public synchronized void setBreakpoint(Address addr) throws DebuggerException {
- if (!suspended) {
- throw new DebuggerException("Process not suspended");
- }
-
- long addrVal = getAddressValue(addr);
- Long where = new Long(addrVal);
- if (breakpoints.get(where) != null) {
- throw new DebuggerException("Breakpoint already set at " + addr);
- }
- Byte what = new Byte(readBytes(addrVal, 1)[0]);
- // Now put 0xCC (int 3) at the target address, fail if can not
- writeBytesToProcess(addrVal, 1, new byte[] { (byte) 0xCC });
- // OK, the breakpoint is set.
- breakpoints.put(where, what);
- }
-
- public synchronized void clearBreakpoint(Address addr) throws DebuggerException {
- if (!suspended) {
- throw new DebuggerException("Process not suspended");
- }
-
- long addrVal = getAddressValue(addr);
- Long where = new Long(addrVal);
- Byte what = (Byte) breakpoints.get(where);
- if (what == null) {
- throw new DebuggerException("Breakpoint not set at " + addr);
- }
- // Put original data back at address
- writeBytesToProcess(addrVal, 1, new byte[] { what.byteValue() });
- // OK, breakpoint is cleared
- breakpoints.remove(where);
- }
-
- public synchronized boolean isBreakpointSet(Address addr) throws DebuggerException {
- return (breakpoints.get(new Long(getAddressValue(addr))) != null);
- }
-
- // Following constants taken from winnt.h
- private static final int EXCEPTION_DEBUG_EVENT = 1;
- private static final int LOAD_DLL_DEBUG_EVENT = 6;
- private static final int UNLOAD_DLL_DEBUG_EVENT = 7;
- private static final int EXCEPTION_ACCESS_VIOLATION = 0xC0000005;
- private static final int EXCEPTION_BREAKPOINT = 0x80000003;
- private static final int EXCEPTION_SINGLE_STEP = 0x80000004;
-
- public synchronized DebugEvent debugEventPoll() throws DebuggerException {
- if (curDebugEvent != null) {
- return curDebugEvent;
- }
-
- try {
- printlnToOutput("pollevent");
- if (!in.parseBoolean()) {
- return null;
- }
- // Otherwise, got a debug event. Need to figure out what kind it is.
- int handle = (int) in.parseAddress();
- ThreadProxy thread = new Win32Thread(this, handle);
- int code = in.parseInt();
- DebugEvent ev = null;
- switch (code) {
- case LOAD_DLL_DEBUG_EVENT: {
- Address addr = newAddress(in.parseAddress());
- ev = BasicDebugEvent.newLoadObjectLoadEvent(thread, addr);
- break;
- }
-
- case UNLOAD_DLL_DEBUG_EVENT: {
- Address addr = newAddress(in.parseAddress());
- ev = BasicDebugEvent.newLoadObjectUnloadEvent(thread, addr);
- break;
- }
-
- case EXCEPTION_DEBUG_EVENT: {
- int exceptionCode = in.parseInt();
- Address pc = newAddress(in.parseAddress());
- switch (exceptionCode) {
- case EXCEPTION_ACCESS_VIOLATION:
- boolean wasWrite = in.parseBoolean();
- Address addr = newAddress(in.parseAddress());
- ev = BasicDebugEvent.newAccessViolationEvent(thread, pc, wasWrite, addr);
- break;
-
- case EXCEPTION_BREAKPOINT:
- ev = BasicDebugEvent.newBreakpointEvent(thread, pc);
- break;
-
- case EXCEPTION_SINGLE_STEP:
- ev = BasicDebugEvent.newSingleStepEvent(thread, pc);
- break;
-
- default:
- ev = BasicDebugEvent.newUnknownEvent(thread,
- "Exception 0x" + Integer.toHexString(exceptionCode) +
- " at PC " + pc);
- break;
- }
- break;
- }
-
- default:
- ev = BasicDebugEvent.newUnknownEvent(thread,
- "Debug event " + code + " occurred");
- break;
- }
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(ev != null, "Must have created event");
- }
- curDebugEvent = ev;
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
-
- return curDebugEvent;
- }
-
- public synchronized void debugEventContinue() throws DebuggerException {
- if (curDebugEvent == null) {
- throw new DebuggerException("No debug event pending");
- }
-
- try {
- ///////////////////////////////////////////////////////////////////
- // //
- // FIXME: this **must** be modified to handle breakpoint events
- // properly. Must temporarily remove the breakpoint and enable
- // single-stepping mode (hiding those single-step events from
- // the user unless they have been requested; currently there is
- // no way to request single-step events; and it isn't clear how
- // to enable them or how the hardware and/or OS typically
- // supports them, i.e., are they on a per-process or per-thread
- // level?) until the process steps past the breakpoint, then put
- // the breakpoint back.
- // //
- ///////////////////////////////////////////////////////////////////
-
- DebugEvent.Type t = curDebugEvent.getType();
- boolean shouldPassOn = true;
- if (t == DebugEvent.Type.BREAKPOINT) {
- // FIXME: correct algorithm appears to be as follows:
- //
- // 1. Check to see whether we know about this breakpoint. If
- // not, it's requested by the user's program and we should
- // ignore it (not pass it on to the program).
- //
- // 2. Replace the original opcode.
- //
- // 3. Set single-stepping mode in the debug registers.
- //
- // 4. Back up the PC.
- //
- // 5. In debugEventPoll(), watch for a single-step event on
- // this thread. When we get it, put the breakpoint back. Only
- // deliver that single-step event if the user has requested
- // single-step events (FIXME: must figure out whether they are
- // per-thread or per-process, and also expose a way to turn
- // them on.)
-
- // To make breakpoints work for now, we will just back up the
- // PC, which we have to do in order to not disrupt the program
- // execution in case the user decides to disable the breakpoint.
-
- if (breakpoints.get(new Long(getAddressValue(curDebugEvent.getPC()))) != null) {
- System.err.println("Backing up PC due to breakpoint");
- X86ThreadContext ctx = (X86ThreadContext) curDebugEvent.getThread().getContext();
- ctx.setRegister(X86ThreadContext.EIP, ctx.getRegister(X86ThreadContext.EIP) - 1);
- curDebugEvent.getThread().setContext(ctx);
- } else {
- System.err.println("Skipping back up of PC since I didn't know about this breakpoint");
- System.err.println("Known breakpoints:");
- for (Iterator iter = breakpoints.keySet().iterator(); iter.hasNext(); ) {
- System.err.println(" 0x" + Long.toHexString(((Long) iter.next()).longValue()));
- }
- }
- shouldPassOn = false;
- } else if (t == DebugEvent.Type.SINGLE_STEP) {
- shouldPassOn = false;
- }
- // Other kinds of debug events are either ignored if passed on
- // or probably should be passed on so the program exits
- // FIXME: generate process exiting events (should be easy)
-
- int val = (shouldPassOn ? 1 : 0);
- printlnToOutput("continueevent " + val);
- if (!in.parseBoolean()) {
- throw new DebuggerException("Unknown error while attempting to continue past debug event");
- }
- curDebugEvent = null;
- } catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- //--------------------------------------------------------------------------------
- // Address access
- //
-
- /** From the Debugger interface */
- public long getAddressValue(Address addr) {
- if (addr == null) return 0;
- return ((Win32Address) addr).getValue();
- }
-
- /** From the Win32Debugger interface */
- public Address newAddress(long value) {
- if (value == 0) return null;
- return new Win32Address(this, value);
- }
-
- //--------------------------------------------------------------------------------
- // Internals only below this point
- //
-
- private String parseString() throws IOException {
- int charSize = in.parseInt();
- int numChars = in.parseInt();
- in.skipByte();
- String str;
- if (charSize == 1) {
- str = in.readByteString(numChars);
- } else {
- str = in.readCharString(numChars);
- }
- return str;
- }
-
- /** Looks up an address in the remote process's address space.
- Returns 0 if symbol not found or upon error. Package private to
- allow Win32DebuggerRemoteIntfImpl access. NOTE that this returns
- a long instead of an Address because we do not want to serialize
- Addresses. */
- synchronized long lookupInProcess(String objectName, String symbol) {
- // NOTE: this assumes that process is suspended (which is probably
- // necessary assumption given that DLLs can be loaded/unloaded as
- // process runs). Should update documentation.
- if (nameToDllMap == null) {
- getLoadObjectList();
- }
- DLL dll = (DLL) nameToDllMap.get(objectName);
- // The DLL can be null because we use this to search through known
- // DLLs in HotSpotTypeDataBase (for example)
- if (dll != null) {
- Win32Address addr = (Win32Address) dll.lookupSymbol(symbol);
- if (addr != null) {
- return addr.getValue();
- }
- }
- return 0;
- }
-
- /** This reads bytes from the remote process. */
- public synchronized ReadResult readBytesFromProcess(long address, long numBytes)
- throws UnmappedAddressException, DebuggerException {
- try {
- String cmd = "peek " + utils.addressValueToString(address) + " " + numBytes;
- printlnToOutput(cmd);
- while (in.readByte() != 'B') {
- }
- byte res = in.readByte();
- if (res == 0) {
- System.err.println("Failing command: " + cmd);
- throw new DebuggerException("Read of remote process address space failed");
- }
- // NOTE: must read ALL of the data regardless of whether we need
- // to throw an UnmappedAddressException. Otherwise will corrupt
- // the input stream each time we have a failure. Not good. Do
- // not want to risk "flushing" the input stream in case a huge
- // read has a hangup in the middle and we leave data on the
- // stream.
- byte[] buf = new byte[(int) numBytes];
- boolean bailOut = false;
- long failureAddress = 0;
- while (numBytes > 0) {
- long len = in.readUnsignedInt();
- boolean isMapped = ((in.readByte() == 0) ? false : true);
- if (!isMapped) {
- if (!bailOut) {
- bailOut = true;
- failureAddress = address;
- }
- } else {
- // This won't work if we have unmapped regions, but if we do
- // then we're going to throw an exception anyway
-
- // NOTE: there is a factor of 20 speed difference between
- // these two ways of doing this read.
- in.readBytes(buf, 0, (int) len);
- }
-
- // Do NOT do this:
- // for (int i = 0; i < (int) len; i++) {
- // buf[i] = in.readByte();
- // }
-
- numBytes -= len;
- address += len;
- }
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(numBytes == 0, "Bug in debug server's implementation of peek");
- }
- if (bailOut) {
- return new ReadResult(failureAddress);
- }
- return new ReadResult(buf);
- }
- catch (IOException e) {
- throw new DebuggerException(e);
- }
- }
-
- /** Convenience routines */
- private void printlnToOutput(String s) throws IOException {
- out.println(s);
- if (out.checkError()) {
- throw new IOException("Error occurred while writing to debug server");
- }
- }
-
- private void printToOutput(String s) throws IOException {
- out.print(s);
- if (out.checkError()) {
- throw new IOException("Error occurred while writing to debug server");
- }
- }
-
- private void writeIntToOutput(int val) throws IOException {
- rawOut.writeInt(val);
- rawOut.flush();
- }
-
- private void writeToOutput(byte[] buf, int off, int len) throws IOException {
- rawOut.write(buf, off, len);
- rawOut.flush();
- }
-
- /** Connects to the debug server, setting up out and in streams. */
- private void connectToDebugServer() throws IOException {
- // Try for a short period of time to connect to debug server; time out
- // with failure if didn't succeed
- debuggerSocket = null;
- long endTime = System.currentTimeMillis() + SHORT_TIMEOUT;
-
- while ((debuggerSocket == null) && (System.currentTimeMillis() < endTime)) {
- try {
- // FIXME: this does not work if we are on a DHCP machine which
- // did not get an IP address this session. It appears to use
- // an old cached address and the connection does not actually
- // succeed. Must file a bug.
- // debuggerSocket = new Socket(InetAddress.getLocalHost(), PORT);
- debuggerSocket = new Socket(InetAddress.getByName("127.0.0.1"), PORT);
- debuggerSocket.setTcpNoDelay(true);
- }
- catch (IOException e) {
- // Swallow IO exceptions while attempting connection
- debuggerSocket = null;
- try {
- // Don't swamp the CPU
- Thread.sleep(750);
- }
- catch (InterruptedException ex) {
- }
- }
- }
-
- if (debuggerSocket == null) {
- // Failed to connect because of timeout
- throw new DebuggerException("Timed out while attempting to connect to debug server (please start SwDbgSrv.exe)");
- }
-
- out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(debuggerSocket.getOutputStream(), "US-ASCII")), true);
- rawOut = new DataOutputStream(new BufferedOutputStream(debuggerSocket.getOutputStream()));
- in = new InputLexer(new BufferedInputStream(debuggerSocket.getInputStream()));
- }
-
- private DLL findDLLByName(String fullPathName) {
- for (Iterator iter = loadObjects.iterator(); iter.hasNext(); ) {
- DLL dll = (DLL) iter.next();
- if (dll.getName().equals(fullPathName)) {
- return dll;
- }
- }
- return null;
- }
-
- private void reresolveLoadObjects() throws DebuggerException {
- try {
- // It is too expensive to throw away the loadobject list every
- // time the process is suspended, largely because of debug
- // information re-parsing. When we suspend the target process we
- // instead fetch the list of loaded libraries in the target and
- // see whether any loadobject needs to be thrown away (because it
- // was unloaded) or invalidated (because it was unloaded and
- // reloaded at a different target address). Note that we don't
- // properly handle the case of a loaded DLL being unloaded,
- // recompiled, and reloaded. We could handle this by keeping a
- // time stamp.
-
- if (loadObjects == null) {
- return;
- }
-
- // Need to create new list since have to figure out which ones
- // were unloaded
- List newLoadObjects = new ArrayList();
-
- // Get list of library names and base addresses
- printlnToOutput("libinfo");
- int numInfo = in.parseInt();
-
- for (int i = 0; i < numInfo; i++) {
- // NOTE: because Win32 is case insensitive, we standardize on
- // lowercase file names.
- String fullPathName = parseString().toLowerCase();
- Address base = newAddress(in.parseAddress());
-
- // Look for full path name in DLL list
- DLL dll = findDLLByName(fullPathName);
- boolean mustLoad = true;
- if (dll != null) {
- loadObjects.remove(dll);
-
- // See whether base addresses match; otherwise, need to reload
- if (AddressOps.equal(base, dll.getBase())) {
- mustLoad = false;
- }
- }
-
- if (mustLoad) {
- // Create new DLL
- File file = new File(fullPathName);
- long size = file.length();
- String name = file.getName();
- dll = new DLL(this, fullPathName, size, base);
- nameToDllMap.put(name, dll);
- }
- newLoadObjects.add(dll);
- }
-
- // All remaining entries in loadObjects have to be removed from
- // the nameToDllMap
- for (Iterator dllIter = loadObjects.iterator(); dllIter.hasNext(); ) {
- DLL dll = (DLL) dllIter.next();
- for (Iterator iter = nameToDllMap.keySet().iterator(); iter.hasNext(); ) {
- String name = (String) iter.next();
- if (nameToDllMap.get(name) == dll) {
- nameToDllMap.remove(name);
- break;
- }
- }
- }
-
- loadObjects = newLoadObjects;
- } catch (IOException e) {
- loadObjects = null;
- nameToDllMap = null;
- throw new DebuggerException(e);
- }
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32LDTEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32LDTEntry.java
deleted file mode 100644
index 03878e7..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32LDTEntry.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import java.io.Serializable;
-
-/** Describes an LDT entry. (Some of the descriptions are taken
- directly from Microsoft's documentation and are copyrighted by
- Microsoft.) */
-
-class Win32LDTEntry implements Serializable {
- private short limitLow;
- private short baseLow;
- private byte baseMid;
- private byte flags1;
- private byte flags2;
- private byte baseHi;
-
- private Win32LDTEntry() {}
-
- public Win32LDTEntry(short limitLow,
- short baseLow,
- byte baseMid,
- byte flags1,
- byte flags2,
- byte baseHi) {
- this.limitLow = limitLow;
- this.baseLow = baseLow;
- this.baseMid = baseMid;
- this.flags1 = flags1;
- this.flags2 = flags2;
- this.baseHi = baseHi;
- }
-
- /** Returns base address of segment */
- public long getBase() { return ( (baseLow & 0xFFFF) |
- ((baseMid & 0xFF) << 16) |
- ((baseHi & 0xFF) << 24)) & 0xFFFFFFFF; }
-
- public short getLimitLow() { return limitLow; }
- public short getBaseLow() { return baseLow; }
- public byte getBaseMid() { return baseMid; }
- public byte getBaseHi() { return baseHi; }
-
- // FIXME: must verify mask and shift are correct
- /** Describes type of segment. See TYPE_ portion of {@link
- sun.jvm.hotspot.debugger.win32.Win32LDTEntryConstants}. */
- public int getType() { return (flags1 & 0x1F); }
-
- // FIXME: verify mask and shift are correct
- /** Privilege level of descriptor: 0 = most privileged, 3 = least privileged */
- public int getPrivilegeLevel() { return ((flags1 & 0x60) >> 5); }
-
- // FIXME: verify mask is correct
- /** Is segment present in physical memory? */
- public boolean isSegmentPhysical() { return ((flags1 & 0x70) != 0); }
-
- // FIXME: verify mask and shift are correct
- /** High bits (16-19) of the address of the last byte of the segment */
- public int getLimitHi() { return (flags2 & 0x0F); }
-
- // FIXME: verify mask is correct
- /** <P> Size of segment. If the segment is a data segment, this
- member contains 1 if the segment is larger than 64 kilobytes (K)
- or 0 if the segment is smaller than or equal to 64K. </P>
-
- <P> If the segment is a code segment, this member contains 1 if
- the segment is a code segment and runs with the default (native
- mode) instruction set. This member contains 0 if the code
- segment is an 80286 code segment and runs with 16-bit offsets
- and the 80286-compatible instruction set. </P> */
- public boolean isDefaultBig() { return ((flags2 & 0x40) != 0); }
-
- // FIXME: verify mask is correct
- /** Returns true if segment is page granular, false if byte
- granular. */
- public boolean isPageGranular() { return ((flags2 & 0x80) != 0); }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32LDTEntryConstants.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32LDTEntryConstants.java
deleted file mode 100644
index 46a0f7d..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32LDTEntryConstants.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-/** Enumerates flags in Win32LDTEntry */
-
-interface Win32LDTEntryConstants {
- // Types of segments
- public static final int TYPE_READ_ONLY_DATA = 0;
- public static final int TYPE_READ_WRITE_DATA = 1;
- public static final int TYPE_UNUSED = 2;
- public static final int TYPE_READ_WRITE_EXPAND_DOWN_DATA = 3;
- public static final int TYPE_EXECUTE_ONLY_CODE = 4;
- public static final int TYPE_EXECUTABLE_READABLE_CODE = 5;
- public static final int TYPE_EXECUTE_ONLY_CONFORMING_CODE = 6;
- public static final int TYPE_EXECUTABLE_READABLE_CONFORMING_CODE = 7;
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32OopHandle.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32OopHandle.java
deleted file mode 100644
index 8491d9a..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32OopHandle.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import sun.jvm.hotspot.debugger.*;
-
-class Win32OopHandle extends Win32Address implements OopHandle {
- Win32OopHandle(Win32Debugger debugger, long addr) {
- super(debugger, addr);
- }
-
- public boolean equals(Object arg) {
- if (arg == null) {
- return false;
- }
-
- if (!(arg instanceof Win32OopHandle)) {
- return false;
- }
-
- return (addr == ((Win32Address) arg).addr);
- }
-
- public Address addOffsetTo (long offset) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("addOffsetTo not applicable to OopHandles (interior object pointers not allowed)");
- }
-
- public Address andWithMask(long mask) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("andWithMask not applicable to OopHandles (i.e., anything but C addresses)");
- }
-
- public Address orWithMask(long mask) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("orWithMask not applicable to OopHandles (i.e., anything but C addresses)");
- }
-
- public Address xorWithMask(long mask) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("xorWithMask not applicable to OopHandles (i.e., anything but C addresses)");
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32Thread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32Thread.java
deleted file mode 100644
index 38eb3f5..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32Thread.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.x86.*;
-
-class Win32Thread implements ThreadProxy {
- private Win32Debugger debugger;
- private int handle;
- private boolean mustDuplicate;
- private boolean gotID;
- private int id;
-
- /** The address argument must be the address of the HANDLE of the
- desired thread in the target process. */
- Win32Thread(Win32Debugger debugger, Address addr) {
- this.debugger = debugger;
- // FIXME: size of data fetched here should be configurable.
- // However, making it so would produce a dependency on the "types"
- // package from the debugger package, which is not desired.
- this.handle = (int) addr.getCIntegerAt(0, 4, true);
- // Thread handles in the target process must be duplicated before
- // fetching their contexts
- mustDuplicate = true;
- gotID = false;
- }
-
- /** The integer argument must be the value of a HANDLE received from
- the "threadlist" operation. */
- Win32Thread(Win32Debugger debugger, long handle) {
- this.debugger = debugger;
- this.handle = (int) handle;
- mustDuplicate = false;
- gotID = false;
- }
-
- public ThreadContext getContext() throws IllegalThreadStateException {
- if (!debugger.isSuspended()) {
- throw new IllegalThreadStateException("Target process must be suspended");
- }
- long[] data = debugger.getThreadIntegerRegisterSet(handle, mustDuplicate);
- Win32ThreadContext context = new Win32ThreadContext(debugger);
- for (int i = 0; i < data.length; i++) {
- context.setRegister(i, data[i]);
- }
- return context;
- }
-
- public boolean canSetContext() throws DebuggerException {
- return true;
- }
-
- public void setContext(ThreadContext thrCtx)
- throws IllegalThreadStateException, DebuggerException {
- if (!debugger.isSuspended()) {
- throw new IllegalThreadStateException("Target process must be suspended");
- }
- X86ThreadContext context = (X86ThreadContext) thrCtx;
- long[] data = new long[X86ThreadContext.NPRGREG];
- for (int i = 0; i < data.length; i++) {
- data[i] = context.getRegister(i);
- }
- debugger.setThreadIntegerRegisterSet(handle, mustDuplicate, data);
- }
-
- public boolean equals(Object obj) {
- if ((obj == null) || !(obj instanceof Win32Thread)) {
- return false;
- }
-
- return (((Win32Thread) obj).getThreadID() == getThreadID());
- }
-
- public int hashCode() {
- return getThreadID();
- }
-
- public String toString() {
- return Integer.toString(getThreadID());
- }
-
- /** Retrieves the thread ID of this thread by examining the Thread
- Information Block. */
- private int getThreadID() {
- if (!gotID) {
- try {
- // Get thread context
- X86ThreadContext context = (X86ThreadContext) getContext();
- // Get LDT entry for FS register
- Win32LDTEntry ldt =
- debugger.getThreadSelectorEntry(handle,
- mustDuplicate,
- (int) context.getRegister(X86ThreadContext.FS));
- // Get base address of segment = Thread Environment Block (TEB)
- Address teb = debugger.newAddress(ldt.getBase());
- // Thread ID is at offset 0x24
- id = (int) teb.getCIntegerAt(0x24, 4, true);
- gotID = true;
- } catch (AddressException e) {
- throw new DebuggerException(e);
- }
- }
-
- return id;
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32ThreadContext.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32ThreadContext.java
deleted file mode 100644
index 831d789..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32ThreadContext.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.debugger.win32;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.debugger.x86.*;
-
-class Win32ThreadContext extends X86ThreadContext {
- private Win32Debugger debugger;
-
- public Win32ThreadContext(Win32Debugger debugger) {
- super();
- this.debugger = debugger;
- }
-
- public void setRegisterAsAddress(int index, Address value) {
- setRegister(index, debugger.getAddressValue(value));
- }
-
- public Address getRegisterAsAddress(int index) {
- return debugger.newAddress(getRegister(index));
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeFastAAccess0.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeFastAAccess0.java
deleted file mode 100644
index b68d3b4..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeFastAAccess0.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.interpreter;
-
-import sun.jvm.hotspot.oops.*;
-import sun.jvm.hotspot.utilities.*;
-
-public class BytecodeFastAAccess0 extends BytecodeGetPut {
- BytecodeFastAAccess0(Method method, int bci) {
- super(method, bci);
- }
-
- public int index() {
- return (int) (0xFF & javaShortAt(2));
- }
-
- public boolean isStatic() {
- return false;
- }
-
- public void verify() {
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(isValid(), "check fast_aaccess_0");
- }
- }
-
- public boolean isValid() {
- return code() == Bytecodes._fast_aaccess_0;
- }
-
- public static BytecodeFastAAccess0 at(Method method, int bci) {
- BytecodeFastAAccess0 b = new BytecodeFastAAccess0(method, bci);
- if (Assert.ASSERTS_ENABLED) {
- b.verify();
- }
- return b;
- }
-
- /** Like at, but returns null if the BCI is not at fast_aaccess_0 */
- public static BytecodeFastAAccess0 atCheck(Method method, int bci) {
- BytecodeFastAAccess0 b = new BytecodeFastAAccess0(method, bci);
- return (b.isValid() ? b : null);
- }
-
- public static BytecodeFastAAccess0 at(BytecodeStream bcs) {
- return new BytecodeFastAAccess0(bcs.method(), bcs.bci());
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("aload_0");
- buf.append(spaces);
- buf.append(super.toString());
- return buf.toString();
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeFastIAccess0.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeFastIAccess0.java
deleted file mode 100644
index 7cfa320..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeFastIAccess0.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.interpreter;
-
-import sun.jvm.hotspot.oops.*;
-import sun.jvm.hotspot.utilities.*;
-
-public class BytecodeFastIAccess0 extends BytecodeGetPut {
- BytecodeFastIAccess0(Method method, int bci) {
- super(method, bci);
- }
-
- public int index() {
- return (int) (0xFF & javaShortAt(2));
- }
-
- public boolean isStatic() {
- return false;
- }
-
- public void verify() {
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(isValid(), "check fast_iaccess_0");
- }
- }
-
- public boolean isValid() {
- return code() == Bytecodes._fast_iaccess_0;
- }
-
- public static BytecodeFastIAccess0 at(Method method, int bci) {
- BytecodeFastIAccess0 b = new BytecodeFastIAccess0(method, bci);
- if (Assert.ASSERTS_ENABLED) {
- b.verify();
- }
- return b;
- }
-
- /** Like at, but returns null if the BCI is not at fast_iaccess_0 */
- public static BytecodeFastIAccess0 atCheck(Method method, int bci) {
- BytecodeFastIAccess0 b = new BytecodeFastIAccess0(method, bci);
- return (b.isValid() ? b : null);
- }
-
- public static BytecodeFastIAccess0 at(BytecodeStream bcs) {
- return new BytecodeFastIAccess0(bcs.method(), bcs.bci());
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("aload_0");
- buf.append(spaces);
- buf.append(super.toString());
- return buf.toString();
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64Frame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64Frame.java
deleted file mode 100644
index 6a5d02c..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64Frame.java
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.runtime.amd64;
-
-import java.util.*;
-import sun.jvm.hotspot.code.*;
-import sun.jvm.hotspot.compiler.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.oops.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-import sun.jvm.hotspot.utilities.*;
-
-/** Specialization of and implementation of abstract methods of the
- Frame class for the amd64 CPU. */
-
-public class AMD64Frame extends Frame {
- private static final boolean DEBUG;
- static {
- DEBUG = System.getProperty("sun.jvm.hotspot.runtime.amd64.AMD64Frame.DEBUG") != null;
- }
-
- // refer to frame_amd64.hpp
- private static final int PC_RETURN_OFFSET = 0;
- // All frames
- private static final int LINK_OFFSET = 0;
- private static final int RETURN_ADDR_OFFSET = 1;
- private static final int SENDER_SP_OFFSET = 2;
-
- // Interpreter frames
- private static final int INTERPRETER_FRAME_MIRROR_OFFSET = 2; // for native calls only
- private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -1;
- private static final int INTERPRETER_FRAME_LAST_SP_OFFSET = INTERPRETER_FRAME_SENDER_SP_OFFSET - 1;
- private static final int INTERPRETER_FRAME_METHOD_OFFSET = INTERPRETER_FRAME_LAST_SP_OFFSET - 1;
- private static int INTERPRETER_FRAME_MDX_OFFSET; // Non-core builds only
- private static int INTERPRETER_FRAME_CACHE_OFFSET;
- private static int INTERPRETER_FRAME_LOCALS_OFFSET;
- private static int INTERPRETER_FRAME_BCX_OFFSET;
- private static int INTERPRETER_FRAME_INITIAL_SP_OFFSET;
- private static int INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET;
- private static int INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET;
-
- // Entry frames
- private static final int ENTRY_FRAME_CALL_WRAPPER_OFFSET = -6;
-
- // Native frames
- private static final int NATIVE_FRAME_INITIAL_PARAM_OFFSET = 2;
-
- static {
- VM.registerVMInitializedObserver(new Observer() {
- public void update(Observable o, Object data) {
- initialize(VM.getVM().getTypeDataBase());
- }
- });
- }
-
- private static synchronized void initialize(TypeDataBase db) {
- if (VM.getVM().isCore()) {
- INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_METHOD_OFFSET - 1;
- } else {
- INTERPRETER_FRAME_MDX_OFFSET = INTERPRETER_FRAME_METHOD_OFFSET - 1;
- INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1;
- }
- INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1;
- INTERPRETER_FRAME_BCX_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1;
- INTERPRETER_FRAME_INITIAL_SP_OFFSET = INTERPRETER_FRAME_BCX_OFFSET - 1;
- INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
- INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
- }
-
- // an additional field beyond sp and pc:
- Address raw_fp; // frame pointer
- private Address raw_unextendedSP;
-
- private AMD64Frame() {
- }
-
- private void adjustForDeopt() {
- if ( pc != null) {
- // Look for a deopt pc and if it is deopted convert to original pc
- CodeBlob cb = VM.getVM().getCodeCache().findBlob(pc);
- if (cb != null && cb.isJavaMethod()) {
- NMethod nm = (NMethod) cb;
- if (pc.equals(nm.deoptBegin())) {
- // adjust pc if frame is deoptimized.
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(this.getUnextendedSP() != null, "null SP in Java frame");
- }
- pc = this.getUnextendedSP().getAddressAt(nm.origPCOffset());
- deoptimized = true;
- }
- }
- }
- }
-
- public AMD64Frame(Address raw_sp, Address raw_fp, Address pc) {
- this.raw_sp = raw_sp;
- this.raw_unextendedSP = raw_sp;
- this.raw_fp = raw_fp;
- this.pc = pc;
-
- // Frame must be fully constructed before this call
- adjustForDeopt();
-
- if (DEBUG) {
- System.out.println("AMD64Frame(sp, fp, pc): " + this);
- dumpStack();
- }
- }
-
- public AMD64Frame(Address raw_sp, Address raw_fp) {
- this.raw_sp = raw_sp;
- this.raw_unextendedSP = raw_sp;
- this.raw_fp = raw_fp;
- this.pc = raw_sp.getAddressAt(-1 * VM.getVM().getAddressSize());
-
- // Frame must be fully constructed before this call
- adjustForDeopt();
-
- if (DEBUG) {
- System.out.println("AMD64Frame(sp, fp): " + this);
- dumpStack();
- }
- }
-
- // This constructor should really take the unextended SP as an arg
- // but then the constructor is ambiguous with constructor that takes
- // a PC so take an int and convert it.
- public AMD64Frame(Address raw_sp, Address raw_fp, long extension) {
- this.raw_sp = raw_sp;
- if ( raw_sp == null) {
- this.raw_unextendedSP = null;
- } else {
- this.raw_unextendedSP = raw_sp.addOffsetTo(extension);
- }
- this.raw_fp = raw_fp;
- this.pc = raw_sp.getAddressAt(-1 * VM.getVM().getAddressSize());
-
- // Frame must be fully constructed before this call
- adjustForDeopt();
-
- if (DEBUG) {
- System.out.println("AMD64Frame(sp, fp, extension): " + this);
- dumpStack();
- }
-
- }
-
- public Object clone() {
- AMD64Frame frame = new AMD64Frame();
- frame.raw_sp = raw_sp;
- frame.raw_unextendedSP = raw_unextendedSP;
- frame.raw_fp = raw_fp;
- frame.pc = pc;
- frame.deoptimized = deoptimized;
- return frame;
- }
-
- public boolean equals(Object arg) {
- if (arg == null) {
- return false;
- }
-
- if (!(arg instanceof AMD64Frame)) {
- return false;
- }
-
- AMD64Frame other = (AMD64Frame) arg;
-
- return (AddressOps.equal(getSP(), other.getSP()) &&
- AddressOps.equal(getFP(), other.getFP()) &&
- AddressOps.equal(getUnextendedSP(), other.getUnextendedSP()) &&
- AddressOps.equal(getPC(), other.getPC()));
- }
-
- public int hashCode() {
- if (raw_sp == null) {
- return 0;
- }
-
- return raw_sp.hashCode();
- }
-
- public String toString() {
- return "sp: " + (getSP() == null? "null" : getSP().toString()) +
- ", unextendedSP: " + (getUnextendedSP() == null? "null" : getUnextendedSP().toString()) +
- ", fp: " + (getFP() == null? "null" : getFP().toString()) +
- ", pc: " + (pc == null? "null" : pc.toString());
- }
-
- // accessors for the instance variables
- public Address getFP() { return raw_fp; }
- public Address getSP() { return raw_sp; }
- public Address getID() { return raw_sp; }
-
- // FIXME: not implemented yet (should be done for Solaris/AMD64)
- public boolean isSignalHandlerFrameDbg() { return false; }
- public int getSignalNumberDbg() { return 0; }
- public String getSignalNameDbg() { return null; }
-
- public boolean isInterpretedFrameValid() {
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(isInterpretedFrame(), "Not an interpreted frame");
- }
-
- // These are reasonable sanity checks
- if (getFP() == null || getFP().andWithMask(0x3) != null) {
- return false;
- }
-
- if (getSP() == null || getSP().andWithMask(0x3) != null) {
- return false;
- }
-
- if (getFP().addOffsetTo(INTERPRETER_FRAME_INITIAL_SP_OFFSET * VM.getVM().getAddressSize()).lessThan(getSP())) {
- return false;
- }
-
- // These are hacks to keep us out of trouble.
- // The problem with these is that they mask other problems
- if (getFP().lessThanOrEqual(getSP())) {
- // this attempts to deal with unsigned comparison above
- return false;
- }
-
- if (getFP().minus(getSP()) > 4096 * VM.getVM().getAddressSize()) {
- // stack frames shouldn't be large.
- return false;
- }
-
- return true;
- }
-
- // FIXME: not applicable in current system
- // void patch_pc(Thread* thread, address pc);
-
- public Frame sender(RegisterMap regMap, CodeBlob cb) {
- AMD64RegisterMap map = (AMD64RegisterMap) regMap;
-
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(map != null, "map must be set");
- }
-
- // Default is we done have to follow them. The sender_for_xxx will
- // update it accordingly
- map.setIncludeArgumentOops(false);
-
- if (isEntryFrame()) return senderForEntryFrame(map);
- if (isInterpretedFrame()) return senderForInterpreterFrame(map);
-
-
- if (!VM.getVM().isCore()) {
- if(cb == null) {
- cb = VM.getVM().getCodeCache().findBlob(getPC());
- } else {
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same");
- }
- }
-
- if (cb != null) {
- return senderForCompiledFrame(map, cb);
- }
- }
-
- // Must be native-compiled frame, i.e. the marshaling code for native
- // methods that exists in the core system.
- return new AMD64Frame(getSenderSP(), getLink(), getSenderPC());
- }
-
- private Frame senderForEntryFrame(AMD64RegisterMap map) {
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(map != null, "map must be set");
- }
- // Java frame called from C; skip all C frames and return top C
- // frame of that chunk as the sender
- AMD64JavaCallWrapper jcw = (AMD64JavaCallWrapper) getEntryFrameCallWrapper();
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero");
- Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack");
- }
- AMD64Frame fr;
- if (jcw.getLastJavaPC() != null) {
- fr = new AMD64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC());
- } else {
- fr = new AMD64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP());
- }
- map.clear();
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(map.getIncludeArgumentOops(), "should be set by clear");
- }
- return fr;
- }
-
- private Frame senderForInterpreterFrame(AMD64RegisterMap map) {
- Address unextendedSP = addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0);
- Address sp = addressOfStackSlot(SENDER_SP_OFFSET);
- // We do not need to update the callee-save register mapping because above
- // us is either another interpreter frame or a converter-frame, but never
- // directly a compiled frame.
- // 11/24/04 SFG. This is no longer true after adapter were removed. However at the moment
- // C2 no longer uses callee save register for java calls so there are no callee register
- // to find.
- return new AMD64Frame(sp, getLink(), unextendedSP.minus(sp));
- }
-
- private Frame senderForCompiledFrame(AMD64RegisterMap map, CodeBlob cb) {
- //
- // NOTE: some of this code is (unfortunately) duplicated in AMD64CurrentFrameGuess
- //
-
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(map != null, "map must be set");
- }
-
- // frame owned by optimizing compiler
- Address sender_sp = null;
-
-
- if (VM.getVM().isClientCompiler()) {
- sender_sp = addressOfStackSlot(SENDER_SP_OFFSET);
- } else {
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(cb.getFrameSize() >= 0, "Compiled by Compiler1: do not use");
- }
- sender_sp = getUnextendedSP().addOffsetTo(cb.getFrameSize());
- }
-
- // On Intel the return_address is always the word on the stack
- Address sender_pc = sender_sp.getAddressAt(-1 * VM.getVM().getAddressSize());
-
- if (map.getUpdateMap() && cb.getOopMaps() != null) {
- OopMapSet.updateRegisterMap(this, cb, map, true);
- }
-
- if (VM.getVM().isClientCompiler()) {
- // Move this here for C1 and collecting oops in arguments (According to Rene)
- map.setIncludeArgumentOops(cb.callerMustGCArguments(map.getThread()));
- }
-
- Address saved_fp = null;
- if (VM.getVM().isClientCompiler()) {
- saved_fp = getFP().getAddressAt(0);
- } else if (VM.getVM().isServerCompiler() &&
- (VM.getVM().getInterpreter().contains(sender_pc) ||
- VM.getVM().getStubRoutines().returnsToCallStub(sender_pc))) {
- // C2 prologue saves EBP in the usual place.
- // however only use it if the sender had link infomration in it.
- saved_fp = sender_sp.getAddressAt(-2 * VM.getVM().getAddressSize());
- }
-
- return new AMD64Frame(sender_sp, saved_fp, sender_pc);
- }
-
- protected boolean hasSenderPD() {
- // FIXME
- // Check for null ebp? Need to do some tests.
- return true;
- }
-
- public long frameSize() {
- return (getSenderSP().minus(getSP()) / VM.getVM().getAddressSize());
- }
-
- public Address getLink() {
- return addressOfStackSlot(LINK_OFFSET).getAddressAt(0);
- }
-
- // FIXME: not implementable yet
- //inline void frame::set_link(intptr_t* addr) { *(intptr_t **)addr_at(link_offset) = addr; }
-
- public Address getUnextendedSP() { return raw_unextendedSP; }
-
- // Return address:
- public Address getSenderPCAddr() { return addressOfStackSlot(RETURN_ADDR_OFFSET); }
- public Address getSenderPC() { return getSenderPCAddr().getAddressAt(0); }
-
- // return address of param, zero origin index.
- public Address getNativeParamAddr(int idx) {
- return addressOfStackSlot(NATIVE_FRAME_INITIAL_PARAM_OFFSET + idx);
- }
-
- public Address getSenderSP() { return addressOfStackSlot(SENDER_SP_OFFSET); }
-
- public Address compiledArgumentToLocationPD(VMReg reg, RegisterMap regMap, int argSize) {
- if (VM.getVM().isCore() || VM.getVM().isClientCompiler()) {
- throw new RuntimeException("Should not reach here");
- }
-
- return oopMapRegToLocation(reg, regMap);
- }
-
- public Address addressOfInterpreterFrameLocals() {
- return addressOfStackSlot(INTERPRETER_FRAME_LOCALS_OFFSET);
- }
-
- private Address addressOfInterpreterFrameBCX() {
- return addressOfStackSlot(INTERPRETER_FRAME_BCX_OFFSET);
- }
-
- public int getInterpreterFrameBCI() {
- // FIXME: this is not atomic with respect to GC and is unsuitable
- // for use in a non-debugging, or reflective, system. Need to
- // figure out how to express this.
- Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0);
- OopHandle methodHandle = addressOfInterpreterFrameMethod().getOopHandleAt(0);
- Method method = (Method) VM.getVM().getObjectHeap().newOop(methodHandle);
- return (int) bcpToBci(bcp, method);
- }
-
- public Address addressOfInterpreterFrameMDX() {
- return addressOfStackSlot(INTERPRETER_FRAME_MDX_OFFSET);
- }
-
- // FIXME
- //inline int frame::interpreter_frame_monitor_size() {
- // return BasicObjectLock::size();
- //}
-
- // expression stack
- // (the max_stack arguments are used by the GC; see class FrameClosure)
-
- public Address addressOfInterpreterFrameExpressionStack() {
- Address monitorEnd = interpreterFrameMonitorEnd().address();
- return monitorEnd.addOffsetTo(-1 * VM.getVM().getAddressSize());
- }
-
- public int getInterpreterFrameExpressionStackDirection() { return -1; }
-
- // top of expression stack
- public Address addressOfInterpreterFrameTOS() {
- return getSP();
- }
-
- /** Expression stack from top down */
- public Address addressOfInterpreterFrameTOSAt(int slot) {
- return addressOfInterpreterFrameTOS().addOffsetTo(slot * VM.getVM().getAddressSize());
- }
-
- public Address getInterpreterFrameSenderSP() {
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(isInterpretedFrame(), "interpreted frame expected");
- }
- return addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0);
- }
-
- // Monitors
- public BasicObjectLock interpreterFrameMonitorBegin() {
- return new BasicObjectLock(addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET));
- }
-
- public BasicObjectLock interpreterFrameMonitorEnd() {
- Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getAddressAt(0);
- if (Assert.ASSERTS_ENABLED) {
- // make sure the pointer points inside the frame
- Assert.that(AddressOps.gt(getFP(), result), "result must < than frame pointer");
- Assert.that(AddressOps.lte(getSP(), result), "result must >= than stack pointer");
- }
- return new BasicObjectLock(result);
- }
-
- public int interpreterFrameMonitorSize() {
- return BasicObjectLock.size();
- }
-
- // Method
- public Address addressOfInterpreterFrameMethod() {
- return addressOfStackSlot(INTERPRETER_FRAME_METHOD_OFFSET);
- }
-
- // Constant pool cache
- public Address addressOfInterpreterFrameCPCache() {
- return addressOfStackSlot(INTERPRETER_FRAME_CACHE_OFFSET);
- }
-
- // Entry frames
- public JavaCallWrapper getEntryFrameCallWrapper() {
- return new AMD64JavaCallWrapper(addressOfStackSlot(ENTRY_FRAME_CALL_WRAPPER_OFFSET).getAddressAt(0));
- }
-
- protected Address addressOfSavedOopResult() {
- // offset is 2 for compiler2 and 3 for compiler1
- return getSP().addOffsetTo((VM.getVM().isClientCompiler() ? 2 : 3) *
- VM.getVM().getAddressSize());
- }
-
- protected Address addressOfSavedReceiver() {
- return getSP().addOffsetTo(-4 * VM.getVM().getAddressSize());
- }
-
- private void dumpStack() {
- if (getFP() != null) {
- for (Address addr = getSP().addOffsetTo(-5 * VM.getVM().getAddressSize());
- AddressOps.lte(addr, getFP().addOffsetTo(5 * VM.getVM().getAddressSize()));
- addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
- System.out.println(addr + ": " + addr.getAddressAt(0));
- }
- } else {
- for (Address addr = getSP().addOffsetTo(-5 * VM.getVM().getAddressSize());
- AddressOps.lte(addr, getSP().addOffsetTo(20 * VM.getVM().getAddressSize()));
- addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
- System.out.println(addr + ": " + addr.getAddressAt(0));
- }
- }
- }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64RegisterMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64RegisterMap.java
deleted file mode 100644
index d5b9956..0000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64RegisterMap.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.runtime.amd64;
-
-import sun.jvm.hotspot.asm.amd64.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-
-public class AMD64RegisterMap extends RegisterMap {
-
- /** This is the only public constructor */
- public AMD64RegisterMap(JavaThread thread, boolean updateMap) {
- super(thread, updateMap);
- }
-
- protected AMD64RegisterMap(RegisterMap map) {
- super(map);
- }
-
- public Object clone() {
- AMD64RegisterMap retval = new AMD64RegisterMap(this);
- return retval;
- }
-
- // no PD state to clear or copy:
- protected void clearPD() {}
- protected void initializePD() {}
- protected void initializeFromPD(RegisterMap map) {}
- protected Address getLocationPD(VMReg reg) { return null; }
-}
diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-nonproduct b/hotspot/make/solaris/makefiles/mapfile-vers-nonproduct
deleted file mode 100644
index e360472..0000000
--- a/hotspot/make/solaris/makefiles/mapfile-vers-nonproduct
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-
-#
-# Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-
-# Define public interface.
-
-SUNWprivate_1.1 {
- global:
- # Old reflection routines
- # These do not need to be present in the product build in JDK 1.4
- # but their code has not been removed yet because there will not
- # be a substantial code savings until JVM_InvokeMethod and
- # JVM_NewInstanceFromConstructor can also be removed; see
- # reflectionCompat.hpp.
- JVM_GetClassConstructor;
- JVM_GetClassConstructors;
- JVM_GetClassField;
- JVM_GetClassFields;
- JVM_GetClassMethod;
- JVM_GetClassMethods;
- JVM_GetField;
- JVM_GetPrimitiveField;
- JVM_NewInstance;
- JVM_SetField;
- JVM_SetPrimitiveField;
-};
diff --git a/hotspot/make/templates/bsd-header b/hotspot/make/templates/bsd-header
deleted file mode 100644
index 95ed87b..0000000
--- a/hotspot/make/templates/bsd-header
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) %YEARS%, Oracle and/or its affiliates. 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.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of Oracle nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-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.
diff --git a/hotspot/src/os/bsd/vm/decoder_bsd.cpp b/hotspot/src/os/bsd/vm/decoder_bsd.cpp
deleted file mode 100644
index dd95929..0000000
--- a/hotspot/src/os/bsd/vm/decoder_bsd.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "prims/jvm.h"
-#include "utilities/decoder.hpp"
-
-#include <cxxabi.h>
-
-#ifdef __APPLE__
-
-void Decoder::initialize() {
- _initialized = true;
-}
-
-void Decoder::uninitialize() {
- _initialized = false;
-}
-
-bool Decoder::can_decode_C_frame_in_vm() {
- return false;
-}
-
-Decoder::decoder_status Decoder::decode(address addr, const char* filepath, char *buf, int buflen, int *offset) {
- return symbol_not_found;
-}
-
-
-#endif
-
-bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
- int status;
- char* result;
- size_t size = (size_t)buflen;
-
- // Don't pass buf to __cxa_demangle. In case of the 'buf' is too small,
- // __cxa_demangle will call system "realloc" for additional memory, which
- // may use different malloc/realloc mechanism that allocates 'buf'.
- if ((result = abi::__cxa_demangle(symbol, NULL, NULL, &status)) != NULL) {
- jio_snprintf(buf, buflen, "%s", result);
- // call c library's free
- ::free(result);
- return true;
- }
- return false;
-}
diff --git a/hotspot/src/share/vm/precompiled.hpp b/hotspot/src/share/vm/precompiled.hpp
deleted file mode 100644
index 686f256..0000000
--- a/hotspot/src/share/vm/precompiled.hpp
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-// Precompiled headers are turned off for Sun Studion,
-// or if the user passes USE_PRECOMPILED_HEADER=0 to the makefiles.
-#ifndef DONT_USE_PRECOMPILED_HEADER
-
-# include "asm/assembler.hpp"
-# include "asm/assembler.inline.hpp"
-# include "asm/codeBuffer.hpp"
-# include "asm/register.hpp"
-# include "ci/ciArray.hpp"
-# include "ci/ciArrayKlass.hpp"
-# include "ci/ciClassList.hpp"
-# include "ci/ciConstant.hpp"
-# include "ci/ciConstantPoolCache.hpp"
-# include "ci/ciEnv.hpp"
-# include "ci/ciExceptionHandler.hpp"
-# include "ci/ciField.hpp"
-# include "ci/ciFlags.hpp"
-# include "ci/ciInstance.hpp"
-# include "ci/ciInstanceKlass.hpp"
-# include "ci/ciInstanceKlassKlass.hpp"
-# include "ci/ciKlass.hpp"
-# include "ci/ciKlassKlass.hpp"
-# include "ci/ciMethod.hpp"
-# include "ci/ciNullObject.hpp"
-# include "ci/ciObjArrayKlass.hpp"
-# include "ci/ciObject.hpp"
-# include "ci/ciObjectFactory.hpp"
-# include "ci/ciSignature.hpp"
-# include "ci/ciStreams.hpp"
-# include "ci/ciSymbol.hpp"
-# include "ci/ciType.hpp"
-# include "ci/ciTypeArrayKlass.hpp"
-# include "ci/ciUtilities.hpp"
-# include "ci/compilerInterface.hpp"
-# include "classfile/classFileParser.hpp"
-# include "classfile/classFileStream.hpp"
-# include "classfile/classLoader.hpp"
-# include "classfile/javaClasses.hpp"
-# include "classfile/symbolTable.hpp"
-# include "classfile/systemDictionary.hpp"
-# include "classfile/vmSymbols.hpp"
-# include "code/codeBlob.hpp"
-# include "code/codeCache.hpp"
-# include "code/compressedStream.hpp"
-# include "code/debugInfo.hpp"
-# include "code/debugInfoRec.hpp"
-# include "code/dependencies.hpp"
-# include "code/exceptionHandlerTable.hpp"
-# include "code/jvmticmlr.h"
-# include "code/location.hpp"
-# include "code/nmethod.hpp"
-# include "code/oopRecorder.hpp"
-# include "code/pcDesc.hpp"
-# include "code/relocInfo.hpp"
-# include "code/stubs.hpp"
-# include "code/vmreg.hpp"
-# include "compiler/disassembler.hpp"
-# include "compiler/methodLiveness.hpp"
-# include "compiler/oopMap.hpp"
-# include "gc_implementation/shared/adaptiveSizePolicy.hpp"
-# include "gc_implementation/shared/ageTable.hpp"
-# include "gc_implementation/shared/allocationStats.hpp"
-# include "gc_implementation/shared/cSpaceCounters.hpp"
-# include "gc_implementation/shared/collectorCounters.hpp"
-# include "gc_implementation/shared/gSpaceCounters.hpp"
-# include "gc_implementation/shared/gcStats.hpp"
-# include "gc_implementation/shared/gcUtil.hpp"
-# include "gc_implementation/shared/generationCounters.hpp"
-# include "gc_implementation/shared/immutableSpace.hpp"
-# include "gc_implementation/shared/markSweep.hpp"
-# include "gc_implementation/shared/markSweep.inline.hpp"
-# include "gc_implementation/shared/mutableSpace.hpp"
-# include "gc_implementation/shared/spaceCounters.hpp"
-# include "gc_implementation/shared/spaceDecorator.hpp"
-# include "gc_interface/collectedHeap.hpp"
-# include "gc_interface/collectedHeap.inline.hpp"
-# include "gc_interface/gcCause.hpp"
-# include "interpreter/abstractInterpreter.hpp"
-# include "interpreter/bytecode.hpp"
-# include "interpreter/bytecodeHistogram.hpp"
-# include "interpreter/bytecodeInterpreter.hpp"
-# include "interpreter/bytecodeInterpreter.inline.hpp"
-# include "interpreter/bytecodeTracer.hpp"
-# include "interpreter/bytecodes.hpp"
-# include "interpreter/cppInterpreter.hpp"
-# include "interpreter/interpreter.hpp"
-# include "interpreter/invocationCounter.hpp"
-# include "interpreter/linkResolver.hpp"
-# include "interpreter/templateInterpreter.hpp"
-# include "interpreter/templateTable.hpp"
-# include "jvmtifiles/jvmti.h"
-# include "memory/allocation.hpp"
-# include "memory/allocation.inline.hpp"
-# include "memory/barrierSet.hpp"
-# include "memory/barrierSet.inline.hpp"
-# include "memory/blockOffsetTable.hpp"
-# include "memory/blockOffsetTable.inline.hpp"
-# include "memory/cardTableModRefBS.hpp"
-# include "memory/collectorPolicy.hpp"
-# include "memory/compactingPermGenGen.hpp"
-# include "memory/defNewGeneration.hpp"
-# include "memory/gcLocker.hpp"
-# include "memory/genCollectedHeap.hpp"
-# include "memory/genOopClosures.hpp"
-# include "memory/genRemSet.hpp"
-# include "memory/generation.hpp"
-# include "memory/generation.inline.hpp"
-# include "memory/heap.hpp"
-# include "memory/iterator.hpp"
-# include "memory/memRegion.hpp"
-# include "memory/modRefBarrierSet.hpp"
-# include "memory/oopFactory.hpp"
-# include "memory/permGen.hpp"
-# include "memory/referencePolicy.hpp"
-# include "memory/referenceProcessor.hpp"
-# include "memory/resourceArea.hpp"
-# include "memory/sharedHeap.hpp"
-# include "memory/space.hpp"
-# include "memory/space.inline.hpp"
-# include "memory/specialized_oop_closures.hpp"
-# include "memory/threadLocalAllocBuffer.hpp"
-# include "memory/threadLocalAllocBuffer.inline.hpp"
-# include "memory/universe.hpp"
-# include "memory/universe.inline.hpp"
-# include "memory/watermark.hpp"
-# include "oops/arrayKlass.hpp"
-# include "oops/arrayOop.hpp"
-# include "oops/constMethodOop.hpp"
-# include "oops/constantPoolOop.hpp"
-# include "oops/cpCacheOop.hpp"
-# include "oops/instanceKlass.hpp"
-# include "oops/instanceOop.hpp"
-# include "oops/instanceRefKlass.hpp"
-# include "oops/klass.hpp"
-# include "oops/klassOop.hpp"
-# include "oops/klassPS.hpp"
-# include "oops/klassVtable.hpp"
-# include "oops/markOop.hpp"
-# include "oops/markOop.inline.hpp"
-# include "oops/methodDataOop.hpp"
-# include "oops/methodOop.hpp"
-# include "oops/objArrayKlass.hpp"
-# include "oops/objArrayOop.hpp"
-# include "oops/oop.hpp"
-# include "oops/oop.inline.hpp"
-# include "oops/oop.inline2.hpp"
-# include "oops/oopsHierarchy.hpp"
-# include "oops/symbol.hpp"
-# include "oops/typeArrayKlass.hpp"
-# include "oops/typeArrayOop.hpp"
-# include "prims/jni.h"
-# include "prims/jvm.h"
-# include "prims/jvmtiExport.hpp"
-# include "prims/methodHandles.hpp"
-# include "runtime/arguments.hpp"
-# include "runtime/atomic.hpp"
-# include "runtime/deoptimization.hpp"
-# include "runtime/extendedPC.hpp"
-# include "runtime/fieldDescriptor.hpp"
-# include "runtime/fieldType.hpp"
-# include "runtime/frame.hpp"
-# include "runtime/frame.inline.hpp"
-# include "runtime/globals.hpp"
-# include "runtime/globals_extension.hpp"
-# include "runtime/handles.hpp"
-# include "runtime/handles.inline.hpp"
-# include "runtime/icache.hpp"
-# include "runtime/init.hpp"
-# include "runtime/interfaceSupport.hpp"
-# include "runtime/java.hpp"
-# include "runtime/javaCalls.hpp"
-# include "runtime/javaFrameAnchor.hpp"
-# include "runtime/jniHandles.hpp"
-# include "runtime/monitorChunk.hpp"
-# include "runtime/mutex.hpp"
-# include "runtime/mutexLocker.hpp"
-# include "runtime/objectMonitor.hpp"
-# include "runtime/orderAccess.hpp"
-# include "runtime/os.hpp"
-# include "runtime/osThread.hpp"
-# include "runtime/perfData.hpp"
-# include "runtime/perfMemory.hpp"
-# include "runtime/prefetch.hpp"
-# include "runtime/reflection.hpp"
-# include "runtime/reflectionUtils.hpp"
-# include "runtime/registerMap.hpp"
-# include "runtime/safepoint.hpp"
-# include "runtime/sharedRuntime.hpp"
-# include "runtime/signature.hpp"
-# include "runtime/stackValue.hpp"
-# include "runtime/stackValueCollection.hpp"
-# include "runtime/stubCodeGenerator.hpp"
-# include "runtime/stubRoutines.hpp"
-# include "runtime/synchronizer.hpp"
-# include "runtime/thread.hpp"
-# include "runtime/threadLocalStorage.hpp"
-# include "runtime/timer.hpp"
-# include "runtime/unhandledOops.hpp"
-# include "runtime/vframe.hpp"
-# include "runtime/virtualspace.hpp"
-# include "runtime/vmThread.hpp"
-# include "runtime/vm_operations.hpp"
-# include "runtime/vm_version.hpp"
-# include "services/lowMemoryDetector.hpp"
-# include "services/memoryPool.hpp"
-# include "services/memoryService.hpp"
-# include "services/memoryUsage.hpp"
-# include "utilities/accessFlags.hpp"
-# include "utilities/array.hpp"
-# include "utilities/bitMap.hpp"
-# include "utilities/bitMap.inline.hpp"
-# include "utilities/constantTag.hpp"
-# include "utilities/copy.hpp"
-# include "utilities/debug.hpp"
-# include "utilities/exceptions.hpp"
-# include "utilities/globalDefinitions.hpp"
-# include "utilities/growableArray.hpp"
-# include "utilities/hashtable.hpp"
-# include "utilities/histogram.hpp"
-# include "utilities/macros.hpp"
-# include "utilities/numberSeq.hpp"
-# include "utilities/ostream.hpp"
-# include "utilities/preserveException.hpp"
-# include "utilities/sizes.hpp"
-# include "utilities/taskqueue.hpp"
-# include "utilities/top.hpp"
-# include "utilities/utf8.hpp"
-# include "utilities/workgroup.hpp"
-# include "utilities/yieldingWorkgroup.hpp"
-#ifdef COMPILER2
-# include "libadt/dict.hpp"
-# include "libadt/port.hpp"
-# include "libadt/set.hpp"
-# include "libadt/vectset.hpp"
-# include "opto/addnode.hpp"
-# include "opto/adlcVMDeps.hpp"
-# include "opto/block.hpp"
-# include "opto/c2_globals.hpp"
-# include "opto/callnode.hpp"
-# include "opto/cfgnode.hpp"
-# include "opto/compile.hpp"
-# include "opto/connode.hpp"
-# include "opto/idealGraphPrinter.hpp"
-# include "opto/loopnode.hpp"
-# include "opto/machnode.hpp"
-# include "opto/matcher.hpp"
-# include "opto/memnode.hpp"
-# include "opto/mulnode.hpp"
-# include "opto/multnode.hpp"
-# include "opto/node.hpp"
-# include "opto/opcodes.hpp"
-# include "opto/optoreg.hpp"
-# include "opto/phase.hpp"
-# include "opto/phaseX.hpp"
-# include "opto/regalloc.hpp"
-# include "opto/regmask.hpp"
-# include "opto/runtime.hpp"
-# include "opto/subnode.hpp"
-# include "opto/type.hpp"
-# include "opto/vectornode.hpp"
-#endif // COMPILER2
-#ifdef COMPILER1
-# include "c1/c1_Compilation.hpp"
-# include "c1/c1_Defs.hpp"
-# include "c1/c1_FrameMap.hpp"
-# include "c1/c1_LIR.hpp"
-# include "c1/c1_MacroAssembler.hpp"
-# include "c1/c1_ValueType.hpp"
-# include "c1/c1_globals.hpp"
-#endif // COMPILER1
-#ifndef SERIALGC
-# include "gc_implementation/concurrentMarkSweep/binaryTreeDictionary.hpp"
-# include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp"
-# include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
-# include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
-# include "gc_implementation/concurrentMarkSweep/freeBlockDictionary.hpp"
-# include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
-# include "gc_implementation/concurrentMarkSweep/freeList.hpp"
-# include "gc_implementation/concurrentMarkSweep/promotionInfo.hpp"
-# include "gc_implementation/g1/dirtyCardQueue.hpp"
-# include "gc_implementation/g1/g1BlockOffsetTable.hpp"
-# include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
-# include "gc_implementation/g1/g1OopClosures.hpp"
-# include "gc_implementation/g1/g1_globals.hpp"
-# include "gc_implementation/g1/g1_specialized_oop_closures.hpp"
-# include "gc_implementation/g1/ptrQueue.hpp"
-# include "gc_implementation/g1/satbQueue.hpp"
-# include "gc_implementation/parNew/parGCAllocBuffer.hpp"
-# include "gc_implementation/parNew/parOopClosures.hpp"
-# include "gc_implementation/parallelScavenge/objectStartArray.hpp"
-# include "gc_implementation/parallelScavenge/parMarkBitMap.hpp"
-# include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
-# include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp"
-# include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
-# include "gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp"
-# include "gc_implementation/parallelScavenge/psGenerationCounters.hpp"
-# include "gc_implementation/parallelScavenge/psOldGen.hpp"
-# include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
-# include "gc_implementation/parallelScavenge/psPermGen.hpp"
-# include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
-# include "gc_implementation/parallelScavenge/psYoungGen.hpp"
-# include "gc_implementation/shared/gcAdaptivePolicyCounters.hpp"
-# include "gc_implementation/shared/gcPolicyCounters.hpp"
-#endif // SERIALGC
-
-#endif // !DONT_USE_PRECOMPILED_HEADER
diff --git a/hotspot/src/share/vm/runtime/reflectionCompat.hpp b/hotspot/src/share/vm/runtime/reflectionCompat.hpp
deleted file mode 100644
index 9551ad5..0000000
--- a/hotspot/src/share/vm/runtime/reflectionCompat.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_RUNTIME_REFLECTIONCOMPAT_HPP
-#define SHARE_VM_RUNTIME_REFLECTIONCOMPAT_HPP
-
-// During the development of the JDK 1.4 reflection implementation
-// based on dynamic bytecode generation, it was hoped that the bulk of
-// the native code for reflection could be removed. Unfortunately
-// there is currently a significant cost associated with loading the
-// stub classes which impacts startup time. Until this cost can be
-// reduced, the JVM entry points JVM_InvokeMethod and
-// JVM_NewInstanceFromConstructor are still needed; these and their
-// dependents currently constitute the bulk of the native code for
-// reflection. If this cost is reduced in the future, the
-// NativeMethodAccessorImpl and NativeConstructorAccessorImpl classes
-// can be removed from sun.reflect and all of the code guarded by this
-// flag removed from the product build. (Non-product builds,
-// specifically the "optimized" target, would retain the code so they
-// could be dropped into earlier JDKs for comparative benchmarking.)
-
-//#ifndef PRODUCT
-# define SUPPORT_OLD_REFLECTION
-//#endif
-
-#endif // SHARE_VM_RUNTIME_REFLECTIONCOMPAT_HPP
diff --git a/jdk/.hg/cache/branchheads b/jdk/.hg/cache/branchheads
index 4f97b9e..b624330 100644
--- a/jdk/.hg/cache/branchheads
+++ b/jdk/.hg/cache/branchheads
@@ -1,2 +1,2 @@
-9aa5af75699e4927bb0a25f26e32cc46db27b188 5215
-9aa5af75699e4927bb0a25f26e32cc46db27b188 default
+b3b9bb762fbd41d6bb7b8dd9d68d128db7305456 5216
+b3b9bb762fbd41d6bb7b8dd9d68d128db7305456 default
diff --git a/jdk/.hg/dirstate b/jdk/.hg/dirstate
index 35efc3e..01d95ef 100644
Binary files a/jdk/.hg/dirstate and b/jdk/.hg/dirstate differ
diff --git a/jdk/.hg/merge/a04e5a6b55e394dcf29df1e5281f4df2551dceb3 b/jdk/.hg/merge/a04e5a6b55e394dcf29df1e5281f4df2551dceb3
deleted file mode 100644
index 71fabdf..0000000
--- a/jdk/.hg/merge/a04e5a6b55e394dcf29df1e5281f4df2551dceb3
+++ /dev/null
@@ -1,2253 +0,0 @@
-/*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Shared source for 'java' command line tool.
- *
- * If JAVA_ARGS is defined, then acts as a launcher for applications. For
- * instance, the JDK command line tools such as javac and javadoc (see
- * makefiles for more details) are built with this program. Any arguments
- * prefixed with '-J' will be passed directly to the 'java' command.
- */
-
-/*
- * One job of the launcher is to remove command line options which the
- * vm does not understand and will not process. These options include
- * options which select which style of vm is run (e.g. -client and
- * -server) as well as options which select the data model to use.
- * Additionally, for tools which invoke an underlying vm "-J-foo"
- * options are turned into "-foo" options to the vm. This option
- * filtering is handled in a number of places in the launcher, some of
- * it in machine-dependent code. In this file, the function
- * CheckJvmType removes vm style options and TranslateApplicationArgs
- * removes "-J" prefixes. The CreateExecutionEnvironment function processes
- * and removes -d<n> options. On unix, there is a possibility that the running
- * data model may not match to the desired data model, in this case an exec is
- * required to start the desired model. If the data models match, then
- * ParseArguments will remove the -d<n> flags. If the data models do not match
- * the CreateExecutionEnviroment will remove the -d<n> flags.
- */
-
-
-#include "java.h"
-
-/*
- * A NOTE TO DEVELOPERS: For performance reasons it is important that
- * the program image remain relatively small until after SelectVersion
- * CreateExecutionEnvironment have finished their possibly recursive
- * processing. Watch everything, but resist all temptations to use Java
- * interfaces.
- */
-
-/* we always print to stderr */
-#define USE_STDERR JNI_TRUE
-
-static jboolean printVersion = JNI_FALSE; /* print and exit */
-static jboolean showVersion = JNI_FALSE; /* print but continue */
-static jboolean printUsage = JNI_FALSE; /* print and exit*/
-static jboolean printXUsage = JNI_FALSE; /* print and exit*/
-static char *showSettings = NULL; /* print but continue */
-
-static const char *_program_name;
-static const char *_launcher_name;
-static const char *_module_name;
-static const char *_module_version;
-static jboolean _is_java_args = JNI_FALSE;
-static const char *_fVersion;
-static const char *_dVersion;
-static jboolean _wc_enabled = JNI_FALSE;
-static jint _ergo_policy = DEFAULT_POLICY;
-
-/*
- * Entries for splash screen environment variables.
- * putenv is performed in SelectVersion. We need
- * them in memory until UnsetEnv, so they are made static
- * global instead of auto local.
- */
-static char* splash_file_entry = NULL;
-static char* splash_jar_entry = NULL;
-
-/*
- * List of VM options to be specified when the VM is created.
- */
-static JavaVMOption *options;
-static int numOptions, maxOptions;
-
-/*
- * Prototypes for functions internal to launcher.
- */
-static void SetClassPath(const char *s);
-static void SetModulesBootClassPath(const char *s);
-static void SelectVersion(int argc, char **argv, char **main_class);
-static jboolean ParseArguments(int *pargc, char ***pargv,
- int *pmode, char **pwhat, char **pmain,
- int *pret, const char *jrepath);
-static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv,
- InvocationFunctions *ifn);
-static jboolean SetLauncherModule(int *pmode, char **pwhat, const char *jrepath);
-static jstring NewPlatformString(JNIEnv *env, char *s);
-static jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc);
-static jclass LoadMainClass(JNIEnv *env, int mode, char *name);
-
-static void TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***pargv);
-static jboolean AddApplicationOptions(int cpathc, const char **cpathv);
-static void SetApplicationClassPath(const char**);
-
-static void PrintJavaVersion(JNIEnv *env, jboolean extraLF);
-static void PrintUsage(JNIEnv* env, jboolean doXUsage);
-static void ShowSettings(JNIEnv* env, char *optString);
-
-static void SetPaths(int argc, char **argv);
-
-static void DumpState();
-static jboolean RemovableOption(char *option);
-
-/* Maximum supported entries from jvm.cfg. */
-#define INIT_MAX_KNOWN_VMS 10
-
-/* Values for vmdesc.flag */
-enum vmdesc_flag {
- VM_UNKNOWN = -1,
- VM_KNOWN,
- VM_ALIASED_TO,
- VM_WARN,
- VM_ERROR,
- VM_IF_SERVER_CLASS,
- VM_IGNORE
-};
-
-struct vmdesc {
- char *name;
- int flag;
- char *alias;
- char *server_class;
-};
-static struct vmdesc *knownVMs = NULL;
-static int knownVMsCount = 0;
-static int knownVMsLimit = 0;
-
-static void GrowKnownVMs();
-static int KnownVMIndex(const char* name);
-static void FreeKnownVMs();
-static void ShowSplashScreen();
-static jboolean IsWildCardEnabled();
-
-#define ARG_CHECK(n, f, a) if (n < 1) { \
- JLI_ReportErrorMessage(f, a); \
- printUsage = JNI_TRUE; \
- *pret = 1; \
- return JNI_TRUE; \
-}
-
-#define ARG_FAIL(m) { \
- JLI_ReportErrorMessage(m); \
- printUsage = JNI_TRUE; \
- *pret = 1; \
- return JNI_TRUE; \
-}
-
-#define ARG_FAIL1(f, a) { \
- JLI_ReportErrorMessage(f, a); \
- printUsage = JNI_TRUE; \
- *pret = 1; \
- return JNI_TRUE; \
-}
-
-/*
- * Running Java code in primordial thread caused many problems. We will
- * create a new thread to invoke JVM. See 6316197 for more information.
- */
-static jlong threadStackSize = 0; /* stack size of the new thread */
-static jlong maxHeapSize = 0; /* max heap size */
-static jlong initialHeapSize = 0; /* inital heap size */
-
-int JNICALL JavaMain(void * args); /* entry point */
-
-enum LaunchMode { // cf. sun.launcher.LauncherHelper
- LM_UNKNOWN = 0,
- LM_CLASS,
- LM_JAR,
- LM_MODULE
-};
-
-static const char *launchModeNames[]
- = { "Unknown", "Main class", "JAR file", "Module" };
-
-typedef struct {
- int argc;
- char **argv;
- int mode;
- char *what;
- InvocationFunctions ifn;
-} JavaMainArgs;
-
-/*
- * Entry point.
- */
-int
-JLI_Launch(int argc, char ** argv, /* main argc, argc */
- int jargc, const char** jargv, /* java args */
- int appclassc, const char** appclassv, /* app classpath */
- const char* fullversion, /* full version defined */
- const char* dotversion, /* dot version defined */
- const char* pname, /* program name */
- const char* lname, /* launcher name */
- const char* mname, /* module name */
- const char* mver, /* module version */
- jboolean javaargs, /* JAVA_ARGS */
- jboolean cpwildcard, /* classpath wildcard*/
- jboolean javaw, /* windows-only javaw */
- jint ergo /* ergonomics class policy */
-)
-{
- int mode = LM_UNKNOWN;
- char *what = NULL;
- char *javamain = NULL;
- char *cpath = 0;
- char *main_class = NULL;
- int ret;
- InvocationFunctions ifn;
- jlong start, end;
- char jvmpath[MAXPATHLEN];
- char jrepath[MAXPATHLEN];
-
- _fVersion = fullversion;
- _dVersion = dotversion;
- _launcher_name = lname;
- _program_name = pname;
- _module_name = mname;
- _module_version = mver;
- _is_java_args = javaargs;
- _wc_enabled = cpwildcard;
- _ergo_policy = ergo;
-
- InitLauncher(javaw);
- DumpState();
-
- /*
- * Make sure the specified version of the JRE is running.
- *
- * There are three things to note about the SelectVersion() routine:
- * 1) If the version running isn't correct, this routine doesn't
- * return (either the correct version has been exec'd or an error
- * was issued).
- * 2) Argc and Argv in this scope are *not* altered by this routine.
- * It is the responsibility of subsequent code to ignore the
- * arguments handled by this routine.
- * 3) As a side-effect, the variable "main_class" is guaranteed to
- * be set (if it should ever be set). This isn't exactly the
- * poster child for structured programming, but it is a small
- * price to pay for not processing a jar file operand twice.
- * (Note: This side effect has been disabled. See comment on
- * bugid 5030265 below.)
- */
- SelectVersion(argc, argv, &main_class);
-
- if (JLI_IsTraceLauncher()) {
- int i;
- printf("Command line args:\n");
- for (i = 0; i < argc ; i++) {
- printf("argv[%d] = %s\n", i, argv[i]);
- }
- AddOption("-Dsun.java.launcher.diag=true", NULL);
- }
-
- CreateExecutionEnvironment(&argc, &argv,
- jrepath, sizeof(jrepath),
- jvmpath, sizeof(jvmpath));
-
- ifn.CreateJavaVM = 0;
- ifn.GetDefaultJavaVMInitArgs = 0;
-
- if (JLI_IsTraceLauncher()) {
- start = CounterGet();
- }
-
- if (!LoadJavaVM(jvmpath, &ifn)) {
- return(6);
- }
-
- if (JLI_IsTraceLauncher()) {
- end = CounterGet();
- }
-
- JLI_TraceLauncher("%ld micro seconds to LoadJavaVM\n",
- (long)(jint)Counter2Micros(end-start));
-
- ++argv;
- --argc;
-
- if (IsJavaArgs()) {
- /* Preprocess wrapper arguments */
- TranslateApplicationArgs(jargc, jargv, &argc, &argv);
- if (!AddApplicationOptions(appclassc, appclassv)) {
- return(1);
- }
- } else {
- /* Set default CLASSPATH */
- cpath = getenv("CLASSPATH");
- if (cpath != NULL) {
- SetClassPath(cpath);
- } else {
- SetClassPath(".");
- }
- }
-
- /* Parse command line options; if the return value of
- * ParseArguments is false, the program should exit.
- */
- if (!ParseArguments(&argc, &argv, &mode, &what, &javamain, &ret, jrepath))
- {
- return(ret);
- }
-
- if (cpath != NULL && mode == LM_MODULE) {
- // CLASSPATH cannot be used with module mode
- JLI_ReportErrorMessage(ARG_ERROR8);
- printUsage = JNI_TRUE;
- return(1);
- }
-
- /* Make adjustments based on what we parsed */
- if (mode == LM_MODULE) {
- SetClassPath(""); /* Hah! */
- SetModuleProp(what); /* sun.java.launcher.module */
- // ## Store boot module in %jigsaw-library?
- // ## hardcoded path is temporary
- SetModuleBootProp("lib/modules/jdk.boot/7-ea/classes:lib/modules/jdk.boot/7-ea/resources"); /* s.j.l.m.boot */
- } else {
- if (mode == LM_JAR) {
- SetClassPath(what); /* Override class path */
- }
- SetModulesBootClassPath(jrepath); /* set boot class path for legacy mode */
- }
-
- /* set the -Dsun.java.command pseudo property */
- SetJavaCommandLineProp(what, argc, argv);
-
- /* set the -Dsun.java.main pseudo property */
- SetJavaMainProp(javamain);
-
- /* Set the -Dsun.java.launcher pseudo property */
- SetJavaLauncherProp();
-
- /* set the -Dsun.java.launcher.* platform properties */
- SetJavaLauncherPlatformProps();
-
- /* Show the splash screen if needed */
- ShowSplashScreen();
-
- return ContinueInNewThread(&ifn, argc, argv, mode, what, ret);
-
-}
-/*
- * Always detach the main thread so that it appears to have ended when
- * the application's main method exits. This will invoke the
- * uncaught exception handler machinery if main threw an
- * exception. An uncaught exception handler cannot change the
- * launcher's return code except by calling System.exit.
- *
- * Wait for all non-daemon threads to end, then destroy the VM.
- * This will actually create a trivial new Java waiter thread
- * named "DestroyJavaVM", but this will be seen as a different
- * thread from the one that executed main, even though they are
- * the same C thread. This allows mainThread.join() and
- * mainThread.isAlive() to work as expected.
- */
-#define LEAVE() \
- if ((*vm)->DetachCurrentThread(vm) != 0) { \
- JLI_ReportErrorMessage(JVM_ERROR2); \
- ret = 1; \
- } \
- (*vm)->DestroyJavaVM(vm); \
- return ret \
-
-#define CHECK_EXCEPTION_NULL_LEAVE(e) \
- if ((*env)->ExceptionOccurred(env)) { \
- JLI_ReportExceptionDescription(env); \
- LEAVE(); \
- } \
- if ((e) == NULL) { \
- JLI_ReportErrorMessage(JNI_ERROR); \
- LEAVE(); \
- }
-
-#define CHECK_EXCEPTION_LEAVE(rv) \
- if ((*env)->ExceptionOccurred(env)) { \
- JLI_ReportExceptionDescription(env); \
- ret = (rv); \
- LEAVE(); \
- }
-
-int JNICALL
-JavaMain(void * _args)
-{
- JavaMainArgs *args = (JavaMainArgs *)_args;
- int argc = args->argc;
- char **argv = args->argv;
- int mode = args->mode;
- char *what = args->what;
- InvocationFunctions ifn = args->ifn;
-
- JavaVM *vm = 0;
- JNIEnv *env = 0;
- jclass mainClass = NULL;
- jmethodID mainID;
- jobjectArray mainArgs;
- int ret = 0;
- jlong start, end;
-
- /* Initialize the virtual machine */
- start = CounterGet();
- if (!InitializeJVM(&vm, &env, &ifn)) {
- JLI_ReportErrorMessage(JVM_ERROR1);
- exit(1);
- }
-
- if (printVersion || showVersion) {
- PrintJavaVersion(env, showVersion);
- CHECK_EXCEPTION_LEAVE(0);
- if (printVersion) {
- LEAVE();
- }
- }
-
- if (showSettings != NULL) {
- ShowSettings(env, showSettings);
- CHECK_EXCEPTION_LEAVE(1);
- }
- /* If the user specified neither a class name nor a JAR file nor a module */
- if (printXUsage || printUsage || what == 0 || mode == LM_UNKNOWN) {
- PrintUsage(env, printXUsage);
- CHECK_EXCEPTION_LEAVE(1);
- LEAVE();
- }
-
- FreeKnownVMs(); /* after last possible PrintUsage() */
-
- if (JLI_IsTraceLauncher()) {
- end = CounterGet();
- JLI_TraceLauncher("%ld micro seconds to InitializeJVM\n",
- (long)(jint)Counter2Micros(end-start));
- }
-
- /* At this stage, argc/argv have the application's arguments */
- if (JLI_IsTraceLauncher()){
- int i;
- printf("%s is '%s'\n", launchModeNames[mode], what);
- printf("App's argc is %d\n", argc);
- for (i=0; i < argc; i++) {
- printf(" argv[%2d] = '%s'\n", i, argv[i]);
- }
- }
-
- ret = 1;
-
- /*
- * Get the application's main class.
- *
- * See bugid 5030265. The Main-Class name has already been parsed
- * from the manifest, but not parsed properly for UTF-8 support.
- * Hence the code here ignores the value previously extracted and
- * uses the pre-existing code to reextract the value. This is
- * possibly an end of release cycle expedient. However, it has
- * also been discovered that passing some character sets through
- * the environment has "strange" behavior on some variants of
- * Windows. Hence, maybe the manifest parsing code local to the
- * launcher should never be enhanced.
- *
- * Hence, future work should either:
- * 1) Correct the local parsing code and verify that the
- * Main-Class attribute gets properly passed through
- * all environments,
- * 2) Remove the vestages of maintaining main_class through
- * the environment (and remove these comments).
- */
- mainClass = LoadMainClass(env, mode, what);
- CHECK_EXCEPTION_NULL_LEAVE(mainClass);
-
- /*
- * The LoadMainClass not only loads the main class, it will also ensure
- * that the main method's signature is correct, therefore further checking
- * is not required. The main method is invoked here so that extraneous java
- * stacks are not in the application stack trace.
- */
- mainID = (*env)->GetStaticMethodID(env, mainClass, "main",
- "([Ljava/lang/String;)V");
- CHECK_EXCEPTION_NULL_LEAVE(mainID);
-
- /* Build argument array */
- mainArgs = NewPlatformStringArray(env, argv, argc);
- CHECK_EXCEPTION_NULL_LEAVE(mainArgs);
-
- /* Invoke main method. */
- (*env)->CallStaticVoidMethod(env, mainClass, mainID, mainArgs);
-
- /*
- * The launcher's exit code (in the absence of calls to
- * System.exit) will be non-zero if main threw an exception.
- */
- ret = (*env)->ExceptionOccurred(env) == NULL ? 0 : 1;
- LEAVE();
-}
-
-/*
- * Checks the command line options to find which JVM type was
- * specified. If no command line option was given for the JVM type,
- * the default type is used. The environment variable
- * JDK_ALTERNATE_VM and the command line option -XXaltjvm= are also
- * checked as ways of specifying which JVM type to invoke.
- */
-char *
-CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
- int i, argi;
- int argc;
- char **newArgv;
- int newArgvIdx = 0;
- int isVMType;
- int jvmidx = -1;
- char *jvmtype = getenv("JDK_ALTERNATE_VM");
-
- argc = *pargc;
-
- /* To make things simpler we always copy the argv array */
- newArgv = JLI_MemAlloc((argc + 1) * sizeof(char *));
-
- /* The program name is always present */
- newArgv[newArgvIdx++] = (*argv)[0];
-
- for (argi = 1; argi < argc; argi++) {
- char *arg = (*argv)[argi];
- isVMType = 0;
-
- if (IsJavaArgs()) {
- if (arg[0] != '-') {
- newArgv[newArgvIdx++] = arg;
- continue;
- }
- } else {
- if (JLI_StrCmp(arg, "-classpath") == 0 ||
- JLI_StrCmp(arg, "-cp") == 0) {
- newArgv[newArgvIdx++] = arg;
- argi++;
- if (argi < argc) {
- newArgv[newArgvIdx++] = (*argv)[argi];
- }
- continue;
- }
- if (arg[0] != '-') break;
- }
-
- /* Did the user pass an explicit VM type? */
- i = KnownVMIndex(arg);
- if (i >= 0) {
- jvmtype = knownVMs[jvmidx = i].name + 1; /* skip the - */
- isVMType = 1;
- *pargc = *pargc - 1;
- }
-
- /* Did the user specify an "alternate" VM? */
- else if (JLI_StrCCmp(arg, "-XXaltjvm=") == 0 || JLI_StrCCmp(arg, "-J-XXaltjvm=") == 0) {
- isVMType = 1;
- jvmtype = arg+((arg[1]=='X')? 10 : 12);
- jvmidx = -1;
- }
-
- if (!isVMType) {
- newArgv[newArgvIdx++] = arg;
- }
- }
-
- /*
- * Finish copying the arguments if we aborted the above loop.
- * NOTE that if we aborted via "break" then we did NOT copy the
- * last argument above, and in addition argi will be less than
- * argc.
- */
- while (argi < argc) {
- newArgv[newArgvIdx++] = (*argv)[argi];
- argi++;
- }
-
- /* argv is null-terminated */
- newArgv[newArgvIdx] = 0;
-
- /* Copy back argv */
- *argv = newArgv;
- *pargc = newArgvIdx;
-
- /* use the default VM type if not specified (no alias processing) */
- if (jvmtype == NULL) {
- char* result = knownVMs[0].name+1;
- /* Use a different VM type if we are on a server class machine? */
- if ((knownVMs[0].flag == VM_IF_SERVER_CLASS) &&
- (ServerClassMachine() == JNI_TRUE)) {
- result = knownVMs[0].server_class+1;
- }
- JLI_TraceLauncher("Default VM: %s\n", result);
- return result;
- }
-
- /* if using an alternate VM, no alias processing */
- if (jvmidx < 0)
- return jvmtype;
-
- /* Resolve aliases first */
- {
- int loopCount = 0;
- while (knownVMs[jvmidx].flag == VM_ALIASED_TO) {
- int nextIdx = KnownVMIndex(knownVMs[jvmidx].alias);
-
- if (loopCount > knownVMsCount) {
- if (!speculative) {
- JLI_ReportErrorMessage(CFG_ERROR1);
- exit(1);
- } else {
- return "ERROR";
- /* break; */
- }
- }
-
- if (nextIdx < 0) {
- if (!speculative) {
- JLI_ReportErrorMessage(CFG_ERROR2, knownVMs[jvmidx].alias);
- exit(1);
- } else {
- return "ERROR";
- }
- }
- jvmidx = nextIdx;
- jvmtype = knownVMs[jvmidx].name+1;
- loopCount++;
- }
- }
-
- switch (knownVMs[jvmidx].flag) {
- case VM_WARN:
- if (!speculative) {
- JLI_ReportErrorMessage(CFG_WARN1, jvmtype, knownVMs[0].name + 1);
- }
- /* fall through */
- case VM_IGNORE:
- jvmtype = knownVMs[jvmidx=0].name + 1;
- /* fall through */
- case VM_KNOWN:
- break;
- case VM_ERROR:
- if (!speculative) {
- JLI_ReportErrorMessage(CFG_ERROR3, jvmtype);
- exit(1);
- } else {
- return "ERROR";
- }
- }
-
- return jvmtype;
-}
-
-/* copied from HotSpot function "atomll()" */
-static int
-parse_size(const char *s, jlong *result) {
- jlong n = 0;
- int args_read = sscanf(s, jlong_format_specifier(), &n);
- if (args_read != 1) {
- return 0;
- }
- while (*s != '\0' && *s >= '0' && *s <= '9') {
- s++;
- }
- // 4705540: illegal if more characters are found after the first non-digit
- if (JLI_StrLen(s) > 1) {
- return 0;
- }
- switch (*s) {
- case 'T': case 't':
- *result = n * GB * KB;
- return 1;
- case 'G': case 'g':
- *result = n * GB;
- return 1;
- case 'M': case 'm':
- *result = n * MB;
- return 1;
- case 'K': case 'k':
- *result = n * KB;
- return 1;
- case '\0':
- *result = n;
- return 1;
- default:
- /* Create JVM with default stack and let VM handle malformed -Xss string*/
- return 0;
- }
-}
-
-/*
- * Adds a new VM option with the given given name and value.
- */
-void
-AddOption(char *str, void *info)
-{
- /*
- * Expand options array if needed to accommodate at least one more
- * VM option.
- */
- if (numOptions >= maxOptions) {
- if (options == 0) {
- maxOptions = 4;
- options = JLI_MemAlloc(maxOptions * sizeof(JavaVMOption));
- } else {
- JavaVMOption *tmp;
- maxOptions *= 2;
- tmp = JLI_MemAlloc(maxOptions * sizeof(JavaVMOption));
- memcpy(tmp, options, numOptions * sizeof(JavaVMOption));
- JLI_MemFree(options);
- options = tmp;
- }
- }
- options[numOptions].optionString = str;
- options[numOptions++].extraInfo = info;
-
- if (JLI_StrCCmp(str, "-Xss") == 0) {
- jlong tmp;
- if (parse_size(str + 4, &tmp)) {
- threadStackSize = tmp;
- }
- }
-
- if (JLI_StrCCmp(str, "-Xmx") == 0) {
- jlong tmp;
- if (parse_size(str + 4, &tmp)) {
- maxHeapSize = tmp;
- }
- }
-
- if (JLI_StrCCmp(str, "-Xms") == 0) {
- jlong tmp;
- if (parse_size(str + 4, &tmp)) {
- initialHeapSize = tmp;
- }
- }
-}
-
-static void
-SetClassPath(const char *s)
-{
- char *def;
- size_t len;
- const char *orig = s;
- static const char format[] = "-Djava.class.path=%s";
- s = JLI_WildcardExpandClasspath(s);
- len = sizeof(format) - 2 + JLI_StrLen(s); /* -2 == strlen("%s") */
- def = JLI_MemAlloc(len);
- JLI_Snprintf(def, len, format, s);
- AddOption(def, NULL);
- if (s != orig)
- JLI_MemFree((char *) s);
-}
-
-static void
-SetModulePath(const char *s)
-{
- char *def;
- size_t len;
- const char *orig = s;
- static const char format[] = "-Djava.module.path=%s";
- len = sizeof(format) - 2 + JLI_StrLen(s); /* -2 == strlen("%s") */
- def = JLI_MemAlloc(len);
- JLI_Snprintf(def, len, format, s);
- AddOption(def, NULL);
- if (s != orig)
- JLI_MemFree((char *) s);
-}
-
-
-/*
- * Set the bootclasspath for installed modules.
- * A temporary workaround until jigsaw legacy support is
- * implemented.
- */
-static void
-SetModulesBootClassPath(const char *jrepath)
-{
- const char separator[] = { FILE_SEPARATOR, '\0' };
- static const char vmoption[] = "-Xbootclasspath/p:";
- const int vmoption_len = JLI_StrLen(vmoption);
- const char *orig = jrepath;
- char pathname[MAXPATHLEN];
- char *def, *s;
- int slen = 0;
- struct stat statbuf;
-
- /* return if jre/lib/rt.jar exists */
- JLI_Snprintf(pathname, sizeof(pathname), "%s%slib%srt.jar", jrepath, separator, separator);
- if (stat(pathname, &statbuf) == 0) {
- return;
- }
-
- /* return if jre/classes exists */
- JLI_Snprintf(pathname, sizeof(pathname), "%s%sclasses", jrepath, separator);
- if (stat(pathname, &statbuf) == 0) {
- return;
- }
-
- /* modularized jre */
- JLI_Snprintf(pathname, sizeof(pathname), "%s%slib%smodules%s*", jrepath, separator, separator, separator);
- s = (char *) JLI_WildcardExpandDirectory(pathname);
- slen = JLI_StrLen(s);
- def = JLI_MemAlloc(vmoption_len+slen+1);
- memcpy(def, vmoption, vmoption_len);
- memcpy(def+vmoption_len, s, slen);
- def[vmoption_len+slen] = '\0';
-
- // Must be added before the user-specified -Xbootclasspath/p: arguments.
- // Hotspot VM prepends the given -Xbootclasspath/p: argument
- // to the bootclasspath in the order of the input VM arguments.
- // The second -Xbootclasspath/p: argument will be prepended
- // to the first -Xbootclasspath/p: if multiple ones are given.
-
- if (numOptions == 0) {
- AddOption(def, NULL);
- } else {
- int newMaxOptions = maxOptions + 1;
- JavaVMOption *new = JLI_MemAlloc(newMaxOptions * sizeof(JavaVMOption));
- JavaVMOption *orig = new+1;
- // Set the -Xbootclasspath/p option to be the first VM argument
- new[0].optionString = def;
- new[0].extraInfo = NULL;
- memcpy(orig, options, numOptions * sizeof(JavaVMOption));
- JLI_MemFree(options);
- options = new;
- maxOptions = newMaxOptions;
- numOptions++;
- }
-
- if (s != orig)
- JLI_MemFree((char *) s);
-}
-
-/*
- * The SelectVersion() routine ensures that an appropriate version of
- * the JRE is running. The specification for the appropriate version
- * is obtained from either the manifest of a jar file (preferred) or
- * from command line options.
- * The routine also parses splash screen command line options and
- * passes on their values in private environment variables.
- */
-static void
-SelectVersion(int argc, char **argv, char **main_class)
-{
- char *arg;
- char **new_argv;
- char **new_argp;
- char *operand;
- char *version = NULL;
- char *jre = NULL;
- int jarflag = 0;
- int headlessflag = 0;
- int restrict_search = -1; /* -1 implies not known */
- manifest_info info;
- char env_entry[MAXNAMELEN + 24] = ENV_ENTRY "=";
- char *splash_file_name = NULL;
- char *splash_jar_name = NULL;
- char *env_in;
- int res;
-
- /*
- * If the version has already been selected, set *main_class
- * with the value passed through the environment (if any) and
- * simply return.
- */
- if ((env_in = getenv(ENV_ENTRY)) != NULL) {
- if (*env_in != '\0')
- *main_class = JLI_StringDup(env_in);
- return;
- }
-
- /*
- * Scan through the arguments for options relevant to multiple JRE
- * support. For reference, the command line syntax is defined as:
- *
- * SYNOPSIS
- * java [options] class [argument...]
- *
- * java [options] -jar file.jar [argument...]
- *
- * As the scan is performed, make a copy of the argument list with
- * the version specification options (new to 1.5) removed, so that
- * a version less than 1.5 can be exec'd.
- *
- * Note that due to the syntax of the native Windows interface
- * CreateProcess(), processing similar to the following exists in
- * the Windows platform specific routine ExecJRE (in java_md.c).
- * Changes here should be reproduced there.
- */
- new_argv = JLI_MemAlloc((argc + 1) * sizeof(char*));
- new_argv[0] = argv[0];
- new_argp = &new_argv[1];
- argc--;
- argv++;
- while ((arg = *argv) != 0 && *arg == '-') {
- if (JLI_StrCCmp(arg, "-version:") == 0) {
- version = arg + 9;
- } else if (JLI_StrCmp(arg, "-jre-restrict-search") == 0) {
- restrict_search = 1;
- } else if (JLI_StrCmp(arg, "-no-jre-restrict-search") == 0) {
- restrict_search = 0;
- } else {
- if (JLI_StrCmp(arg, "-jar") == 0)
- jarflag = 1;
- /* deal with "unfortunate" classpath syntax */
- if ((JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) &&
- (argc >= 2)) {
- *new_argp++ = arg;
- argc--;
- argv++;
- arg = *argv;
- }
-
- /*
- * Checking for headless toolkit option in the some way as AWT does:
- * "true" means true and any other value means false
- */
- if (JLI_StrCmp(arg, "-Djava.awt.headless=true") == 0) {
- headlessflag = 1;
- } else if (JLI_StrCCmp(arg, "-Djava.awt.headless=") == 0) {
- headlessflag = 0;
- } else if (JLI_StrCCmp(arg, "-splash:") == 0) {
- splash_file_name = arg+8;
- }
- *new_argp++ = arg;
- }
- argc--;
- argv++;
- }
- if (argc <= 0) { /* No operand? Possibly legit with -[full]version */
- operand = NULL;
- } else {
- argc--;
- *new_argp++ = operand = *argv++;
- }
- while (argc-- > 0) /* Copy over [argument...] */
- *new_argp++ = *argv++;
- *new_argp = NULL;
-
- /*
- * If there is a jar file, read the manifest. If the jarfile can't be
- * read, the manifest can't be read from the jar file, or the manifest
- * is corrupt, issue the appropriate error messages and exit.
- *
- * Even if there isn't a jar file, construct a manifest_info structure
- * containing the command line information. It's a convenient way to carry
- * this data around.
- */
- if (jarflag && operand) {
- if ((res = JLI_ParseManifest(operand, &info)) != 0) {
- if (res == -1)
- JLI_ReportErrorMessage(JAR_ERROR2, operand);
- else
- JLI_ReportErrorMessage(JAR_ERROR3, operand);
- exit(1);
- }
-
- /*
- * Command line splash screen option should have precedence
- * over the manifest, so the manifest data is used only if
- * splash_file_name has not been initialized above during command
- * line parsing
- */
- if (!headlessflag && !splash_file_name && info.splashscreen_image_file_name) {
- splash_file_name = info.splashscreen_image_file_name;
- splash_jar_name = operand;
- }
- } else {
- info.manifest_version = NULL;
- info.main_class = NULL;
- info.jre_version = NULL;
- info.jre_restrict_search = 0;
- }
-
- /*
- * Passing on splash screen info in environment variables
- */
- if (splash_file_name && !headlessflag) {
- char* splash_file_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_FILE_ENV_ENTRY "=")+JLI_StrLen(splash_file_name)+1);
- JLI_StrCpy(splash_file_entry, SPLASH_FILE_ENV_ENTRY "=");
- JLI_StrCat(splash_file_entry, splash_file_name);
- putenv(splash_file_entry);
- }
- if (splash_jar_name && !headlessflag) {
- char* splash_jar_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_JAR_ENV_ENTRY "=")+JLI_StrLen(splash_jar_name)+1);
- JLI_StrCpy(splash_jar_entry, SPLASH_JAR_ENV_ENTRY "=");
- JLI_StrCat(splash_jar_entry, splash_jar_name);
- putenv(splash_jar_entry);
- }
-
- /*
- * The JRE-Version and JRE-Restrict-Search values (if any) from the
- * manifest are overwritten by any specified on the command line.
- */
- if (version != NULL)
- info.jre_version = version;
- if (restrict_search != -1)
- info.jre_restrict_search = restrict_search;
-
- /*
- * "Valid" returns (other than unrecoverable errors) follow. Set
- * main_class as a side-effect of this routine.
- */
- if (info.main_class != NULL)
- *main_class = JLI_StringDup(info.main_class);
-
- /*
- * If no version selection information is found either on the command
- * line or in the manifest, simply return.
- */
- if (info.jre_version == NULL) {
- JLI_FreeManifest();
- JLI_MemFree(new_argv);
- return;
- }
-
- /*
- * Check for correct syntax of the version specification (JSR 56).
- */
- if (!JLI_ValidVersionString(info.jre_version)) {
- JLI_ReportErrorMessage(SPC_ERROR1, info.jre_version);
- exit(1);
- }
-
- /*
- * Find the appropriate JVM on the system. Just to be as forgiving as
- * possible, if the standard algorithms don't locate an appropriate
- * jre, check to see if the one running will satisfy the requirements.
- * This can happen on systems which haven't been set-up for multiple
- * JRE support.
- */
- jre = LocateJRE(&info);
- JLI_TraceLauncher("JRE-Version = %s, JRE-Restrict-Search = %s Selected = %s\n",
- (info.jre_version?info.jre_version:"null"),
- (info.jre_restrict_search?"true":"false"), (jre?jre:"null"));
-
- if (jre == NULL) {
- if (JLI_AcceptableRelease(GetFullVersion(), info.jre_version)) {
- JLI_FreeManifest();
- JLI_MemFree(new_argv);
- return;
- } else {
- JLI_ReportErrorMessage(CFG_ERROR4, info.jre_version);
- exit(1);
- }
- }
-
- /*
- * If I'm not the chosen one, exec the chosen one. Returning from
- * ExecJRE indicates that I am indeed the chosen one.
- *
- * The private environment variable _JAVA_VERSION_SET is used to
- * prevent the chosen one from re-reading the manifest file and
- * using the values found within to override the (potential) command
- * line flags stripped from argv (because the target may not
- * understand them). Passing the MainClass value is an optimization
- * to avoid locating, expanding and parsing the manifest extra
- * times.
- */
- if (info.main_class != NULL) {
- if (JLI_StrLen(info.main_class) <= MAXNAMELEN) {
- (void)JLI_StrCat(env_entry, info.main_class);
- } else {
- JLI_ReportErrorMessage(CLS_ERROR5, MAXNAMELEN);
- exit(1);
- }
- }
- (void)putenv(env_entry);
- ExecJRE(jre, new_argv);
- JLI_FreeManifest();
- JLI_MemFree(new_argv);
- return;
-}
-
-/*
- * Parses command line arguments. Returns JNI_FALSE if launcher
- * should exit without starting vm, returns JNI_TRUE if vm needs
- * to be started to process given options. *pret (the launcher
- * process return value) is set to 0 for a normal exit.
- */
-static jboolean
-ParseArguments(int *pargc, char ***pargv,
- int *pmode, char **pwhat, char **pmain,
- int *pret, const char *jrepath)
-{
- int argc = *pargc;
- char **argv = *pargv;
- int mode = LM_UNKNOWN;
- jboolean legacy = _module_name != NULL ? JNI_FALSE : JNI_TRUE;
- char *arg;
- char buf[MAXPATHLEN];
-
- *pret = 0;
-
- while ((arg = *argv) != 0 && *arg == '-') {
- argv++; --argc;
- if (JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) {
- ARG_CHECK (argc, ARG_ERROR1, arg);
- SetClassPath(*argv);
- /* -classpath can only be set when running legacy mode */
- mode = LM_CLASS;
- argv++; --argc;
- } else if (JLI_StrCmp(arg, "-modulepath") == 0 || JLI_StrCmp(arg, "-mp") == 0) {
- ARG_CHECK (argc, ARG_ERROR1, arg);
- SetModulePath(*argv);
- /* -modulepath can only be set when running in module mode */
- mode = LM_MODULE;
- argv++; --argc;
- } else if (JLI_StrCmp(arg, "-jar") == 0) {
- ARG_CHECK (argc, ARG_ERROR2, arg);
- if (mode == LM_MODULE)
- ARG_FAIL(ARG_ERROR5);
- mode = LM_JAR;
- } else if (JLI_StrCmp(arg, "-m") == 0) {
- ARG_CHECK (argc, ARG_ERROR4, arg);
- if (mode == LM_JAR)
- ARG_FAIL(ARG_ERROR5);
- if (mode == LM_CLASS)
- ARG_FAIL(ARG_ERROR7);
- mode = LM_MODULE;
- legacy = JNI_FALSE;
- } else if (JLI_StrCmp(arg, "-L") == 0) {
- ARG_CHECK (argc, ARG_ERROR6, arg);
- SetModuleLibraryProp(*argv);
- argv++; --argc;
- } else if (JLI_StrCmp(arg, "-help") == 0 ||
- JLI_StrCmp(arg, "-h") == 0 ||
- JLI_StrCmp(arg, "-?") == 0) {
- printUsage = JNI_TRUE;
- return JNI_TRUE;
- } else if (JLI_StrCmp(arg, "-version") == 0) {
- printVersion = JNI_TRUE;
- return JNI_TRUE;
- } else if (JLI_StrCmp(arg, "-showversion") == 0) {
- showVersion = JNI_TRUE;
- } else if (JLI_StrCmp(arg, "-X") == 0) {
- printXUsage = JNI_TRUE;
- return JNI_TRUE;
-/*
- * The following case checks for -XshowSettings OR -XshowSetting:SUBOPT.
- * In the latter case, any SUBOPT value not recognized will default to "all"
- */
- } else if (JLI_StrCmp(arg, "-XshowSettings") == 0 ||
- JLI_StrCCmp(arg, "-XshowSettings:") == 0) {
- showSettings = arg;
- } else if (JLI_StrCmp(arg, "-Xdiag") == 0) {
- AddOption("-Dsun.java.launcher.diag=true", NULL);
-/*
- * The following case provide backward compatibility with old-style
- * command line options.
- */
- } else if (JLI_StrCmp(arg, "-fullversion") == 0) {
- JLI_ReportMessage("%s full version \"%s\"", _launcher_name, GetFullVersion());
- return JNI_FALSE;
- } else if (JLI_StrCmp(arg, "-verbosegc") == 0) {
- AddOption("-verbose:gc", NULL);
- } else if (JLI_StrCmp(arg, "-t") == 0) {
- AddOption("-Xt", NULL);
- } else if (JLI_StrCmp(arg, "-tm") == 0) {
- AddOption("-Xtm", NULL);
- } else if (JLI_StrCmp(arg, "-debug") == 0) {
- AddOption("-Xdebug", NULL);
- } else if (JLI_StrCmp(arg, "-noclassgc") == 0) {
- AddOption("-Xnoclassgc", NULL);
- } else if (JLI_StrCmp(arg, "-Xfuture") == 0) {
- AddOption("-Xverify:all", NULL);
- } else if (JLI_StrCmp(arg, "-verify") == 0) {
- AddOption("-Xverify:all", NULL);
- } else if (JLI_StrCmp(arg, "-verifyremote") == 0) {
- AddOption("-Xverify:remote", NULL);
- } else if (JLI_StrCmp(arg, "-noverify") == 0) {
- AddOption("-Xverify:none", NULL);
- } else if (JLI_StrCCmp(arg, "-prof") == 0) {
- char *p = arg + 5;
- char *tmp = JLI_MemAlloc(JLI_StrLen(arg) + 50);
- if (*p) {
- sprintf(tmp, "-Xrunhprof:cpu=old,file=%s", p + 1);
- } else {
- sprintf(tmp, "-Xrunhprof:cpu=old,file=java.prof");
- }
- AddOption(tmp, NULL);
- } else if (JLI_StrCCmp(arg, "-ss") == 0 ||
- JLI_StrCCmp(arg, "-oss") == 0 ||
- JLI_StrCCmp(arg, "-ms") == 0 ||
- JLI_StrCCmp(arg, "-mx") == 0) {
- char *tmp = JLI_MemAlloc(JLI_StrLen(arg) + 6);
- sprintf(tmp, "-X%s", arg + 1); /* skip '-' */
- AddOption(tmp, NULL);
- } else if (JLI_StrCmp(arg, "-checksource") == 0 ||
- JLI_StrCmp(arg, "-cs") == 0 ||
- JLI_StrCmp(arg, "-noasyncgc") == 0) {
- /* No longer supported */
- JLI_ReportErrorMessage(ARG_WARN, arg);
- } else if (JLI_StrCCmp(arg, "-version:") == 0 ||
- JLI_StrCmp(arg, "-no-jre-restrict-search") == 0 ||
- JLI_StrCmp(arg, "-jre-restrict-search") == 0 ||
- JLI_StrCCmp(arg, "-splash:") == 0) {
- ; /* Ignore machine independent options already handled */
- } else if (JLI_StrCCmp(arg, "-Xmode:") == 0) {
- /* Temporary internal option and it's only valid for jdk tools.
- * Tools like javac and javah can use this option to diagnose
- * if a problem is caused by module mode or not.
- */
- if (_module_name == NULL)
- ARG_FAIL1(ARG_ERROR9, arg);
-
- if (JLI_StrCmp(arg, "-Xmode:legacy") == 0) {
- legacy = JNI_TRUE;
- } else if (JLI_StrCmp(arg, "-Xmode:module") == 0) {
- legacy = JNI_FALSE;
- } else
- ARG_FAIL1(ARG_ERROR9, arg);
- } else if (RemovableOption(arg) ) {
- ; /* Do not pass option to vm. */
- } else {
- AddOption(arg, NULL);
- }
- }
-
- if (_module_name != NULL && !legacy) {
- /* determine if jdk tool can run in module mode */
- if (SetLauncherModule(pmode, pwhat, jrepath)) {
- /* module whose name is "jdk." + _program_name indicates
- * that the tool's main class is the module's main entry point.
- * Other module requires to pass the tool's main class as
- * the first argument */
- JLI_StrCpy(buf, "jdk.");
- JLI_StrCat(buf, _program_name);
- *pmain = *argv; // the main class name is in the first argument
- if (JLI_StrCmp(buf, _module_name) == 0) {
- // module's entry point == main class name
- // skip the main class name argument
- argc--;
- argv++;
- }
-
- if (argc >= 0) {
- *pargc = argc;
- *pargv = argv;
- }
- JLI_TraceLauncher("%s runs in module mode (%s) argv[0]=%s\n",
- _program_name, *pwhat, argc > 0 ? *argv : "none");
- return JNI_TRUE;
- }
- }
-
- // applications or tools runs in legacy mode
- if (--argc >= 0) {
- *pwhat = *argv++;
- *pmain = *pwhat; // module's name or main class name
- }
-
- if (*pwhat == NULL) {
- *pret = 1;
- } else if (mode == LM_UNKNOWN) {
- /* default to LM_CLASS if -jar and -cp option are
- * not specified */
- mode = LM_CLASS;
- }
-
- if (argc >= 0) {
- *pargc = argc;
- *pargv = argv;
- }
-
- *pmode = mode;
-
- return JNI_TRUE;
-}
-
-/* Set the launcher mode for jdk tools (i.e. _module_name != NULL).
- * Detect if java.home is a legacy image or module image;
- * launch the tool in module mode if running in a module image.
- *
- * Returns true if set to run in module mode
- */
-static jboolean
-SetLauncherModule(int *pmode, char **pwhat, const char *jrepath)
-{
- struct stat statbuf;
- char buf[MAXPATHLEN];
- const char separator[] = { FILE_SEPARATOR, '\0' };
-
- /*
- * Run the program in module module if running on
- * a JRE module image (i.e. rt.jar doesn't exist) and
- * "classes" dir doesn't exists; otherwise, run in legacy mode
- */
- snprintf(buf, sizeof(buf), "%s%slib%srt.jar", jrepath, separator, separator);
- if (stat(buf, &statbuf) != 0) {
- snprintf(buf, sizeof(buf), "%s%sclasses", jrepath, separator);
- if (stat(buf, &statbuf) != 0) {
- JLI_StrCpy(buf, _module_name);
- JLI_StrCat(buf, "@");
- JLI_StrCat(buf, _module_version);
- *pwhat = JLI_StringDup(buf);
- *pmode = LM_MODULE;
- return JNI_TRUE;
- }
- }
- return JNI_FALSE;
-}
-
-/*
- * Initializes the Java Virtual Machine. Also frees options array when
- * finished.
- */
-static jboolean
-InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn)
-{
- JavaVMInitArgs args;
- jint r;
-
- memset(&args, 0, sizeof(args));
- args.version = JNI_VERSION_1_2;
- args.nOptions = numOptions;
- args.options = options;
- args.ignoreUnrecognized = JNI_FALSE;
-
- if (JLI_IsTraceLauncher()) {
- int i = 0;
- printf("JavaVM args:\n ");
- printf("version 0x%08lx, ", (long)args.version);
- printf("ignoreUnrecognized is %s, ",
- args.ignoreUnrecognized ? "JNI_TRUE" : "JNI_FALSE");
- printf("nOptions is %ld\n", (long)args.nOptions);
- for (i = 0; i < numOptions; i++)
- printf(" option[%2d] = '%s'\n",
- i, args.options[i].optionString);
- }
-
- r = ifn->CreateJavaVM(pvm, (void **)penv, &args);
- JLI_MemFree(options);
- return r == JNI_OK;
-}
-
-
-#define NULL_CHECK0(e) if ((e) == 0) { \
- JLI_ReportErrorMessage(JNI_ERROR); \
- return 0; \
- }
-
-#define NULL_CHECK(e) if ((e) == 0) { \
- JLI_ReportErrorMessage(JNI_ERROR); \
- return; \
- }
-
-static jclass helperClass = NULL;
-
-static jclass
-GetLauncherHelperClass(JNIEnv *env) {
- if (helperClass == NULL) {
- NULL_CHECK0(helperClass = FindBootStrapClass(env,
- "sun/launcher/LauncherHelper"));
- }
- return helperClass;
-}
-
-static jmethodID makePlatformStringMID = NULL;
-/*
- * Returns a new Java string object for the specified platform string.
- */
-static jstring
-NewPlatformString(JNIEnv *env, char *s)
-{
- int len = (int)JLI_StrLen(s);
- jbyteArray ary;
- jclass cls = GetLauncherHelperClass(env);
- NULL_CHECK0(cls);
- if (s == NULL)
- return 0;
-
- ary = (*env)->NewByteArray(env, len);
- if (ary != 0) {
- jstring str = 0;
- (*env)->SetByteArrayRegion(env, ary, 0, len, (jbyte *)s);
- if (!(*env)->ExceptionOccurred(env)) {
- if (makePlatformStringMID == NULL) {
- NULL_CHECK0(makePlatformStringMID = (*env)->GetStaticMethodID(env,
- cls, "makePlatformString", "(Z[B)Ljava/lang/String;"));
- }
- str = (*env)->CallStaticObjectMethod(env, cls,
- makePlatformStringMID, USE_STDERR, ary);
- (*env)->DeleteLocalRef(env, ary);
- return str;
- }
- }
- return 0;
-}
-
-/*
- * Returns a new array of Java string objects for the specified
- * array of platform strings.
- */
-static jobjectArray
-NewPlatformStringArray(JNIEnv *env, char **strv, int strc)
-{
- jarray cls;
- jarray ary;
- int i;
-
- NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String"));
- NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0));
- for (i = 0; i < strc; i++) {
- jstring str = NewPlatformString(env, *strv++);
- NULL_CHECK0(str);
- (*env)->SetObjectArrayElement(env, ary, i, str);
- (*env)->DeleteLocalRef(env, str);
- }
- return ary;
-}
-
-/*
- * Loads a class and verifies that the main class is present and it is ok to
- * call it for more details refer to the java implementation.
- */
-static jclass
-LoadMainClass(JNIEnv *env, int mode, char *name)
-{
- jmethodID mid;
- jstring str;
- jobject result;
- jlong start, end;
- jclass cls = GetLauncherHelperClass(env);
- NULL_CHECK0(cls);
- if (JLI_IsTraceLauncher()) {
- start = CounterGet();
- }
- NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls,
- "checkAndLoadMain",
- "(ZILjava/lang/String;)Ljava/lang/Class;"));
-
- switch (mode) {
- case LM_CLASS:
- str = NewPlatformString(env, name);
- break;
- default:
- str = (*env)->NewStringUTF(env, name);
- break;
- }
- result = (*env)->CallStaticObjectMethod(env, cls, mid, USE_STDERR, mode, str);
-
- if (JLI_IsTraceLauncher()) {
- end = CounterGet();
- printf("%ld micro seconds to load main class\n",
- (long)(jint)Counter2Micros(end-start));
- printf("----_JAVA_LAUNCHER_DEBUG----\n");
- }
-
- return (jclass)result;
-}
-
-/*
- * For tools, convert command line args thus:
- * javac -cp foo:foo/"*" -J-ms32m ...
- * java -ms32m -cp JLI_WildcardExpandClasspath(foo:foo/"*") ...
- *
- * Takes 4 parameters, and returns the populated arguments
- */
-static void
-TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***pargv)
-{
- int argc = *pargc;
- char **argv = *pargv;
- int nargc = argc + jargc;
- char **nargv = JLI_MemAlloc((nargc + 1) * sizeof(char *));
- int i;
-
- *pargc = nargc;
- *pargv = nargv;
-
- /* Copy the VM arguments (i.e. prefixed with -J) */
- for (i = 0; i < jargc; i++) {
- const char *arg = jargv[i];
- if (arg[0] == '-' && arg[1] == 'J') {
- *nargv++ = ((arg + 2) == NULL) ? NULL : JLI_StringDup(arg + 2);
- }
- }
-
- for (i = 0; i < argc; i++) {
- char *arg = argv[i];
- if (arg[0] == '-' && arg[1] == 'J') {
- if (arg[2] == '\0') {
- JLI_ReportErrorMessage(ARG_ERROR3);
- exit(1);
- }
- *nargv++ = arg + 2;
- }
- }
-
- /* Copy the rest of the arguments */
- for (i = 0; i < jargc ; i++) {
- const char *arg = jargv[i];
- if (arg[0] != '-' || arg[1] != 'J') {
- *nargv++ = (arg == NULL) ? NULL : JLI_StringDup(arg);
- }
- }
- for (i = 0; i < argc; i++) {
- char *arg = argv[i];
- if (arg[0] == '-') {
- if (arg[1] == 'J')
- continue;
- if (IsWildCardEnabled() && arg[1] == 'c'
- && (JLI_StrCmp(arg, "-cp") == 0 ||
- JLI_StrCmp(arg, "-classpath") == 0)
- && i < argc - 1) {
- *nargv++ = arg;
- *nargv++ = (char *) JLI_WildcardExpandClasspath(argv[i+1]);
- i++;
- continue;
- }
- }
- *nargv++ = arg;
- }
- *nargv = 0;
-}
-
-/*
- * For our tools, we try to add 3 VM options:
- * -Denv.class.path=<envcp>
- * -Dapplication.home=<apphome>
- * -Djava.class.path=<appcp>
- * <envcp> is the user's setting of CLASSPATH -- for instance the user
- * tells javac where to find binary classes through this environment
- * variable. Notice that users will be able to compile against our
- * tools classes (sun.tools.javac.Main) only if they explicitly add
- * tools.jar to CLASSPATH.
- * <apphome> is the directory where the application is installed.
- * <appcp> is the classpath to where our apps' classfiles are.
- */
-static jboolean
-AddApplicationOptions(int cpathc, const char **cpathv)
-{
- char *envcp, *appcp, *apphome;
- char home[MAXPATHLEN]; /* application home */
- char separator[] = { PATH_SEPARATOR, '\0' };
- int size, i;
-
- {
- const char *s = getenv("CLASSPATH");
- if (s) {
- s = (char *) JLI_WildcardExpandClasspath(s);
- /* 40 for -Denv.class.path= */
- envcp = (char *)JLI_MemAlloc(JLI_StrLen(s) + 40);
- sprintf(envcp, "-Denv.class.path=%s", s);
- AddOption(envcp, NULL);
- }
- }
-
- if (!GetApplicationHome(home, sizeof(home))) {
- JLI_ReportErrorMessage(CFG_ERROR5);
- return JNI_FALSE;
- }
-
- /* 40 for '-Dapplication.home=' */
- apphome = (char *)JLI_MemAlloc(JLI_StrLen(home) + 40);
- sprintf(apphome, "-Dapplication.home=%s", home);
- AddOption(apphome, NULL);
-
- /* How big is the application's classpath? */
- size = 40; /* 40: "-Djava.class.path=" */
- for (i = 0; i < cpathc; i++) {
- size += (int)JLI_StrLen(home) + (int)JLI_StrLen(cpathv[i]) + 1; /* 1: separator */
- }
- appcp = (char *)JLI_MemAlloc(size + 1);
- JLI_StrCpy(appcp, "-Djava.class.path=");
- for (i = 0; i < cpathc; i++) {
- JLI_StrCat(appcp, home); /* c:\program files\myapp */
- JLI_StrCat(appcp, cpathv[i]); /* \lib\myapp.jar */
- JLI_StrCat(appcp, separator); /* ; */
- }
- appcp[JLI_StrLen(appcp)-1] = '\0'; /* remove trailing path separator */
- AddOption(appcp, NULL);
- return JNI_TRUE;
-}
-
-/*
- * inject the -Dsun.java.command pseudo property into the args structure
- * this pseudo property is used in the HotSpot VM to expose the
- * Java class name and arguments to the main method to the VM. The
- * HotSpot VM uses this pseudo property to store the Java class name
- * (or jar file name) and the arguments to the class's main method
- * to the instrumentation memory region. The sun.java.command pseudo
- * property is not exported by HotSpot to the Java layer.
- */
-void
-SetJavaCommandLineProp(char *what, int argc, char **argv)
-{
-
- int i = 0;
- size_t len = 0;
- char* javaCommand = NULL;
- char* dashDstr = "-Dsun.java.command=";
-
- if (what == NULL) {
- /* unexpected, one of these should be set. just return without
- * setting the property
- */
- return;
- }
-
- /* determine the amount of memory to allocate assuming
- * the individual components will be space separated
- */
- len = JLI_StrLen(what);
- for (i = 0; i < argc; i++) {
- len += JLI_StrLen(argv[i]) + 1;
- }
-
- /* allocate the memory */
- javaCommand = (char*) JLI_MemAlloc(len + JLI_StrLen(dashDstr) + 1);
-
- /* build the -D string */
- *javaCommand = '\0';
- JLI_StrCat(javaCommand, dashDstr);
- JLI_StrCat(javaCommand, what);
-
- for (i = 0; i < argc; i++) {
- /* the components of the string are space separated. In
- * the case of embedded white space, the relationship of
- * the white space separated components to their true
- * positional arguments will be ambiguous. This issue may
- * be addressed in a future release.
- */
- JLI_StrCat(javaCommand, " ");
- JLI_StrCat(javaCommand, argv[i]);
- }
-
- AddOption(javaCommand, NULL);
-}
-
-/*
- * Set the "sun.java.main" property for tools like jps to show
- * the main class name or the module name.
- *
- * ## The JDK tools are launched in a module mode
- */
-void
-SetJavaMainProp(char *javamain) {
- char *prop;
- int buflen;
- if (javamain == NULL) {
- return;
- }
-
- buflen = JLI_StrLen(javamain) + 40;
- prop = (char *)JLI_MemAlloc(buflen);
- JLI_Snprintf(prop, buflen, "-Dsun.java.main=%s", javamain);
- AddOption(prop, NULL);
-}
-
-/*
- * JVM would like to know if it's created by a standard Sun launcher, or by
- * user native application, the following property indicates the former.
- */
-void
-SetJavaLauncherProp() {
- AddOption("-Dsun.java.launcher=SUN_STANDARD", NULL);
-}
-
-/* Set the property that tells java.lang.ClassLoader to create a Jigsaw
- * root-module loader rather than the usual delegating application loader
- */
-void
-SetModuleProp(char *module) {
- size_t buflen = JLI_StrLen(module) + 40;
- char *prop = (char *)JLI_MemAlloc(buflen);
- JLI_Snprintf(prop, buflen, "-Dsun.java.launcher.module=%s", module);
- AddOption(prop, NULL);
-}
-
-/* Tell the Jigsaw launcher which module library to use, if not the default
- */
-void
-SetModuleLibraryProp(char *mlpath) {
- size_t buflen = JLI_StrLen(mlpath) + 40;
- char *prop = (char *)JLI_MemAlloc(JLI_StrLen(mlpath) + 40);
- JLI_Snprintf(prop, buflen, "-Dsun.java.launcher.module.library=%s", mlpath);
- AddOption(prop, NULL);
-}
-
-/* Tell the VM where to find the classes in the boot module
- */
-void
-SetModuleBootProp(char *bpath) {
- size_t buflen = JLI_StrLen(bpath) + 40;
- char *prop = (char *)JLI_MemAlloc(buflen);
- JLI_Snprintf(prop, buflen, "-Dsun.java.launcher.module.boot=%s", bpath);
- AddOption(prop, NULL);
-}
-
-/*
- * Prints the version information from the java.version and other properties.
- */
-static void
-PrintJavaVersion(JNIEnv *env, jboolean extraLF)
-{
- jclass ver;
- jmethodID print;
-
- NULL_CHECK(ver = FindBootStrapClass(env, "sun/misc/Version"));
- NULL_CHECK(print = (*env)->GetStaticMethodID(env,
- ver,
- (extraLF == JNI_TRUE) ? "println" : "print",
- "()V"
- )
- );
-
- (*env)->CallStaticVoidMethod(env, ver, print);
-}
-
-/*
- * Prints all the Java settings, see the java implementation for more details.
- */
-static void
-ShowSettings(JNIEnv *env, char *optString)
-{
- jmethodID showSettingsID;
- jstring joptString;
- jclass cls = GetLauncherHelperClass(env);
- NULL_CHECK(cls);
- NULL_CHECK(showSettingsID = (*env)->GetStaticMethodID(env, cls,
- "showSettings", "(ZLjava/lang/String;JJJZ)V"));
- joptString = (*env)->NewStringUTF(env, optString);
- (*env)->CallStaticVoidMethod(env, cls, showSettingsID,
- USE_STDERR,
- joptString,
- (jlong)initialHeapSize,
- (jlong)maxHeapSize,
- (jlong)threadStackSize,
- ServerClassMachine());
-}
-
-/*
- * Prints default usage or the Xusage message, see sun.launcher.LauncherHelper.java
- */
-static void
-PrintUsage(JNIEnv* env, jboolean doXUsage)
-{
- jmethodID initHelp, vmSelect, vmSynonym, vmErgo, printHelp, printXUsageMessage;
- jstring jprogname, vm1, vm2;
- int i;
- jclass cls = GetLauncherHelperClass(env);
- NULL_CHECK(cls);
- if (doXUsage) {
- NULL_CHECK(printXUsageMessage = (*env)->GetStaticMethodID(env, cls,
- "printXUsageMessage", "(Z)V"));
- (*env)->CallStaticVoidMethod(env, cls, printXUsageMessage, USE_STDERR);
- } else {
- NULL_CHECK(initHelp = (*env)->GetStaticMethodID(env, cls,
- "initHelpMessage", "(Ljava/lang/String;)V"));
-
- NULL_CHECK(vmSelect = (*env)->GetStaticMethodID(env, cls, "appendVmSelectMessage",
- "(Ljava/lang/String;Ljava/lang/String;)V"));
-
- NULL_CHECK(vmSynonym = (*env)->GetStaticMethodID(env, cls,
- "appendVmSynonymMessage",
- "(Ljava/lang/String;Ljava/lang/String;)V"));
- NULL_CHECK(vmErgo = (*env)->GetStaticMethodID(env, cls,
- "appendVmErgoMessage", "(ZLjava/lang/String;)V"));
-
- NULL_CHECK(printHelp = (*env)->GetStaticMethodID(env, cls,
- "printHelpMessage", "(Z)V"));
-
- jprogname = (*env)->NewStringUTF(env, _program_name);
-
- /* Initialize the usage message with the usual preamble */
- (*env)->CallStaticVoidMethod(env, cls, initHelp, jprogname);
-
-
- /* Assemble the other variant part of the usage */
- if ((knownVMs[0].flag == VM_KNOWN) ||
- (knownVMs[0].flag == VM_IF_SERVER_CLASS)) {
- vm1 = (*env)->NewStringUTF(env, knownVMs[0].name);
- vm2 = (*env)->NewStringUTF(env, knownVMs[0].name+1);
- (*env)->CallStaticVoidMethod(env, cls, vmSelect, vm1, vm2);
- }
- for (i=1; i<knownVMsCount; i++) {
- if (knownVMs[i].flag == VM_KNOWN) {
- vm1 = (*env)->NewStringUTF(env, knownVMs[i].name);
- vm2 = (*env)->NewStringUTF(env, knownVMs[i].name+1);
- (*env)->CallStaticVoidMethod(env, cls, vmSelect, vm1, vm2);
- }
- }
- for (i=1; i<knownVMsCount; i++) {
- if (knownVMs[i].flag == VM_ALIASED_TO) {
- vm1 = (*env)->NewStringUTF(env, knownVMs[i].name);
- vm2 = (*env)->NewStringUTF(env, knownVMs[i].alias+1);
- (*env)->CallStaticVoidMethod(env, cls, vmSynonym, vm1, vm2);
- }
- }
-
- /* The first known VM is the default */
- {
- jboolean isServerClassMachine = ServerClassMachine();
-
- const char* defaultVM = knownVMs[0].name+1;
- if ((knownVMs[0].flag == VM_IF_SERVER_CLASS) && isServerClassMachine) {
- defaultVM = knownVMs[0].server_class+1;
- }
-
- vm1 = (*env)->NewStringUTF(env, defaultVM);
- (*env)->CallStaticVoidMethod(env, cls, vmErgo, isServerClassMachine, vm1);
- }
-
- /* Complete the usage message and print to stderr*/
- (*env)->CallStaticVoidMethod(env, cls, printHelp, USE_STDERR);
- }
- return;
-}
-
-/*
- * Read the jvm.cfg file and fill the knownJVMs[] array.
- *
- * The functionality of the jvm.cfg file is subject to change without
- * notice and the mechanism will be removed in the future.
- *
- * The lexical structure of the jvm.cfg file is as follows:
- *
- * jvmcfg := { vmLine }
- * vmLine := knownLine
- * | aliasLine
- * | warnLine
- * | ignoreLine
- * | errorLine
- * | predicateLine
- * | commentLine
- * knownLine := flag "KNOWN" EOL
- * warnLine := flag "WARN" EOL
- * ignoreLine := flag "IGNORE" EOL
- * errorLine := flag "ERROR" EOL
- * aliasLine := flag "ALIASED_TO" flag EOL
- * predicateLine := flag "IF_SERVER_CLASS" flag EOL
- * commentLine := "#" text EOL
- * flag := "-" identifier
- *
- * The semantics are that when someone specifies a flag on the command line:
- * - if the flag appears on a knownLine, then the identifier is used as
- * the name of the directory holding the JVM library (the name of the JVM).
- * - if the flag appears as the first flag on an aliasLine, the identifier
- * of the second flag is used as the name of the JVM.
- * - if the flag appears on a warnLine, the identifier is used as the
- * name of the JVM, but a warning is generated.
- * - if the flag appears on an ignoreLine, the identifier is recognized as the
- * name of a JVM, but the identifier is ignored and the default vm used
- * - if the flag appears on an errorLine, an error is generated.
- * - if the flag appears as the first flag on a predicateLine, and
- * the machine on which you are running passes the predicate indicated,
- * then the identifier of the second flag is used as the name of the JVM,
- * otherwise the identifier of the first flag is used as the name of the JVM.
- * If no flag is given on the command line, the first vmLine of the jvm.cfg
- * file determines the name of the JVM.
- * PredicateLines are only interpreted on first vmLine of a jvm.cfg file,
- * since they only make sense if someone hasn't specified the name of the
- * JVM on the command line.
- *
- * The intent of the jvm.cfg file is to allow several JVM libraries to
- * be installed in different subdirectories of a single JRE installation,
- * for space-savings and convenience in testing.
- * The intent is explicitly not to provide a full aliasing or predicate
- * mechanism.
- */
-jint
-ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
-{
- FILE *jvmCfg;
- char jvmCfgName[MAXPATHLEN+20];
- char line[MAXPATHLEN+20];
- int cnt = 0;
- int lineno = 0;
- jlong start, end;
- int vmType;
- char *tmpPtr;
- char *altVMName = NULL;
- char *serverClassVMName = NULL;
- static char *whiteSpace = " \t";
- if (JLI_IsTraceLauncher()) {
- start = CounterGet();
- }
- JLI_Snprintf(jvmCfgName, sizeof(jvmCfgName), "%s%slib%s%s%sjvm.cfg",
- jrepath, FILESEP, FILESEP, arch, FILESEP);
-
- jvmCfg = fopen(jvmCfgName, "r");
- if (jvmCfg == NULL) {
- if (!speculative) {
- JLI_ReportErrorMessage(CFG_ERROR6, jvmCfgName);
- exit(1);
- } else {
- return -1;
- }
- }
- while (fgets(line, sizeof(line), jvmCfg) != NULL) {
- vmType = VM_UNKNOWN;
- lineno++;
- if (line[0] == '#')
- continue;
- if (line[0] != '-') {
- JLI_ReportErrorMessage(CFG_WARN2, lineno, jvmCfgName);
- }
- if (cnt >= knownVMsLimit) {
- GrowKnownVMs(cnt);
- }
- line[JLI_StrLen(line)-1] = '\0'; /* remove trailing newline */
- tmpPtr = line + JLI_StrCSpn(line, whiteSpace);
- if (*tmpPtr == 0) {
- JLI_ReportErrorMessage(CFG_WARN3, lineno, jvmCfgName);
- } else {
- /* Null-terminate this string for JLI_StringDup below */
- *tmpPtr++ = 0;
- tmpPtr += JLI_StrSpn(tmpPtr, whiteSpace);
- if (*tmpPtr == 0) {
- JLI_ReportErrorMessage(CFG_WARN3, lineno, jvmCfgName);
- } else {
- if (!JLI_StrCCmp(tmpPtr, "KNOWN")) {
- vmType = VM_KNOWN;
- } else if (!JLI_StrCCmp(tmpPtr, "ALIASED_TO")) {
- tmpPtr += JLI_StrCSpn(tmpPtr, whiteSpace);
- if (*tmpPtr != 0) {
- tmpPtr += JLI_StrSpn(tmpPtr, whiteSpace);
- }
- if (*tmpPtr == 0) {
- JLI_ReportErrorMessage(CFG_WARN3, lineno, jvmCfgName);
- } else {
- /* Null terminate altVMName */
- altVMName = tmpPtr;
- tmpPtr += JLI_StrCSpn(tmpPtr, whiteSpace);
- *tmpPtr = 0;
- vmType = VM_ALIASED_TO;
- }
- } else if (!JLI_StrCCmp(tmpPtr, "WARN")) {
- vmType = VM_WARN;
- } else if (!JLI_StrCCmp(tmpPtr, "IGNORE")) {
- vmType = VM_IGNORE;
- } else if (!JLI_StrCCmp(tmpPtr, "ERROR")) {
- vmType = VM_ERROR;
- } else if (!JLI_StrCCmp(tmpPtr, "IF_SERVER_CLASS")) {
- tmpPtr += JLI_StrCSpn(tmpPtr, whiteSpace);
- if (*tmpPtr != 0) {
- tmpPtr += JLI_StrSpn(tmpPtr, whiteSpace);
- }
- if (*tmpPtr == 0) {
- JLI_ReportErrorMessage(CFG_WARN4, lineno, jvmCfgName);
- } else {
- /* Null terminate server class VM name */
- serverClassVMName = tmpPtr;
- tmpPtr += JLI_StrCSpn(tmpPtr, whiteSpace);
- *tmpPtr = 0;
- vmType = VM_IF_SERVER_CLASS;
- }
- } else {
- JLI_ReportErrorMessage(CFG_WARN5, lineno, &jvmCfgName[0]);
- vmType = VM_KNOWN;
- }
- }
- }
-
- JLI_TraceLauncher("jvm.cfg[%d] = ->%s<-\n", cnt, line);
- if (vmType != VM_UNKNOWN) {
- knownVMs[cnt].name = JLI_StringDup(line);
- knownVMs[cnt].flag = vmType;
- switch (vmType) {
- default:
- break;
- case VM_ALIASED_TO:
- knownVMs[cnt].alias = JLI_StringDup(altVMName);
- JLI_TraceLauncher(" name: %s vmType: %s alias: %s\n",
- knownVMs[cnt].name, "VM_ALIASED_TO", knownVMs[cnt].alias);
- break;
- case VM_IF_SERVER_CLASS:
- knownVMs[cnt].server_class = JLI_StringDup(serverClassVMName);
- JLI_TraceLauncher(" name: %s vmType: %s server_class: %s\n",
- knownVMs[cnt].name, "VM_IF_SERVER_CLASS", knownVMs[cnt].server_class);
- break;
- }
- cnt++;
- }
- }
- fclose(jvmCfg);
- knownVMsCount = cnt;
-
- if (JLI_IsTraceLauncher()) {
- end = CounterGet();
- printf("%ld micro seconds to parse jvm.cfg\n",
- (long)(jint)Counter2Micros(end-start));
- }
-
- return cnt;
-}
-
-
-static void
-GrowKnownVMs(int minimum)
-{
- struct vmdesc* newKnownVMs;
- int newMax;
-
- newMax = (knownVMsLimit == 0 ? INIT_MAX_KNOWN_VMS : (2 * knownVMsLimit));
- if (newMax <= minimum) {
- newMax = minimum;
- }
- newKnownVMs = (struct vmdesc*) JLI_MemAlloc(newMax * sizeof(struct vmdesc));
- if (knownVMs != NULL) {
- memcpy(newKnownVMs, knownVMs, knownVMsLimit * sizeof(struct vmdesc));
- }
- JLI_MemFree(knownVMs);
- knownVMs = newKnownVMs;
- knownVMsLimit = newMax;
-}
-
-
-/* Returns index of VM or -1 if not found */
-static int
-KnownVMIndex(const char* name)
-{
- int i;
- if (JLI_StrCCmp(name, "-J") == 0) name += 2;
- for (i = 0; i < knownVMsCount; i++) {
- if (!JLI_StrCmp(name, knownVMs[i].name)) {
- return i;
- }
- }
- return -1;
-}
-
-static void
-FreeKnownVMs()
-{
- int i;
- for (i = 0; i < knownVMsCount; i++) {
- JLI_MemFree(knownVMs[i].name);
- knownVMs[i].name = NULL;
- }
- JLI_MemFree(knownVMs);
-}
-
-
-/*
- * Displays the splash screen according to the jar file name
- * and image file names stored in environment variables
- */
-static void
-ShowSplashScreen()
-{
- const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY);
- const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY);
- int data_size;
- void *image_data;
- if (jar_name) {
- image_data = JLI_JarUnpackFile(jar_name, file_name, &data_size);
- if (image_data) {
- DoSplashInit();
- DoSplashLoadMemory(image_data, data_size);
- JLI_MemFree(image_data);
- }
- } else if (file_name) {
- DoSplashInit();
- DoSplashLoadFile(file_name);
- } else {
- return;
- }
- DoSplashSetFileJarName(file_name, jar_name);
-
- /*
- * Done with all command line processing and potential re-execs so
- * clean up the environment.
- */
- (void)UnsetEnv(ENV_ENTRY);
- (void)UnsetEnv(SPLASH_FILE_ENV_ENTRY);
- (void)UnsetEnv(SPLASH_JAR_ENV_ENTRY);
-
- JLI_MemFree(splash_jar_entry);
- JLI_MemFree(splash_file_entry);
-
-}
-
-const char*
-GetDotVersion()
-{
- return _dVersion;
-}
-
-const char*
-GetFullVersion()
-{
- return _fVersion;
-}
-
-const char*
-GetProgramName()
-{
- return _program_name;
-}
-
-const char*
-GetLauncherName()
-{
- return _launcher_name;
-}
-
-const char*
-GetModuleName()
-{
- return _module_name;
-}
-
-const char*
-GetModuleVersion()
-{
- return _module_version;
-}
-
-jint
-GetErgoPolicy()
-{
- return _ergo_policy;
-}
-
-jboolean
-IsJavaArgs()
-{
- return _is_java_args;
-}
-
-static jboolean
-IsWildCardEnabled()
-{
- return _wc_enabled;
-}
-
-static int
-ContinueInNewThread(InvocationFunctions* ifn, int argc, char **argv,
- int mode, char *what, int ret)
-{
-
- /*
- * If user doesn't specify stack size, check if VM has a preference.
- * Note that HotSpot no longer supports JNI_VERSION_1_1 but it will
- * return its default stack size through the init args structure.
- */
- if (threadStackSize == 0) {
- struct JDK1_1InitArgs args1_1;
- memset((void*)&args1_1, 0, sizeof(args1_1));
- args1_1.version = JNI_VERSION_1_1;
- ifn->GetDefaultJavaVMInitArgs(&args1_1); /* ignore return value */
- if (args1_1.javaStackSize > 0) {
- threadStackSize = args1_1.javaStackSize;
- }
- }
-
- { /* Create a new thread to create JVM and invoke main method */
- JavaMainArgs args;
- int rslt;
-
- args.argc = argc;
- args.argv = argv;
- args.mode = mode;
- args.what = what;
- args.ifn = *ifn;
-
- rslt = ContinueInNewThread0(JavaMain, threadStackSize, (void*)&args);
- /* If the caller has deemed there is an error we
- * simply return that, otherwise we return the value of
- * the callee
- */
- return (ret != 0) ? ret : rslt;
- }
-}
-
-static void
-DumpState()
-{
- if (!JLI_IsTraceLauncher()) return ;
- printf("Launcher state:\n");
- printf("\tdebug:%s\n", (JLI_IsTraceLauncher() == JNI_TRUE) ? "on" : "off");
- printf("\tjavargs:%s\n", (_is_java_args == JNI_TRUE) ? "on" : "off");
- printf("\tprogram name:%s\n", GetProgramName());
- printf("\tlauncher name:%s\n", GetLauncherName());
- printf("\tmodule name:%s @ %s\n",
- GetModuleName() == NULL ? "null" : GetModuleName(),
- GetModuleVersion() == NULL ? "null" : GetModuleVersion());
- printf("\tjavaw:%s\n", (IsJavaw() == JNI_TRUE) ? "on" : "off");
- printf("\tfullversion:%s\n", GetFullVersion());
- printf("\tdotversion:%s\n", GetDotVersion());
- printf("\tergo_policy:");
- switch(GetErgoPolicy()) {
- case NEVER_SERVER_CLASS:
- printf("NEVER_ACT_AS_A_SERVER_CLASS_MACHINE\n");
- break;
- case ALWAYS_SERVER_CLASS:
- printf("ALWAYS_ACT_AS_A_SERVER_CLASS_MACHINE\n");
- break;
- default:
- printf("DEFAULT_ERGONOMICS_POLICY\n");
- }
-}
-
-/*
- * Return JNI_TRUE for an option string that has no effect but should
- * _not_ be passed on to the vm; return JNI_FALSE otherwise. On
- * Solaris SPARC, this screening needs to be done if:
- * -d32 or -d64 is passed to a binary with an unmatched data model
- * (the exec in CreateExecutionEnvironment removes -d<n> options and points the
- * exec to the proper binary). In the case of when the data model and the
- * requested version is matched, an exec would not occur, and these options
- * were erroneously passed to the vm.
- */
-jboolean
-RemovableOption(char * option)
-{
- /*
- * Unconditionally remove both -d32 and -d64 options since only
- * the last such options has an effect; e.g.
- * java -d32 -d64 -d32 -version
- * is equivalent to
- * java -d32 -version
- */
-
- if( (JLI_StrCCmp(option, "-d32") == 0 ) ||
- (JLI_StrCCmp(option, "-d64") == 0 ) )
- return JNI_TRUE;
- else
- return JNI_FALSE;
-}
-
-/*
- * A utility procedure to always print to stderr
- */
-void
-JLI_ReportMessage(const char* fmt, ...)
-{
- va_list vl;
- va_start(vl, fmt);
- vfprintf(stderr, fmt, vl);
- fprintf(stderr, "\n");
- va_end(vl);
-}
diff --git a/jdk/.hg/merge/state b/jdk/.hg/merge/state
deleted file mode 100644
index 72edc57..0000000
Binary files a/jdk/.hg/merge/state and /dev/null differ
diff --git a/jdk/.hg/store/00changelog.d b/jdk/.hg/store/00changelog.d
index 7423a46..2393033 100644
Binary files a/jdk/.hg/store/00changelog.d and b/jdk/.hg/store/00changelog.d differ
diff --git a/jdk/.hg/store/00changelog.i b/jdk/.hg/store/00changelog.i
index 3316dfa..ecaeca4 100644
Binary files a/jdk/.hg/store/00changelog.i and b/jdk/.hg/store/00changelog.i differ
diff --git a/jdk/.hg/store/00manifest.d b/jdk/.hg/store/00manifest.d
index f377bd2..030b1e0 100644
Binary files a/jdk/.hg/store/00manifest.d and b/jdk/.hg/store/00manifest.d differ
diff --git a/jdk/.hg/store/00manifest.i b/jdk/.hg/store/00manifest.i
index d7292b9..94ccc39 100644
Binary files a/jdk/.hg/store/00manifest.i and b/jdk/.hg/store/00manifest.i differ
diff --git a/jdk/.hg/store/data/src/share/classes/java/util/_service_loader.java.i b/jdk/.hg/store/data/src/share/classes/java/util/_service_loader.java.i
index ff372bd..53038ad 100644
Binary files a/jdk/.hg/store/data/src/share/classes/java/util/_service_loader.java.i and b/jdk/.hg/store/data/src/share/classes/java/util/_service_loader.java.i differ
diff --git a/jdk/.hg/store/data/src/share/classes/sun/font/_font_manager_factory.java.i b/jdk/.hg/store/data/src/share/classes/sun/font/_font_manager_factory.java.i
index b018091..a9581bb 100644
Binary files a/jdk/.hg/store/data/src/share/classes/sun/font/_font_manager_factory.java.i and b/jdk/.hg/store/data/src/share/classes/sun/font/_font_manager_factory.java.i differ
diff --git a/jdk/.hg/store/undo b/jdk/.hg/store/undo
index dff24ea..d70b343 100644
Binary files a/jdk/.hg/store/undo and b/jdk/.hg/store/undo differ
diff --git a/jdk/.hg/undo.desc b/jdk/.hg/undo.desc
index eefa23e..e1a7dd0 100644
--- a/jdk/.hg/undo.desc
+++ b/jdk/.hg/undo.desc
@@ -1,3 +1,3 @@
-5004
+5216
pull
http://hg.openjdk.java.net/jigsaw/jigsaw/jdk
diff --git a/jdk/.hg/undo.dirstate b/jdk/.hg/undo.dirstate
index a4ac688..35efc3e 100644
Binary files a/jdk/.hg/undo.dirstate and b/jdk/.hg/undo.dirstate differ
diff --git a/jdk/make/modules/jdk7.depconfig b/jdk/make/modules/jdk7.depconfig
deleted file mode 100644
index b589039..0000000
--- a/jdk/make/modules/jdk7.depconfig
+++ /dev/null
@@ -1,503 +0,0 @@
-#
-# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# private java.lang.Object createInetSocketAddress(java.lang.String, int)
- at ClassForName
- com.sun.jndi.ldap.Connection -> java.net.InetSocketAddress
- com.sun.jndi.ldap.Connection -> java.net.SocketAddress
-
-# com.sun.jndi.ldap.VersionHelper
- at ClassForName(optional)
- com.sun.jndi.ldap.VersionHelper -> com.sun.jndi.ldap.VersionHelper*
-
-# private static void initMethodHandles()
- at ClassForName
- com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.CORBA.Stub
- com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.PortableRemoteObject
-
-# com.sun.naming.internal.ResourceManager$AppletParameter
- at ClassForName(optional)
- com.sun.naming.internal.ResourceManager$AppletParameter -> java.applet.Applet
-
-# private static boolean loadProviderAsService()
- at Provider
- com.sun.net.httpserver.spi.HttpServerProvider -> META-INF/services/com.sun.net.httpserver.spi.HttpServerProvider
-
-# com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT
- at ClassForName
- com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT -> javax.xml.XMLConstants
-
-# public static java.beans.PersistenceDelegate getPersistenceDelegate(java.lang.Class)
- at ClassForName
- java.beans.MetaData -> java.beans.*_PersistenceDelegate
-
-# ## desktop -> jdbc (does this need to be optional dependency so that
-# desktop module can find java.sql.Timestamp class when jdbc module exist)??
-#
-# private static java.lang.reflect.Method getNanosMethod()
-# @ClassForName(optional)
-# java.beans.java_sql_Timestamp_PersistenceDelegate -> java.sql.Timestamp
-
-# java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate
- at ClassForName
- java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate -> java.util.Collections$CheckedCollection
-
-# java.beans.java_util_Collections$CheckedMap_PersistenceDelegate
- at ClassForName
- java.beans.java_util_Collections$CheckedMap_PersistenceDelegate -> java.util.Collections$CheckedMap
-
-# private static java.lang.Object getType(java.lang.Object)
- at ClassForName
- java.beans.java_util_EnumMap_PersistenceDelegate -> java.util.EnumMap
-
-# private java.lang.Integer getAxis(java.lang.Object)
- at ClassForName
- java.beans.javax_swing_Box_PersistenceDelegate -> javax.swing.BoxLayout
-
-# java.lang.Double
- at Inline
- java.lang.Double -> sun.misc.FloatConsts
- java.lang.Double -> sun.misc.DoubleConsts
-
-# java.lang.Float
- at Inline
- java.lang.Float -> sun.misc.FloatConsts
- java.lang.Float -> sun.misc.DoubleConsts
-
-# java.net.DefaultDatagramSocketImplFactory
- at ClassForName(optional)
- java.net.DefaultDatagramSocketImplFactory -> java.net.*DatagramSocketImpl
-
-# private static sun.net.spi.nameservice.NameService createNSProvider(java.lang.String)
- at Provider
- java.net.InetAddress -> META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
-
-# static java.net.InetAddressImpl create()
- at ClassForName
- java.net.InetAddressImplFactory -> java.net.*Inet[46]AddressImpl
-
-# private static void init()
- at NativeFindClass
- java.net.PlainDatagramSocketImpl -> java.io.FileDescriptor
-
-# java.net.ProxySelector
- at ClassForName
- java.net.ProxySelector -> sun.net.spi.DefaultProxySelector
-
-# static java.net.URLStreamHandler getURLStreamHandler(java.lang.String)
- at ClassForName(optional)
- java.net.URL -> sun.net.www.protocol.*.Handler
-
-# private java.net.ContentHandler lookupContentHandlerClassFor(java.lang.String)
- at ClassForName
- java.net.URLConnection -> sun.net.www.content.*
-
-# private static java.nio.channels.spi.AsynchronousChannelProvider loadProviderAsService()
- at Provider
- java.nio.channels.spi.AsynchronousChannelProvider$ProviderHolder -> META-INF/services/java.nio.channels.spi.AsynchronousChannelProvider
-
-# private static boolean loadProviderFromProperty()
- at ClassForName
- java.nio.channels.spi.SelectorProvider -> sun.nio.ch.DefaultSelectorProvider
-
-# private static boolean loadProviderAsService()
- at Provider
- java.nio.channels.spi.SelectorProvider -> META-INF/services/java.nio.channels.spi.SelectorProvider
-
-# private static java.util.Iterator providers()
- at Provider
- java.nio.charset.Charset -> META-INF/services/java.nio.charset.spi.CharsetProvider
-
-# private static void probeExtendedProvider()
- at ClassForName(optional)
- java.nio.charset.Charset -> sun.nio.cs.ext.ExtendedCharsets
-
-# public static java.nio.file.FileSystem newFileSystem(java.net.URI, java.util.Map<java.lang.String, ?>, java.lang.ClassLoader)
- at Provider
- java.nio.file.FileSystems -> META-INF/services/java.nio.file.FileSystemProvider
-
-# private static java.util.List<java.nio.file.spi.FileTypeDetector> loadInstalledDetectors()
- at Provider
- java.nio.file.Files$DefaultFileTypeDetectorHolder -> META-INF/services/java.nio.file.spi.FileTypeDetector
-
-# public static java.util.List<java.nio.file.spi.FileSystemProvider> installedProviders()
- at Provider
- java.nio.file.spi.FileSystemProvider -> META-INF/services/java.nio.file.FileSystemProvider
-
-# private static java.rmi.server.RMIClassLoaderSpi initializeProvider()
- at Provider
- java.rmi.server.RMIClassLoader -> META-INF/services/java.rmi.server.RMIClassLoaderSpi
-
-# private static void initializeSystemScope()
- at ClassForName(optional)
- java.security.IdentityScope -> sun.security.provider.IdentityDatabase
-
-# static java.security.Policy getPolicyNoCheck()
- at ClassForName
- java.security.Policy -> sun.security.provider.PolicyFile
-
-# private static java.lang.Class getSpiClass(java.lang.String)
- at ClassForName
- java.security.Security -> java.security.*Spi
-
-# private static void invalidateSMCache(java.lang.String)
- at ClassForName
- java.security.Security -> java.lang.SecurityManager
-
-# private static void loadInitialDrivers()
- at Provider
- java.sql.DriverManager -> META-INF/services/java.sql.Driver
-
-# private static java.text.BreakIterator createBreakInstance(java.util.Locale, int, java.lang.String, java.lang.String)
- at Provider
- java.text.BreakIterator -> META-INF/services/java.util.spi.BreakIteratorProvider
-
-# public static java.text.Collator getInstance(java.util.Locale)
- at Provider
- java.text.Collator -> META-INF/services/java.util.spi.CollatorProvider
-
-# private static java.text.DateFormat get(int, int, int, java.util.Locale)
- at Provider
- java.text.DateFormat -> META-INF/services/java.util.spi.DateNameProvider
-
-# public static java.util.Locale[] getAvailableLocales()
- at Provider
- java.text.DateFormatSymbols -> META-INF/services/java.util.spi.DateFormatSymbolsProvider
-
-# public static java.util.Locale[] getAvailableLocales()
- at Provider
- java.text.DecimalFormatSymbols -> META-INF/services/java.util.spi.DecimalFormatSymbolsProvider
-
-# public static java.util.Locale[] getAvailableLocales()
- at Provider
- java.text.NumberFormat -> META-INF/services/java.util.spi.NumberFormatProvider
-
-# public java.lang.String getDisplayName(java.util.Locale)
- at Provider
- java.util.Currency -> META-INF/services/java.util.spi.CurrencyNameProvider
-
-# java.util.Formatter
- at Inline
- java.util.Formatter -> sun.misc.DoubleConsts
-
-# java.util.Locale
- at Inline
- java.util.Locale -> java.util.LocaleISOData
-
-# private java.lang.String getDisplayString(java.lang.String, java.util.Locale, int)
- at Provider
- java.util.Locale -> META-INF/services/java.util.spi.LocaleNameProvider
-
-# private static java.util.prefs.PreferencesFactory factory1()
- at ClassForName
- java.util.prefs.Preferences -> java.util.prefs.WindowsPreferencesFactory
- java.util.prefs.Preferences -> java.util.prefs.FileSystemPreferencesFactory
-
-# private static java.util.prefs.PreferencesFactory factory1()
- at Provider
- java.util.prefs.Preferences -> META-INF/services/java.util.prefs.PreferencesFactory
-
-# public void registerApplicationClasspathSpis()
- at Provider
- javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.IIOServiceProvider
-
-# private void registerInstalledProviders()
- at Provider
- javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderSpi
- javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageWriterSpi
- javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderWriterSpi
- javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageTranscoderSpi
- javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageInputStreamSpi
- javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageOutputStreamSpi
-
-# public javax.naming.ldap.ExtendedResponse createExtendedResponse(java.lang.String, byte[], int, int)
- at Provider
- javax.naming.ldap.StartTlsRequest -> META-INF/services/javax.naming.ldap.StartTlsResponse
-
-# private static java.util.ArrayList getAllLookupServices()
- at Provider
- javax.print.PrintServiceLookup -> META-INF/services/javax.print.PrintServiceLookup
-
-# private static java.util.ArrayList getAllFactories()
- at Provider
- javax.print.StreamPrintServiceFactory -> META-INF/services/javax.print.StreamPrintServiceFactory
-
-# private void initEngines(java.lang.ClassLoader)
- at Provider
- javax.script.ScriptEngineManager -> META-INF/services/javax.script.ScriptEngineFactory
-
-# private void initializeInputMethodLocatorList()
- at Provider
- sun.awt.im.ExecutableInputMethodManager -> META-INF/services/java.awt.im.spi.InputMethodDescriptor
-
-# private static java.lang.Class getConverterClass(int, java.lang.String)
- at ClassForName(optional)
- sun.io.Converters -> sun.io.*
-
-# public static sun.java2d.cmm.PCMM getModule()
- at Provider
- sun.java2d.cmm.CMSManager -> META-INF/services/sun.java2d.cmm.PCMM
-
-# public static sun.java2d.pipe.RenderingEngine getInstance()
- at Provider
- sun.java2d.pipe.RenderingEngine -> META-INF/services/sun.java2d.pipe.RenderingEngine
-
-# public static sun.java2d.pipe.RenderingEngine getInstance()
- at ClassForName(optional)
- sun.java2d.pipe.RenderingEngine -> sun.dc.DuctusRenderingEngine
-
-# sun.misc.FloatingDecimal
- at Inline
- sun.misc.FloatingDecimal -> sun.misc.FloatConsts
- sun.misc.FloatingDecimal -> sun.misc.DoubleConsts
-
-# sun.misc.FormattedFloatingDecimal
- at Inline
- sun.misc.FormattedFloatingDecimal -> sun.misc.FloatConsts
- sun.misc.FormattedFloatingDecimal -> sun.misc.DoubleConsts
-
-# sun.misc.FpUtils
- at Inline
- sun.misc.FpUtils -> sun.misc.FloatConsts
- sun.misc.FpUtils -> sun.misc.DoubleConsts
-
-# public java.net.URLStreamHandler createURLStreamHandler(java.lang.String)
- at ClassForName(optional)
- sun.misc.Launcher$Factory -> sun.net.www.protocol.*.Handler
-
-# private static sun.net.NetHooks$Provider loadProvider(java.lang.String)
- at ClassForName(optional)
- sun.net.NetHooks -> sun.net.spi.SdpProvider
-
-# sun.net.idn.StringPrep
- at Inline
- sun.net.idn.StringPrep -> sun.net.idn.UCharacterDirection
-
-# private static boolean init()
- at NativeFindClass
- sun.net.spi.DefaultProxySelector -> java.net.Proxy
- sun.net.spi.DefaultProxySelector -> java.net.Proxy$Type
- sun.net.spi.DefaultProxySelector -> java.net.InetSocketAddress
-
-# private static java.nio.channels.Channel createChannel()
- at ClassForName
- sun.nio.ch.InheritedChannel -> java.io.FileDescriptor
-
-# private static void initDBBConstructor()
- at ClassForName
- sun.nio.ch.Util -> java.nio.DirectByteBuffer
-
-# private static void initDBBRConstructor()
- at ClassForName
- sun.nio.ch.Util -> java.nio.DirectByteBufferR
-
-# private java.nio.charset.Charset lookup(java.lang.String)
- at ClassForName(optional)
- sun.nio.cs.FastCharsetProvider -> sun.nio.cs.*
-
-# sun.nio.cs.ext.ExtendedCharsets
- at ClassForName(optional)
- sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.*
-
-# sun.nio.cs.ext.ExtendedCharsets
- at ClassForName(optional)
- sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.*
-
-
-# public static java.nio.file.spi.FileSystemProvider create()
- at ClassForName
- sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.SolarisFileSystemProvider
- sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.LinuxFileSystemProvider
-
-# sun.rmi.server.MarshalInputStream
- at ClassForName
- sun.rmi.server.MarshalInputStream -> sun.rmi.server.Activation$ActivationSystemImpl_Stub
- sun.rmi.server.MarshalInputStream -> sun.rmi.registry.RegistryImpl_Stub
-
-# private java.security.Provider doLoadProvider()
- at ClassForName(optional)
- sun.security.jca.ProviderConfig -> sun.security.pkcs11.SunPKCS11
- sun.security.jca.ProviderConfig -> sun.security.provider.Sun
- sun.security.jca.ProviderConfig -> sun.security.rsa.SunRsaSign
- sun.security.jca.ProviderConfig -> sun.security.ec.SunEC
- sun.security.jca.ProviderConfig -> com.sun.net.ssl.internal.ssl.Provider
- sun.security.jca.ProviderConfig -> com.sun.crypto.provider.SunJCE
- sun.security.jca.ProviderConfig -> sun.security.jgss.SunProvider
- sun.security.jca.ProviderConfig -> com.sun.security.sasl.Provider
- sun.security.jca.ProviderConfig -> org.jcp.xml.dsig.internal.dom.XMLDSigRI
- sun.security.jca.ProviderConfig -> sun.security.smartcardio.SunPCSC
- sun.security.jca.ProviderConfig -> sun.security.mscapi.SunMSCAPI
-
-# public static java.security.Provider getSunProvider()
- at ClassForName
- sun.security.jca.Providers -> sun.security.provider.Sun
- sun.security.jca.Providers -> sun.security.provider.VerificationProvider
-
-# private static sun.security.jgss.spi.MechanismFactory getMechFactoryImpl(java.security.Provider, java.lang.String, org.ietf.jgss.Oid, sun.security.jgss.GSSCaller)
- at ClassForName
- sun.security.jgss.ProviderList -> sun.security.jgss.spi.MechanismFactory
-
-# sun.security.jgss.wrapper.SunNativeProvider
- at NativeFindClass
- sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.Oid
- sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.GSSException
- sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSNameElement
- sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSCredElement
- sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.NativeGSSContext
- sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.SunNativeProvider
- sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.MessageProp
- sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.ChannelBinding
- sun.security.jgss.wrapper.SunNativeProvider -> java.net.InetAddress
- sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSLibStub
-
-# static void ensureLoaded()
- at NativeFindClass
- sun.security.krb5.Credentials -> sun.security.krb5.internal.Krb5
- sun.security.krb5.Credentials -> sun.security.krb5.internal.Ticket
- sun.security.krb5.Credentials -> sun.security.krb5.PrincipalName
- sun.security.krb5.Credentials -> sun.security.util.DerValue
- sun.security.krb5.Credentials -> sun.security.krb5.EncryptionKey
- sun.security.krb5.Credentials -> sun.security.krb5.internal.TicketFlags
- sun.security.krb5.Credentials -> sun.security.krb5.internal.KerberosTime
-
-# public static java.lang.String getDefaultCacheName()
- at ClassForName(optional)
- sun.security.krb5.internal.ccache.FileCredentialsCache -> com.sun.security.auth.module.UnixSystem
-
-# sun.security.pkcs.PKCS9Attribute
- at ClassForName
- sun.security.pkcs.PKCS9Attribute -> sun.security.util.ObjectIdentifier
- sun.security.pkcs.PKCS9Attribute -> java.util.Date
- sun.security.pkcs.PKCS9Attribute -> sun.security.pkcs.SignerInfo
- sun.security.pkcs.PKCS9Attribute -> sun.security.x509.CertificateExtensions
-
-# protected T engineGetKeySpec(java.security.Key, java.lang.Class<T>)
- at ClassForName
- sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPublicKeySpec
- sun.security.provider.DSAKeyFactory -> java.security.spec.X509EncodedKeySpec
- sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPrivateKeySpec
- sun.security.provider.DSAKeyFactory -> java.security.spec.PKCS8EncodedKeySpec
-
-# protected T engineGetParameterSpec(java.lang.Class<T>)
- at ClassForName
- sun.security.provider.DSAParameters -> java.security.spec.DSAParameterSpec
-
-# sun.security.provider.VerificationProvider
- at ClassForName(optional)
- sun.security.provider.VerificationProvider -> sun.security.provider.Sun
- sun.security.provider.VerificationProvider -> sun.security.rsa.SunRsaSign
-
-# sun.security.provider.certpath.URICertStore$LDAP
- at ClassForName(optional)
- sun.security.provider.certpath.URICertStore$LDAP -> sun.security.provider.certpath.ldap.LDAPCertStoreHelper
-
-# sun.security.smartcardio.PCSC
- at NativeFindClass
- sun.security.smartcardio.PCSC -> sun.security.smartcardio.PCSCException
-
-# sun.security.ssl.HandshakeMessage
- at ClassForName
- sun.security.ssl.HandshakeMessage -> java.security.MessageDigest$Delegate
-
-# ## This is a test to implement JsseJce.isKerberosAvailable() method.
-# but causes a circular dependence jsse -> kerberos -> jsse
-#
-# sun.security.ssl.JsseJce
-# @ClassForName(optional)
-# sun.security.ssl.JsseJce -> sun.security.krb5.PrincipalName
-
-# sun.security.x509.OIDMap$OIDInfo
- at ClassForName
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectKeyIdentifierExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.KeyUsageExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PrivateKeyUsageExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectAlternativeNameExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuerAlternativeNameExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.BasicConstraintsExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLNumberExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLReasonCodeExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NameConstraintsExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyMappingsExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityKeyIdentifierExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyConstraintsExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NetscapeCertTypeExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificatePoliciesExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.ExtendedKeyUsageExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.InhibitAnyPolicyExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLDistributionPointsExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificateIssuerExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectInfoAccessExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityInfoAccessExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuingDistributionPointExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.DeltaCRLIndicatorExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.FreshestCRLExtension
- sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.OCSPNoCheckExtension
-
-# sun.util.LocaleServiceProviderPool$AllAvailableLocales
- at Provider
- sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.BreakIteratorProvider
- sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.CollatorProvider
- sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatProvider
- sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatSymbolsProvider
- sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DecimalFormatSymbolsProvider
- sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.NumberFormatProvider
- sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.CurrencyNameProvider
- sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.LocaleNameProvider
- sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.TimeZoneNameProvider
-
-# private static final java.lang.String[] retrieveDisplayNames(sun.util.resources.OpenListResourceBundle, java.lang.String, java.util.Locale)
- at Provider
- sun.util.TimeZoneNameUtility -> META-INF/services/java.util.spi.TimeZoneNamePProvider
-
-# public static sun.util.calendar.CalendarSystem forName(java.lang.String)
- at ClassForName
- sun.util.calendar.CalendarSystem -> sun.util.calendar.Gregorian
- sun.util.calendar.CalendarSystem -> sun.util.calendar.LocalGregorianCalendar
- sun.util.calendar.CalendarSystem -> sun.util.calendar.JulianCalendar
-
-# sun.util.logging.LoggingSupport
- at ClassForName(optional)
- sun.util.logging.LoggingSupport -> java.util.logging.LoggingProxyImpl
-
- at ClassForName(optional)
- sun.tools.jinfo.JInfo -> sun.jvm.hotspot.tools.JInfo
-
- at ClassForName(optional)
- sun.tools.jmap.JMap -> sun.jvm.hotspot.tools.PMap
- sun.tools.jmap.JMap -> sun.jvm.hotspot.tools.HeapSummary
- sun.tools.jmap.JMap -> sun.jvm.hotspot.tools.HeapDumper
- sun.tools.jmap.JMap -> sun.jvm.hotspot.tools.ObjectHistogram
- sun.tools.jmap.JMap -> sun.jvm.hotspot.tools.PermStat
- sun.tools.jmap.JMap -> sun.jvm.hotspot.tools.FinalizerInfo
- sun.tools.jmap.JMap -> sun.jvm.hotspot.tools.HeapDumper
- sun.tools.jmap.JMap -> sun.jvm.hotspot.tools.HeapSummary
-
- at ClassForName(optional)
- sun.tools.jstack.JStack -> sun.jvm.hotspot.tools.JStack
-
- at ClassForName(optional)
- sun.rmi.rmic.Main -> sun.rmi.rmic.iiop.StubGenerator
- sun.rmi.rmic.Main -> sun.rmi.rmic.iiop.IDLGenerator
- sun.rmi.rmic.Main -> sun.rmi.rmic.iiop.PrintGenerator
- sun.rmi.rmic.Main -> sun.rmi.rmic.iiop.BatchEnvironment
-
diff --git a/jdk/make/modules/update_module.sh b/jdk/make/modules/update_module.sh
deleted file mode 100755
index 931ee01..0000000
--- a/jdk/make/modules/update_module.sh
+++ /dev/null
@@ -1,333 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# A script to assist incremental jdk development to update a specified
-# module in the module library of the build outputdir or a specified
-# module image (such as jdk-module-image, jdk-base-image, etc).
-#
-# You can find out which module a class or resource file belongs
-# from the classlist files generated by the class analyzer tool:
-# $outputdir/moduleinfo/classlist/*.classlist
-# $outputdir/moduleinfo/classlist/*.resources
-#
-# Details:
-#
-# After the jdk is built, a module library, $outputdir/lib/modules,
-# with jdk modules preinstalled will be created.
-#
-# When classes are modified and recompiled, an additional step is
-# required to update the module library; otherwise, module mode
-# will not run with the latest recompiled classes.
-#
-# To modularize the jdk and recreate the module library:
-# cd jdk/make/modules; make all
-#
-# To avoid reinstalling all jdk modules, you can use this script
-# to update one or more modules.
-#
-# Examples:
-# Reinstall jdk.boot module in the build outputdir
-# $ update_module jdk.boot
-
-# Reinstall jdk.boot module in the build outputdir and the jdk-module-image
-# $ update_module -image jdk-module-image jdk.boot
-#
-# Reinstall javac module in a specified jdkhome from the langtools buildarea
-# $ update_module -jdkhome mymoduleimage -classes langtools/build/classes javac
-#
-
-do_usage() {
- printf "Usage: $0 [module name]+\n"
- printf " options\n"
- printf " -builddir : build outputdir\n"
- printf " -image : module image name (e.g. jdk-module-image)\n"
- printf " -jdkhome : jdk module image to be updated\n"
- printf " If specified, only its module library is updated\n"
- printf " -classes : directory from which classes are copied\n"
- printf " Must be used with -jdkhome\n"
- printf " -d64 : 64-bit build\n"
- printf " -h : this help message\n"
- printf " \n"
- printf " Note: By default it will update the module library\n"
- printf " in the build outputdir.\n"
- exit 1
-}
-
-if [ $# -eq 0 ] ; then
- do_usage;
- exit 1
-fi
-
-#
-# Directory build outputdir directory is under the top forest repo
-#
-builddir=
-image=
-classesdir=
-jdkhome=
-quick=0
-lp64=0
-modules=
-for i in $*; do
- case $i in
- -builddir) builddir="$2"; shift 2;;
- -image) image="$2"; shift 2;;
- -jdkhome) jdkhome="$2"; shift 2;;
- -classes) classesdir="$2"; shift 2;;
- -d64) lp64=1; shift;;
- -h) do_usage ; break ;;
- --) shift; break;;
- esac
-done
-
-modules=$@
-
-ARCH=i586
-OS=`uname -s`
-case "$OS" in
- SunOS )
- PLATFORM=solaris
- proc=`uname -p`
- case "$proc" in
- i[3-9]86)
- ARCH=i586
- ;;
- sparc*)
- ARCH=sparc
- ;;
- *)
- ARCH=$proc
- ;;
- esac
- ;;
- Linux )
- PLATFORM=linux
- mach=`uname -m`
- case "$mach" in
- i[3-9]86)
- ARCH=i586
- ;;
- ia64)
- ARCH=ia64
- ;;
- x86_64)
- ARCH=amd64
- ;;
- sparc*)
- ARCH=sparc
- ;;
- arm*)
- ARCH=arm
- ;;
- *)
- ARCH=$mach
- ;;
- esac
- ;;
- Windows* )
- PLATFORM=windows
- ;;
- CYGWIN* )
- PLATFORM=windows
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-if [ ${lp64} = 1 -a ${PLATFORM} = "solaris" ] ; then
- if [ ${ARCH} = "sparc" ] ; then
- ARCH=sparcv9
- else
- ARCH=`isainfo -n`
- fi
-fi
-
-# set default build output dir to the top forest build directory
-if [ "x${builddir}" = x ] ; then
- builddir=`dirname $0`/../../../build/${PLATFORM}-${ARCH}
- echo "Build outputdir : ${builddir}"
-fi
-
-
-if [ ! -d ${builddir} ] ; then
- echo "Build outputdir $builddir doesn't exist"
- do_usage
- exit 1
-fi
-
-if [ "x${jdkhome}" != x ] ; then
- if [ ! -d ${jdkhome} ] ; then
- echo "JDK home ${jdkhome} doesn't exist"
- do_usage
- exit 1
- fi
-fi
-
-if [ "x${classesdir}" != x ] ; then
- if [ ! -d ${classesdir} ] ; then
- echo "Class directory $classesdir doesn't exist"
- do_usage
- exit 1
- fi
-fi
-
-if [ "x${classesdir}" != x -a "x${jdkhome}" = x ] ; then
- echo "-jdkhome must be set"
- do_usage
- exit 1
-fi
-
-if [ "x${jdkhome}" != x -a "x${image}" != x ] ; then
- echo "Both -jdkhome and -image set is not supported"
- do_usage
- exit 1
-fi
-
-abs_builddir=`cd $builddir; pwd`
-
-module_image_dir=${abs_builddir}/${image}
-if [ "x${image}" != x -a ! -d ${module_image_dir} ] ; then
- echo "Module image ${image} doesn't exist"
- do_usage
- exit 1
-fi
-
-if [ "x${modules}" = x ] ; then
- echo "Must specify a module"
- do_usage;
- exit 1
-fi
-
-submodule_dir=${abs_builddir}/submodules
-classlist_dir=${abs_builddir}/moduleinfo/classlist
-modules_list=${classlist_dir}/modules.list
-
-copy_module() {
- m=$1
- mroot=$2
- classes=$3
- mcontent=${abs_builddir}/modules/$m
- if [ ! -d ${mcontent} ] ; then
- echo "module $m doesn't exist"
- exit 1
- fi
-
- echo "Syncing module $m in the build outputdir"
- for s in `grep "^$m " ${modules_list}` ; do
- if [ -d ${submodule_dir}/$s ] ; then
- for d in bin lib etc include ; do
- if [ -d ${submodule_dir}/$s/$d ] ; then
- cp -rf ${submodule_dir}/$s/$d ${mcontent}
- fi ;
- done
- fi ;
- done ;
-
- cd ${classes}
- if [ -f ${classlist_dir}/$m.classlist ] ; then
- sed -e 's%\\%\/%g' < ${classlist_dir}/$m.classlist \
- | cpio -pdum ${mcontent}/classes
- fi
- if [ -f ${classlist_dir}/$m.resources ] ; then
- sed -e 's%\\%\/%g' < ${classlist_dir}/$m.resources \
- | cpio -pdum ${mcontent}/resources
- fi
-}
-
-reinstall_module() {
- m=$1
- mroot=$2
- classes=$3
- mlib=$mroot/lib/modules
- mcontent=${abs_builddir}/modules/$m
-
- JMOD_OPTION=
- if [ -f ${classlist_dir}/$m.resources ] ; then
- JMOD_OPTION="-r ${mcontent}/resources"
- fi
-
- echo "Reinstalling module $m in $4"
- rm -rf ${mlib}/$m
- cd ${mcontent}
- ${abs_builddir}/bin/jmod -L ${mlib} install classes ${JMOD_OPTION} $m || exit 1
-}
-
-quick_update() {
- m=$1
- mroot=$2
- classes=$3
- mlib=$mroot/lib/modules
- mcontent=${abs_builddir}/modules/$m
- if [ ! -d ${mlib} ] ; then
- echo "module $m doesn't exist in ${mroot}"
- exit 1
- fi
-
- cd ${classes}
- if [ -f ${classlist_dir}/$m.classlist ] ; then
- filelist=`cat ${classlist_dir}/$m.classlist`
- ${mroot}/bin/jar uf $mlib/$m/7-ea/classes $filelist
- fi
- if [ -f ${classlist_dir}/$m.resources ] ; then
- filelist=`cat ${classlist_dir}/$m.resources`
- ${mroot}/bin/jar uf $mlib/$m/7-ea/classes $filelist
- fi
-
- echo "Reindexing module $m in $4"
- ${abs_builddir}/bin/jmod -L ${mlib} reindex $m at 7-ea || exit 1
-}
-
-update() {
- if [ ${quick} = 0 ] ; then
- reinstall_module $@
- else
- quick_update $@
- fi
-}
-
-for m in ${modules} ; do
- if [ "x${jdkhome}" = x ] ; then
- # update the module content in the build directory once
- copy_module $m ${abs_builddir} ${abs_builddir}/classes ${abs_builddir}
- update $m ${abs_builddir} ${abs_builddir}/classes "the build outputdir"
- if [ "x${image}" != x ] ; then
- cp -r ${abs_builddir}/lib/modules/$m ${module_image_dir}/lib/modules
- fi
- else
- mroot=${jdkhome}
- dest=${jdkhome}
- classes=${abs_builddir}/classes
- if [ "x${classesdir}" != x ] ; then
- classes=${classesdir}
- fi
- copy_module $m ${abs_builddir} ${classes} ${abs_builddir}
- update $m ${mroot} ${classes} ${mroot} ${dest}
- fi
-done
diff --git a/jdk/make/sun/motif12/reorder-i586 b/jdk/make/sun/motif12/reorder-i586
deleted file mode 100644
index 9cbfe97..0000000
--- a/jdk/make/sun/motif12/reorder-i586
+++ /dev/null
@@ -1,216 +0,0 @@
-data = R0x2000;
-text = LOAD ?RXO;
-# Test Null
-# Test Exit
-# Test Hello
-# Test Sleep
-# Test IntToString
-# Test LoadToolkit
-text: .text%JNI_OnLoad;
-text: .text%awt_util_debug_init;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_initDisplay;
-text: .text%awt_init_Display;
-text: .text%makeDefaultConfig: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
-text: .text%awt_allocate_colors;
-text: .text%alloc_col: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11Color.o;
-text: .text%getVirtCubeSize;
-text: .text%uname: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11Color.o;
-text: .text%Java_sun_awt_font_NativeFontWrapper_getFontPath;
-text: .text%getPlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%getSolarisFontLocations: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%fstat: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%AppendFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%freePlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%checkFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Font.o;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_getNativeFonts;
-text: .text%Java_sun_awt_font_NativeFontWrapper_setNativeFontPath;
-text: .text%isDisplayLocal;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_checkShmExt;
-text: .text%TryInitMITShm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
-text: .text%awt_output_flush;
-text: .text%awtJNI_TimeMillis: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%AddFontsToX11FontPath: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_getNumScreens;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum;
-text: .text%Java_sun_awt_X11GraphicsDevice_getConfigVisualId;
-text: .text%Java_sun_awt_X11GraphicsDevice_isDBESupported;
-text: .text%Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
-text: .text%Java_sun_awt_X11GraphicsConfig_initIDs;
-text: .text%Java_sun_awt_X11GraphicsConfig_init;
-text: .text%getAllConfigs: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
-text: .text%Java_sun_awt_motif_MToolkit_init;
-text: .text%getDefaultConfig;
-text: .text%getScreenData;
-text: .text%Java_sun_awt_PlatformFont_initIDs;
-text: .text%Java_sun_awt_motif_MFontPeer_initIDs;
-text: .text%awt_wm_init;
-text: .text%awt_wm_initAtoms: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_getRunningWM;
-text: .text%xerror_detect_wm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_prepareIsIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isNetSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_checkAnchor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_getProperty32: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isWinSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isEnlightenment: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_getECommsWindowIDProperty: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isSawfish: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isNetWMName: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isKDE2: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isCDE: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_color_match;
-text: .text%setup_modifier_map: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%set_mod_mask: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_initialize_DataTransferer;
-text: .text%awt_initialize_Xm_DnD;
-text: .text%cacheDropDone: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o;
-text: .text%awt_motif_enableSingleDragInitiator;
-text: .text%Java_java_awt_Cursor_initIDs;
-text: .text%Java_sun_awt_motif_X11CustomCursor_cacheInit;
-text: .text%Java_sun_awt_motif_MToolkit_run;
-text: .text%awtJNI_GetCurrentThread;
-text: .text%awt_MToolkit_loop: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_pipe_init: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_set_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_events_pending: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%processOneEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%set_toolkit_busy;
-text: .text%waitForEvents;
-text: .text%performPoll: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_get_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awtJNI_CleanupGlobalRefs;
-text: .text%Java_java_awt_AWTEvent_initIDs;
-text: .text%Java_sun_awt_SunToolkit_wakeupEventQueue;
-text: .text%Java_sun_awt_motif_MToolkit_shutdown;
-text: .text%X11SD_LibDispose;
-text: .text%LibDisposeStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-# Test LoadFrame
-text: .text%Java_java_awt_Component_initIDs;
-text: .text%Java_java_awt_Container_initIDs;
-text: .text%Java_java_awt_Window_initIDs;
-text: .text%Java_java_awt_Frame_initIDs;
-text: .text%Java_sun_awt_SunToolkit_getPrivateKey;
-text: .text%Java_java_awt_MenuComponent_initIDs;
-text: .text%Java_sun_awt_X11GraphicsConfig_pGetBounds;
-text: .text%Java_java_awt_Insets_initIDs;
-text: .text%Java_sun_awt_motif_MComponentPeer_initIDs;
-text: .text%Java_sun_awt_motif_MWindowPeer_initIDs;
-text: .text%Java_sun_awt_motif_MWindowAttributes_initIDs;
-text: .text%Java_sun_awt_motif_MWindowPeer_pCreate;
-text: .text%awtJNI_CreateAndSetGlobalRef;
-text: .text%copyGraphicsConfigToPeer;
-text: .text%awt_Frame_guessInsets;
-text: .text%awtJNI_ChangeInsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%getMotifFontList;
-text: .text%getMotifFontStruct;
-text: .text%setDeleteCallback: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%awt_canvas_create;
-text: .text%awt_util_show;
-text: .text%addTopLevel;
-text: .text%Java_sun_awt_motif_MWindowPeer_pHide;
-text: .text%Java_sun_awt_motif_MComponentPeer_pInitialize;
-text: .text%awt_addWidget;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetCursor;
-text: .text%getCursor;
-text: .text%awt_util_setCursor;
-text: .text%Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode;
-text: .text%Java_sun_awt_motif_MWindowPeer_pReshape;
-text: .text%reshape: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%awtJNI_setMbAndWwHeightAndOffsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%awt_wm_configureGravityBuggy;
-text: .text%Java_sun_awt_X11SurfaceData_initIDs;
-text: .text%Java_sun_awt_motif_MToolkit_loadSystemColors;
-text: .text%colorToRGB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_allocate_systemcolors;
-text: .text%Java_sun_awt_X11GraphicsConfig_makeColorModel;
-text: .text%awtJNI_GetColorModel;
-text: .text%Java_sun_awt_X11SurfaceData_initOps;
-text: .text%Java_sun_awt_motif_MWindowPeer_pSetTitle;
-text: .text%Java_sun_awt_motif_MWindowPeer_setResizable;
-text: .text%Java_java_awt_Font_initIDs;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetFont;
-text: .text%awt_util_mapChildren;
-text: .text%changeFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Component.o;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetBackground;
-text: .text%getGraphicsConfigFromComponentPeer;
-text: .text%awtJNI_GetColorForVis;
-text: .text%ColorProc;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetForeground;
-text: .text%Java_sun_awt_motif_MWindowPeer_pShow;
-text: .text%Java_sun_awt_motif_MWindowPeer_pShowModal;
-text: .text%awt_wm_setExtendedState;
-text: .text%awt_wm_doStateProtocolNet: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_doStateProtocolWin: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_setShellDecor;
-text: .text%awt_wm_setMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_setOLDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_normalizeMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_removeSizeHints;
-text: .text%shellEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%awt_wm_isStateChange;
-text: .text%awt_wm_getWMState;
-text: .text%Java_sun_awt_motif_MGlobalCursorManager_cacheInit;
-text: .text%innerCanvasEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%reconfigureOuterCanvas: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%outerCanvasResizeCB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor;
-text: .text%awt_wm_getInsetsFromProp;
-text: .text%syncTopLevelPos;
-text: .text%raiseInputMethodWindow;
-text: .text%awt_wm_getExtendedState: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_canvas_event_handler;
-text: .text%awt_canvas_handleEvent;
-text: .text%HandleExposeEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
-text: .text%checkForExpose: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
-text: .text%expandDamageRect: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
-text: .text%getCurComponent;
-text: .text%Java_java_awt_KeyboardFocusManager_initIDs;
-text: .text%Java_java_awt_event_InputEvent_initIDs;
-text: .text%Java_java_awt_event_KeyEvent_initIDs;
-text: .text%Java_java_awt_AWTKeyStroke_allocateNewInstance;
-text: .text%Java_sun_awt_motif_MComponentPeer_nativeHandleEvent;
-text: .text%Java_java_awt_Event_initIDs;
-# Test LoadJFrame
-text: .text%Java_sun_awt_motif_MToolkit_getScreenWidth;
-text: .text%Java_sun_awt_motif_MToolkit_getScreenHeight;
-text: .text%X11SD_Lock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%X11SD_InitWindow: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%GetLockStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%X11SD_GetRasInfo: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%X11SD_Unlock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%X11SD_InitClip: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%XRequestSentStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-# Test JHello
-text: .text%AWTLoadFont;
-text: .text%AWTFontMaxByte1;
-text: .text%AWTFontMaxCharOrByte2;
-text: .text%AWTFontMaxBounds;
-text: .text%AWTCharAscent;
-text: .text%AWTCharDescent;
-text: .text%AWTCharWidth;
-text: .text%AWTFontMinByte1;
-text: .text%AWTFontMinCharOrByte2;
-text: .text%AWTFontPerChar;
-text: .text%AWTCharRBearing;
-text: .text%AWTCharLBearing;
-text: .text%Java_sun_awt_X11SurfaceData_setInvalid;
-text: .text%Java_sun_awt_X11SurfaceData_nativeDispose;
-text: .text%X11SurfaceData_GetOps;
-# SwingSet
-text: .text%Java_sun_awt_motif_MWindowPeer_setSaveUnder;
-text: .text%Java_sun_awt_motif_MCanvasPeer_create;
-text: .text%awt_util_insertCallback;
-text: .text%Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode;
-text: .text%Java_sun_awt_motif_MComponentPeer_pReshape;
-text: .text%awt_util_reshape;
-text: .text%Java_sun_awt_motif_MComponentPeer_pShow;
-text: .text%Java_sun_awt_motif_MDataTransferer_getAtomForTarget;
-text: .text%Java_sun_awt_motif_MComponentPeer_addNativeDropTarget;
-text: .text%register_drop_site;
-text: .text%update_drop_site_hierarchy: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o;
-text: .text%AWTFontDefaultChar;
-text: .text%AWTFontGenerateImage;
-text: .text%CreatePixmapAndGC;
-text: .text%isAncestor;
-text: .text%xerror_handler;
diff --git a/jdk/make/sun/motif12/reorder-sparc b/jdk/make/sun/motif12/reorder-sparc
deleted file mode 100644
index 8ac5471..0000000
--- a/jdk/make/sun/motif12/reorder-sparc
+++ /dev/null
@@ -1,212 +0,0 @@
-data = R0x2000;
-text = LOAD ?RXO;
-# Test Null
-# Test Exit
-# Test Hello
-# Test Sleep
-# Test IntToString
-# Test LoadToolkit
-text: .text%JNI_OnLoad;
-text: .text%awt_util_debug_init;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_initDisplay;
-text: .text%awt_init_Display;
-text: .text%makeDefaultConfig: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
-text: .text%awt_allocate_colors;
-text: .text%Java_sun_awt_font_NativeFontWrapper_getFontPath;
-text: .text%getPlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%getSolarisFontLocations: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%AppendFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%freePlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%checkFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Font.o;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_getNativeFonts;
-text: .text%Java_sun_awt_font_NativeFontWrapper_setNativeFontPath;
-text: .text%isDisplayLocal;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_checkShmExt;
-text: .text%TryInitMITShm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
-text: .text%awt_output_flush;
-text: .text%awtJNI_TimeMillis: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%AddFontsToX11FontPath: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_getNumScreens;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum;
-text: .text%Java_sun_awt_X11GraphicsDevice_getConfigVisualId;
-text: .text%Java_sun_awt_X11GraphicsDevice_isDBESupported;
-text: .text%Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
-text: .text%Java_sun_awt_X11GraphicsConfig_initIDs;
-text: .text%Java_sun_awt_X11GraphicsConfig_init;
-text: .text%getAllConfigs: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
-text: .text%Java_sun_awt_motif_MToolkit_init;
-text: .text%getDefaultConfig;
-text: .text%getScreenData;
-text: .text%Java_sun_awt_PlatformFont_initIDs;
-text: .text%Java_sun_awt_motif_MFontPeer_initIDs;
-text: .text%awt_wm_init;
-text: .text%awt_wm_initAtoms: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_getRunningWM;
-text: .text%xerror_detect_wm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_prepareIsIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isNetSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_checkAnchor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_getProperty32: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isWinSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isEnlightenment: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_getECommsWindowIDProperty: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isSawfish: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isNetWMName: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isKDE2: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_isCDE: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_color_matchTC;
-text: .text%setup_modifier_map: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%set_mod_mask: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_initialize_DataTransferer;
-text: .text%awt_initialize_Xm_DnD;
-text: .text%cacheDropDone: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o;
-text: .text%awt_motif_enableSingleDragInitiator;
-text: .text%Java_java_awt_Cursor_initIDs;
-text: .text%Java_sun_awt_motif_X11CustomCursor_cacheInit;
-text: .text%Java_sun_awt_motif_MToolkit_run;
-text: .text%awtJNI_GetCurrentThread;
-text: .text%awt_MToolkit_loop: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_pipe_init: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_set_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_events_pending: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%processOneEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%set_toolkit_busy;
-text: .text%waitForEvents;
-text: .text%performPoll: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awt_get_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%awtJNI_CleanupGlobalRefs;
-text: .text%Java_java_awt_AWTEvent_initIDs;
-text: .text%Java_sun_awt_SunToolkit_wakeupEventQueue;
-text: .text%Java_sun_awt_motif_MToolkit_shutdown;
-text: .text%X11SD_LibDispose;
-text: .text%LibDisposeStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-# Test LoadFrame
-text: .text%Java_java_awt_Component_initIDs;
-text: .text%Java_java_awt_Container_initIDs;
-text: .text%Java_java_awt_Window_initIDs;
-text: .text%Java_java_awt_Frame_initIDs;
-text: .text%Java_sun_awt_SunToolkit_getPrivateKey;
-text: .text%Java_java_awt_MenuComponent_initIDs;
-text: .text%Java_sun_awt_X11GraphicsConfig_pGetBounds;
-text: .text%Java_java_awt_Insets_initIDs;
-text: .text%Java_sun_awt_motif_MComponentPeer_initIDs;
-text: .text%Java_sun_awt_motif_MWindowPeer_initIDs;
-text: .text%Java_sun_awt_motif_MWindowAttributes_initIDs;
-text: .text%Java_sun_awt_motif_MWindowPeer_pCreate;
-text: .text%awtJNI_CreateAndSetGlobalRef;
-text: .text%copyGraphicsConfigToPeer;
-text: .text%awt_Frame_guessInsets;
-text: .text%awtJNI_ChangeInsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%getMotifFontList;
-text: .text%getMotifFontStruct;
-text: .text%setDeleteCallback: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%ColorProc;
-text: .text%awt_canvas_create;
-text: .text%awt_util_show;
-text: .text%addTopLevel;
-text: .text%Java_sun_awt_motif_MWindowPeer_pHide;
-text: .text%Java_sun_awt_motif_MComponentPeer_pInitialize;
-text: .text%awt_addWidget;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetCursor;
-text: .text%getCursor;
-text: .text%awt_util_setCursor;
-text: .text%Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode;
-text: .text%Java_sun_awt_motif_MWindowPeer_pReshape;
-text: .text%reshape: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%awtJNI_setMbAndWwHeightAndOffsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%awt_wm_configureGravityBuggy;
-text: .text%Java_sun_awt_X11SurfaceData_initIDs;
-text: .text%Java_sun_awt_motif_MToolkit_loadSystemColors;
-text: .text%colorToRGB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
-text: .text%Java_sun_awt_X11GraphicsConfig_makeColorModel;
-text: .text%awtJNI_GetColorModel;
-text: .text%Java_sun_awt_X11SurfaceData_initOps;
-text: .text%Java_sun_awt_motif_MWindowPeer_pSetTitle;
-text: .text%Java_sun_awt_motif_MWindowPeer_setResizable;
-text: .text%Java_java_awt_Font_initIDs;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetFont;
-text: .text%awt_util_mapChildren;
-text: .text%changeFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Component.o;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetBackground;
-text: .text%getGraphicsConfigFromComponentPeer;
-text: .text%awtJNI_GetColorForVis;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetForeground;
-text: .text%Java_sun_awt_motif_MWindowPeer_pShow;
-text: .text%Java_sun_awt_motif_MWindowPeer_pShowModal;
-text: .text%awt_wm_setExtendedState;
-text: .text%awt_wm_doStateProtocolNet: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_doStateProtocolWin: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_setShellDecor;
-text: .text%awt_wm_setMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_setOLDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_normalizeMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%awt_wm_removeSizeHints;
-text: .text%Java_sun_awt_motif_MGlobalCursorManager_cacheInit;
-text: .text%Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor;
-text: .text%getCurComponent;
-text: .text%shellEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%awt_wm_isStateChange;
-text: .text%awt_wm_getWMState;
-text: .text%innerCanvasEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%reconfigureOuterCanvas: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%outerCanvasResizeCB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
-text: .text%awt_wm_getInsetsFromProp;
-text: .text%syncTopLevelPos;
-text: .text%raiseInputMethodWindow;
-text: .text%awt_canvas_event_handler;
-text: .text%awt_canvas_handleEvent;
-text: .text%HandleExposeEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
-text: .text%checkForExpose: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
-text: .text%awt_wm_getExtendedState: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
-text: .text%expandDamageRect: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
-text: .text%Java_java_awt_KeyboardFocusManager_initIDs;
-text: .text%Java_java_awt_event_InputEvent_initIDs;
-text: .text%Java_java_awt_event_KeyEvent_initIDs;
-text: .text%Java_java_awt_AWTKeyStroke_allocateNewInstance;
-text: .text%Java_sun_awt_motif_MComponentPeer_nativeHandleEvent;
-text: .text%Java_java_awt_Event_initIDs;
-# Test LoadJFrame
-text: .text%awtJNI_ThreadYield;
-text: .text%Java_sun_awt_motif_MToolkit_getScreenWidth;
-text: .text%Java_sun_awt_motif_MToolkit_getScreenHeight;
-text: .text%X11SD_Lock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%X11SD_InitWindow: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%GetLockStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%X11SD_GetRasInfo: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%X11SD_Unlock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%X11SD_InitClip: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-text: .text%XRequestSentStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
-# Test JHello
-text: .text%AWTLoadFont;
-text: .text%AWTFontMaxByte1;
-text: .text%AWTFontMaxCharOrByte2;
-text: .text%AWTFontMaxBounds;
-text: .text%AWTCharAscent;
-text: .text%AWTCharDescent;
-text: .text%AWTCharWidth;
-text: .text%AWTFontMinByte1;
-text: .text%AWTFontMinCharOrByte2;
-text: .text%AWTFontPerChar;
-text: .text%AWTCharRBearing;
-text: .text%AWTCharLBearing;
-text: .text%Java_sun_awt_X11SurfaceData_setInvalid;
-# SwingSet
-text: .text%Java_sun_awt_motif_MWindowPeer_setSaveUnder;
-text: .text%Java_sun_awt_X11SurfaceData_nativeDispose;
-text: .text%X11SurfaceData_GetOps;
-text: .text%Java_sun_awt_motif_MCanvasPeer_create;
-text: .text%awt_util_insertCallback;
-text: .text%Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode;
-text: .text%Java_sun_awt_motif_MComponentPeer_pReshape;
-text: .text%awt_util_reshape;
-text: .text%Java_sun_awt_motif_MComponentPeer_pShow;
-text: .text%Java_sun_awt_motif_MDataTransferer_getAtomForTarget;
-text: .text%Java_sun_awt_motif_MComponentPeer_addNativeDropTarget;
-text: .text%register_drop_site;
-text: .text%update_drop_site_hierarchy: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o;
-text: .text%AWTFontDefaultChar;
-text: .text%isAncestor;
-text: .text%xerror_handler;
-text: .text%AWTFontGenerateImage;
-text: .text%CreatePixmapAndGC;
diff --git a/jdk/make/sun/motif12/reorder-sparcv9 b/jdk/make/sun/motif12/reorder-sparcv9
deleted file mode 100644
index 8542b6c..0000000
--- a/jdk/make/sun/motif12/reorder-sparcv9
+++ /dev/null
@@ -1,233 +0,0 @@
-data = R0x2000;
-text = LOAD ?RXO;
-# Test Null
-# Test Exit
-# Test Hello
-# Test Sleep
-# Test IntToString
-# Test LoadToolkit
-text: .text%JNI_OnLoad;
-text: .text%awt_util_debug_init;
-text: .text%Java_java_awt_Toolkit_initIDs;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_initDisplay;
-text: .text%awt_init_Display;
-text: .text%makeDefaultConfig: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_GraphicsEnv.o;
-text: .text%awt_allocate_colors;
-text: .text%make_uns_ordered_dither_array;
-text: .text%checkFont: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Font.o;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_getNativeFonts;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_getNumScreens;
-text: .text%Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum;
-text: .text%Java_sun_awt_X11GraphicsDevice_getConfigVisualId;
-text: .text%Java_sun_awt_X11GraphicsConfig_initIDs;
-text: .text%Java_sun_awt_X11GraphicsConfig_init;
-text: .text%getAllConfigs: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_GraphicsEnv.o;
-text: .text%awt_output_flush;
-text: .text%awtJNI_TimeMillis: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%Java_sun_awt_motif_MToolkit_init;
-text: .text%getDefaultConfig;
-text: .text%getScreenData;
-text: .text%Java_sun_awt_PlatformFont_initIDs;
-text: .text%Java_sun_awt_motif_MFontPeer_initIDs;
-text: .text%awt_color_matchTC;
-text: .text%setup_modifier_map: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%set_mod_mask: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%awt_initialize_Xm_DnD;
-text: .text%Java_java_awt_Cursor_initIDs;
-text: .text%Java_sun_awt_motif_X11CustomCursor_cacheInit;
-text: .text%Java_java_awt_Dimension_initIDs;
-text: .text%Java_sun_awt_motif_MToolkit_run;
-text: .text%awtJNI_GetCurrentThread;
-text: .text%awt_MToolkit_loop: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%awt_pipe_init: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%awt_set_poll_timeout: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%awt_events_pending: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%processOneEvent: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%waitForEvents: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%performPoll: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%awt_get_poll_timeout: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%awtJNI_CleanupGlobalRefs;
-# Test LoadFrame
-text: .text%Java_java_awt_Component_initIDs;
-text: .text%Java_java_awt_Container_initIDs;
-text: .text%Java_java_awt_Window_initIDs;
-text: .text%Java_java_awt_Frame_initIDs;
-text: .text%Java_sun_awt_SunToolkit_getPrivateKey;
-text: .text%Java_java_awt_MenuComponent_initIDs;
-text: .text%Java_sun_awt_X11GraphicsConfig_pGetBounds;
-text: .text%Java_java_awt_Rectangle_initIDs;
-text: .text%Java_sun_awt_motif_MComponentPeer_initIDs;
-text: .text%Java_sun_awt_motif_MWindowPeer_initIDs;
-text: .text%Java_java_awt_Insets_initIDs;
-text: .text%Java_sun_awt_motif_MWindowAttributes_initIDs;
-text: .text%Java_sun_awt_motif_MWindowPeer_create;
-text: .text%awtJNI_CreateAndSetGlobalRef;
-text: .text%copyGraphicsConfigToPeer;
-text: .text%awt_Frame_guessInsets;
-text: .text%awt_util_runningWindowManager;
-text: .text%awt_winmgrerr: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_util.o;
-text: .text%awtJNI_ChangeInsets: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%getMotifFontList;
-text: .text%getMotifFontStruct;
-text: .text%setDeleteCallback: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%ColorProc;
-text: .text%awt_canvas_create;
-text: .text%awt_util_show;
-text: .text%addTopLevel;
-text: .text%Java_sun_awt_motif_MWindowPeer_pHide;
-text: .text%Java_sun_awt_motif_MComponentPeer_pInitialize;
-text: .text%awt_addWidget;
-text: .text%Java_sun_awt_motif_MComponentPeer_setCursor;
-text: .text%getCursor;
-text: .text%awt_util_setCursor;
-text: .text%Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode;
-text: .text%Java_sun_awt_motif_MWindowPeer_pReshape;
-text: .text%reshape: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%awtJNI_setMbAndWwHeightAndOffsets: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%awt_util_wmPositionsShellXY;
-text: .text%Java_sun_awt_motif_MWindowPeer_pSetTitle;
-text: .text%Java_sun_awt_motif_MWindowPeer_setResizable;
-text: .text%Java_java_awt_Font_initIDs;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetFont;
-text: .text%awt_util_mapChildren;
-text: .text%changeFont: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Component.o;
-text: .text%Java_java_awt_Color_initIDs;
-text: .text%Java_sun_awt_motif_MToolkit_loadSystemColors;
-text: .text%colorToRGB: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetBackground;
-text: .text%getGraphicsConfigFromComponentPeer;
-text: .text%awtJNI_GetColorForVis;
-text: .text%Java_sun_awt_motif_MComponentPeer_pSetForeground;
-text: .text%Java_sun_awt_motif_MWindowPeer_pShow;
-text: .text%Java_sun_awt_motif_MWindowPeer_pShowModal;
-text: .text%setStateHints: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%awt_util_setMinMaxSizeProps;
-text: .text%innerCanvasEH: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%reconfigureOuterCanvas: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%Java_java_awt_AWTEvent_initIDs;
-text: .text%outerCanvasResizeCB: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%Java_sun_awt_motif_MGlobalCursorManager_cacheInit;
-text: .text%shellEH: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor;
-text: .text%getCurComponent;
-text: .text%get_awt_TopLevelInsetsProp;
-text: .text%syncTopLevelPos;
-text: .text%Java_sun_awt_motif_MComponentPeer_nativeHandleEvent;
-text: .text%raiseInputMethodWindow;
-text: .text%getWindowState: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
-text: .text%awt_canvas_event_handler;
-text: .text%awt_canvas_handleEvent;
-text: .text%HandleExposeEvent: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/canvas.o;
-text: .text%checkForExpose: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/canvas.o;
-text: .text%Java_java_awt_Event_initIDs;
-text: .text%Java_java_awt_image_ColorModel_initIDs;
-text: .text%Java_sun_awt_motif_X11Graphics_cacheInit;
-text: .text%InitMITShm: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
-text: .text%Java_sun_java2d_loops_RasterOutputManager_getPlatformFontVar;
-text: .text%Java_sun_awt_motif_X11Graphics_createFromComponent;
-text: .text%Java_sun_awt_motif_X11Graphics_pSetForeground;
-text: .text%awt_init_gc;
-text: .text%Java_sun_awt_motif_X11Graphics_pSetFont;
-text: .text%awtJNI_GetFontData;
-text: .text%awtJNI_IsMultiFont;
-text: .text%Java_sun_awt_FontDescriptor_initIDs;
-text: .text%loadFont;
-text: .text%Java_sun_awt_motif_X11Graphics_setOrigin;
-text: .text%Java_sun_awt_motif_X11Graphics_setLineAttrs;
-text: .text%Java_sun_awt_motif_X11Graphics_changeClip;
-text: .text%Java_sun_awt_motif_X11Graphics_devClearRect;
-text: .text%Java_sun_awt_motif_X11Graphics_disposeImpl;
-# Test LoadJFrame
-text: .text%Java_java_awt_event_InputEvent_initIDs;
-text: .text%Java_java_awt_event_KeyEvent_initIDs;
-text: .text%expandDamageRect: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/canvas.o;
-text: .text%awtJNI_ThreadYield;
-text: .text%Java_sun_awt_motif_X11Graphics_createFromGraphics;
-text: .text%Java_sun_awt_motif_MToolkit_getScreenWidth;
-text: .text%Java_sun_awt_motif_MToolkit_getScreenHeight;
-text: .text%Java_sun_awt_X11GraphicsConfig_makeColorModel;
-text: .text%awtJNI_GetColorModel;
-text: .text%Java_java_awt_image_BufferedImage_initIDs;
-text: .text%Java_java_awt_image_Raster_initIDs;
-text: .text%Java_java_awt_image_SampleModel_initIDs;
-text: .text%Java_java_awt_image_SinglePixelPackedSampleModel_initIDs;
-text: .text%Java_sun_awt_image_IntegerComponentRaster_initIDs;
-text: .text%Java_sun_java2d_loops_ImageData_initIDs;
-text: .text%Java_sun_java2d_loops_IntDiscreteRenderer_devSetRect;
-text: .text%Java_sun_awt_motif_X11Graphics_X11LockViewResources;
-text: .text%X11DeferredLockViewResources: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
-text: .text%getLockMethod: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
-text: .text%DGA_DeferredLockViewResources;
-text: .text%setLockMethod: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
-text: .text%getPrimitiveType: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
-text: .text%Java_sun_awt_motif_X11Graphics_X11UnLockViewResources;
-text: .text%DGA_UnlockViewResources;
-text: .text%Java_sun_java2d_loops_DefaultComponent_IntIsomorphicCopy;
-text: .text%minImageWidths;
-text: .text%minImageRows;
-text: .text%getIntImageLockInfo;
-text: .text%lockIntImageData;
-text: .text%unlockIntImageData;
-# Test JHello
-text: .text%Java_java_awt_FontMetrics_initIDs;
-# SwingSet
-text: .text%Java_sun_awt_image_Image_initIDs;
-text: .text%Java_sun_awt_image_ImageRepresentation_initIDs;
-text: .text%Java_java_awt_image_IndexColorModel_initIDs;
-text: .text%Java_sun_awt_motif_MWindowPeer_setSaveUnder;
-text: .text%Java_java_awt_AWTEvent_freeNativeData;
-text: .text%Java_sun_java2d_loops_DefaultComponent_IntRgbToXbgr;
-text: .text%Java_sun_awt_motif_MCanvasPeer_create;
-text: .text%awt_util_insertCallback;
-text: .text%Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode;
-text: .text%Java_sun_awt_motif_MComponentPeer_pReshape;
-text: .text%awt_util_reshape;
-text: .text%Java_sun_awt_motif_MComponentPeer_pShow;
-text: .text%Java_sun_java2d_loops_IntDiscreteRenderer_devDrawLine;
-text: .text%doDrawLine: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/IntDiscreteRenderer.o;
-text: .text%adjustLine: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/IntDiscreteRenderer.o;
-text: .text%Java_sun_awt_image_GifImageDecoder_initIDs;
-text: .text%Java_java_awt_image_ComponentSampleModel_initIDs;
-text: .text%Java_sun_awt_image_ByteComponentRaster_initIDs;
-text: .text%Java_sun_awt_image_GifImageDecoder_parseImage;
-text: .text%Java_sun_awt_image_ImageRepresentation_setBytePixels;
-text: .text%Java_sun_java2d_loops_IntDiscreteRenderer_devDrawRect;
-text: .text%outcode: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/IntDiscreteRenderer.o;
-text: .text%Java_sun_java2d_loops_ImageData_isAllOpaqueGrayICM;
-text: .text%Java_sun_java2d_loops_GIFAcceleratorLoops_LUTcopyTo32BitXBgr;
-text: .text%getByteIndexedImageLockInfo;
-text: .text%lockByteIndexedImageData;
-text: .text%unlockByteIndexedImageData;
-text: .text%Java_sun_java2d_loops_GIFAcceleratorLoops_LUTxparTo32BitXBgr;
-text: .text%shouldDispatchToWidget: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%awtMenuIsActive;
-text: .text%awt_util_focusIsOnMenu;
-text: .text%awt_isModal;
-text: .text%findWidgetInfo: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%awt_copyXEvent;
-text: .text%awt_post_java_mouse_event;
-text: .text%Java_java_awt_event_MouseEvent_initIDs;
-text: .text%sysTimeMillis;
-text: .text%updateCursor;
-text: .text%awt_setActivatedShell;
-text: .text%handleFocusEvent;
-text: .text%awt_post_java_focus_event;
-text: .text%getModifiers;
-text: .text%Java_java_awt_AWTEvent_copyDataFieldInto;
-text: .text%Java_sun_awt_motif_X11InputMethod_initIDs;
-text: .text%Java_sun_awt_motif_X11InputMethod_openXIM;
-text: .text%awt_put_back_event;
-text: .text%awt_get_next_put_back_event: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%null_event_handler: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
-text: .text%Java_sun_awt_motif_MGlobalCursorManager_getCursorPos;
-text: .text%Java_sun_awt_motif_MGlobalCursorManager_findComponentAt;
-text: .text%Java_sun_awt_motif_MWindowPeer_hasTextComponents;
-text: .text%Java_sun_awt_motif_X11InputMethod_createXICNative;
-text: .text%findClass: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o;
-text: .text%createXIC: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o;
-text: .text%Java_sun_awt_motif_X11InputMethod_setXICFocus;
-text: .text%setXICWindowFocus: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o;
-text: .text%setXICFocus: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o;
-text: .text%getAncestorShell;
-text: .text%Java_sun_awt_motif_X11InputMethod_turnoffStatusWindow;
-text: .text%Frame_quit: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
diff --git a/jdk/make/sun/rmi/rmi/mapfile-vers b/jdk/make/sun/rmi/rmi/mapfile-vers
deleted file mode 100644
index dc33402..0000000
--- a/jdk/make/sun/rmi/rmi/mapfile-vers
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# Define library interface.
-
-SUNWprivate_1.1 {
- global:
- Java_sun_rmi_server_MarshalInputStream_latestUserDefinedLoader;
- local:
- *;
-};
diff --git a/jdk/make/tools/classanalyzer/src/com/sun/classanalyzer/PlatformModuleBuilder.java b/jdk/make/tools/classanalyzer/src/com/sun/classanalyzer/PlatformModuleBuilder.java
deleted file mode 100644
index 380f4e7..0000000
--- a/jdk/make/tools/classanalyzer/src/com/sun/classanalyzer/PlatformModuleBuilder.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.classanalyzer;
-
-import com.sun.classanalyzer.Module.Factory;
-import com.sun.classanalyzer.ModuleInfo.Dependence;
-import static com.sun.classanalyzer.PlatformModuleBuilder.PlatformFactory.*;
-
-import java.io.IOException;
-import java.util.*;
-
-/**
- * A platform module builder for JDK. JDK's boot module, base module,
- * and JRE tools module must be defined in the modules.config files.
- * The platform module builder will create the following platform
- * modules in addition to the ones specified in the configuration files:
- * - JDK and JRE aggregator modules
- * - one jdk.<m> aggregator module for each sun.<m> module to
- * reexport its public APIs
- *
- */
-public class PlatformModuleBuilder extends ModuleBuilder {
- private final PlatformFactory factory;
-
- public PlatformModuleBuilder(List<String> configs, String version)
- throws IOException {
- this(configs, null, true, version);
- }
-
- public PlatformModuleBuilder(List<String> configs,
- List<String> depconfigs,
- boolean merge,
- String version)
- throws IOException {
- super(null, depconfigs, merge, version);
- // the factory will create the modules for the input config files
- this.factory = new PlatformFactory(configs, version);
- }
-
- @Override
- protected Factory getFactory() {
- return factory;
- }
-
- @Override
- public Set<Module> run() throws IOException {
- // assign classes and resource files to the modules
- // group fine-grained modules per configuration files
- buildModules();
-
- // build public jdk modules to reexport sun.* modules
- buildJDKModules();
-
- // generate package infos and determine if there is any split package
- buildPackageInfos();
-
- // analyze cross-module dependencies and generate ModuleInfo
- List<ModuleInfo> minfos = buildModuleInfos();
-
- // generate an ordered list from the module dependency graph
- result = Collections.unmodifiableSet(orderedModuleList(minfos));
- return result;
- }
-
- private void buildJDKModules() {
- Set<PlatformModule> pmodules = new LinkedHashSet<PlatformModule>();
- PlatformModule jreToolModule = (PlatformModule)
- factory.findModule(JRE_TOOLS_MODULE);
- BootModule bootModule = (BootModule)
- factory.findModule(BOOT_MODULE);
- PlatformModule jdkModule = (PlatformModule) factory.findModule(JDK_MODULE);
- PlatformModule jreModule = (PlatformModule) factory.findModule(JRE_MODULE);
-
- for (Module m : factory.getAllModules()) {
- if (m.isTopLevel()) {
- PlatformModule pm = (PlatformModule) m;
- pmodules.add(pm);
- }
- }
-
- // set exporter
- for (PlatformModule pm : pmodules) {
- PlatformModule exporter = pm;
- String name = pm.name();
- if (name.startsWith("sun.")) {
- // create an aggregate module for each sun.* module
- String mn = name.replaceFirst("sun", "jdk");
- String mainClassName =
- pm.mainClass() == null ? null : pm.mainClass().getClassName();
-
- PlatformModule rm = (PlatformModule) factory.findModule(mn);
- if (rm != null) {
- if (pm.mainClass() != rm.mainClass()) {
- // propagate the main class to its aggregator module
- rm.setMainClass(mainClassName);
- }
- exporter = rm;
- } else if (pm.hasPlatformAPIs()) {
- ModuleConfig config = new ModuleConfig(mn, version, mainClassName);
- exporter = factory.addPlatformModule(config);
- }
-
- if (pm != exporter) {
- pm.reexportBy(exporter);
- }
- }
- }
-
- // base module to reexport boot module
- bootModule.reexportBy((PlatformModule) factory.findModule(BASE_MODULE));
-
- // set up the jdk and jdk.jre modules
- for (Module m : factory.getAllModules()) {
- if (m.isTopLevel()) {
- PlatformModule pm = (PlatformModule) m;
- String name = pm.name();
- if (name.startsWith("jdk.") || name.startsWith("sun.")) {
- if (pm != jdkModule && pm != jreModule) {
- Module exp = pm.exporter(jdkModule);
- // the "jdk" module requires all platform modules (public ones)
- jdkModule.config().reexportModule(exp);
- if (pm.isBootConnected() || pm == jreToolModule) {
- // add all modules that are strongly connected to jdk.boot to JRE
- jreModule.config().reexportModule(exp);
- }
- }
- }
- }
- }
- }
-
- /*
- * Returns an ordered list of platform modules according to
- * their dependencies with jdk.boot always be the first.
- */
- private Set<Module> orderedModuleList(Collection<ModuleInfo> minfos) {
- Set<Module> visited = new HashSet<Module>();
- Set<Module> orderedList = new LinkedHashSet<Module>();
- Dependence.Filter filter = new Dependence.Filter() {
-
- @Override
- public boolean accept(Dependence d) {
- return !d.isOptional();
- }
- };
-
- BootModule bootModule = (BootModule)
- factory.findModule(BOOT_MODULE);
-
- // put the boot module first
- visited.add(bootModule);
- orderedList.add(bootModule);
- factory.findModule(BASE_MODULE).getModuleInfo().visitDependence(filter, visited, orderedList);
- factory.findModule(JDK_MODULE).getModuleInfo().visitDependence(filter, visited, orderedList);
- for (ModuleInfo mi : minfos) {
- mi.visitDependence(filter, visited, orderedList);
- }
-
- return orderedList;
- }
-
- @Override
- protected ModuleInfo buildModuleInfo(Module m) {
- ModuleInfo mi = super.buildModuleInfo(m);
-
- // use the module's exporter in the dependence
- Set<Dependence> depset = new HashSet<Dependence>();
- for (Dependence d : mi.requires()) {
- Dependence dep = d;
- if (!d.isInternal() && !d.isLocal()) {
- Module exp = ((PlatformModule)d.getModule()).exporter(m);
- if (exp == null) {
- throw new RuntimeException(d.getModule() + " null exporter");
- }
- if (d.getModule() != exp && exp != m) {
- dep = new Dependence(exp, d.modifiers());
- }
- }
-
- // ## not to include optional dependences in jdk.boot
- // ## should move this to jdk.base
- if (m instanceof PlatformModuleBuilder.BootModule && d.isOptional()) {
- continue;
- }
- depset.add(dep);
- }
-
- // return a new ModuleInfo with patched dependences
- return new ModuleInfo(m, depset, mi.permits());
- }
-
- static class PlatformFactory extends Factory {
- /**
- * Platform modules that must be defined in the modules.properties
- */
- static final String BOOT_MODULE =
- getValue("platform.boot.module");
- static final String BASE_MODULE =
- getValue("platform.base.module");
- static final String JDK_MODULE =
- getValue("platform.jdk.module");
- static final String JRE_MODULE =
- getValue("platform.jre.module");
- static final String JRE_TOOLS_MODULE =
- getValue("platform.jre.tools.module");
-
- static String getValue(String key) {
- String value = Module.getModuleProperty(key);
- if (value == null || value.isEmpty()) {
- throw new RuntimeException("Null or empty module property: " + key);
- }
- return value;
- }
-
- PlatformFactory(List<String> configs, String version) throws IOException {
- Module.setBaseModule(BASE_MODULE);
-
- // create modules based on the input config files
- List<ModuleConfig> mconfigs = new ArrayList<ModuleConfig>();
- for (String file : configs) {
- mconfigs.addAll(ModuleConfig.readConfigurationFile(file, version));
- }
- init(mconfigs);
-
- // Create the full jdk and jre modules
- addModule(new NoClassModule(JDK_MODULE, version));
- addModule(new NoClassModule(JRE_MODULE, version));
- }
-
- @Override
- public Module newModule(String name, String version) {
- return newPlatformModule(new ModuleConfig(name, version));
- }
-
- @Override
- public Module newModule(ModuleConfig config) {
- return newPlatformModule(config);
- }
-
- private PlatformModule newPlatformModule(ModuleConfig config) {
- if (config.module.equals(BOOT_MODULE)) {
- return new BootModule(config);
- } else {
- return new PlatformModule(config);
- }
- }
-
- PlatformModule addPlatformModule(String name, String version) {
- return addPlatformModule(new ModuleConfig(name, version));
- }
-
- PlatformModule addPlatformModule(ModuleConfig config) {
- PlatformModule m = newPlatformModule(config);
- addModule(m);
- return m;
- }
- }
-
- static class PlatformModule extends Module {
- private Module exporter; // module that reexports this platform module
- public PlatformModule(ModuleConfig config) {
- super(config);
- this.exporter = this;
- }
-
- // support for incremental build
- // an aggregate module "jdk.*" is not defined in modules.config
- // files but created by the platform module builder
- // Set to the main class of sun.* module
- void setMainClass(String classname) {
- String mn = name();
- if (!mn.startsWith("jdk") || !isEmpty()) {
- throw new RuntimeException("module " + name()
- + " not an aggregator");
- }
-
- if (classname == null) {
- throw new RuntimeException("Null main class for module " + name());
- }
-
- mainClassName = classname;
- }
-
- // requires local for JRE modules that are strongly
- // connected with the boot module
- boolean isBootConnected() {
- // ## should it check for local?
- Dependence d = config().requires.get(BOOT_MODULE);
- return d != null; // && d.isLocal());
- }
- private int platformAPIs;
-
- boolean hasPlatformAPIs() {
- platformAPIs = 0;
- Visitor<Void, PlatformModule> v = new Visitor<Void, PlatformModule>() {
-
- public Void visitClass(Klass k, PlatformModule pm) {
- if (PackageInfo.isExportedPackage(k.getPackageName())) {
- pm.platformAPIs++;
- }
- return null;
- }
-
- public Void visitResource(ResourceFile r, PlatformModule pm) {
- return null;
- }
- };
-
- this.visit(v, this);
- return platformAPIs > 0;
- }
-
- // returns the module that is used by the requires statement
- // in other module's module-info
- Module exporter(Module from) {
- PlatformModule pm = (PlatformModule) from;
- if (pm.isBootConnected()) {
- // If it's a local module requiring jdk.boot, retain
- // the original requires; otherwise, use its external
- // module
- return this;
- } else {
- return exporter;
- }
- }
-
- void reexportBy(PlatformModule pm) {
- exporter = pm;
- // sun.<m> permits jdk.<m>
- this.config().addPermit(pm);
- // jdk.<m> requires public sun.<m>;
- pm.config().reexportModule(this);
- }
- }
-
- static class BootModule extends PlatformModule {
- BootModule(ModuleConfig config) {
- super(config);
- }
-
- @Override
- boolean isBootConnected() {
- return true;
- }
- }
- static class NoClassModule extends PlatformModule {
- NoClassModule(String name, String version) {
- super(new ModuleConfig(name, version));
- }
-
- @Override
- boolean allowEmpty() {
- return true;
- }
- }
-}
diff --git a/jdk/src/share/classes/com/sun/tools/jdi/LinkedHashMap.java b/jdk/src/share/classes/com/sun/tools/jdi/LinkedHashMap.java
deleted file mode 100644
index fb055ee..0000000
--- a/jdk/src/share/classes/com/sun/tools/jdi/LinkedHashMap.java
+++ /dev/null
@@ -1,904 +0,0 @@
-/*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.jdi;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Hash table based implementation of the Map interface. This implementation
- * provides all of the optional Map operations, and permits null values and
- * the null key. (HashMap is roughly equivalent to Hashtable, except that it
- * is unsynchronized and permits nulls.) In addition, elements in the map are
- * ordered and doubly linked together.
- * <p>
- * This implementation provides constant-time performance for the basic
- * operations (get and put), assuming the the hash function disperses the
- * elements properly among the buckets. Iteration over Collection views
- * requires time proportional to its size (the number of key-value mappings)
- * and returns elements in the order they are linked. In a HashMap the
- * iteration would require time proportional to the capacity of the map
- * plus the map size.
- * <p>
- * An instance of LinkedHashMap has two parameters that affect its efficiency:
- * its <i>capacity</i> and its <i>load factor</i>. The load factor should be
- * between 0.0 and 1.0. When the number of mappings in the LinkedHashMap exceeds
- * the product of the load factor and the current capacity, the capacity is
- * increased by calling the rehash method which requires time proportional
- * to the number of key-value mappings in the map. Larger load factors
- * use memory more efficiently, at the expense of larger expected time per
- * lookup.
- * <p>
- * If many mappings are to be stored in a LinkedHashMap, creating it with a
- * sufficiently large capacity will allow the mappings to be stored more
- * efficiently than letting it perform automatic rehashing as needed to grow
- * the table.
- * <p>
- * <strong>Note that this implementation is not synchronized.</strong> If
- * multiple threads access a LinkedHashMap concurrently, and at least one of the
- * threads modifies the LinkedHashMap structurally, it <em>must</em> be
- * synchronized externally. (A structural modification is any operation that
- * adds or deletes one or more mappings; merely changing the value associated
- * with a key that is already contained in the Table is not a structural
- * modification.) This is typically accomplished by synchronizing on some
- * object that naturally encapsulates the LinkedHashMap. If no such object
- * exists, the LinkedHashMap should be "wrapped" using the
- * Collections.synchronizedSet method. This is best done at creation time, to
- * prevent accidental unsynchronized access to the LinkedHashMap:
- * <pre>
- * Map m = Collections.synchronizedMap(new LinkedHashMap(...));
- * </pre>
- * <p>
- * The Iterators returned by the iterator methods of the Collections returned
- * by all of LinkedHashMap's "collection view methods" are <em>fail-fast</em>:
- * if the LinkedHashMap is structurally modified at any time after the Iterator
- * is created, in any way except through the Iterator's own remove or add
- * methods, the Iterator will throw a ConcurrentModificationException. Thus,
- * in the face of concurrent modification, the Iterator fails quickly and
- * cleanly, rather than risking arbitrary, non-deterministic behavior at an
- * undetermined time in the future.
- *
- * @author Josh Bloch
- * @author Arthur van Hoff
- * @author Zhenghua Li
- * @see Object#hashCode()
- * @see java.util.Collection
- * @see java.util.Map
- * @see java.util.TreeMap
- * @see java.util.Hashtable
- * @see java.util.HashMap
- */
-
-import java.io.Serializable;
-
-public class LinkedHashMap extends AbstractMap implements Map, Serializable {
- /**
- * The hash table data.
- */
- private transient Entry table[];
-
- /**
- * The head of the double linked list.
- */
- private transient Entry header;
-
- /**
- * The total number of mappings in the hash table.
- */
- private transient int count;
-
- /**
- * Rehashes the table when count exceeds this threshold.
- */
- private int threshold;
-
- /**
- * The load factor for the LinkedHashMap.
- */
- private float loadFactor;
-
- /**
- * The number of times this LinkedHashMap has been structurally modified
- * Structural modifications are those that change the number of mappings in
- * the LinkedHashMap or otherwise modify its internal structure (e.g.,
- * rehash). This field is used to make iterators on Collection-views of
- * the LinkedHashMap fail-fast. (See ConcurrentModificationException).
- */
- private transient int modCount = 0;
-
- /**
- * Constructs a new, empty LinkedHashMap with the specified initial
- * capacity and the specified load factor.
- *
- * @param initialCapacity the initial capacity of the LinkedHashMap.
- * @param loadFactor a number between 0.0 and 1.0.
- * @exception IllegalArgumentException if the initial capacity is less
- * than or equal to zero, or if the load factor is less than
- * or equal to zero.
- */
- public LinkedHashMap(int initialCapacity, float loadFactor) {
- if (initialCapacity < 0)
- throw new IllegalArgumentException("Illegal Initial Capacity: "+
- initialCapacity);
- if ((loadFactor > 1) || (loadFactor <= 0))
- throw new IllegalArgumentException("Illegal Load factor: "+
- loadFactor);
- if (initialCapacity==0)
- initialCapacity = 1;
- this.loadFactor = loadFactor;
- table = new Entry[initialCapacity];
- threshold = (int)(initialCapacity * loadFactor);
- header = new Entry(-1, null, null, null);
- header.before = header.after = header;
- }
-
- /**
- * Constructs a new, empty LinkedHashMap with the specified initial capacity
- * and default load factor.
- *
- * @param initialCapacity the initial capacity of the LinkedHashMap.
- */
- public LinkedHashMap(int initialCapacity) {
- this(initialCapacity, 0.75f);
- }
-
- /**
- * Constructs a new, empty LinkedHashMap with a default capacity and load
- * factor.
- */
- public LinkedHashMap() {
- this(101, 0.75f);
- }
-
- /**
- * Constructs a new LinkedHashMap with the same mappings as the given
- * Map. The LinkedHashMap is created with a capacity of thrice the number
- * of mappings in the given Map or 11 (whichever is greater), and a
- * default load factor.
- */
- public LinkedHashMap(Map t) {
- this(Math.max(3*t.size(), 11), 0.75f);
- putAll(t);
- }
-
- /**
- * Returns the number of key-value mappings in this Map.
- */
- public int size() {
- return count;
- }
-
- /**
- * Returns true if this Map contains no key-value mappings.
- */
- public boolean isEmpty() {
- return count == 0;
- }
-
- /**
- * Returns true if this LinkedHashMap maps one or more keys to the specified
- * value.
- *
- * @param value value whose presence in this Map is to be tested.
- */
- public boolean containsValue(Object value) {
- if (value==null) {
- for (Entry e = header.after; e != header; e = e.after)
- if (e.value==null)
- return true;
- } else {
- for (Entry e = header.after; e != header; e = e.after)
- if (value.equals(e.value))
- return true;
- }
- return false;
- }
-
- /**
- * Returns true if this LinkedHashMap contains a mapping for the specified
- * key.
- *
- * @param key key whose presence in this Map is to be tested.
- */
- public boolean containsKey(Object key) {
- Entry tab[] = table;
- if (key != null) {
- int hash = key.hashCode();
- int index = (hash & 0x7FFFFFFF) % tab.length;
- for (Entry e = tab[index]; e != null; e = e.next)
- if (e.hash==hash && e.key.equals(key))
- return true;
- } else {
- for (Entry e = tab[0]; e != null; e = e.next)
- if (e.key==null)
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns the value to which this LinkedHashMap maps the specified key.
- * Returns null if the LinkedHashMap contains no mapping for this key.
- * A return value of null does not <em>necessarily</em> indicate that the
- * LinkedHashMap contains no mapping for the key; it's also possible that
- * the LinkedHashMap explicitly maps the key to null. The containsKey
- * operation may be used to distinguish these two cases.
- *
- * @param key key whose associated value is to be returned.
- */
- public Object get(Object key) {
- Entry e = getEntry(key);
- return e==null ? null : e.value;
- }
-
- /**
- * Returns the entry associated with the specified key in the LinkedHashMap.
- * Returns null if the LinkedHashMap contains no mapping for this key.
- */
- private Entry getEntry(Object key) {
- Entry tab[] = table;
-
- if (key != null) {
- int hash = key.hashCode();
- int index = (hash & 0x7FFFFFFF) % tab.length;
- for (Entry e = tab[index]; e != null; e = e.next)
- if ((e.hash == hash) && e.key.equals(key))
- return e;
- } else {
- for (Entry e = tab[0]; e != null; e = e.next)
- if (e.key==null)
- return e;
- }
-
- return null;
- }
-
- /**
- * Rehashes the contents of the LinkedHashMap into a LinkedHashMap with a
- * larger capacity. This method is called automatically when the
- * number of keys in the LinkedHashMap exceeds this LinkedHashMap's capacity
- * and load factor.
- */
- private void rehash() {
- int oldCapacity = table.length;
- Entry oldMap[] = table;
-
- int newCapacity = oldCapacity * 2 + 1;
- Entry newMap[] = new Entry[newCapacity];
-
- modCount++;
- threshold = (int)(newCapacity * loadFactor);
- table = newMap;
-
- for (Entry e = header.after; e != header; e = e.after) {
- int index = (e.hash & 0x7FFFFFFF) % newCapacity;
- e.next = newMap[index];
- newMap[index] = e;
- }
- }
-
- /**
- * Remove an entry from the linked list.
- */
- private void listRemove(Entry entry) {
- if (entry == null) {
- return;
- }
- entry.before.after = entry.after;
- entry.after.before = entry.before;
- }
-
- /**
- * Add the specified entry before the specified existing entry to
- * the linked list.
- */
- private void listAddBefore(Entry entry, Entry existEntry) {
- entry.after = existEntry;
- entry.before = existEntry.before;
- entry.before.after = entry;
- entry.after.before = entry;
- }
-
- /**
- * Returns the position of the mapping for the specified key
- * in the ordered map.
- *
- * @param key the specified key.
- * @return index of the key mapping.
- */
- public int indexOf(Object key) {
- int i = 0;
- if (key == null) {
- for (Entry e = header.after; e != header; e = e.after, i++)
- if (e.key == null)
- return i;
- } else {
- for (Entry e = header.after; e != header; e = e.after, i++)
- if(key.equals(e.key))
- return i;
- }
- return -1;
- }
-
- /**
- * Associates the specified value with the specified key in this
- * LinkedHashMap. If the LinkedHashMap previously contained a mapping for
- * this key, the old value is replaced and the position of this mapping
- * entry in the double linked list remains the same. Otherwise, a new
- * mapping entry is created and inserted into the list before the specified
- * existing mapping entry. The method returns the previous value associated
- * with the specified key, or null if there was no mapping for key. A null
- * return can also indicate that the LinkedHashMap previously associated
- * null with the specified key.
- */
- private Object putAhead(Object key, Object value, Entry existEntry) {
- // Makes sure the key is not already in the LinkedHashMap.
- Entry tab[] = table;
- int hash = 0;
- int index = 0;
-
- if (key != null) {
- hash = key.hashCode();
- index = (hash & 0x7FFFFFFF) % tab.length;
- for (Entry e = tab[index] ; e != null ; e = e.next) {
- if ((e.hash == hash) && e.key.equals(key)) {
- Object old = e.value;
- e.value = value;
- return old;
- }
- }
- } else {
- for (Entry e = tab[0] ; e != null ; e = e.next) {
- if (e.key == null) {
- Object old = e.value;
- e.value = value;
- return old;
- }
- }
- }
-
- modCount++;
- if (count >= threshold) {
- // Rehash the table if the threshold is exceeded
- rehash();
- tab = table;
- index = (hash & 0x7FFFFFFF) % tab.length;
- }
-
- // Creates the new entry.
- Entry e = new Entry(hash, key, value, tab[index]);
- tab[index] = e;
- listAddBefore(e, existEntry);
- count++;
- return null;
- }
-
- /**
- * Associates the specified value with the specified key in this
- * LinkedHashMap and position the mapping at the specified index.
- * If the LinkedHashMap previously contained a mapping for this key,
- * the old value is replaced and the position of this mapping entry
- * in the double linked list remains the same. Otherwise, a new mapping
- * entry is created and inserted into the list at the specified
- * position.
- *
- * @param index the position to put the key-value mapping.
- * @param key key with which the specified value is to be associated.
- * @param value value to be associated with the specified key.
- * @return previous value associated with specified key, or null if there
- * was no mapping for key. A null return can also indicate that
- * the LinkedHashMap previously associated null with the specified
- * key.
- */
- public Object put(int index, Object key, Object value) {
- if (index < 0 || index > count)
- throw new IndexOutOfBoundsException();
- Entry e = header.after;
- if (index == count)
- return putAhead(key, value, header); //fast approach for append
- else {
- for (int i = 0; i < index; i++)
- e = e.after;
- return putAhead(key, value, e);
- }
- }
-
-
- /**
- * Associates the specified value with the specified key in this
- * LinkedHashMap. If the LinkedHashMap previously contained a mapping for
- * this key, the old value is replaced. The mapping entry is also appended
- * to the end of the ordered linked list.
- *
- * @param key key with which the specified value is to be associated.
- * @param value value to be associated with the specified key.
- * @return previous value associated with specified key, or null if there
- * was no mapping for key. A null return can also indicate that
- * the LinkedHashMap previously associated null with the specified
- * key.
- */
- public Object put(Object key, Object value) {
- return putAhead(key, value, header);
- }
-
- /**
- * Removes the mapping for this key from this LinkedHashMap if present.
- * The mapping would also be removed from the double linked list.
- *
- * @param key key whose mapping is to be removed from the Map.
- * @return previous value associated with specified key, or null if there
- * was no mapping for key. A null return can also indicate that
- * the LinkedHashMap previously associated null with the specified
- * key.
- */
- public Object remove(Object key) {
- Entry tab[] = table;
-
- if (key != null) {
- int hash = key.hashCode();
- int index = (hash & 0x7FFFFFFF) % tab.length;
-
- for (Entry e = tab[index], prev = null; e != null;
- prev = e, e = e.next) {
- if ((e.hash == hash) && e.key.equals(key)) {
- modCount++;
- if (prev != null)
- prev.next = e.next;
- else
- tab[index] = e.next;
-
- count--;
- Object oldValue = e.value;
- e.value = null;
-
- listRemove(e);
- return oldValue;
- }
- }
- } else {
- for (Entry e = tab[0], prev = null; e != null;
- prev = e, e = e.next) {
- if (e.key == null) {
- modCount++;
- if (prev != null)
- prev.next = e.next;
- else
- tab[0] = e.next;
-
- count--;
- Object oldValue = e.value;
- e.value = null;
-
- listRemove(e);
- return oldValue;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Copies all of the mappings from the specified Map to this LinkedHashMap
- * These mappings will replace any mappings that this LinkedHashMap had for
- * any of the keys currently in the specified Map.
- *
- * @param t Mappings to be stored in this Map.
- */
- public void putAll(Map t) {
- Iterator i = t.entrySet().iterator();
- while (i.hasNext()) {
- Map.Entry e = (Map.Entry) i.next();
- put(e.getKey(), e.getValue());
- }
- }
-
- /**
- * Removes all mappings from this LinkedHashMap.
- */
- public void clear() {
- Entry tab[] = table;
- modCount++;
- for (int index = tab.length; --index >= 0; )
- tab[index] = null;
- count = 0;
- header.before = header.after = header;
- }
-
- /**
- * Returns a shallow copy of this LinkedHashMap. The keys and values
- * themselves are not cloned.
- */
- public Object clone() {
- return new LinkedHashMap(this);
- }
-
- // Views
-
- private transient Set keySet = null;
- private transient Set entries = null;
- private transient Collection values = null;
-
- /**
- * Returns a Set view of the keys contained in this LinkedHashMap. The Set
- * is backed by the LinkedHashMap, so changes to the LinkedHashMap are
- * reflected in the Set, and vice-versa. The Set supports element removal,
- * which removes the corresponding mapping from the LinkedHashMap, via the
- * Iterator.remove, Set.remove, removeAll retainAll, and clear operations.
- * It does not support the add or addAll operations.
- */
- public Set keySet() {
- if (keySet == null) {
- keySet = new AbstractSet() {
- public Iterator iterator() {
- return new HashIterator(KEYS);
- }
- public int size() {
- return count;
- }
- public boolean contains(Object o) {
- return containsKey(o);
- }
- public boolean remove(Object o) {
- return LinkedHashMap.this.remove(o) != null;
- }
- public void clear() {
- LinkedHashMap.this.clear();
- }
- };
- }
- return keySet;
- }
-
- /**
- * Returns a Collection view of the values contained in this LinkedHashMap.
- * The Collection is backed by the LinkedHashMap, so changes to the
- * LinkedHashMap are reflected in the Collection, and vice-versa. The
- * Collection supports element removal, which removes the corresponding
- * mapping from the LinkedHashMap, via the Iterator.remove,
- * Collection.remove, removeAll, retainAll and clear operations. It does
- * not support the add or addAll operations.
- */
- public Collection values() {
- if (values==null) {
- values = new AbstractCollection() {
- public Iterator iterator() {
- return new HashIterator(VALUES);
- }
- public int size() {
- return count;
- }
- public boolean contains(Object o) {
- return containsValue(o);
- }
- public void clear() {
- LinkedHashMap.this.clear();
- }
- };
- }
- return values;
- }
-
- /**
- * Returns a Collection view of the mappings contained in this
- * LinkedHashMap. Each element in the returned collection is a Map.Entry.
- * The Collection is backed by the LinkedHashMap, so changes to the
- * LinkedHashMap are reflected in the Collection, and vice-versa. The
- * Collection supports element removal, which removes the corresponding
- * mapping from the LinkedHashMap, via the Iterator.remove,
- * Collection.remove, removeAll, retainAll and clear operations. It does
- * not support the add or addAll operations.
- *
- * @see java.util.Map.Entry
- */
- public Set entrySet() {
- if (entries==null) {
- entries = new AbstractSet() {
- public Iterator iterator() {
- return new HashIterator(ENTRIES);
- }
-
- public boolean contains(Object o) {
- if (!(o instanceof Map.Entry))
- return false;
- Map.Entry entry = (Map.Entry)o;
- Object key = entry.getKey();
- Entry tab[] = table;
- int hash = (key==null ? 0 : key.hashCode());
- int index = (hash & 0x7FFFFFFF) % tab.length;
-
- for (Entry e = tab[index]; e != null; e = e.next)
- if (e.hash==hash && e.equals(entry))
- return true;
- return false;
- }
-
- public boolean remove(Object o) {
- if (!(o instanceof Map.Entry))
- return false;
- Map.Entry entry = (Map.Entry)o;
- Object key = entry.getKey();
- Entry tab[] = table;
- int hash = (key==null ? 0 : key.hashCode());
- int index = (hash & 0x7FFFFFFF) % tab.length;
-
- for (Entry e = tab[index], prev = null; e != null;
- prev = e, e = e.next) {
- if (e.hash==hash && e.equals(entry)) {
- modCount++;
- if (prev != null)
- prev.next = e.next;
- else
- tab[index] = e.next;
-
- count--;
- e.value = null;
- listRemove(e);
- return true;
- }
- }
- return false;
- }
-
- public int size() {
- return count;
- }
-
- public void clear() {
- LinkedHashMap.this.clear();
- }
- };
- }
-
- return entries;
- }
-
- /**
- * Compares the specified Object with this Map for equality.
- * Returns true if the given object is also a LinkedHashMap and the two
- * Maps represent the same mappings in the same order. More formally,
- * two Maps <code>t1</code> and <code>t2</code> represent the same mappings
- * if <code>t1.keySet().equals(t2.keySet())</code> and for every
- * key <code>k</code> in <code>t1.keySet()</code>, <code>
- * (t1.get(k)==null ? t2.get(k)==null : t1.get(k).equals(t2.get(k)))
- * </code>.
- * <p>
- * This implementation first checks if the specified Object is this Map;
- * if so it returns true. Then, it checks if the specified Object is
- * a Map whose size is identical to the size of this Set; if not, it
- * it returns false. If so, it iterates over this Map and the specified
- * Map's entrySet() Collection, and checks that the specified Map contains
- * each mapping that this Map contains at the same position. If the
- * specified Map fails to contain such a mapping in the right order, false
- * is returned. If the iteration completes, true is returned.
- *
- * @param o Object to be compared for equality with this Map.
- * @return true if the specified Object is equal to this Map.
- *
- */
- public boolean equals(Object o) {
- if (o == this)
- return true;
-
- if (!(o instanceof LinkedHashMap))
- return false;
- LinkedHashMap t = (LinkedHashMap) o;
- if (t.size() != size())
- return false;
-
- Iterator i1 = entrySet().iterator();
- Iterator i2 = t.entrySet().iterator();
-
- while (i1.hasNext()) {
- Entry e1 = (Entry) i1.next();
- Entry e2 = (Entry) i2.next();
-
- Object key1 = e1.getKey();
- Object value1 = e1.getValue();
- Object key2 = e2.getKey();
- Object value2 = e2.getValue();
-
- if ((key1 == null ? key2 == null : key1.equals(key2)) &&
- (value1 == null ? value2 == null : value1.equals(value2))) {
- continue;
- } else {
- return false;
- }
- }
- return true;
- }
-
- /**
- * LinkedHashMap collision list entry.
- */
- private static class Entry implements Map.Entry {
- int hash;
- Object key;
- Object value;
- Entry next;
-
- // These fields comprise the doubly linked list that is used for
- // iteration.
- Entry before, after;
-
- Entry(int hash, Object key, Object value, Entry next) {
- this.hash = hash;
- this.key = key;
- this.value = value;
- this.next = next;
- }
-
- // Map.Entry Ops
-
- public Object getKey() {
- return key;
- }
-
- public Object getValue() {
- return value;
- }
-
- public Object setValue(Object value) {
- Object oldValue = this.value;
- this.value = value;
- return oldValue;
- }
-
- public boolean equals(Object o) {
- if (!(o instanceof Map.Entry))
- return false;
- Map.Entry e = (Map.Entry)o;
-
- return (key==null ? e.getKey()==null : key.equals(e.getKey())) &&
- (value==null ? e.getValue()==null : value.equals(e.getValue()));
- }
-
- public int hashCode() {
- return hash ^ (value==null ? 0 : value.hashCode());
- }
-
- public String toString() {
- return key+"="+value;
- }
- }
-
- // Types of Iterators
- private static final int KEYS = 0;
- private static final int VALUES = 1;
- private static final int ENTRIES = 2;
-
- private class HashIterator implements Iterator {
- private Entry[] table = LinkedHashMap.this.table;
- private Entry entry = null;
- private Entry lastReturned = null;
- private int type;
-
- /**
- * The modCount value that the iterator believes that the backing
- * List should have. If this expectation is violated, the iterator
- * has detected concurrent modification.
- */
- private int expectedModCount = modCount;
-
- HashIterator(int type) {
- this.type = type;
- this.entry = LinkedHashMap.this.header.after;
- }
-
- public boolean hasNext() {
- return entry != header;
- }
-
- public Object next() {
- if (modCount != expectedModCount)
- throw new ConcurrentModificationException();
- if (entry == LinkedHashMap.this.header)
- throw new NoSuchElementException();
-
- Entry e = lastReturned = entry;
- entry = e.after;
- return type == KEYS ? e.key : (type == VALUES ? e.value : e);
- }
-
- public void remove() {
- if (lastReturned == null)
- throw new IllegalStateException();
- if (modCount != expectedModCount)
- throw new ConcurrentModificationException();
-
- Entry[] tab = LinkedHashMap.this.table;
- int index = (lastReturned.hash & 0x7FFFFFFF) % tab.length;
-
- for (Entry e = tab[index], prev = null; e != null;
- prev = e, e = e.next) {
- if (e == lastReturned) {
- modCount++;
- expectedModCount++;
- if (prev == null)
- tab[index] = e.next;
- else
- prev.next = e.next;
- count--;
- listRemove(e);
- lastReturned = null;
- return;
- }
- }
- throw new ConcurrentModificationException();
- }
- }
-
- /**
- * Save the state of the LinkedHashMap to a stream (i.e., serialize it).
- * The objects will be written out in the order they are linked
- * in the list.
- */
- private void writeObject(java.io.ObjectOutputStream s)
- throws IOException
- {
- // Write out the threshold, loadfactor, and any hidden stuff
- s.defaultWriteObject();
-
- // Write out number of buckets
- s.writeInt(table.length);
-
- // Write out size (number of Mappings)
- s.writeInt(count);
-
- // Write out keys and values (alternating)
- for (Entry e = header.after; e != header; e = e.after) {
- s.writeObject(e.key);
- s.writeObject(e.value);
- }
- }
-
- /**
- * Reconstitute the LinkedHashMap from a stream (i.e., deserialize it).
- */
- private void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- // Read in the threshold, loadfactor, and any hidden stuff
- s.defaultReadObject();
-
- // Read in number of buckets and allocate the bucket array;
- int numBuckets = s.readInt();
- table = new Entry[numBuckets];
- header = new Entry(-1, null, null, null);
- header.before = header;
- header.after = header;
-
- // Read in size (number of Mappings)
- int size = s.readInt();
-
- // Read the keys and values, and put the mappings in the LinkedHashMap
- for (int i=0; i<size; i++) {
- Object key = s.readObject();
- Object value = s.readObject();
- put(key, value);
- }
- }
-}
diff --git a/jdk/src/share/classes/java/lang/module/ModuleInfoAnnotation.java b/jdk/src/share/classes/java/lang/module/ModuleInfoAnnotation.java
deleted file mode 100644
index 27422ec..0000000
--- a/jdk/src/share/classes/java/lang/module/ModuleInfoAnnotation.java
+++ /dev/null
@@ -1,682 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang.module;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.AnnotationFormatError;
-import java.lang.annotation.AnnotationTypeMismatchException;
-import java.lang.module.ModuleInfoReader.ConstantPool;
-import java.lang.reflect.*;
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import sun.reflect.annotation.*;
-import sun.reflect.generics.parser.SignatureParser;
-import sun.reflect.generics.factory.GenericsFactory;
-import sun.reflect.generics.factory.CoreReflectionFactory;
-import sun.reflect.generics.visitor.Reifier;
-import sun.reflect.generics.visitor.TypeTreeVisitor;
-import sun.reflect.generics.tree.*;
-
-/**
- * Represents an annotation in module-info.class. This class is
- * based on the com.sun.tools.classfile library.
- *
- */
-/* package */ class ModuleInfoAnnotation {
- private final int typeIndex;
- private final int numElements;
- private final String typeSig;
- private final String typeName;
- private final Set<Element> elements;
-
- /**
- * Constructs a ModuleInfoAnnotation by parsing the bytes from
- * the specified input stream and resolving constant references in
- * the specified constant pool.
- *
- * @params in Data input stream for reading an annotation
- * @params cpool Constant pool of module-info.class
- */
- ModuleInfoAnnotation(DataInputStream in, ConstantPool cpool) throws IOException {
- this.typeIndex = in.readUnsignedShort();
- this.numElements = in.readUnsignedShort();
-
- this.typeSig = cpool.getUtf8(typeIndex);
- // convert the field descriptor to the fully qualified class name
- this.typeName = typeSig.substring(1, typeSig.length()-1).replace('/', '.');
- this.elements = new HashSet<Element>();
- for (int i = 0; i < numElements; i++)
- elements.add(new Element(in, cpool));
- }
-
- /**
- * Returns the annotation type name.
- */
- String getName() {
- return typeName;
- }
-
- /**
- * Returns an Annotation object that doesn't support element of type
- * Class; attempting to read a Class object by invoking the relevant
- * method on the returned annotation will result in a
- * UnsupportedElementTypeException.
- *
- * This method is called by the ModuleInfo.getAnnotation() method;
- */
- <T extends Annotation> T generateAnnotation(Class<T> annotationClass) {
- return generateAnnotation(annotationClass, false);
- }
-
- /**
- * Returns an Annotation object created by the core reflection.
- * If supportClassElementType is false, attempting to read a Class
- * object by invoking the relevant method on the returned annotation
- * will result in a UnsupportedElementTypeException.
- *
- * @param annotationClass annotation class
- * @param supportClassElementType supports element of Class type
- */
- <T extends Annotation> T generateAnnotation(Class<T> annotationClass,
- boolean supportClassElementType) {
- AnnotationType type = AnnotationType.getInstance(annotationClass);
- Map<String, Class<?>> memberTypes = type.memberTypes();
- Map<String, Object> memberValues =
- new LinkedHashMap<String, Object>(type.memberDefaults());
-
- // A visitor to obtain the value of an element
- ElementValueVisitor elementVisitor =
- new ElementValueVisitor(annotationClass, supportClassElementType);
-
- for (Element e : elements) {
- String memberName = e.elementName;
- Class<?> memberType = memberTypes.get(memberName);
- if (memberType != null) {
- Object value = elementVisitor.getValue(e, memberType);
- memberValues.put(memberName, value);
- }
- }
-
- // replace the default value of elements of Class type
- // to UnsupportedElementTypeExceptionProxy if it doesn't support
- // elements of Class type
- if (!supportClassElementType) {
- for (Map.Entry<String, Class<?>> e : memberTypes.entrySet()) {
- String memberName = e.getKey();
- Class<?> memberType = e.getValue();
- Object value = memberValues.get(memberName);
- if (memberType == Class.class && !(value instanceof ExceptionProxy)) {
- value = new DefaultValueExceptionProxy(Class.class.cast(value));
- memberValues.put(memberName, value);
- } else if (memberType.isArray() &&
- memberType.getComponentType() == Class.class) {
- if (!(value instanceof ExceptionProxy)) {
- value = new DefaultValueExceptionProxy((Class<?>[]) value);
- memberValues.put(memberName, value);
- }
- }
- }
- }
-
- Annotation a = AnnotationParser.annotationForMap(annotationClass, memberValues);
- return annotationClass.cast(a);
- }
-
- /**
- * Returns Annotation object for a java.lang.reflect.Module
- */
- @SuppressWarnings({"unchecked"})
- Annotation getAnnotation(Module module) {
- Class<? extends Annotation> annotationClass = null;
- try {
- annotationClass = (Class<? extends Annotation>) parseSig(typeSig, module);
- } catch (NoClassDefFoundError e) {
- throw new TypeNotPresentException(typeSig, e);
- }
- return generateAnnotation(annotationClass, true);
- }
-
- /**
- * Returns a Class object of the given signature loaded by
- * the module class loader of the given Module.
- */
- private static Class<?> parseSig(String sig, Module module) {
- if (sig.equals("V")) return void.class;
- SignatureParser parser = SignatureParser.make();
- TypeSignature typeSig = parser.parseTypeSig(sig);
- GenericsFactory factory = CoreReflectionFactory.make(module);
- Reifier reify = Reifier.make(factory);
- typeSig.accept(reify);
- Type result = reify.getResult();
- return toClass(result);
- }
-
- private static Class<?> toClass(Type o) {
- if (o instanceof GenericArrayType)
- return Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()),
- 0)
- .getClass();
- return (Class)o;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("@").append(typeName).append("(");
- String sep = "";
- for (Element e : elements) {
- sb.append(sep);
- sb.append(e.elementName).append("=").append(e.value.toString());
- sep = ", ";
- }
- sb.append(")");
- return sb.toString();
- }
-
- /**
- * element_value_pair structure
- */
- static class Element {
- Element (DataInputStream in, ConstantPool cpool)
- throws IOException {
- this.elementNameIndex = in.readUnsignedShort();
- this.elementName = cpool.getUtf8(elementNameIndex);
- this.value = ElementValue.read(in, cpool);
- }
-
- final int elementNameIndex;
- final String elementName;
- final ElementValue value;
- }
-
- /**
- * element_value structure
- */
- static abstract class ElementValue {
- static ElementValue read(DataInputStream in, ConstantPool cpool)
- throws IOException {
- int tag = in.readUnsignedByte();
- switch (tag) {
- case 'B':
- case 'C':
- case 'D':
- case 'F':
- case 'I':
- case 'J':
- case 'S':
- case 'Z':
- case 's':
- return new PrimitiveElementValue(in, tag, cpool);
-
- case 'e':
- return new EnumElementValue(in, tag, cpool);
-
- case 'c':
- return new ClassElementValue(in, tag, cpool);
-
- case '@':
- return new AnnotationElementValue(in, tag, cpool);
-
- case '[':
- return new ArrayElementValue(in, tag, cpool);
-
- default:
- throw new ClassFormatError("unrecognized tag: " + tag);
- }
- }
-
- protected ElementValue(int tag) {
- this.tag = tag;
- }
-
- abstract <R,P> R accept(Visitor<R,P> visitor, P p);
-
- interface Visitor<R,P> {
- R visitPrimitive(PrimitiveElementValue ev, P p);
- R visitEnum(EnumElementValue ev, P p);
- R visitClass(ClassElementValue ev, P p);
- R visitAnnotation(AnnotationElementValue ev, P p);
- R visitArray(ArrayElementValue ev, P p);
- }
-
- final int tag;
- }
-
- static class PrimitiveElementValue extends ElementValue {
- PrimitiveElementValue(DataInputStream in, int tag, ConstantPool cpool) throws IOException {
- super(tag);
- this.constValueIndex = in.readUnsignedShort();
- Integer v;
- switch(tag) {
- case 'B':
- v = (Integer) cpool.getValue(constValueIndex);
- this.constValue = new Byte(v.byteValue());
- break;
- case 'C':
- v = (Integer) cpool.getValue(constValueIndex);
- this.constValue = new Character((char) v.shortValue());
- break;
- case 'S':
- v = (Integer) cpool.getValue(constValueIndex);
- this.constValue = new Short(v.shortValue());
- break;
- case 'Z':
- v = (Integer) cpool.getValue(constValueIndex);
- this.constValue = v.intValue() == 1 ? Boolean.TRUE : Boolean.FALSE;
- break;
- case 'D':
- case 'F':
- case 'I':
- case 'J':
- this.constValue = cpool.getValue(constValueIndex);
- break;
- case 's':
- this.constValue = cpool.getValue(constValueIndex);
- break;
- default:
- throw new AnnotationFormatError(
- "Invalid member-value tag in annotation: " + (char) tag);
- }
- }
-
- <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitPrimitive(this, p);
- }
-
- @Override
- public String toString() {
- return constValue.getClass().getName() + " value " + constValue;
- }
-
- final int constValueIndex;
- final Object constValue;
- }
-
- static class EnumElementValue extends ElementValue {
- EnumElementValue(DataInputStream in, int tag, ConstantPool cpool) throws IOException {
- super(tag);
- typeNameIndex = in.readUnsignedShort();
- constNameIndex = in.readUnsignedShort();
- this.typeName = cpool.getUtf8(typeNameIndex);
- this.constName = cpool.getUtf8(constNameIndex);
- }
-
- public <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitEnum(this, p);
- }
-
- @Override
- public String toString() {
- return typeName + "." + constName;
- }
-
- final int typeNameIndex;
- final int constNameIndex;
- final String typeName;
- final String constName;
- }
-
- static class ClassElementValue extends ElementValue {
- ClassElementValue(DataInputStream in, int tag, ConstantPool cpool) throws IOException {
- super(tag);
- this.classInfoIndex = in.readUnsignedShort();
- this.className = cpool.getUtf8(classInfoIndex);
- }
-
- <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitClass(this, p);
- }
-
- final int classInfoIndex;
- final String className;
-
- @Override
- public String toString() {
- return className;
- }
- }
-
- static class AnnotationElementValue extends ElementValue {
- AnnotationElementValue(DataInputStream in, int tag, ConstantPool cpool)
- throws IOException {
- super(tag);
- annotationValue = new ModuleInfoAnnotation(in, cpool);
- }
-
- <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitAnnotation(this, p);
- }
-
- final ModuleInfoAnnotation annotationValue;
-
- @Override
- public String toString() {
- return annotationValue.toString();
- }
- }
-
- static class ArrayElementValue extends ElementValue {
- ArrayElementValue(DataInputStream in, int tag, ConstantPool cpool)
- throws IOException {
- super(tag);
- numValues = in.readUnsignedShort();
- values = new ElementValue[numValues];
- for (int i = 0; i < values.length; i++)
- values[i] = ElementValue.read(in, cpool);
- }
-
- <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitArray(this, p);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("[");
- for (ElementValue v : values) {
- sb.append(v.toString()).append(" ");
- }
- sb.append("]");
- return sb.toString();
- }
-
- final int numValues;
- final ElementValue[] values;
- }
-
- // proxy exception
- private static class UnsupportedElementTypeExceptionProxy extends ExceptionProxy {
- static final long serialVersionUID = 7579289665484587465L;
-
- private List<String> typeSigs;
-
- UnsupportedElementTypeExceptionProxy(String sig) {
- this.typeSigs = Collections.singletonList(sig);
- }
-
- UnsupportedElementTypeExceptionProxy(List<String> sigs) {
- this.typeSigs = Collections.unmodifiableList(sigs);
- }
-
- protected RuntimeException generateException() {
- List<String> names = new ArrayList<String>();
- for (String sig : typeSigs) {
- names.add(parseTypeSignature(sig));
- }
- return new UnsupportedElementTypeException(names);
- }
-
- /*
- * Returns a string representing the type in the source code if possible.
- */
- private String parseTypeSignature(String sig) {
- if (sig.equals("V")) return "Void";
- SignatureParser parser = SignatureParser.make();
- TypeSignature typeSig = parser.parseTypeSig(sig);
- TypeVisitor visitor = new TypeVisitor();
- typeSig.accept(visitor);
- return visitor.getResult();
- }
- }
-
- private static class DefaultValueExceptionProxy extends ExceptionProxy {
- static final long serialVersionUID = 1361256048223626671L;
-
- private List<String> typeNames = new ArrayList<String>();
-
- DefaultValueExceptionProxy(Class<?> cls) {
- typeNames.add(cls.getName());
- }
-
- DefaultValueExceptionProxy(Class<?>[] classes) {
- for (Class<?> c : classes) {
- typeNames.add(c.getName());
- }
- }
-
- protected RuntimeException generateException() {
- return new UnsupportedElementTypeException(typeNames);
- }
- }
-
- // Visitor to get the reified type name
- private static class TypeVisitor implements TypeTreeVisitor<String> {
- private String resultType = "";
- public String getResult() {
- return resultType;
- }
-
- // Visitor methods, per node type
- public void visitFormalTypeParameter(FormalTypeParameter ftp) {
- throw new AssertionError("Should not reach here");
- }
-
- // copy from sun.reflect.generics.visitor.Reifier
- public void visitClassTypeSignature(ClassTypeSignature ct) {
- // extract iterator on list of simple class type sigs
- List<SimpleClassTypeSignature> scts = ct.getPath();
- assert(!scts.isEmpty());
- Iterator<SimpleClassTypeSignature> iter = scts.iterator();
- SimpleClassTypeSignature sc = iter.next();
- StringBuilder n = new StringBuilder(sc.getName());
- boolean dollar = sc.getDollar();
-
- // phase 1: iterate over simple class types until
- // we are either done or we hit one with non-empty type parameters
- while (iter.hasNext() && sc.getTypeArguments().length == 0) {
- sc = iter.next();
- dollar = sc.getDollar();
- n.append(dollar?"$":".").append(sc.getName());
- }
-
- // Now, either sc is the last element of the list, or
- // it has type arguments (or both)
- assert(!(iter.hasNext()) || (sc.getTypeArguments().length > 0));
- // if there are no type arguments
- if (sc.getTypeArguments().length == 0) {
- //we have surely reached the end of the path
- assert(!iter.hasNext());
- resultType = n.toString(); // the result is the raw type
- } else {
- assert(sc.getTypeArguments().length > 0);
-
- // phase 2: iterate over remaining simple class types
- dollar =false;
- while (iter.hasNext()) {
- sc = iter.next();
- dollar = sc.getDollar();
- n.append(dollar?"$":".").append(sc.getName()); // build up raw class name
- }
- resultType = n.toString();
- }
- }
-
- public void visitArrayTypeSignature(ArrayTypeSignature a) {
- // extract and reify component type
- a.getComponentType().accept(this);
- resultType = resultType + "[]";
- }
-
- public void visitTypeVariableSignature(TypeVariableSignature tv) {
- throw new AssertionError("Should not reach here");
- }
- public void visitWildcard(Wildcard w) {
- throw new AssertionError("Should not reach here");
- }
-
- public void visitSimpleClassTypeSignature(SimpleClassTypeSignature sct) {
- resultType = sct.getName();
- }
-
- public void visitBottomSignature(BottomSignature b) {
- throw new AssertionError("Should not reach here");
- }
-
- // Primitives and Void
- public void visitByteSignature(ByteSignature b) {
- resultType = "byte";
- }
- public void visitBooleanSignature(BooleanSignature b) {
- resultType = "boolean";
- }
- public void visitShortSignature(ShortSignature s) {
- resultType = "short";
- }
- public void visitCharSignature(CharSignature c) {
- resultType = "char";
- }
- public void visitIntSignature(IntSignature i) {
- resultType = "int";
- }
- public void visitLongSignature(LongSignature l) {
- resultType = "long";
- }
- public void visitFloatSignature(FloatSignature f) {
- resultType = "float";
- }
- public void visitDoubleSignature(DoubleSignature d) {
- resultType = "double";
- }
-
- public void visitVoidDescriptor(VoidDescriptor v) {
- resultType = "Void";
- }
- }
-
- private static class ElementValueVisitor implements ElementValue.Visitor<Object, Class<?>> {
- private final Class<? extends Annotation> annotationClass;
- private final boolean supportClassElementType;
- private String mismatchType = "unknown";
- ElementValueVisitor(Class<? extends Annotation> annotationClass,
- boolean supportClassElementType) {
- this.annotationClass = annotationClass;
- this.supportClassElementType = supportClassElementType;
- }
-
- Object getValue(Element e, Class<?> elementType) {
- Object value;
- try {
- mismatchType = "unknown";
- value = e.value.accept(this, elementType);
- } catch (IllegalArgumentException ex) {
- // indicates a type mismatch
- Method method = null;
- try {
- method = annotationClass.getMethod(e.elementName);
- } catch (NoSuchMethodException x) {
- throw new AssertionError("should not reach here");
- }
- final Method m = method;
- value = new ExceptionProxy() {
- static final long serialVersionUID = 269;
- public String toString() {
- return "<error>"; // eg: @Anno(value=<error>)
- }
- protected RuntimeException generateException() {
- return new AnnotationTypeMismatchException(m, mismatchType);
- }
- };
- }
- return value;
- }
-
- private Object parse(ElementValue value, Class<?> elementType) {
- return value.accept(this, elementType);
- }
-
- public Object visitPrimitive(PrimitiveElementValue ev, Class<?> elementType) {
- return ev.constValue;
- }
-
- @SuppressWarnings({"unchecked", "rawtypes"})
- public Object visitEnum(EnumElementValue ev, Class<?> elementType) {
- Class<Enum<?>> enumType = (Class<Enum<?>>) elementType;
- Object value;
- try {
- value = Enum.valueOf((Class)enumType, ev.constName);
- } catch (IllegalArgumentException ex) {
- value = new EnumConstantNotPresentExceptionProxy(enumType, ev.constName);
- }
- return value;
- }
-
- public Object visitClass(ClassElementValue ev, Class<?> elementType) {
- if (supportClassElementType) {
- try {
- return parseSig(ev.className, annotationClass.getModule());
- } catch (NoClassDefFoundError e) {
- return new TypeNotPresentExceptionProxy(ev.className, e);
- }
- } else {
- return new UnsupportedElementTypeExceptionProxy(ev.className);
- }
- }
-
- @SuppressWarnings({"unchecked"})
- public Object visitAnnotation(AnnotationElementValue ev, Class<?> elementType) {
- Class<? extends Annotation> type = (Class<? extends Annotation>) elementType;
- return ev.annotationValue.generateAnnotation(type);
- }
-
- public Object visitArray(ArrayElementValue ev, Class<?> elementType) {
- Class<?> componentType = elementType.getComponentType();
- int length = ev.numValues;
- if (componentType == Class.class && !supportClassElementType) {
- List<String> elems = new ArrayList<String>();
- for (int i = 0; i < length; i++) {
- ClassElementValue e = (ClassElementValue) ev.values[i];
- elems.add(e.className);
- }
- return new UnsupportedElementTypeExceptionProxy(elems);
- } else {
- Object result = Array.newInstance(componentType, length);
- for (int i = 0; i < length; i++) {
- Object value = parse(ev.values[i], componentType);
- if (value == null || value instanceof ExceptionProxy) {
- return value;
- }
- try {
- Array.set(result, i, value);
- } catch (IllegalArgumentException e) {
- // type mismatch
- mismatchType = value.getClass().getName();
- return e;
- }
- }
- return result;
- }
- }
- }
-}
diff --git a/jdk/src/share/classes/java/lang/module/UnsupportedElementTypeException.java b/jdk/src/share/classes/java/lang/module/UnsupportedElementTypeException.java
deleted file mode 100644
index b781af7..0000000
--- a/jdk/src/share/classes/java/lang/module/UnsupportedElementTypeException.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.lang.module;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Collections;
-
-
-/**
- * Thrown when an application attempts to read a {@code Class}
- * object or a Class[]-valued element by invoking the relevant method
- * on an annotation returned by the {@link java.lang.module.ModuleInfo#getAnnotation}
- * method.
- *
- * @see java.lang.module.ModuleInfo#getAnnotation(Class)
- * @since 1.7
- */
-public class UnsupportedElementTypeException extends RuntimeException {
-
- private static final long serialVersionUID = 6548519553178935875L;
- private List<String> classnames;
-
- /**
- * Constructs a new UnsupportedElementTypeException.
- *
- * @param classname a fully-qualified class name
- * specified in the element being accessed.
- */
- public UnsupportedElementTypeException(String classname) {
- super("Attempt to access Class object " + classname);
- this.classnames = Collections.singletonList(classname);
- }
-
- /**
- * Constructs a new UnsupportedElementTypeException.
- *
- * @param classnames a list of fully-qualified class name
- * specified in the element being accessed.
- */
- public UnsupportedElementTypeException(List<String> classnames) {
- super("Attempt to access Class objects " +
- (classnames = // defensive copy
- new ArrayList<String>(classnames)).toString() );
- this.classnames = Collections.unmodifiableList(classnames);
- }
-
- /**
- * Returns the list of fully-qualified class name corresponding
- * to the value of the element being accessed.
- *
- * @return the list of fully-qualified class name corresponding
- * to the value of the element being accessed.
- */
- public List<String> getClassNames() {
- return classnames;
- }
-}
diff --git a/jdk/src/share/classes/java/util/ServiceLoader.java b/jdk/src/share/classes/java/util/ServiceLoader.java
index b3c34ae..0aef303 100644
--- a/jdk/src/share/classes/java/util/ServiceLoader.java
+++ b/jdk/src/share/classes/java/util/ServiceLoader.java
@@ -30,15 +30,16 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
+
+import org.openjdk.jigsaw.*;
+import sun.reflect.Reflection;
/**
* A simple service-provider loading facility.
+ *
+ * <p> ## spec needs significant changes to specifying loading of services that
+ * are installed as modules.
*
* <p> A <i>service</i> is a well-known set of interfaces and (usually
* abstract) classes. A <i>service provider</i> is a specific implementation
@@ -185,16 +186,16 @@ public final class ServiceLoader<S>
private static final String PREFIX = "META-INF/services/";
// The class or interface representing the service being loaded
- private Class<S> service;
+ private final Class<S> service;
// The class loader used to locate, load, and instantiate providers
- private ClassLoader loader;
+ private final ClassLoader loader;
// Cached providers, in instantiation order
- private LinkedHashMap<String,S> providers = new LinkedHashMap<>();
+ private final LinkedHashMap<String,S> providers = new LinkedHashMap<>();
// The current lazy-lookup iterator
- private LazyIterator lookupIterator;
+ private Iterator<S> lookupIterator;
/**
* Clear this loader's provider cache so that all providers will be
@@ -208,7 +209,7 @@ public final class ServiceLoader<S>
* can be installed into a running Java virtual machine.
*/
public void reload() {
- providers.clear();
+ providers.clear();
lookupIterator = new LazyIterator(service, loader);
}
@@ -309,7 +310,7 @@ public final class ServiceLoader<S>
}
return names.iterator();
}
-
+
// Private inner class implementing fully-lazy provider lookup
//
private class LazyIterator
@@ -377,9 +378,9 @@ public final class ServiceLoader<S>
public void remove() {
throw new UnsupportedOperationException();
}
-
- }
-
+
+ }
+
/**
* Lazily loads the available providers of this loader's service.
*
@@ -444,6 +445,19 @@ public final class ServiceLoader<S>
};
}
+
+ /**
+ * Returns the caller claser's class loader. Should only be invoked by
+ * the public load methods when in module mode.
+ */
+ private static ClassLoader callerLoader() {
+ Class<?> caller = Reflection.getCallerClass(3);
+ ClassLoader cl = (caller != null) ? caller.getClassLoader() : null;
+ if (cl == null)
+ cl = BootLoader.getLoader();
+ return cl;
+ }
+
/**
* Creates a new service loader for the given service type and class
@@ -463,7 +477,17 @@ public final class ServiceLoader<S>
public static <S> ServiceLoader<S> load(Class<S> service,
ClassLoader loader)
{
- return new ServiceLoader<>(service, loader);
+ ClassLoader cl;
+ // ## in module mode use the caller module's loader when null. This
+ // will be re-visited once the full support for services is in.
+ if ((BootLoader.getLoader() != null) &&
+ (loader == null || loader == ClassLoader.getSystemClassLoader()))
+ {
+ cl = callerLoader();
+ } else {
+ cl = loader;
+ }
+ return new ServiceLoader<>(service, cl);
}
/**
@@ -488,8 +512,13 @@ public final class ServiceLoader<S>
* @return A new service loader
*/
public static <S> ServiceLoader<S> load(Class<S> service) {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- return ServiceLoader.load(service, cl);
+ ClassLoader cl;
+ if (BootLoader.getLoader() != null) {
+ cl = callerLoader();
+ } else {
+ cl = Thread.currentThread().getContextClassLoader();
+ }
+ return new ServiceLoader<>(service, cl);
}
/**
@@ -517,13 +546,18 @@ public final class ServiceLoader<S>
* @return A new service loader
*/
public static <S> ServiceLoader<S> loadInstalled(Class<S> service) {
- ClassLoader cl = ClassLoader.getSystemClassLoader();
- ClassLoader prev = null;
- while (cl != null) {
- prev = cl;
- cl = cl.getParent();
+ if (BootLoader.getLoader() != null) {
+ // in module mode then use the caller's class loader
+ return new ServiceLoader<>(service, callerLoader());
+ } else {
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ ClassLoader prev = null;
+ while (cl != null) {
+ prev = cl;
+ cl = cl.getParent();
+ }
+ return new ServiceLoader<>(service, prev);
}
- return ServiceLoader.load(service, prev);
}
/**
diff --git a/jdk/src/share/classes/java/util/XMLUtils.java b/jdk/src/share/classes/java/util/XMLUtils.java
deleted file mode 100644
index 1666c63..0000000
--- a/jdk/src/share/classes/java/util/XMLUtils.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.util;
-
-import java.io.*;
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-import org.w3c.dom.*;
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.stream.*;
-
-/**
- * A class used to aid in Properties load and save in XML. Keeping this
- * code outside of Properties helps reduce the number of classes loaded
- * when Properties is loaded.
- *
- * @author Michael McCloskey
- * @since 1.3
- */
-class XMLUtils {
-
- // XML loading and saving methods for Properties
-
- // The required DTD URI for exported properties
- private static final String PROPS_DTD_URI =
- "http://java.sun.com/dtd/properties.dtd";
-
- private static final String PROPS_DTD =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<!-- DTD for properties -->" +
- "<!ELEMENT properties ( comment?, entry* ) >"+
- "<!ATTLIST properties" +
- " version CDATA #FIXED \"1.0\">" +
- "<!ELEMENT comment (#PCDATA) >" +
- "<!ELEMENT entry (#PCDATA) >" +
- "<!ATTLIST entry " +
- " key CDATA #REQUIRED>";
-
- /**
- * Version number for the format of exported properties files.
- */
- private static final String EXTERNAL_XML_VERSION = "1.0";
-
- static void load(Properties props, InputStream in)
- throws IOException, InvalidPropertiesFormatException
- {
- Document doc = null;
- try {
- doc = getLoadingDoc(in);
- } catch (SAXException saxe) {
- throw new InvalidPropertiesFormatException(saxe);
- }
- Element propertiesElement = (Element)doc.getChildNodes().item(1);
- String xmlVersion = propertiesElement.getAttribute("version");
- if (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0)
- throw new InvalidPropertiesFormatException(
- "Exported Properties file format version " + xmlVersion +
- " is not supported. This java installation can read" +
- " versions " + EXTERNAL_XML_VERSION + " or older. You" +
- " may need to install a newer version of JDK.");
- importProperties(props, propertiesElement);
- }
-
- static Document getLoadingDoc(InputStream in)
- throws SAXException, IOException
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setIgnoringElementContentWhitespace(true);
- dbf.setValidating(true);
- dbf.setCoalescing(true);
- dbf.setIgnoringComments(true);
- try {
- DocumentBuilder db = dbf.newDocumentBuilder();
- db.setEntityResolver(new Resolver());
- db.setErrorHandler(new EH());
- InputSource is = new InputSource(in);
- return db.parse(is);
- } catch (ParserConfigurationException x) {
- throw new Error(x);
- }
- }
-
- static void importProperties(Properties props, Element propertiesElement) {
- NodeList entries = propertiesElement.getChildNodes();
- int numEntries = entries.getLength();
- int start = numEntries > 0 &&
- entries.item(0).getNodeName().equals("comment") ? 1 : 0;
- for (int i=start; i<numEntries; i++) {
- Element entry = (Element)entries.item(i);
- if (entry.hasAttribute("key")) {
- Node n = entry.getFirstChild();
- String val = (n == null) ? "" : n.getNodeValue();
- props.setProperty(entry.getAttribute("key"), val);
- }
- }
- }
-
- static void save(Properties props, OutputStream os, String comment,
- String encoding)
- throws IOException
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = null;
- try {
- db = dbf.newDocumentBuilder();
- } catch (ParserConfigurationException pce) {
- assert(false);
- }
- Document doc = db.newDocument();
- Element properties = (Element)
- doc.appendChild(doc.createElement("properties"));
-
- if (comment != null) {
- Element comments = (Element)properties.appendChild(
- doc.createElement("comment"));
- comments.appendChild(doc.createTextNode(comment));
- }
-
- synchronized (props) {
- for (String key : props.stringPropertyNames()) {
- Element entry = (Element)properties.appendChild(
- doc.createElement("entry"));
- entry.setAttribute("key", key);
- entry.appendChild(doc.createTextNode(props.getProperty(key)));
- }
- }
- emitDocument(doc, os, encoding);
- }
-
- static void emitDocument(Document doc, OutputStream os, String encoding)
- throws IOException
- {
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer t = null;
- try {
- t = tf.newTransformer();
- t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, PROPS_DTD_URI);
- t.setOutputProperty(OutputKeys.INDENT, "yes");
- t.setOutputProperty(OutputKeys.METHOD, "xml");
- t.setOutputProperty(OutputKeys.ENCODING, encoding);
- } catch (TransformerConfigurationException tce) {
- assert(false);
- }
- DOMSource doms = new DOMSource(doc);
- StreamResult sr = new StreamResult(os);
- try {
- t.transform(doms, sr);
- } catch (TransformerException te) {
- IOException ioe = new IOException();
- ioe.initCause(te);
- throw ioe;
- }
- }
-
- private static class Resolver implements EntityResolver {
- public InputSource resolveEntity(String pid, String sid)
- throws SAXException
- {
- if (sid.equals(PROPS_DTD_URI)) {
- InputSource is;
- is = new InputSource(new StringReader(PROPS_DTD));
- is.setSystemId(PROPS_DTD_URI);
- return is;
- }
- throw new SAXException("Invalid system identifier: " + sid);
- }
- }
-
- private static class EH implements ErrorHandler {
- public void error(SAXParseException x) throws SAXException {
- throw x;
- }
- public void fatalError(SAXParseException x) throws SAXException {
- throw x;
- }
- public void warning(SAXParseException x) throws SAXException {
- throw x;
- }
- }
-
-}
diff --git a/jdk/src/share/classes/org/openjdk/jigsaw/ModuleFileFormat.java b/jdk/src/share/classes/org/openjdk/jigsaw/ModuleFileFormat.java
deleted file mode 100644
index 8e2005e..0000000
--- a/jdk/src/share/classes/org/openjdk/jigsaw/ModuleFileFormat.java
+++ /dev/null
@@ -1,1400 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package org.openjdk.jigsaw;
-
-import java.io.*;
-import java.math.BigInteger;
-import java.nio.*;
-import java.nio.channels.*;
-import java.nio.channels.FileChannel.MapMode;
-import java.nio.file.*;
-import java.security.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.zip.*;
-
-import static org.openjdk.jigsaw.FileConstants.*;
-
-public final class ModuleFileFormat {
-
- public static final int FILE_HEADER_LENGTH_WITHOUT_HASH = 30;
- public static final int SECTION_HEADER_LENGTH_WITHOUT_HASH = 12;
- public static final int FILE_HEADER_LENGTH
- = FILE_HEADER_LENGTH_WITHOUT_HASH + ModuleFile.HashType.SHA256.length();
- public static final int SECTION_HEADER_LENGTH
- = SECTION_HEADER_LENGTH_WITHOUT_HASH +
- ModuleFile.HashType.SHA256.length();
-
- /**
- * Return the subdir of a section in an extracted module file.
- */
- public static String getSubdirOfSection(ModuleFile.SectionType type) {
- switch (type) {
- case MODULE_INFO:
- case SIGNATURE:
- return ".";
- case CLASSES:
- case RESOURCES:
- return "classes";
- case NATIVE_LIBS:
- return "lib";
- case NATIVE_CMDS:
- return "bin";
- case CONFIG:
- return "etc";
- default:
- throw new AssertionError(type);
- }
- }
-
- public final static class Writer {
- private boolean fastestCompression;
- private File outfile;
- private File sourcedir;
- private ModuleFile.HashType hashtype;
- private long usize;
-
- private static class ByteArrayDataOutputStream
- extends ByteArrayOutputStream {
- public void writeTo(DataOutput out) throws IOException {
- out.write(buf, 0, count);
- }
- }
-
- public Writer (File outfile, File sourcedir) {
- this.outfile = outfile;
- hashtype = ModuleFile.HashType.SHA256;
- this.sourcedir = sourcedir;
- }
-
- /*
- * Generates an unsigned module file.
- */
- public void writeModule(File classes,
- File resources,
- File nativelibs,
- File nativecmds,
- File config)
- throws IOException {
-
- try (RandomAccessFile file = new RandomAccessFile(outfile, "rw")) {
-
- // Truncate the file if it already exists
- file.setLength(0);
-
- // Reset module file to right after module header
- file.seek(FILE_HEADER_LENGTH);
-
- // Write out the Module-Info Section
- File miclass = new File("module-info.class");
- writeSection(file, ModuleFile.SectionType.MODULE_INFO,
- miclass, ModuleFile.Compressor.NONE);
-
- long remainderStart = file.getFilePointer();
-
- // Write out the optional file sections
- writeOptionalSections(file, classes, resources,
- nativelibs, nativecmds, config);
-
- // Write out the module file header
- writeModuleFileHeader(file, remainderStart);
- }
- }
-
- public void writeSection(RandomAccessFile file,
- ModuleFile.SectionType type,
- File dir,
- ModuleFile.Compressor compressor)
- throws IOException {
-
- checkFileName(type, dir);
-
- // Start of section header
- final long start = file.getFilePointer();
- // Start of section content
- final long cstart = start + SECTION_HEADER_LENGTH;
- // Seek to start of section content
- file.seek(cstart);
-
- MessageDigest md = getHashInstance(hashtype);
-
- short count = writeFile(file, dir, compressor, type);
- // End of section
- final long end = file.getFilePointer();
- final int csize = (int) (end - cstart);
-
- // Reset module file to right after section header
- file.seek(cstart);
-
- // Compute hash of content
- FileChannel channel = file.getChannel();
- ByteBuffer content = ByteBuffer.allocate(csize);
- int n = channel.read(content, cstart);
- if (n != csize)
- throw new IOException("too few bytes read");
- content.position(0);
- md.update(content);
- final byte[] hash = md.digest();
-
- // A section type that only allows a single file
- // has a section count of 0.
- if (count > Short.MAX_VALUE)
- throw new IOException("Too many files: " + count);
-
- final short subsections = type.hasFiles() ? count : 0;
-
- // Write section header at section header start,
- // and seek to end of section.
- SectionHeader header =
- new SectionHeader(type, compressor, csize, subsections, hash);
- file.seek(start);
- header.write(file);
- file.seek(end);
- }
-
- public short writeFile(DataOutput out, File path,
- ModuleFile.Compressor compressor,
- ModuleFile.SectionType type)
- throws IOException {
-
- switch (compressor) {
- case NONE:
- boolean subsectionfileheader =
- type == ModuleFile.SectionType.MODULE_INFO ? false : true;
- writeUncompressedFile(out, path, subsectionfileheader);
- usize += path.length();
- return 1;
- case GZIP:
- short count = 0;
- sourcedir = path;
-
- if (!path.exists())
- throw new IOException("Path does not exist: " + path);
- if (!path.isDirectory())
- throw new IOException("Path is not a directory: " + path);
- if (!path.canRead())
- throw new IOException("Path can not be read: " + path);
- Queue<File> files =
- new LinkedList(Arrays.asList(path.listFiles()));
- if (files.isEmpty())
- throw new IOException("Path is empty: " + path);
-
- // System.out.println("Gzipping: " + path);
- while (!files.isEmpty()) {
- File file = files.remove();
- if (file.isDirectory()) {
- files.addAll(Arrays.asList(file.listFiles()));
- continue;
- }
- else {
- writeGZIPCompressedFile(out, file);
- ++count;
- usize += file.length();
- }
- }
- return count;
- case PACK200_GZIP:
- writeClasses(out, path);
- return 1;
- default:
- throw new IOException("Unsupported Compressor for files: " +
- compressor);
- }
- }
-
- public void writeClasses(DataOutput out, File dir)
- throws IOException {
-
- try (JarInputStream jis = jar(dir)) {
- copyStream(packAndGzip(jis), out);
- }
- }
-
- public void writeGZIPCompressedFile(DataOutput out,
- File path)
- throws IOException {
-
- File realpath = computeRealPath(path);
- String storedpath = computeStoredPath(realpath);
- // System.out.println("Gzipping " + realpath);
- ByteArrayDataOutputStream bados = new ByteArrayDataOutputStream();
- try (GZIPOutputStream gos = new GZIPOutputStream(bados);
- InputStream is = new FileInputStream(realpath);
- BufferedInputStream in = new BufferedInputStream(is)) {
- copyStream(in, gos);
- gos.finish();
- }
-
- final int csize = bados.size();
- SubSectionFileHeader header
- = new SubSectionFileHeader(csize, storedpath);
- header.write(out);
- bados.writeTo(out);
- }
-
- public void writeUncompressedFile(DataOutput out, File path,
- boolean writeheader)
- throws IOException {
-
- File realpath = computeRealPath(path);
- if (writeheader) {
- final long size = realpath.length();
- ensureValidFileSize(size, realpath);
- final int csize = (int) size;
- String storedpath = computeStoredPath(realpath);
-
- SubSectionFileHeader header
- = new SubSectionFileHeader(csize, storedpath);
- header.write(out);
- }
-
- try (InputStream is = new FileInputStream(realpath);
- BufferedInputStream in = new BufferedInputStream(is)) {
- copyStream(in, out);
- }
- }
-
- private static void checkFileName(ModuleFile.SectionType t,
- File file)
- throws IOException {
-
- final String MICLASS = "module-info.class";
-
- if (ModuleFile.SectionType.MODULE_INFO == t
- && ! file.toString().toLowerCase().endsWith(MICLASS))
- throw new IOException("Not a " + MICLASS + " file: " + file);
-
- if (ModuleFile.SectionType.CLASSES == t
- && ! file.isDirectory())
- throw new IOException("Not a directory: " + file);
- }
-
- private File computeRealPath(File path)
- throws IOException {
- String name = path.toString();
- if (name.startsWith(sourcedir.toString()))
- name = sourcedir.toPath().relativize(path.toPath()).toString();
- File realpath = resolveAndNormalize(sourcedir, name);
- if (realpath.isDirectory())
- throw new IOException("Directory instead of file: " + realpath);
- return realpath;
- }
-
- private String computeStoredPath(File file) throws IOException {
- // Path names are relative to an unspecifed installation directory.
- Path relativepath = (sourcedir != null?
- sourcedir.toPath().relativize(file.toPath())
- : file.toPath());
- // The '/' character separates nested directories in path names.
- String pathseparator = relativepath.getFileSystem().getSeparator();
- String stored = relativepath.toString().replace(pathseparator, "/");
- // System.out.println(sourcedir.toString() + " : " + file.toString() + "->" + stored);
- // The path names of native-code files
- // must not include more than one element.
- // ## Temporarily turn off this check until the location of
- // ## the native libraries in jdk modules are changed
- // ensureShortNativePath(file, stored);
- return stored;
- }
-
- private JarInputStream jar(File dir)
- throws IOException {
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (JarOutputStream jos = new JarOutputStream(baos)) {
- jos.setLevel(0);
- Queue<File> files
- = new LinkedList(Arrays.asList(dir.listFiles()));
-
- while (!files.isEmpty()) {
- File file = files.remove();
- if (file.isDirectory()) {
- files.addAll(Arrays.asList(file.listFiles()));
- continue;
- }
- else {
- String name = file.getName().toLowerCase();
- final String CLASS = ".class";
- final String MICLASS = "module-info.class";
- if (name.endsWith(CLASS) && !name.equals(MICLASS)) {
- String path = dir.toPath()
- .relativize(file.toPath()).toString();
- JarEntry entry = new JarEntry(path);
- jos.putNextEntry(entry);
- try (FileInputStream cfis
- = new FileInputStream(file)) {
- copyStream(cfis, jos);
- }
- jos.closeEntry();
- }
- usize += file.length();
- }
- }
- }
-
- byte[] jar = baos.toByteArray();
- ByteArrayInputStream bain = new ByteArrayInputStream(jar);
- return new JarInputStream(bain);
- }
-
- private InputStream packAndGzip(JarInputStream jar)
- throws IOException {
-
- Pack200.Packer packer = Pack200.newPacker();
- Map<String,String> p = packer.properties();
- p.put(Pack200.Packer.SEGMENT_LIMIT, "-1");
- if (fastestCompression)
- p.put(Pack200.Packer.EFFORT, "1");
- p.put(Pack200.Packer.KEEP_FILE_ORDER, Pack200.Packer.FALSE);
- p.put(Pack200.Packer.MODIFICATION_TIME, Pack200.Packer.LATEST);
- p.put(Pack200.Packer.DEFLATE_HINT, Pack200.Packer.FALSE);
- ByteArrayOutputStream gbaos = new ByteArrayOutputStream();
- try (GZIPOutputStream gout = new GZIPOutputStream(gbaos)) {
- packer.pack(jar, gout);
- }
- return new ByteArrayInputStream(gbaos.toByteArray());
- }
-
- /**
- * Favor compression speed over size of resulting file.
- */
- public void useFastestCompression(boolean fastest) {
- fastestCompression = fastest;
- }
-
- /*
- * Processes each of the optional file sections.
- */
- private void writeOptionalSections(RandomAccessFile file,
- File classes,
- File resources,
- File nativelibs,
- File nativecmds,
- File config)
- throws IOException {
-
- if (classes != null && directoryIsNotEmpty(classes)) {
- writeSection(file, ModuleFile.SectionType.CLASSES,
- classes, ModuleFile.Compressor.PACK200_GZIP);
- }
- if (resources != null && directoryIsNotEmpty(resources)) {
- writeSection(file, ModuleFile.SectionType.RESOURCES,
- resources, ModuleFile.Compressor.GZIP);
- }
- if (nativelibs != null && directoryIsNotEmpty(nativelibs)) {
- writeSection(file, ModuleFile.SectionType.NATIVE_LIBS,
- nativelibs, ModuleFile.Compressor.GZIP);
- }
- if (nativecmds != null && directoryIsNotEmpty(nativecmds)) {
- writeSection(file, ModuleFile.SectionType.NATIVE_CMDS,
- nativecmds, ModuleFile.Compressor.GZIP);
- }
- if (config != null && directoryIsNotEmpty(config)) {
- writeSection(file, ModuleFile.SectionType.CONFIG,
- config, ModuleFile.Compressor.GZIP);
- }
- }
-
- /*
- * Writes out the module file header.
- */
- private void writeModuleFileHeader(RandomAccessFile file,
- long remainderStart)
- throws IOException {
-
- long csize = file.length() - remainderStart;
-
- // Header Step 1
- // Write out the module file header (using a dummy file hash value)
- ModuleFileHeader header =
- new ModuleFileHeader(csize, usize, hashtype,
- new byte[hashtype.length()]);
- file.seek(0);
- header.write(file);
-
- // Generate the module file hash
- byte[] fileHash = generateFileHash(file);
-
- // Header Step 2
- // Write out the module file header (using correct file hash value)
- header = new ModuleFileHeader(csize, usize, hashtype, fileHash);
- file.seek(0);
- header.write(file);
- }
-
- /*
- * Generates the hash value for a module file.
- * Excludes itself (the hash bytes in the module file header).
- */
- private byte[] generateFileHash(RandomAccessFile file)
- throws IOException {
-
- MessageDigest md = getHashInstance(hashtype);
-
- long remainderSize = file.length() - FILE_HEADER_LENGTH;
- FileChannel channel = file.getChannel();
-
- // Module file header without the hash bytes
- ByteBuffer content
- = ByteBuffer.allocate(FILE_HEADER_LENGTH_WITHOUT_HASH);
- int n = channel.read(content, 0);
- if (n != FILE_HEADER_LENGTH_WITHOUT_HASH)
- throw new IOException("too few bytes read");
- content.position(0);
- md.update(content);
-
- // Remainder of file (read in chunks)
- content = ByteBuffer.allocate(8192);
- channel.position(FILE_HEADER_LENGTH);
- n = channel.read(content);
- while (n != -1) {
- content.limit(n);
- content.position(0);
- md.update(content);
- content = ByteBuffer.allocate(8192);
- n = channel.read(content);
- }
-
- return md.digest();
- }
- }
-
- public final static class Reader implements Closeable {
-
- private DataInputStream stream;
- private File destination;
- private ModuleFile.HashType hashtype;
-
- private static class CountingInputStream extends FilterInputStream {
- int count;
- public CountingInputStream(InputStream stream, int count) {
- super(stream);
- this.count = count;
- }
-
- public int available() throws IOException {
- return count;
- }
-
- public boolean markSupported() {
- return false;
- }
-
- public int read() throws IOException {
- if (count == 0)
- return -1;
- int read = super.read();
- if (-1 != read)
- count--;
- return read;
- }
-
- public int read(byte[] b, int off, int len) throws IOException {
- if (count == 0)
- return -1;
- len = Math.min(len, count);
- int read = super.read(b, off, len);
- if (-1 != read)
- count-=read;
- return read;
- }
-
- public void reset() throws IOException {
- throw new IOException("Can't reset this stream");
- }
-
- public long skip(long n) throws IOException {
- if (count == 0)
- return -1;
- n = Math.min(n, count);
- long skipped = super.skip(n);
- if (n > 0)
- count-=skipped;
- return skipped;
- }
- }
-
- public Reader(DataInputStream stream) {
- hashtype = ModuleFile.HashType.SHA256;
- // Ensure that mark/reset is supported
- if (stream.markSupported()) {
- this.stream = stream;
- } else {
- this.stream =
- new DataInputStream(new BufferedInputStream(stream));
- }
- }
-
- private void checkHashMatch(byte[] expected, byte[] computed)
- throws IOException {
- if (!MessageDigest.isEqual(expected, computed))
- throw new IOException("Expected hash "
- + hashHexString(expected)
- + " instead of "
- + hashHexString(computed));
- }
-
- private ModuleFileHeader fileHeader = null;
- private MessageDigest fileDigest = null;
- private MessageDigest sectionDigest = null;
- private DataInputStream fileIn = null;
- private byte[] moduleInfoBytes = null;
- private Integer moduleSignatureType = null;
- private byte[] moduleSignatureBytes = null;
- private final int MAX_SECTION_HEADER_LENGTH = 128;
- private List<byte[]> calculatedHashes = new ArrayList<>();
- private boolean extract = true;
-
- /*
- * Reads the MODULE_INFO section and the Signature section, if present,
- * but does not write any files.
- */
- public byte[] readStart() throws IOException {
-
- try {
- fileDigest = getHashInstance(hashtype);
- sectionDigest = getHashInstance(hashtype);
- DigestInputStream dis =
- new DigestInputStream(stream, fileDigest);
- fileHeader = ModuleFileHeader.read(dis);
- // calculate module header hash
- sectionDigest.update(fileHeader.toByteArray());
- calculatedHashes.add(sectionDigest.digest());
-
- fileIn = new DataInputStream(dis);
- if (readSection(fileIn) != ModuleFile.SectionType.MODULE_INFO)
- throw new IOException("First module-file section"
- + " is not MODULE_INFO");
- assert moduleInfoBytes != null;
-
- // Read the Signature Section, if present
- readSignatureSection(fileIn, dis);
-
- return moduleInfoBytes.clone();
- } catch (IOException x) {
- close();
- throw x;
- }
- }
-
- public void readRest() throws IOException {
- extract = false;
- readRest(null);
- }
-
- public void readRest(File dst) throws IOException {
-
- destination = dst;
- try {
- if (extract)
- Files.store(moduleInfoBytes, computeRealPath("info"));
- // Module-Info and Signature, if present, have been consumed
-
- // Read rest of file until all sections have been read
- stream.mark(1);
- while (-1 != stream.read()) {
- stream.reset();
- readSection(fileIn);
- stream.mark(1);
- }
-
- close();
- byte[] fileHeaderHash = fileHeader.getHashNoClone();
- checkHashMatch(fileHeaderHash, fileDigest.digest());
- calculatedHashes.add(fileHeaderHash);
- } finally {
- close();
- }
- }
-
- public byte[] getHash() throws IOException {
- if (null == fileHeader)
- readStart();
- return fileHeader.getHash();
- }
-
- public List<byte[]> getCalculatedHashes() {
- return calculatedHashes;
- }
-
- public boolean hasSignature() throws IOException {
- if (null == fileHeader)
- readStart();
- return moduleSignatureBytes != null;
- }
-
- public Integer getSignatureType() throws IOException {
- if (null == fileHeader)
- readStart();
- return moduleSignatureType;
- }
-
- public byte[] getSignature() throws IOException {
- if (null == fileHeader)
- readStart();
- return moduleSignatureBytes != null
- ? moduleSignatureBytes.clone()
- : null;
- }
-
- byte[] getSignatureNoClone() {
- return moduleSignatureBytes;
- }
-
- private JarOutputStream contentStream = null;
-
- private JarOutputStream contentStream() throws IOException {
- if (contentStream == null) {
- if (extract) {
- FileOutputStream fos
- = new FileOutputStream(computeRealPath("classes"));
- contentStream
- = new JarOutputStream(new BufferedOutputStream(fos));
- } else {
- contentStream = new JarOutputStream(new NullOutputStream());
- }
- }
- return contentStream;
- }
-
- public void close() throws IOException {
- try {
- if (contentStream != null) {
- contentStream.close();
- contentStream = null;
- }
- } finally {
- if (fileIn != null) {
- fileIn.close();
- fileIn = null;
- }
- }
- }
-
- public void readModule() throws IOException {
- extract = false;
- readStart();
- readRest();
- }
-
- public void readModule(File dst) throws IOException {
- readStart();
- readRest(dst);
- }
-
- private void readSignatureSection(DataInputStream stream,
- DigestInputStream dis)
- throws IOException {
-
- // Turn off digest computation before reading Signature Section
- dis.on(false);
-
- // Mark the starting position
- stream.mark(MAX_SECTION_HEADER_LENGTH);
- SectionHeader header = SectionHeader.read(stream);
- if (header != null &&
- header.getType() == ModuleFile.SectionType.SIGNATURE) {
- readSectionContent(header, stream);
- } else {
- // Revert back to the starting position
- stream.reset();
- }
-
- // Turn on digest computation again
- dis.on(true);
- }
-
- private ModuleFile.SectionType readSection(DataInputStream stream)
- throws IOException {
-
- SectionHeader header = SectionHeader.read(stream);
- readSectionContent(header, stream);
- return header.getType();
- }
-
- private void readSectionContent(SectionHeader header,
- DataInputStream stream)
- throws IOException {
-
- ModuleFile.SectionType type = header.getType();
- ModuleFile.Compressor compressor = header.getCompressor();
- int csize = header.getCSize();
- short subsections =
- type.hasFiles() ? header.getSubsections() : 1;
-
- CountingInputStream cs = new CountingInputStream(stream, csize);
- sectionDigest.reset();
- DigestInputStream dis = new DigestInputStream(cs, sectionDigest);
- DataInputStream in = new DataInputStream(dis);
-
- for (int subsection = 0; subsection < subsections; subsection++)
- readFile(in, compressor, type, csize);
-
- byte[] headerHash = header.getHashNoClone();
- checkHashMatch(headerHash, sectionDigest.digest());
- if (header.getType() != ModuleFile.SectionType.SIGNATURE) {
- calculatedHashes.add(headerHash);
- }
- }
-
- public void readFile(DataInputStream in,
- ModuleFile.Compressor compressor,
- ModuleFile.SectionType type,
- int csize)
- throws IOException {
-
- switch (compressor) {
- case NONE:
- if (type == ModuleFile.SectionType.MODULE_INFO) {
- moduleInfoBytes = readModuleInfo(in, csize);
-
- } else if (type == ModuleFile.SectionType.SIGNATURE) {
- // Examine the Signature header
- moduleSignatureType = (int)in.readShort();
- int length = in.readInt();
- moduleSignatureBytes = readModuleSignature(in, csize - 6);
- if (length != moduleSignatureBytes.length) {
- throw new IOException("Invalid Signature length");
- }
- } else {
- readUncompressedFile(in, type, csize);
- }
- break;
- case GZIP:
- readGZIPCompressedFile(in, type);
- break;
- case PACK200_GZIP:
- readClasses(
- new DataInputStream(new CountingInputStream(in, csize)));
- break;
- default:
- throw new IOException("Unsupported Compressor for files: " +
- compressor);
- }
- }
-
- public void readClasses(DataInputStream in) throws IOException {
- unpack200gzip(in);
- }
-
- private File currentPath = null;
-
- private OutputStream openOutputStream(ModuleFile.SectionType type,
- String path)
- throws IOException
- {
- if (!extract)
- return new NullOutputStream();
- currentPath = null;
- assert type != ModuleFile.SectionType.CLASSES;
- if (type == ModuleFile.SectionType.RESOURCES)
- return Files.newOutputStream(contentStream(), path);
- currentPath = computeRealPath(type, path);
- File parent = currentPath.getParentFile();
- if (!parent.exists())
- Files.mkdirs(parent, currentPath.getName());
- return new BufferedOutputStream(new FileOutputStream(currentPath));
- }
-
- private static class NullOutputStream extends OutputStream {
- @Override
- public void write(int b) throws IOException {}
- @Override
- public void write(byte[] b) throws IOException {}
- @Override
- public void write(byte[] b, int off, int len) throws IOException {}
- }
-
- public void readGZIPCompressedFile(DataInputStream in,
- ModuleFile.SectionType type)
- throws IOException {
-
- SubSectionFileHeader header = SubSectionFileHeader.read(in);
- int csize = header.getCSize();
-
- // Splice off the compressed file from input stream
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- copyStream(new CountingInputStream(in, csize), baos, csize);
-
- byte[] compressedfile = baos.toByteArray();
- ByteArrayInputStream bain
- = new ByteArrayInputStream(compressedfile);
- try (GZIPInputStream gin = new GZIPInputStream(bain);
- OutputStream out = openOutputStream(type, header.getPath())) {
- copyStream(gin, out);
- }
-
- if (extract)
- markNativeCodeExecutable(type, currentPath);
- }
-
- public void readUncompressedFile(DataInputStream in,
- ModuleFile.SectionType type,
- int csize)
- throws IOException
- {
- assert type != ModuleFile.SectionType.MODULE_INFO;
- SubSectionFileHeader header = SubSectionFileHeader.read(in);
- csize = header.getCSize();
- try (OutputStream out = openOutputStream(type, header.getPath())) {
- CountingInputStream cin = new CountingInputStream(in, csize);
- byte[] buf = new byte[8192];
- int n;
- while ((n = cin.read(buf)) >= 0)
- out.write(buf, 0, n);
- }
- markNativeCodeExecutable(type, currentPath);
- }
-
- public byte[] readModuleInfo(DataInputStream in, int csize)
- throws IOException
- {
- CountingInputStream cin = new CountingInputStream(in, csize);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- byte[] buf = new byte[8192];
- int n;
- while ((n = cin.read(buf)) >= 0)
- out.write(buf, 0, n);
- return out.toByteArray();
- }
-
- public byte[] readModuleSignature(DataInputStream in, int csize)
- throws IOException
- {
- return readModuleInfo(in, csize); // signature has the same format
- }
-
- private File computeRealPath(String storedpath) throws IOException {
-
- String convertedpath = storedpath.replace('/', File.separatorChar);
- File path = new File(convertedpath);
-
- // Absolute path names are not permitted.
- ensureNonAbsolute(path);
- path = resolveAndNormalize(destination, convertedpath);
- // Create the parent directories if necessary
- File parent = path.getParentFile();
- if (!parent.exists())
- Files.mkdirs(parent, path.getName());
-
- return path;
- }
-
- private File computeRealPath(ModuleFile.SectionType type,
- String storedpath)
- throws IOException
- {
- String dir = getSubdirOfSection(type);
- return computeRealPath(dir + File.separatorChar + storedpath);
- }
-
- private static void markNativeCodeExecutable(ModuleFile.SectionType type,
- File file)
- {
- if (type == ModuleFile.SectionType.NATIVE_CMDS
- || (type == ModuleFile.SectionType.NATIVE_LIBS
- && System.getProperty("os.name").startsWith("Windows")))
- {
- file.setExecutable(true);
- }
- }
-
- private void unpack200gzip(DataInputStream in) throws IOException {
- GZIPInputStream gis = new GZIPInputStream(in) {
- public void close() throws IOException {}
- };
- Pack200.Unpacker unpacker = Pack200.newUnpacker();
- unpacker.unpack(gis, contentStream());
- }
-
- }
-
- private static void checkCompressor(ModuleFile.SectionType type,
- ModuleFile.Compressor compressor)
- throws IllegalArgumentException {
-
- if ((ModuleFile.SectionType.MODULE_INFO == type &&
- ModuleFile.Compressor.NONE != compressor)
- || (ModuleFile.SectionType.CLASSES == type &&
- ModuleFile.Compressor.PACK200_GZIP != compressor))
- throw new IllegalArgumentException(type
- + " may not use compressor "
- + compressor);
- }
-
- private static void checkSubsectionCount(ModuleFile.SectionType type,
- short subsections)
- throws IllegalArgumentException {
-
- if (!type.hasFiles() && subsections != 0)
- throw new IllegalArgumentException(type
- + " subsection count not 0: "
- + subsections);
- else if (type.hasFiles() && subsections == 0)
- throw new IllegalArgumentException(type + " subsection count is 0");
- }
-
- private static void copyStream(InputStream in, DataOutput out)
- throws IOException {
-
- byte[] buffer = new byte[1024 * 8];
- for (int b_read = in.read(buffer);
- -1 != b_read;
- b_read = in.read(buffer))
- out.write(buffer, 0, b_read);
- }
-
- private static void copyStream(InputStream in, OutputStream out)
- throws IOException {
- copyStream(in, (DataOutput) new DataOutputStream(out));
- }
-
- private static void copyStream(InputStream in, DataOutput out,
- int count)
- throws IOException {
-
- byte[] buffer = new byte[1024 * 8];
-
- while(count > 0) {
- int b_read = in.read(buffer, 0, Math.min(count, buffer.length));
- if (-1 == b_read)
- return;
- out.write(buffer, 0, b_read);
- count-=b_read;
- }
- }
-
- private static void copyStream(InputStream in, OutputStream out,
- int count)
- throws IOException{
- copyStream(in, (DataOutput) new DataOutputStream(out), count);
- }
-
- /*
- * Check if a given directory is not empty.
- */
- private static boolean directoryIsNotEmpty(File dir)
- throws IOException {
- try (DirectoryStream<Path> ds =
- java.nio.file.Files.newDirectoryStream(dir.toPath())) {
- return ds.iterator().hasNext();
- }
- }
-
- private static void ensureNonAbsolute(File path) throws IOException {
- if (path.isAbsolute())
- throw new IOException("Abolute path instead of relative: " + path);
- }
-
- private static void ensureNonNegativity(long size, String parameter)
- throws IllegalArgumentException {
-
- if (size < 0)
- throw new IllegalArgumentException(parameter + "<0: " + size);
- }
-
- private static void ensureNonNull(Object reference, String parameter)
- throws IllegalArgumentException {
-
- if (null == reference)
- throw new IllegalArgumentException(parameter + " == null");
- }
-
- private static void ensureMatch(int found, int expected, String field)
- throws IOException {
-
- if (found != expected)
- throw new IOException(field + " expected : "
- + Integer.toHexString(expected) + " found: "
- + Integer.toHexString(found));
- }
-
- private static void ensureShortNativePath(File path, String name)
- throws IOException {
- // TODO: check for native code file in a stricter way
- if (path.canExecute()
- && name.indexOf('/') != -1)
- throw new IOException("Native code path too long: " + path);
- }
-
- private static void ensureValidFileSize(long size, File path)
- throws IOException {
-
- if (size < 0 || size > Integer.MAX_VALUE)
- throw new IOException("File " + path + " too large: " + size);
- }
-
- private static MessageDigest getHashInstance(ModuleFile.HashType hashtype)
- throws IOException {
-
- try {
- switch(hashtype) {
- case SHA256:
- return MessageDigest.getInstance("SHA-256");
- default:
- throw new IOException("Unknown hash type: " + hashtype);
- }
- }
- catch (NoSuchAlgorithmException ex) {
- throw (IOException) (new IOException(hashtype + " not found"))
- .initCause(ex);
- }
- }
-
- private static short getMUTF8Length(String name) {
- short size = 2;
-
- for (int i = name.length()-1; i >= 0; i--) {
- char ch = name.charAt(i);
-
- if ('\u0001' <= ch && ch <= '\u007F')
- size += 1;
- else if ('\u0000' == ch
- || '\u0080' <= ch && ch <= '\u07FF')
- size += 2;
- else
- size += 3;
- }
-
- return size;
- }
-
- private static String hashHexString(byte[] hash) {
- StringBuilder hex = new StringBuilder("0x");
- for (int i = 0; i < hash.length; i++) {
- int val = (hash[i] & 0xFF);
- if (val <= 16)
- hex.append("0");
- hex.append(Integer.toHexString(val));
- }
- return hex.toString();
- }
-
- private static File resolveAndNormalize(File directory, String path)
- throws IOException {
-
- File realpath = new File(directory, path);
- if (directory != null &&
- ! realpath.toPath().startsWith(directory.toPath()))
- throw new IOException("Bogus relative path: " + path);
-
- return realpath;
- }
-
- private static void writeHash(DataOutput out, byte[] hash)
- throws IOException {
-
- out.writeShort(hash.length);
- out.write(hash);
- }
-
- private static short readHashLength(DataInputStream in) throws IOException {
- final short hashLength = in.readShort();
- ensureNonNegativity(hashLength, "hashLength");
-
- return hashLength;
- }
-
- private static byte[] readHashBytes(DataInputStream in, short hashLength)
- throws IOException {
-
- final byte[] hash = new byte[hashLength];
- in.readFully(hash);
-
- return hash;
- }
-
- private static byte[] readHash(DataInputStream in) throws IOException {
- return readHashBytes(in, readHashLength(in));
- }
-
- private static byte[] readFileHash(DigestInputStream dis)
- throws IOException {
-
- DataInputStream in = new DataInputStream(dis);
-
- final short hashLength = readHashLength(in);
-
- // Turn digest computation off before reading the file hash
- dis.on(false);
- byte[] hash = readHashBytes(in, hashLength);
- // Turn digest computation on again afterwards.
- dis.on(true);
-
- return hash;
- }
-
- public final static class ModuleFileHeader {
- // Fields are specified as unsigned. Treat signed values as bugs.
- int magic; // MAGIC
- Type type; // Type.MODULE_FILE
- short major; // ModuleFile.MAJOR_VERSION
- short minor; // ModuleFile.MINOR_VERSION
- long csize; // Size of rest of file, compressed
- long usize; // Space required for uncompressed contents
- // (upper bound; need not be exact)
- ModuleFile.HashType hashType;// One of ModuleFile.HashType
- // (applies to all hashes in this file)
- byte[] hash; // Hash of entire file (except this hash
- // and the Signature section, if present)
-
- public String toString() {
- return "MODULE{csize=" + csize
- + ", hash=" + hashHexString(hash) + "}";
- }
-
- public byte[] getHash() {
- return (byte[]) hash.clone();
- }
-
- private byte[] getHashNoClone() {
- return hash;
- }
-
- public ModuleFileHeader(long csize, long usize,
- ModuleFile.HashType hashType, byte[] hash)
- throws IllegalArgumentException {
-
- ensureNonNegativity(csize, "csize");
- ensureNonNegativity(usize, "usize");
-
- magic = MAGIC;
- type = Type.MODULE_FILE;
- major = ModuleFile.MAJOR_VERSION;
- minor = ModuleFile.MINOR_VERSION;
-
- this.csize = csize;
- this.usize = usize;
- this.hashType = hashType;
- this.hash = (byte[]) hash.clone();
- }
-
- public void write(final DataOutput out) throws IOException {
-
- out.writeInt(magic);
- out.writeShort(type.value());
- out.writeShort(major);
- out.writeShort(minor);
- out.writeLong(csize);
- out.writeLong(usize);
- out.writeShort(hashType.value());
- writeHash(out, hash);
- }
-
- private static ModuleFile.HashType lookupHashType(short value)
- throws IllegalArgumentException {
-
- for (ModuleFile.HashType i :
- ModuleFile.HashType.class.getEnumConstants())
- if (i.value() == value) return i;
-
- throw new IllegalArgumentException("No HashType exists with value "
- + value);
- }
-
- public static ModuleFileHeader read(final DigestInputStream dis)
- throws IOException {
- DataInputStream in = new DataInputStream(dis);
-
- final int magic = in.readInt();
- ensureMatch(magic, MAGIC, "MAGIC");
-
- final short type = in.readShort();
- ensureMatch(type, Type.MODULE_FILE.value(),
- "Type.MODULE_FILE");
-
- final short major = in.readShort();
- ensureMatch(major, ModuleFile.MAJOR_VERSION,
- "ModuleFile.MAJOR_VERSION");
-
- final short minor = in.readShort();
- ensureMatch(minor, ModuleFile.MINOR_VERSION,
- "ModuleFile.MINOR_VERSION");
-
- final long csize = in.readLong();
- final long usize = in.readLong();
- final short hashTypeValue = in.readShort();
- ModuleFile.HashType hashType = lookupHashType(hashTypeValue);
- final byte[] hash = readFileHash(dis);
-
- return new ModuleFileHeader(csize, usize, hashType, hash);
- }
-
- private byte[] toByteArray() throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- write(new DataOutputStream(baos));
-
- return baos.toByteArray();
- }
- }
-
- public final static class SectionHeader {
- // Fields are specified as unsigned. Treat signed values as bugs.
- private ModuleFile.SectionType type;
- private ModuleFile.Compressor compressor;
- private int csize; // Size of section content, compressed
- private short subsections; // Number of following subsections
- private byte[] hash; // Hash of section content
-
- public SectionHeader(ModuleFile.SectionType type,
- ModuleFile.Compressor compressor,
- int csize, short subsections, byte[] hash) {
- ensureNonNull(type, "type");
- ensureNonNull(compressor, "compressor");
- ensureNonNegativity(csize, "csize");
- ensureNonNegativity(subsections, "subsections");
- ensureNonNull(hash, "hash");
- checkSubsectionCount(type, subsections);
- checkCompressor(type, compressor);
-
-
- this.type = type;
- this.compressor = compressor;
- this.csize = csize;
- this.subsections = subsections;
- this.hash = (byte[]) hash.clone();
- }
-
- public void write(DataOutput out) throws IOException {
- out.writeShort(type.value());
- out.writeShort(compressor.value());
- out.writeInt(csize);
- out.writeShort(subsections);
- writeHash(out, hash);
- }
-
- private static ModuleFile.SectionType lookupSectionType(short value)
- throws IllegalArgumentException {
-
- for (ModuleFile.SectionType i :
- ModuleFile.SectionType.class.getEnumConstants())
- if (i.value() == value) return i;
-
- throw new
- IllegalArgumentException("No SectionType exists with value "
- + value);
- }
-
- private static ModuleFile.Compressor lookupCompressor(short value)
- throws IllegalArgumentException {
-
- for (ModuleFile.Compressor i :
- ModuleFile.Compressor.class.getEnumConstants())
- if (i.value() == value) return i;
-
- throw new
- IllegalArgumentException("No Compressor exists with value "
- + value);
- }
-
- public static SectionHeader read(DataInputStream in)
- throws IOException {
-
- short tvalue = in.readShort();
- final ModuleFile.SectionType type = lookupSectionType(tvalue);
- short cvalue = in.readShort();
- final ModuleFile.Compressor compressor =
- lookupCompressor(cvalue);
- final int csize = in.readInt();
- final short sections = in.readShort();
- final byte[] hash = readHash(in);
-
- return new SectionHeader(type, compressor, csize,
- sections, hash);
- }
-
- public ModuleFile.SectionType getType() {
- return type;
- }
-
- public ModuleFile.Compressor getCompressor() {
- return compressor;
- }
-
- public int getCSize() {
- return csize;
- }
-
- public short getSubsections() {
- return subsections;
- }
-
- public byte[] getHash() {
- return (byte[]) hash.clone();
- }
-
- private byte[] getHashNoClone() {
- return hash;
- }
-
- public String toString() {
- return "SectionHeader{type= " + getType()
- + ", compressor=" + getCompressor()
- + ", csize=" + getCSize()
- + ", subsections=" + getSubsections()
- + ", hash=" + hashHexString(hash) + "}";
- }
- }
-
- public final static class SubSectionFileHeader {
- private int csize; // Size of file, compressed
- private String path; // Path name, in Java-modified UTF-8
-
- public int getCSize() {
- return csize;
- }
-
- public String getPath() {
- return path;
- }
-
- public SubSectionFileHeader(int csize, String path) {
- ensureNonNegativity(csize, "csize");
- ensureNonNull(path, "path");
-
- this.csize = csize;
- this.path = path;
- }
-
- public void write(DataOutput out) throws IOException {
- out.writeShort(ModuleFile.SubSectionType.FILE.value());
- out.writeInt(csize);
- out.writeUTF(path);
- }
-
- public static SubSectionFileHeader read(DataInputStream in)
- throws IOException {
-
- final short type = in.readShort();
- ensureMatch(type, ModuleFile.SubSectionType.FILE.value(),
- "ModuleFile.SubSectionType.FILE");
- final int csize = in.readInt();
- final String path = in.readUTF();
-
- return new SubSectionFileHeader(csize, path);
- }
- }
-}
diff --git a/jdk/src/share/classes/sun/awt/FocusingTextField.java b/jdk/src/share/classes/sun/awt/FocusingTextField.java
deleted file mode 100644
index efd65a8..0000000
--- a/jdk/src/share/classes/sun/awt/FocusingTextField.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-
-/**
- * FocusingTextField: a subclass of java.awt.TextField that handles moving the
- * input focus from field to field, as when the user hits 'return.'
- *
- * @author Herb Jellinek
- */
-
-public class FocusingTextField extends TextField {
-
- /** The field to move to on 'return' - can be null. */
- TextField next;
-
- /** If true, select the contents of the field when it gets the focus. */
- boolean willSelect;
-
- /**
- * Create a FocusingTextField.
- * @param cols number of columns of text.
- */
- public FocusingTextField(int cols) {
- super("", cols);
- }
-
- /**
- * Create a FocusingTextField.
- * @param cols number of columns of text.
- * @param willSelect if true, will select all contents of field when
- * focus is gained.
- */
- public FocusingTextField(int cols, boolean willSelect) {
- this(cols);
- this.willSelect = willSelect;
- }
-
- public void setWillSelect(boolean will) {
- willSelect = will;
- }
-
- public boolean getWillSelect() {
- return willSelect;
- }
-
- /**
- * Call this to set the next field to receive the input focus.
- * @param next the next TextField in order - can be null.
- */
- public void setNextField(TextField next) {
- this.next = next;
- }
-
- /**
- * We got the focus. If willSelect is true, select everything.
- */
- public boolean gotFocus(Event e, Object arg) {
- if (willSelect) {
- select(0, getText().length());
- }
- return true;
- }
-
- /**
- * We lost the focus. If willSelect is true, deselect everything.
- */
- public boolean lostFocus(Event e, Object arg) {
- if (willSelect) {
- select(0, 0);
- }
- return true;
- }
-
- /**
- * Pass the focus to the next guy, if any.
- */
- public void nextFocus() {
- if (next != null) {
- next.requestFocus();
- }
- super.nextFocus();
- }
-}
diff --git a/jdk/src/share/classes/sun/awt/HorizBagLayout.java b/jdk/src/share/classes/sun/awt/HorizBagLayout.java
deleted file mode 100644
index 364d00b..0000000
--- a/jdk/src/share/classes/sun/awt/HorizBagLayout.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-
-/**
- * A horizontal 'bag' of Components. Allocates space for each Component
- * from left to right.
- *
- * @author Herb Jellinek
- */
-public class HorizBagLayout implements LayoutManager {
-
- int hgap;
-
- /**
- * Constructs a new HorizBagLayout.
- */
- public HorizBagLayout() {
- this(0);
- }
-
- /**
- * Constructs a HorizBagLayout with the specified gaps.
- * @param hgap the horizontal gap
- */
- public HorizBagLayout(int hgap) {
- this.hgap = hgap;
- }
-
- /**
- * Adds the specified named component to the layout.
- * @param name the String name
- * @param comp the component to be added
- */
- public void addLayoutComponent(String name, Component comp) {
- }
-
- /**
- * Removes the specified component from the layout.
- * @param comp the component to be removed
- */
- public void removeLayoutComponent(Component comp) {
- }
-
- /**
- * Returns the minimum dimensions needed to lay out the components
- * contained in the specified target container.
- * @param target the Container on which to do the layout
- * @see Container
- * @see #preferredLayoutSize
- */
- public Dimension minimumLayoutSize(Container target) {
- Dimension dim = new Dimension();
-
- for (int i = 0; i < target.countComponents(); i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- Dimension d = comp.minimumSize();
- dim.width += d.width + hgap;
- dim.height = Math.max(d.height, dim.height);
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right;
- dim.height += insets.top + insets.bottom;
-
- return dim;
- }
-
- /**
- * Returns the preferred dimensions for this layout given the components
- * in the specified target container.
- * @param target the component which needs to be laid out
- * @see Container
- * @see #minimumLayoutSize
- */
- public Dimension preferredLayoutSize(Container target) {
- Dimension dim = new Dimension();
-
- for (int i = 0; i < target.countComponents(); i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- Dimension d = comp.preferredSize();
- dim.width += d.width + hgap;
- dim.height = Math.max(dim.height, d.height);
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right;
- dim.height += insets.top + insets.bottom;
-
- return dim;
- }
-
- /**
- * Lays out the specified container. This method will actually reshape the
- * components in the specified target container in order to satisfy the
- * constraints of the HorizBagLayout object.
- * @param target the component being laid out
- * @see Container
- */
- public void layoutContainer(Container target) {
- Insets insets = target.insets();
- int top = insets.top;
- int bottom = target.size().height - insets.bottom;
- int left = insets.left;
- int right = target.size().width - insets.right;
-
- for (int i = 0; i < target.countComponents(); i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- int compWidth = comp.size().width;
- comp.resize(compWidth, bottom - top);
- Dimension d = comp.preferredSize();
- comp.reshape(left, top, d.width, bottom - top);
- left += d.width + hgap;
- }
- }
- }
-
- /**
- * Returns the String representation of this HorizBagLayout's values.
- */
- public String toString() {
- return getClass().getName() + "[hgap=" + hgap + "]";
- }
-}
diff --git a/jdk/src/share/classes/sun/awt/OrientableFlowLayout.java b/jdk/src/share/classes/sun/awt/OrientableFlowLayout.java
deleted file mode 100644
index 4b0a211..0000000
--- a/jdk/src/share/classes/sun/awt/OrientableFlowLayout.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.awt;
-
-import java.awt.*;
-
-/**
- * Extends the FlowLayout class to support both vertical and horizontal
- * layout of components. Orientation can be changed dynamically after
- * creation by calling either of the methods @method orientHorizontally or
- * @method orientVertically. Separate values for alignment, vertical gap,
- * and horizontal gap can be specified for horizontal and vertical
- * orientation.
- *
- * @author Terry Cline
- */
-public class OrientableFlowLayout extends FlowLayout {
- /**
- * The horizontal orientation constant.
- */
- public static final int HORIZONTAL = 0;
-
- /**
- * The vertical orientation constant.
- */
- public static final int VERTICAL = 1;
-
- /**
- * The top vertical alignment constant.
- */
- public static final int TOP = 0;
-
- /**
- * The bottom vertical alignment constant.
- */
- public static final int BOTTOM = 2; // CENTER == 1
-
- int orientation;
- int vAlign;
- int vHGap;
- int vVGap;
-
- /**
- * Constructs a new flow layout with a horizontal orientation and
- * centered alignment.
- */
- public OrientableFlowLayout() {
- this(HORIZONTAL, CENTER, CENTER, 5, 5, 5, 5);
- }
-
- /**
- * Constructs a new flow layout with the specified orientation and
- * a centered alignment.
- *
- * @param orientation the orientation, one of HORIZONTAL or VERTICAL.
- */
- public OrientableFlowLayout(int orientation) {
- this(orientation, CENTER, CENTER, 5, 5, 5, 5);
- }
-
- /**
- * Constructs a new flow layout with the specified orientation and
- * alignment.
- *
- * @param orientation the orientation, one of HORIZONTAL or VERTICAL.
- * @param hAlign the horizontal alignment, one of LEFT, CENTER, or RIGHT.
- * @param vAlign the vertical alignment, one of TOP, CENTER, or BOTTOM.
- */
- public OrientableFlowLayout(int orientation, int hAlign, int vAlign) {
- this(orientation, hAlign, vAlign, 5, 5, 5, 5);
- }
-
- /**
- * Constructs a new flow layout with the specified orientation,
- * alignment, and gap values.
- *
- * @param orientation the orientation, one of HORIZONTAL or VERTICAL.
- * @param hAlign the horizontal alignment, one of LEFT, CENTER, or RIGHT.
- * @param vAlign the vertical alignment, one of TOP, CENTER, or BOTTOM.
- * @param hHGap the horizontal gap between components in HORIZONTAL.
- * @param hVGap the vertical gap between components in HORIZONTAL.
- * @param vHGap the horizontal gap between components in VERTICAL.
- * @param vVGap the vertical gap between components in VERTICAL.
- */
- public OrientableFlowLayout(int orientation, int hAlign, int vAlign, int hHGap, int hVGap, int vHGap, int vVGap) {
- super(hAlign, hHGap, hVGap);
- this.orientation = orientation;
- this.vAlign = vAlign;
- this.vHGap = vHGap;
- this.vVGap = vVGap;
- }
-
- /**
- * Set the layout's current orientation to horizontal.
- */
- public synchronized void orientHorizontally() {
- orientation = HORIZONTAL;
- }
-
- /**
- * Set the layout's current orientation to vertical.
- */
- public synchronized void orientVertically() {
- orientation = VERTICAL;
- }
-
- /**
- * Returns the preferred dimensions for this layout given the
- * components in the specified target container.
- *
- * @param target the component which needs to be laid out.
- * @see Container
- * @see FlowLayout
- * @see #minimumLayoutSize
- */
- public Dimension preferredLayoutSize(Container target) {
- if (orientation == HORIZONTAL) {
- return super.preferredLayoutSize(target);
- }
- else {
- Dimension dim = new Dimension(0, 0);
-
- int n = target.countComponents();
- for (int i = 0; i < n; i++) {
- Component c = target.getComponent(i);
- if (c.isVisible()) {
- Dimension cDim = c.preferredSize();
- dim.width = Math.max(dim.width, cDim.width);
- if (i > 0) {
- dim.height += vVGap;
- }
- dim.height += cDim.height;
- }
- }
-
- Insets insets = target.insets();;
- dim.width += insets.left + insets.right + vHGap*2;
- dim.height += insets.top + insets.bottom + vVGap*2;
-
- return dim;
- }
- }
-
- /**
- * Returns the minimum dimensions needed to layout the components
- * contained in the specified target container.
- *
- * @param target the component which needs to be laid out.
- * @see #preferredLayoutSize.
- */
- public Dimension minimumLayoutSize(Container target) {
- if (orientation == HORIZONTAL) {
- return super.minimumLayoutSize(target);
- }
- else {
- Dimension dim = new Dimension(0, 0);
-
- int n = target.countComponents();
- for (int i = 0; i < n; i++) {
- Component c = target.getComponent(i);
- if (c.isVisible()) {
- Dimension cDim = c.minimumSize();
- dim.width = Math.max(dim.width, cDim.width);
- if (i > 0) {
- dim.height += vVGap;
- }
- dim.height += cDim.height;
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right + vHGap*2;
- dim.height += insets.top + insets.bottom + vVGap*2;
-
- return dim;
- }
- }
-
- /**
- * Lays out the container. This method will reshape the
- * components in the target to satisfy the constraints of the
- * layout.
- *
- * @param target the specified component being laid out.
- * @see Container.
- */
- public void layoutContainer(Container target) {
- if (orientation == HORIZONTAL) {
- super.layoutContainer(target);
- }
- else {
- Insets insets = target.insets();
- Dimension targetDim = target.size();
- int maxHeight = targetDim.height - (insets.top + insets.bottom + vVGap*2);
- int x = insets.left + vHGap;
- int y = 0;
- int colWidth = 0;
- int start = 0;
-
- int n = target.countComponents();
- for (int i = 0; i < n; i++) {
- Component c = target.getComponent(i);
- if (c.isVisible()) {
- Dimension cDim = c.preferredSize();
- c.resize(cDim.width, cDim.height);
-
- if ((y == 0) || ((y + cDim.height) <= maxHeight)) {
- if (y > 0) {
- y += vVGap;
- }
- y += cDim.height;
- colWidth = Math.max(colWidth, cDim.width);
- }
- else {
- moveComponents(target,
- x,
- insets.top + vVGap,
- colWidth,
- maxHeight - y,
- start,
- i);
- x += vHGap + colWidth;
- y = cDim.width;
- colWidth = cDim.width;
- start = i;
- }
- }
- }
-
- moveComponents(target,
- x,
- insets.top + vVGap,
- colWidth,
- maxHeight - y,
- start,
- n);
- }
- }
-
- /**
- * Aligns the components vertically if there is any slack.
- *
- * @param target the container whose components need to be moved.
- * @param x the x coordinate.
- * @param y the y coordinate.
- * @param width the width available.
- * @param height the height available.
- * @param colStart the beginning of the column.
- * @param colEnd the end of the column.
- */
- private void moveComponents(Container target, int x, int y, int width, int height, int colStart, int colEnd) {
- switch (vAlign) {
- case TOP:
- break;
- case CENTER:
- y += height/2;
- break;
- case BOTTOM:
- y += height;
- }
-
- for (int i = colStart; i < colEnd; i++) {
- Component c = target.getComponent(i);
- Dimension cDim = c.size();
- if (c.isVisible()) {
- c.move(x + (width - cDim.width)/2, y);
- y += vVGap + cDim.height;
- }
- }
- }
-
- /**
- * Returns the String representation of this layout's values.
- */
- public String toString() {
- String str = "";
- switch (orientation) {
- case HORIZONTAL:
- str = "orientation=horizontal, ";
- break;
- case VERTICAL:
- str = "orientation=vertical, ";
- break;
- }
-
- return getClass().getName() + "[" + str + super.toString() + "]";
- }
-}
diff --git a/jdk/src/share/classes/sun/awt/VariableGridLayout.java b/jdk/src/share/classes/sun/awt/VariableGridLayout.java
deleted file mode 100644
index 4ca2993..0000000
--- a/jdk/src/share/classes/sun/awt/VariableGridLayout.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-import java.util.BitSet;
-
-
-/**
- * A layout manager for a container that lays out grids. Allows setting
- * the relative sizes of rows and columns.
- *
- * @author Herb Jellinek
- */
-
-
-public class VariableGridLayout extends GridLayout {
-
- BitSet rowsSet = new BitSet();
- double rowFractions[] = null;
-
- BitSet colsSet = new BitSet();
- double colFractions[] = null;
-
- int rows;
- int cols;
- int hgap;
- int vgap;
-
- /**
- * Creates a grid layout with the specified rows and specified columns.
- * @param rows the rows
- * @param cols the columns
- */
- public VariableGridLayout(int rows, int cols) {
- this(rows, cols, 0, 0);
-
- if (rows != 0) {
- rowsSet = new BitSet(rows);
- stdRowFractions(rows);
- }
-
- if (cols != 0) {
- colsSet = new BitSet(cols);
- stdColFractions(cols);
- }
- }
-
- /**
- * Creates a grid layout with the specified rows, columns,
- * horizontal gap, and vertical gap.
- * @param rows the rows
- * @param cols the columns
- * @param hgap the horizontal gap variable
- * @param vgap the vertical gap variable
- * @exception IllegalArgumentException If the rows and columns are invalid.
- */
- public VariableGridLayout(int rows, int cols, int hgap, int vgap) {
- super(rows, cols, hgap, vgap);
-
- this.rows = rows;
- this.cols = cols;
- this.hgap = hgap;
- this.vgap = vgap;
-
- if (rows != 0) {
- rowsSet = new BitSet(rows);
- stdRowFractions(rows);
- }
-
- if (cols != 0) {
- colsSet = new BitSet(cols);
- stdColFractions(cols);
- }
- }
-
- void stdRowFractions(int nrows) {
- rowFractions = new double[nrows];
- for (int i = 0; i < nrows; i++) {
- rowFractions[i] = 1.0 / nrows;
- }
- }
-
- void stdColFractions(int ncols) {
- colFractions = new double[ncols];
- for (int i = 0; i < ncols; i++) {
- colFractions[i] = 1.0 / ncols;
- }
- }
-
- public void setRowFraction(int rowNum, double fraction) {
- rowsSet.set(rowNum);
- rowFractions[rowNum] = fraction;
- }
-
- public void setColFraction(int colNum, double fraction) {
- colsSet.set(colNum);
- colFractions[colNum] = fraction;
- }
-
- public double getRowFraction(int rowNum) {
- return rowFractions[rowNum];
- }
-
- public double getColFraction(int colNum) {
- return colFractions[colNum];
- }
-
- void allocateExtraSpace(double vec[], BitSet userSet) {
- // collect the space that's been explicitly allocated...
- double total = 0.0;
- int unallocated = 0;
- int i;
- for (i = 0; i < vec.length; i++) {
- if (userSet.get(i)) {
- total += vec[i];
- } else {
- unallocated++;
- }
- }
-
- // ... then spread the extra space
- if (unallocated != 0) {
- double space = (1.0 - total) / unallocated;
- for (i = 0; i < vec.length; i++) {
- if (!userSet.get(i)) {
- vec[i] = space;
- userSet.set(i);
- }
- }
- }
- }
-
-
- void allocateExtraSpace() {
- allocateExtraSpace(rowFractions, rowsSet);
- allocateExtraSpace(colFractions, colsSet);
- }
-
- /**
- * Lays out the container in the specified panel.
- * @param parent the specified component being laid out
- * @see Container
- */
- public void layoutContainer(Container parent) {
- Insets insets = parent.insets();
- int ncomponents = parent.countComponents();
- int nrows = rows;
- int ncols = cols;
-
- if (nrows > 0) {
- ncols = (ncomponents + nrows - 1) / nrows;
- } else {
- nrows = (ncomponents + ncols - 1) / ncols;
- }
-
- if (rows == 0) {
- stdRowFractions(nrows);
- }
- if (cols == 0) {
- stdColFractions(ncols);
- }
-
- Dimension size = parent.size();
- int w = size.width - (insets.left + insets.right);
- int h = size.height - (insets.top + insets.bottom);
-
- w = (w - (ncols - 1) * hgap);
- h = (h - (nrows - 1) * vgap);
-
- allocateExtraSpace();
-
- for (int c = 0, x = insets.left ; c < ncols ; c++) {
- int colWidth = (int)(getColFraction(c) * w);
- for (int r = 0, y = insets.top ; r < nrows ; r++) {
- int i = r * ncols + c;
- int rowHeight = (int)(getRowFraction(r) * h);
-
- if (i < ncomponents) {
- parent.getComponent(i).reshape(x, y, colWidth, rowHeight);
- }
- y += rowHeight + vgap;
- }
- x += colWidth + hgap;
- }
- }
-
- static String fracsToString(double array[]) {
- String result = "["+array.length+"]";
-
- for (int i = 0; i < array.length; i++) {
- result += "<"+array[i]+">";
- }
- return result;
- }
-
- /**
- * Returns the String representation of this VariableGridLayout's values.
- */
- public String toString() {
- return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap +
- ",rows=" + rows + ",cols=" + cols +
- ",rowFracs=" +
- fracsToString(rowFractions) +
- ",colFracs=" +
- fracsToString(colFractions) + "]";
- }
-}
diff --git a/jdk/src/share/classes/sun/awt/VerticalBagLayout.java b/jdk/src/share/classes/sun/awt/VerticalBagLayout.java
deleted file mode 100644
index fcc3e78..0000000
--- a/jdk/src/share/classes/sun/awt/VerticalBagLayout.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-
-
-/**
- * A vertical 'bag' of Components. Allocates space for each Component from
- * top to bottom.
- *
- * @author Herb Jellinek
- */
-public class VerticalBagLayout implements LayoutManager {
-
- int vgap;
-
- /**
- * Constructs a new VerticalBagLayout.
- */
- public VerticalBagLayout() {
- this(0);
- }
-
- /**
- * Constructs a VerticalBagLayout with the specified gaps.
- * @param vgap the vertical gap
- */
- public VerticalBagLayout(int vgap) {
- this.vgap = vgap;
- }
-
- /**
- * Adds the specified named component to the layout.
- * @param name the String name
- * @param comp the component to be added
- */
- public void addLayoutComponent(String name, Component comp) {
- }
-
- /**
- * Removes the specified component from the layout.
- * @param comp the component to be removed
- */
- public void removeLayoutComponent(Component comp) {
- }
-
- /**
- * Returns the minimum dimensions needed to lay out the components
- * contained in the specified target container.
- * @param target the Container on which to do the layout
- * @see Container
- * @see #preferredLayoutSize
- */
- public Dimension minimumLayoutSize(Container target) {
- Dimension dim = new Dimension();
- int nmembers = target.countComponents();
-
- for (int i = 0; i < nmembers; i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- Dimension d = comp.minimumSize();
- dim.width = Math.max(d.width, dim.width);
- dim.height += d.height + vgap;
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right;
- dim.height += insets.top + insets.bottom;
-
- return dim;
- }
-
- /**
- * Returns the preferred dimensions for this layout given the components
- * in the specified target container.
- * @param target the component which needs to be laid out
- * @see Container
- * @see #minimumLayoutSize
- */
- public Dimension preferredLayoutSize(Container target) {
- Dimension dim = new Dimension();
- int nmembers = target.countComponents();
-
- for (int i = 0; i < nmembers; i++) {
- Component comp = target.getComponent(i);
- if (true || comp.isVisible()) {
- Dimension d = comp.preferredSize();
- dim.width = Math.max(d.width, dim.width);
- dim.height += d.height + vgap;
- }
- }
-
- Insets insets = target.insets();
- dim.width += insets.left + insets.right;
- dim.height += insets.top + insets.bottom;
-
- return dim;
- }
-
- /**
- * Lays out the specified container. This method will actually reshape the
- * components in the specified target container in order to satisfy the
- * constraints of the VerticalBagLayout object.
- * @param target the component being laid out
- * @see Container
- */
- public void layoutContainer(Container target) {
- Insets insets = target.insets();
- int top = insets.top;
- int bottom = target.size().height - insets.bottom;
- int left = insets.left;
- int right = target.size().width - insets.right;
- int nmembers = target.countComponents();
-
- for (int i = 0; i < nmembers; i++) {
- Component comp = target.getComponent(i);
- if (comp.isVisible()) {
- int compHeight = comp.size().height;
- comp.resize(right - left, compHeight);
- Dimension d = comp.preferredSize();
- comp.reshape(left, top, right - left, d.height);
- top += d.height + vgap;
- }
- }
- }
-
- /**
- * Returns the String representation of this VerticalBagLayout's values.
- */
- public String toString() {
- return getClass().getName() + "[vgap=" + vgap + "]";
- }
-}
diff --git a/jdk/src/share/classes/sun/font/FontManagerFactory.java b/jdk/src/share/classes/sun/font/FontManagerFactory.java
index 20618e2..b9b7b3a 100644
--- a/jdk/src/share/classes/sun/font/FontManagerFactory.java
+++ b/jdk/src/share/classes/sun/font/FontManagerFactory.java
@@ -75,7 +75,8 @@ public final class FontManagerFactory {
String fmClassName =
System.getProperty("sun.font.fontmanager",
DEFAULT_CLASS);
- ClassLoader cl = ClassLoader.getSystemClassLoader();
+ // ## for now use boot loader in module mode
+ ClassLoader cl = org.openjdk.jigsaw.BootLoader.getSystemLoader();
Class fmClass = Class.forName(fmClassName, true, cl);
instance = (FontManager) fmClass.newInstance();
} catch (ClassNotFoundException |
diff --git a/jdk/src/share/classes/sun/io/ByteToCharASCII.java b/jdk/src/share/classes/sun/io/ByteToCharASCII.java
deleted file mode 100644
index b36d239..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharASCII.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A algorithmic conversion from ASCII to Unicode
- *
- * @author Limin Shi
- */
-public class ByteToCharASCII extends ByteToCharConverter {
-
- // Return the character set id
- public String getCharacterEncoding()
- {
- return "ASCII";
- }
-
- public int flush(char[] output, int outStart, int outEnd) {
- // This converter will not buffer any data.
- byteOff = charOff = 0;
- return 0;
- }
-
- /**
- * Algorithmic character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws ConversionBufferFullException, UnknownCharacterException
- {
- byte inputByte;
-
- charOff = outOff;
- byteOff = inOff;
-
- // Loop until we hit the end of the input
- while(byteOff < inEnd)
- {
- // If we don't have room for the output, throw an exception
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- // Convert the input byte
- inputByte = input[byteOff++];
-
- if (inputByte >= 0)
- output[charOff++] = (char)inputByte;
- else {
- if (subMode)
- output[charOff++] = '\uFFFD'; // Replace Char
- else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- }
-
- // Return the length written to the output buffer
- return charOff-outOff;
- }
-
- /*
- * Reset after finding bad input
- */
- public void reset() {
- byteOff = charOff = 0;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharBig5.java b/jdk/src/share/classes/sun/io/ByteToCharBig5.java
deleted file mode 100644
index 31b2ce4..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharBig5.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import sun.nio.cs.ext.Big5;
-
-/**
- * Tables and data to convert Big5 to Unicode
- *
- */
-
-public class ByteToCharBig5 extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new Big5().newDecoder();
-
- public String getCharacterEncoding() {
- return "Big5";
- }
-
- public ByteToCharBig5() {
- super(dec);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharBig5_HKSCS.java b/jdk/src/share/classes/sun/io/ByteToCharBig5_HKSCS.java
deleted file mode 100644
index dc36675..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharBig5_HKSCS.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.Big5_HKSCS;
-import sun.nio.cs.ext.HKSCS;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class ByteToCharBig5_HKSCS extends ByteToCharDBCS_ASCII {
-
- protected static HKSCS.Decoder dec =
- (HKSCS.Decoder)new Big5_HKSCS().newDecoder();
-
-
- public String getCharacterEncoding() {
- return "Big5_HKSCS";
- }
-
- public ByteToCharBig5_HKSCS() {
- super(dec);
- }
-
- protected char decodeDouble(int byte1, int byte2) {
- char c = dec.decodeDouble(byte1, byte2);
- if (c == UNMAPPABLE_DECODING)
- c = dec.decodeBig5(byte1, byte2);
- return c;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharBig5_Solaris.java b/jdk/src/share/classes/sun/io/ByteToCharBig5_Solaris.java
deleted file mode 100644
index a6cd945..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharBig5_Solaris.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import sun.nio.cs.ext.Big5_Solaris;
-
-public class ByteToCharBig5_Solaris extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new Big5_Solaris().newDecoder();
-
- public String getCharacterEncoding() {
- return "Big5_Solaris";
- }
-
- public ByteToCharBig5_Solaris() {
- super(dec);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharConverter.java b/jdk/src/share/classes/sun/io/ByteToCharConverter.java
deleted file mode 100644
index 99a1f29..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharConverter.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import java.io.*;
-
-
-/**
- * An abstract base class for subclasses which convert character data
- * in an external encoding into Unicode characters.
- *
- * @author Asmus Freytag
- * @author Lloyd Honomichl
- *
- * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
- * REMOVED IN J2SE 1.6.
- */
- at Deprecated
-public abstract class ByteToCharConverter {
-
- /*
- * Substitution mode flag.
- */
- protected boolean subMode = true;
-
- /*
- * Characters to use for automatic substitution.
- */
- protected char[] subChars = { '\uFFFD' };
-
- /*
- * Offset of next character to be output
- */
- protected int charOff;
-
- /*
- * Offset of next byte to be converted
- */
- protected int byteOff;
-
- /*
- * Length of bad input that caused a MalformedInputException.
- */
- protected int badInputLength;
-
- /**
- * Create an instance of the default ByteToCharConverter subclass.
- */
- public static ByteToCharConverter getDefault() {
- Object cvt;
- cvt = Converters.newDefaultConverter(Converters.BYTE_TO_CHAR);
- return (ByteToCharConverter)cvt;
- }
-
- /**
- * Returns appropriate ByteToCharConverter subclass instance.
- * @param string represents encoding
- */
- public static ByteToCharConverter getConverter(String encoding)
- throws UnsupportedEncodingException
- {
- Object cvt;
- cvt = Converters.newConverter(Converters.BYTE_TO_CHAR, encoding);
- return (ByteToCharConverter)cvt;
- }
-
- /**
- * Returns the character set id for the conversion
- */
- public abstract String getCharacterEncoding();
-
- /**
- * Converts an array of bytes containing characters in an external
- * encoding into an array of Unicode characters. This method allows
- * a buffer by buffer conversion of a data stream. The state of the
- * conversion is saved between calls to convert. Among other things,
- * this means multibyte input sequences can be split between calls.
- * If a call to convert results in an exception, the conversion may be
- * continued by calling convert again with suitably modified parameters.
- * All conversions should be finished with a call to the flush method.
- *
- * @return the number of bytes written to output.
- * @param input byte array containing text to be converted.
- * @param inStart begin conversion at this offset in input array.
- * @param inEnd stop conversion at this offset in input array (exclusive).
- * @param output character array to receive conversion result.
- * @param outStart start writing to output array at this offset.
- * @param outEnd stop writing to output array at this offset (exclusive).
- * @exception MalformedInputException if the input buffer contains any
- * sequence of bytes that is illegal for the input character set.
- * @exception UnknownCharacterException for any character that
- * that cannot be converted to Unicode. Thrown only when converter
- * is not in substitution mode.
- * @exception ConversionBufferFullException if output array is filled prior
- * to converting all the input.
- */
- public abstract int convert(byte[] input, int inStart, int inEnd,
- char[] output, int outStart, int outEnd)
- throws MalformedInputException,
- UnknownCharacterException,
- ConversionBufferFullException;
-
- /**
- * Converts an array of bytes containing characters in an external
- * encoding into an array of Unicode characters. Unlike convert,
- * this method does not do incremental conversion. It assumes that
- * the given input array contains all the characters to be
- * converted. The state of the converter is reset at the beginning
- * of this method and is left in the reset state on successful
- * termination. The converter is not reset if an exception is
- * thrown. This allows the caller to determine where the bad input
- * was encountered by calling nextByteIndex.
- * <p>
- * This method uses substitution mode when performing the
- * conversion. The method setSubstitutionChars may be used to
- * determine what characters are substituted. Even though substitution
- * mode is used, the state of the converter's substitution mode is
- * not changed at the end of this method.
- *
- * @return an array of chars containing the converted characters.
- * @param input array containing Unicode characters to be converted.
- * @exception MalformedInputException if the input buffer contains any
- * sequence of chars that is illegal in the input character encoding.
- * After this exception is thrown,
- * the method nextByteIndex can be called to obtain the index of the
- * first invalid input byte and getBadInputLength can be called
- * to determine the length of the invalid input.
- *
- * @see #nextByteIndex
- * @see #setSubstitutionMode
- * @see sun.io.CharToByteConverter#setSubstitutionBytes(byte[])
- * @see #getBadInputLength
- */
- public char[] convertAll( byte input[] ) throws MalformedInputException {
- reset();
- boolean savedSubMode = subMode;
- subMode = true;
-
- char[] output = new char[ getMaxCharsPerByte() * input.length ];
-
- try {
- int outputLength = convert( input, 0, input.length,
- output, 0, output.length );
- outputLength += flush( output, outputLength, output.length );
-
- char [] returnedOutput = new char[ outputLength ];
- System.arraycopy( output, 0, returnedOutput, 0, outputLength );
- return returnedOutput;
- }
- catch( ConversionBufferFullException e ) {
- //Not supposed to happen. If it does, getMaxCharsPerByte() lied.
- throw new
- InternalError("this.getMaxCharsBerByte returned bad value");
- }
- catch( UnknownCharacterException e ) {
- // Not supposed to happen since we're in substitution mode.
- throw new InternalError();
- }
- finally {
- subMode = savedSubMode;
- }
- }
-
- /**
- * Writes any remaining output to the output buffer and resets the
- * converter to its initial state.
- *
- * @param output char array to receive flushed output.
- * @param outStart start writing to output array at this offset.
- * @param outEnd stop writing to output array at this offset (exclusive).
- * @exception MalformedInputException if the output to be flushed contained
- * a partial or invalid multibyte character sequence. flush will
- * write what it can to the output buffer and reset the converter before
- * throwing this exception. An additional call to flush is not required.
- * @exception ConversionBufferFullException if output array is filled
- * before all the output can be flushed. flush will write what it can
- * to the output buffer and remember its state. An additional call to
- * flush with a new output buffer will conclude the operation.
- */
- public abstract int flush( char[] output, int outStart, int outEnd )
- throws MalformedInputException, ConversionBufferFullException;
-
- /**
- * Resets converter to its initial state.
- */
- public abstract void reset();
-
- /**
- * Returns the maximum number of characters needed to convert a byte. Useful
- * for calculating the maximum output buffer size needed for a particular
- * input buffer.
- */
- public int getMaxCharsPerByte() {
- // Until UTF-16, this will do for every encoding
- return 1;
- }
-
- /**
- * Returns the length, in bytes, of the input which caused a
- * MalformedInputException. Always refers to the last
- * MalformedInputException thrown by the converter. If none have
- * ever been thrown, returns 0.
- */
- public int getBadInputLength() {
- return badInputLength;
- }
-
- /**
- * Returns the index of the character just past the last character
- * written by the previous call to convert.
- */
- public int nextCharIndex() {
- return charOff;
- }
-
- /**
- * Returns the index of the byte just past the last byte successfully
- * converted by the previous call to convert.
- */
- public int nextByteIndex() {
- return byteOff;
- }
-
- /**
- * Sets converter into substitution mode. In substitution mode,
- * the converter will replace untranslatable characters in the source
- * encoding with the substitution character set by setSubstitionChars.
- * When not in substitution mode, the converter will throw an
- * UnknownCharacterException when it encounters untranslatable input.
- *
- * @param doSub if true, enable substitution mode.
- * @see #setSubstitutionChars
- */
- public void setSubstitutionMode(boolean doSub) {
- subMode = doSub;
- }
-
- /**
- * Sets the substitution characters to use when the converter is in
- * substitution mode. The given chars must not be
- * longer than the value returned by getMaxCharsPerByte for this
- * converter.
- *
- * @param newSubBytes the substitution bytes
- * @exception IllegalArgumentException if given byte array is longer than
- * the value returned by the method getMaxBytesPerChar.
- * @see #setSubstitutionMode
- * @see #getMaxBytesPerChar
- */
- /**
- * sets the substitution character to use
- * @param c the substitution character
- */
- public void setSubstitutionChars(char[] c)
- throws IllegalArgumentException
- {
- if( c.length > getMaxCharsPerByte() ) {
- throw new IllegalArgumentException();
- }
-
- subChars = new char[ c.length ];
- System.arraycopy( c, 0, subChars, 0, c.length );
- }
-
- /**
- * returns a string representation of the character conversion
- */
- public String toString() {
- return "ByteToCharConverter: " + getCharacterEncoding();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp037.java b/jdk/src/share/classes/sun/io/ByteToCharCp037.java
deleted file mode 100644
index cc3ce47..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp037.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM037;
-
-/**
- * A table to convert to Cp037 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp037 extends ByteToCharSingleByte {
-
- private final static IBM037 nioCoder = new IBM037();
-
- public String getCharacterEncoding() {
- return "Cp037";
- }
-
- public ByteToCharCp037() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1006.java b/jdk/src/share/classes/sun/io/ByteToCharCp1006.java
deleted file mode 100644
index c7ef9b5..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1006.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1006;
-
-/**
- * A table to convert to Cp1006 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1006 extends ByteToCharSingleByte {
-
- private final static IBM1006 nioCoder = new IBM1006();
-
- public String getCharacterEncoding() {
- return "Cp1006";
- }
-
- public ByteToCharCp1006() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1025.java b/jdk/src/share/classes/sun/io/ByteToCharCp1025.java
deleted file mode 100644
index 21f960d..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1025.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1025;
-
-/**
- * A table to convert to Cp1025 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1025 extends ByteToCharSingleByte {
-
- private final static IBM1025 nioCoder = new IBM1025();
-
- public String getCharacterEncoding() {
- return "Cp1025";
- }
-
- public ByteToCharCp1025() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1026.java b/jdk/src/share/classes/sun/io/ByteToCharCp1026.java
deleted file mode 100644
index d09eadb..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1026.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1026;
-
-/**
- * A table to convert to Cp1026 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1026 extends ByteToCharSingleByte {
-
- private final static IBM1026 nioCoder = new IBM1026();
-
- public String getCharacterEncoding() {
- return "Cp1026";
- }
-
- public ByteToCharCp1026() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1046.java b/jdk/src/share/classes/sun/io/ByteToCharCp1046.java
deleted file mode 100644
index 6a99f4f..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1046.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1046;
-
-/**
- * A table to convert to Cp1046 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1046 extends ByteToCharSingleByte {
-
- private final static IBM1046 nioCoder = new IBM1046();
-
- public String getCharacterEncoding() {
- return "Cp1046";
- }
-
- public ByteToCharCp1046() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1047.java b/jdk/src/share/classes/sun/io/ByteToCharCp1047.java
deleted file mode 100644
index 0dd8743..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1047.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1047;
-
-/**
- * A table to convert to Cp1047 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1047 extends ByteToCharSingleByte {
-
- private final static IBM1047 nioCoder = new IBM1047();
-
- public String getCharacterEncoding() {
- return "Cp1047";
- }
-
- public ByteToCharCp1047() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1097.java b/jdk/src/share/classes/sun/io/ByteToCharCp1097.java
deleted file mode 100644
index ca64a1f..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1097.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1097;
-
-/**
- * A table to convert to Cp1097 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1097 extends ByteToCharSingleByte {
-
- private final static IBM1097 nioCoder = new IBM1097();
-
- public String getCharacterEncoding() {
- return "Cp1097";
- }
-
- public ByteToCharCp1097() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1098.java b/jdk/src/share/classes/sun/io/ByteToCharCp1098.java
deleted file mode 100644
index b2f28c3..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1098.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1098;
-
-/**
- * A table to convert to Cp1098 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1098 extends ByteToCharSingleByte {
-
- private final static IBM1098 nioCoder = new IBM1098();
-
- public String getCharacterEncoding() {
- return "Cp1098";
- }
-
- public ByteToCharCp1098() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1112.java b/jdk/src/share/classes/sun/io/ByteToCharCp1112.java
deleted file mode 100644
index 582ffad..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1112.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1112;
-
-/**
- * A table to convert to Cp1112 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1112 extends ByteToCharSingleByte {
-
- private final static IBM1112 nioCoder = new IBM1112();
-
- public String getCharacterEncoding() {
- return "Cp1112";
- }
-
- public ByteToCharCp1112() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1122.java b/jdk/src/share/classes/sun/io/ByteToCharCp1122.java
deleted file mode 100644
index 8719bf2..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1122.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1122;
-
-/**
- * A table to convert to Cp1122 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1122 extends ByteToCharSingleByte {
-
- private final static IBM1122 nioCoder = new IBM1122();
-
- public String getCharacterEncoding() {
- return "Cp1122";
- }
-
- public ByteToCharCp1122() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1123.java b/jdk/src/share/classes/sun/io/ByteToCharCp1123.java
deleted file mode 100644
index 13feb79..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1123.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1123;
-
-/**
- * A table to convert to Cp1123 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1123 extends ByteToCharSingleByte {
-
- private final static IBM1123 nioCoder = new IBM1123();
-
- public String getCharacterEncoding() {
- return "Cp1123";
- }
-
- public ByteToCharCp1123() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1124.java b/jdk/src/share/classes/sun/io/ByteToCharCp1124.java
deleted file mode 100644
index 00d4fcc..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1124.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1124;
-
-/**
- * A table to convert to Cp1124 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1124 extends ByteToCharSingleByte {
-
- private final static IBM1124 nioCoder = new IBM1124();
-
- public String getCharacterEncoding() {
- return "Cp1124";
- }
-
- public ByteToCharCp1124() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1140.java b/jdk/src/share/classes/sun/io/ByteToCharCp1140.java
deleted file mode 100644
index 96a82a9..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1140.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1140 to Unicode. This converter differs from
- * Cp037 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1140 extends ByteToCharCp037 {
- public ByteToCharCp1140() {}
-
- public String getCharacterEncoding() {
- return "Cp1140";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // Cast to byte to get sign extension to match byteIndex.
- return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1141.java b/jdk/src/share/classes/sun/io/ByteToCharCp1141.java
deleted file mode 100644
index ea14cb9..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1141.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1141 to Unicode. This converter differs from
- * Cp273 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1141 extends ByteToCharCp273 {
- public ByteToCharCp1141() {}
-
- public String getCharacterEncoding() {
- return "Cp1141";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // Cast to byte to get sign extension to match byteIndex.
- return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1142.java b/jdk/src/share/classes/sun/io/ByteToCharCp1142.java
deleted file mode 100644
index 5097d72..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1142.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1142 to Unicode. This converter differs from
- * Cp277 is one code point, 0x5A, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1142 extends ByteToCharCp277 {
- public ByteToCharCp1142() {}
-
- public String getCharacterEncoding() {
- return "Cp1142";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // [Careful -- if the code point in question is >= 0x80, make
- // sure you do the comparison like this: (byteIndex == (byte)0x??)]
- return (byteIndex == 0x5A) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1143.java b/jdk/src/share/classes/sun/io/ByteToCharCp1143.java
deleted file mode 100644
index a3b0ed9..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1143.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1143 to Unicode. This converter differs from
- * Cp278 is one code point, 0x5A, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1143 extends ByteToCharCp278 {
- public ByteToCharCp1143() {}
-
- public String getCharacterEncoding() {
- return "Cp1143";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // [Careful -- if the code point in question is >= 0x80, make
- // sure you do the comparison like this: (byteIndex == (byte)0x??)]
- return (byteIndex == 0x5A) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1144.java b/jdk/src/share/classes/sun/io/ByteToCharCp1144.java
deleted file mode 100644
index cb6bb7d..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1144.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1144 to Unicode. This converter differs from
- * Cp280 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1144 extends ByteToCharCp280 {
- public ByteToCharCp1144() {}
-
- public String getCharacterEncoding() {
- return "Cp1144";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // Cast to byte to get sign extension to match byteIndex.
- return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1145.java b/jdk/src/share/classes/sun/io/ByteToCharCp1145.java
deleted file mode 100644
index a11b819..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1145.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1145 to Unicode. This converter differs from
- * Cp284 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1145 extends ByteToCharCp284 {
- public ByteToCharCp1145() {}
-
- public String getCharacterEncoding() {
- return "Cp1145";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // Cast to byte to get sign extension to match byteIndex.
- return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1146.java b/jdk/src/share/classes/sun/io/ByteToCharCp1146.java
deleted file mode 100644
index 017f60f..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1146.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1146 to Unicode. This converter differs from
- * Cp285 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1146 extends ByteToCharCp285 {
- public ByteToCharCp1146() {}
-
- public String getCharacterEncoding() {
- return "Cp1146";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // Cast to byte to get sign extension to match byteIndex.
- return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1147.java b/jdk/src/share/classes/sun/io/ByteToCharCp1147.java
deleted file mode 100644
index 98926bb..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1147.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1147 to Unicode. This converter differs from
- * Cp297 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1147 extends ByteToCharCp297 {
- public ByteToCharCp1147() {}
-
- public String getCharacterEncoding() {
- return "Cp1147";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // Cast to byte to get sign extension to match byteIndex.
- return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1148.java b/jdk/src/share/classes/sun/io/ByteToCharCp1148.java
deleted file mode 100644
index 90bd067..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1148.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1148 to Unicode. This converter differs from
- * Cp500 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1148 extends ByteToCharCp500 {
- public ByteToCharCp1148() {}
-
- public String getCharacterEncoding() {
- return "Cp1148";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // Cast to byte to get sign extension to match byteIndex.
- return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1149.java b/jdk/src/share/classes/sun/io/ByteToCharCp1149.java
deleted file mode 100644
index 105e737..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1149.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp1149 to Unicode. This converter differs from
- * Cp871 is one code point, 0x9F, which changes from \u00A4 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp1149 extends ByteToCharCp871 {
- public ByteToCharCp1149() {}
-
- public String getCharacterEncoding() {
- return "Cp1149";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // Cast to byte to get sign extension to match byteIndex.
- return (byteIndex == (byte)0x9F) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1250.java b/jdk/src/share/classes/sun/io/ByteToCharCp1250.java
deleted file mode 100644
index a493cd6..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1250.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.MS1250;
-
-/**
- * A table to convert Cp1250 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1250 extends ByteToCharSingleByte {
-
- private final static MS1250 nioCoder = new MS1250();
-
- public String getCharacterEncoding() {
- return "Cp1250";
- }
-
- public ByteToCharCp1250() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1251.java b/jdk/src/share/classes/sun/io/ByteToCharCp1251.java
deleted file mode 100644
index b337e35..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1251.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.MS1251;
-
-/**
- * A table to convert Cp1251 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1251 extends ByteToCharSingleByte {
-
- private final static MS1251 nioCoder = new MS1251();
-
- public String getCharacterEncoding() {
- return "Cp1251";
- }
-
- public ByteToCharCp1251() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1252.java b/jdk/src/share/classes/sun/io/ByteToCharCp1252.java
deleted file mode 100644
index bd1e764..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1252.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.MS1252;
-
-/**
- * A table to convert Cp1252 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1252 extends ByteToCharSingleByte {
-
- private final static MS1252 nioCoder = new MS1252();
-
- public String getCharacterEncoding() {
- return "Cp1252";
- }
-
- public ByteToCharCp1252() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1253.java b/jdk/src/share/classes/sun/io/ByteToCharCp1253.java
deleted file mode 100644
index fdf0470..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1253.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.MS1253;
-
-/**
- * A table to convert Cp1253 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1253 extends ByteToCharSingleByte {
-
- private final static MS1253 nioCoder = new MS1253();
-
- public String getCharacterEncoding() {
- return "Cp1253";
- }
-
- public ByteToCharCp1253() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1254.java b/jdk/src/share/classes/sun/io/ByteToCharCp1254.java
deleted file mode 100644
index f370e04..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1254.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.MS1254;
-
-/**
- * A table to convert Cp1254 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1254 extends ByteToCharSingleByte {
-
- private final static MS1254 nioCoder = new MS1254();
-
- public String getCharacterEncoding() {
- return "Cp1254";
- }
-
- public ByteToCharCp1254() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1255.java b/jdk/src/share/classes/sun/io/ByteToCharCp1255.java
deleted file mode 100644
index f703761..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1255.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MS1255;
-
-/**
- * A table to convert Cp1255 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1255 extends ByteToCharSingleByte {
-
- private final static MS1255 nioCoder = new MS1255();
-
- public String getCharacterEncoding() {
- return "Cp1255";
- }
-
- public ByteToCharCp1255() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1256.java b/jdk/src/share/classes/sun/io/ByteToCharCp1256.java
deleted file mode 100644
index ce7edd1..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1256.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MS1256;
-
-/**
- * A table to convert Cp1256 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1256 extends ByteToCharSingleByte {
-
- private final static MS1256 nioCoder = new MS1256();
-
- public String getCharacterEncoding() {
- return "Cp1256";
- }
-
- public ByteToCharCp1256() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1257.java b/jdk/src/share/classes/sun/io/ByteToCharCp1257.java
deleted file mode 100644
index 2691caf..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1257.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.MS1257;
-
-/**
- * A table to convert Cp1257 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1257 extends ByteToCharSingleByte {
-
- private final static MS1257 nioCoder = new MS1257();
-
- public String getCharacterEncoding() {
- return "Cp1257";
- }
-
- public ByteToCharCp1257() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1258.java b/jdk/src/share/classes/sun/io/ByteToCharCp1258.java
deleted file mode 100644
index 70b101c..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1258.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MS1258;
-
-/**
- * A table to convert Cp1258 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp1258 extends ByteToCharSingleByte {
-
- private final static MS1258 nioCoder = new MS1258();
-
- public String getCharacterEncoding() {
- return "Cp1258";
- }
-
- public ByteToCharCp1258() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1381.java b/jdk/src/share/classes/sun/io/ByteToCharCp1381.java
deleted file mode 100644
index c38b96b..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1381.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp1381 extends ByteToCharDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp1381";
- }
-
- public ByteToCharCp1381() {
- super((DoubleByte.Decoder)new IBM1381().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp1383.java b/jdk/src/share/classes/sun/io/ByteToCharCp1383.java
deleted file mode 100644
index cf0b06e..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp1383.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp1383 extends ByteToCharEUC2 {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp1383";
- }
-
- public ByteToCharCp1383() {
- super((DoubleByte.Decoder)new IBM1383().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp273.java b/jdk/src/share/classes/sun/io/ByteToCharCp273.java
deleted file mode 100644
index af0cbc6..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp273.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM273;
-
-/**
- * A table to convert to Cp273 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp273 extends ByteToCharSingleByte {
-
- private final static IBM273 nioCoder = new IBM273();
-
- public String getCharacterEncoding() {
- return "Cp273";
- }
-
- public ByteToCharCp273() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp277.java b/jdk/src/share/classes/sun/io/ByteToCharCp277.java
deleted file mode 100644
index fd749ea..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp277.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM277;
-
-/**
- * A table to convert to Cp277 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp277 extends ByteToCharSingleByte {
-
- private final static IBM277 nioCoder = new IBM277();
-
- public String getCharacterEncoding() {
- return "Cp277";
- }
-
- public ByteToCharCp277() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp278.java b/jdk/src/share/classes/sun/io/ByteToCharCp278.java
deleted file mode 100644
index 334c587..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp278.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM278;
-
-/**
- * A table to convert to Cp278 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp278 extends ByteToCharSingleByte {
-
- private final static IBM278 nioCoder = new IBM278();
-
- public String getCharacterEncoding() {
- return "Cp278";
- }
-
- public ByteToCharCp278() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp280.java b/jdk/src/share/classes/sun/io/ByteToCharCp280.java
deleted file mode 100644
index 72cb21c..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp280.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM280;
-
-/**
- * A table to convert to Cp280 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp280 extends ByteToCharSingleByte {
-
- private final static IBM280 nioCoder = new IBM280();
-
- public String getCharacterEncoding() {
- return "Cp280";
- }
-
- public ByteToCharCp280() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp284.java b/jdk/src/share/classes/sun/io/ByteToCharCp284.java
deleted file mode 100644
index 83089d9..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp284.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM284;
-
-/**
- * A table to convert to Cp284 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp284 extends ByteToCharSingleByte {
-
- private final static IBM284 nioCoder = new IBM284();
-
- public String getCharacterEncoding() {
- return "Cp284";
- }
-
- public ByteToCharCp284() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp285.java b/jdk/src/share/classes/sun/io/ByteToCharCp285.java
deleted file mode 100644
index d652f40..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp285.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM285;
-
-/**
- * A table to convert to Cp285 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp285 extends ByteToCharSingleByte {
-
- private final static IBM285 nioCoder = new IBM285();
-
- public String getCharacterEncoding() {
- return "Cp285";
- }
-
- public ByteToCharCp285() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp297.java b/jdk/src/share/classes/sun/io/ByteToCharCp297.java
deleted file mode 100644
index 67fed6d..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp297.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM297;
-
-/**
- * A table to convert to Cp297 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp297 extends ByteToCharSingleByte {
-
- private final static IBM297 nioCoder = new IBM297();
-
- public String getCharacterEncoding() {
- return "Cp297";
- }
-
- public ByteToCharCp297() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp33722.java b/jdk/src/share/classes/sun/io/ByteToCharCp33722.java
deleted file mode 100644
index 68db184..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp33722.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.IBM33722;
-
-/**
-* @author Malcolm Ayres
-*/
-public class ByteToCharCp33722 extends ByteToCharConverter
-{
- private final int G0 = 0;
- private final int G1 = 1;
- private final int G2 = 2;
- private final int G3 = 3;
- private final int G4 = 4;
- private final int SS2 = 0x8E;
- private final int SS3 = 0x8F;
-
- private int firstByte, state;
- private String byteToCharTable;
- private String mappingTableG1;
- private String mappingTableG2;
- private String mappingTableG3;
-
- private final static IBM33722 nioCoder = new IBM33722();
-
- public ByteToCharCp33722() {
- super();
- state = G0;
- byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- mappingTableG1 = nioCoder.getDecoderMappingTableG1();
- mappingTableG2 = nioCoder.getDecoderMappingTableG2();
- mappingTableG3 = nioCoder.getDecoderMappingTableG3();
- }
-
- /**
- * Return the character set id
- */
- public String getCharacterEncoding()
- {
- return "Cp33722";
- }
-
- /**
- * flush out any residual data and reset the buffer state
- */
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (state != G0) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- reset();
- return 0;
- }
-
- /**
- * Resets the converter.
- */
- public void reset() {
- state = G0;
- charOff = byteOff = 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
-
- int byte1;
- char outputChar = '\uFFFD';
-
- byteOff = inOff;
- charOff = outOff;
-
- while (byteOff < inEnd) {
-
- byte1 = input[byteOff];
- if (byte1 < 0)
- byte1 += 256;
-
- switch (state) {
- case G0:
- if (byte1 == SS2) // drop into G2 set
- state = G2;
- else if (byte1 == SS3) // drop into G3 set
- state = G3;
- else if ( byte1 <= 0x9f ) // valid single byte
- outputChar = byteToCharTable.charAt(byte1);
- else if (byte1 < 0xa1 || byte1 > 0xfe) { // valid G1 set 1st byte
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
- firstByte = byte1; // save the 1st byte
- state = G1;
- }
- break;
-
- case G1:
- state = G0;
- if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid second byte for G1
- badInputLength = 1;
- throw new MalformedInputException();
- }
- outputChar = mappingTableG1.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
- break;
-
- case G2:
- state = G0; // valid first byte for G2
- if ( byte1 < 0xa1 || byte1 > 0xfe) {
- badInputLength = 1;
- throw new MalformedInputException();
- }
- outputChar = mappingTableG2.charAt(byte1 - 0xa1);
- break;
-
- case G3:
- if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid first byte for G3
- state = G0;
- badInputLength = 1;
- throw new MalformedInputException();
- }
- firstByte = byte1;
- state = G4;
- break;
-
- case G4:
- state = G0; // valid second byte for G3
- if ( byte1 < 0xa1 || byte1 > 0xfe) {
- badInputLength = 1;
- throw new MalformedInputException();
- }
- outputChar = mappingTableG3.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
- break;
-
- }
-
- if (state == G0) {
- if (outputChar == '\uFFFD') {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- output[charOff++] = outputChar;
- }
-
- byteOff++;
-
- }
-
- return charOff - outOff;
-
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp420.java b/jdk/src/share/classes/sun/io/ByteToCharCp420.java
deleted file mode 100644
index 17a80a1..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp420.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM420;
-
-/**
- * A table to convert to Cp420 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp420 extends ByteToCharSingleByte {
-
- private final static IBM420 nioCoder = new IBM420();
-
- public String getCharacterEncoding() {
- return "Cp420";
- }
-
- public ByteToCharCp420() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp424.java b/jdk/src/share/classes/sun/io/ByteToCharCp424.java
deleted file mode 100644
index be4d135..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp424.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM424;
-
-/**
- * A table to convert to Cp424 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp424 extends ByteToCharSingleByte {
-
- private final static IBM424 nioCoder = new IBM424();
-
- public String getCharacterEncoding() {
- return "Cp424";
- }
-
- public ByteToCharCp424() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp437.java b/jdk/src/share/classes/sun/io/ByteToCharCp437.java
deleted file mode 100644
index d509f42..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp437.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.IBM437;
-
-/**
- * A table to convert to Cp437 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp437 extends ByteToCharSingleByte {
-
- private final static IBM437 nioCoder = new IBM437();
-
- public String getCharacterEncoding() {
- return "Cp437";
- }
-
- public ByteToCharCp437() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp500.java b/jdk/src/share/classes/sun/io/ByteToCharCp500.java
deleted file mode 100644
index 41e488f..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp500.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM500;
-
-/**
- * A table to convert to Cp500 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp500 extends ByteToCharSingleByte {
-
- private final static IBM500 nioCoder = new IBM500();
-
- public String getCharacterEncoding() {
- return "Cp500";
- }
-
- public ByteToCharCp500() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp737.java b/jdk/src/share/classes/sun/io/ByteToCharCp737.java
deleted file mode 100644
index e7ca4d3..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp737.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.IBM737;
-
-/**
- * A table to convert to Cp737 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp737 extends ByteToCharSingleByte {
-
- private final static IBM737 nioCoder = new IBM737();
-
- public String getCharacterEncoding() {
- return "Cp737";
- }
-
- public ByteToCharCp737() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp775.java b/jdk/src/share/classes/sun/io/ByteToCharCp775.java
deleted file mode 100644
index 3e06491..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp775.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.IBM775;
-
-/**
- * A table to convert to Cp775 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp775 extends ByteToCharSingleByte {
-
- private final static IBM775 nioCoder = new IBM775();
-
- public String getCharacterEncoding() {
- return "Cp775";
- }
-
- public ByteToCharCp775() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp833.java b/jdk/src/share/classes/sun/io/ByteToCharCp833.java
deleted file mode 100644
index 6549828..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp833.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM833;
-
-public class ByteToCharCp833 extends ByteToCharSingleByte {
-
- private final static IBM833 nioCoder = new IBM833();
-
- public String getCharacterEncoding() {
- return "Cp833";
- }
-
- public ByteToCharCp833() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
-
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp834.java b/jdk/src/share/classes/sun/io/ByteToCharCp834.java
deleted file mode 100644
index 2019a6b..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp834.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp834 extends ByteToCharDBCS_ASCII {
-
- public String getCharacterEncoding() {
- return "Cp834";
- }
-
- public ByteToCharCp834() {
- super((DoubleByte.Decoder)new IBM834().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp838.java b/jdk/src/share/classes/sun/io/ByteToCharCp838.java
deleted file mode 100644
index 74166ab..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp838.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM838;
-
-/**
- * A table to convert to Cp838 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp838 extends ByteToCharSingleByte {
-
- private final static IBM838 nioCoder = new IBM838();
-
- public String getCharacterEncoding() {
- return "Cp838";
- }
-
- public ByteToCharCp838() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp850.java b/jdk/src/share/classes/sun/io/ByteToCharCp850.java
deleted file mode 100644
index 1713108..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp850.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM850;
-
-/**
- * A table to convert to Cp850 to Unicode
- *
- * @author ConverterGenerator tool
- * @version >= JDK1.1.6
- */
-
-public class ByteToCharCp850 extends ByteToCharSingleByte {
-
- public String getCharacterEncoding() {
- return "Cp850";
- }
-
- public ByteToCharCp850() {
- super.byteToCharTable = new IBM850().getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp852.java b/jdk/src/share/classes/sun/io/ByteToCharCp852.java
deleted file mode 100644
index 851eb2b..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp852.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.IBM852;
-
-/**
- * A table to convert to Cp852 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp852 extends ByteToCharSingleByte {
-
- private final static IBM852 nioCoder = new IBM852();
-
- public String getCharacterEncoding() {
- return "Cp852";
- }
-
- public ByteToCharCp852() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp855.java b/jdk/src/share/classes/sun/io/ByteToCharCp855.java
deleted file mode 100644
index dc48df3..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp855.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.IBM855;
-
-/**
- * A table to convert to Cp855 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp855 extends ByteToCharSingleByte {
-
- private final static IBM855 nioCoder = new IBM855();
-
- public String getCharacterEncoding() {
- return "Cp855";
- }
-
- public ByteToCharCp855() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp856.java b/jdk/src/share/classes/sun/io/ByteToCharCp856.java
deleted file mode 100644
index 404d237..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp856.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM856;
-
-/**
- * A table to convert to Cp856 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp856 extends ByteToCharSingleByte {
-
- private final static IBM856 nioCoder = new IBM856();
-
- public String getCharacterEncoding() {
- return "Cp856";
- }
-
- public ByteToCharCp856() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp857.java b/jdk/src/share/classes/sun/io/ByteToCharCp857.java
deleted file mode 100644
index 16dbb9d..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp857.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.IBM857;
-
-/**
- * A table to convert to Cp857 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp857 extends ByteToCharSingleByte {
-
- private final static IBM857 nioCoder = new IBM857();
-
- public String getCharacterEncoding() {
- return "Cp857";
- }
-
- public ByteToCharCp857() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp858.java b/jdk/src/share/classes/sun/io/ByteToCharCp858.java
deleted file mode 100644
index 480c67b..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp858.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert Cp858 to Unicode. This converter differs from
- * Cp850 is one code point, 0xD5, which changes from \u0131 to \u20AC.
- * @author Alan Liu
- */
-public class ByteToCharCp858 extends ByteToCharCp850 {
- public ByteToCharCp858() {}
-
- public String getCharacterEncoding() {
- return "Cp858";
- }
-
- protected char getUnicode(int byteIndex) {
- // Change single code point with respect to parent.
- // Cast to byte to get sign extension to match byteIndex.
- return (byteIndex == (byte)0xD5) ? '\u20AC' : super.getUnicode(byteIndex);
- }
-}
-
-//eof
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp860.java b/jdk/src/share/classes/sun/io/ByteToCharCp860.java
deleted file mode 100644
index 0b9ec7c..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp860.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM860;
-
-/**
- * A table to convert to Cp860 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp860 extends ByteToCharSingleByte {
-
- private final static IBM860 nioCoder = new IBM860();
-
- public String getCharacterEncoding() {
- return "Cp860";
- }
-
- public ByteToCharCp860() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp861.java b/jdk/src/share/classes/sun/io/ByteToCharCp861.java
deleted file mode 100644
index 450e5bd..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp861.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM861;
-
-/**
- * A table to convert to Cp861 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp861 extends ByteToCharSingleByte {
-
- private final static IBM861 nioCoder = new IBM861();
-
- public String getCharacterEncoding() {
- return "Cp861";
- }
-
- public ByteToCharCp861() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp862.java b/jdk/src/share/classes/sun/io/ByteToCharCp862.java
deleted file mode 100644
index b0420dd..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp862.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.IBM862;
-
-/**
- * A table to convert to Cp862 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp862 extends ByteToCharSingleByte {
-
- private final static IBM862 nioCoder = new IBM862();
-
- public String getCharacterEncoding() {
- return "Cp862";
- }
-
- public ByteToCharCp862() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp863.java b/jdk/src/share/classes/sun/io/ByteToCharCp863.java
deleted file mode 100644
index 7dcd64c..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp863.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM863;
-
-/**
- * A table to convert to Cp863 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp863 extends ByteToCharSingleByte {
-
- private final static IBM863 nioCoder = new IBM863();
-
- public String getCharacterEncoding() {
- return "Cp863";
- }
-
- public ByteToCharCp863() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp864.java b/jdk/src/share/classes/sun/io/ByteToCharCp864.java
deleted file mode 100644
index 7aa11fa..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp864.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM864;
-
-/**
- * A table to convert to Cp864 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp864 extends ByteToCharSingleByte {
-
- private final static IBM864 nioCoder = new IBM864();
-
- public String getCharacterEncoding() {
- return "Cp864";
- }
-
- public ByteToCharCp864() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp865.java b/jdk/src/share/classes/sun/io/ByteToCharCp865.java
deleted file mode 100644
index 75e0fef..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp865.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM865;
-
-/**
- * A table to convert to Cp865 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp865 extends ByteToCharSingleByte {
-
- private final static IBM865 nioCoder = new IBM865();
-
- public String getCharacterEncoding() {
- return "Cp865";
- }
-
- public ByteToCharCp865() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp866.java b/jdk/src/share/classes/sun/io/ByteToCharCp866.java
deleted file mode 100644
index df47322..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp866.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.IBM866;
-
-/**
- * A table to convert to Cp866 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp866 extends ByteToCharSingleByte {
-
- private final static IBM866 nioCoder = new IBM866();
-
- public String getCharacterEncoding() {
- return "Cp866";
- }
-
- public ByteToCharCp866() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp868.java b/jdk/src/share/classes/sun/io/ByteToCharCp868.java
deleted file mode 100644
index af21983..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp868.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM868;
-
-/**
- * A table to convert to Cp868 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp868 extends ByteToCharSingleByte {
-
- private final static IBM868 nioCoder = new IBM868();
-
- public String getCharacterEncoding() {
- return "Cp868";
- }
-
- public ByteToCharCp868() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp869.java b/jdk/src/share/classes/sun/io/ByteToCharCp869.java
deleted file mode 100644
index 10f6576..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp869.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM869;
-
-/**
- * A table to convert to Cp869 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp869 extends ByteToCharSingleByte {
-
- private final static IBM869 nioCoder = new IBM869();
-
- public String getCharacterEncoding() {
- return "Cp869";
- }
-
- public ByteToCharCp869() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp870.java b/jdk/src/share/classes/sun/io/ByteToCharCp870.java
deleted file mode 100644
index 463d1ef..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp870.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM870;
-
-/**
- * A table to convert to Cp870 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp870 extends ByteToCharSingleByte {
-
- private final static IBM870 nioCoder = new IBM870();
-
- public String getCharacterEncoding() {
- return "Cp870";
- }
-
- public ByteToCharCp870() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp871.java b/jdk/src/share/classes/sun/io/ByteToCharCp871.java
deleted file mode 100644
index b6a59ad..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp871.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM871;
-
-/**
- * A table to convert to Cp871 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp871 extends ByteToCharSingleByte {
-
- private final static IBM871 nioCoder = new IBM871();
-
- public String getCharacterEncoding() {
- return "Cp871";
- }
-
- public ByteToCharCp871() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp874.java b/jdk/src/share/classes/sun/io/ByteToCharCp874.java
deleted file mode 100644
index 0eabc28..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp874.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.IBM874;
-
-/**
- * A table to convert to Cp874 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp874 extends ByteToCharSingleByte {
-
- private final static IBM874 nioCoder = new IBM874();
-
- public String getCharacterEncoding() {
- return "Cp874";
- }
-
- public ByteToCharCp874() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp875.java b/jdk/src/share/classes/sun/io/ByteToCharCp875.java
deleted file mode 100644
index c08e956..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp875.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM875;
-
-/**
- * A table to convert to Cp875 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp875 extends ByteToCharSingleByte {
-
- private final static IBM875 nioCoder = new IBM875();
-
- public String getCharacterEncoding() {
- return "Cp875";
- }
-
- public ByteToCharCp875() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp918.java b/jdk/src/share/classes/sun/io/ByteToCharCp918.java
deleted file mode 100644
index 858b311..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp918.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM918;
-
-/**
- * A table to convert to Cp918 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp918 extends ByteToCharSingleByte {
-
- private final static IBM918 nioCoder = new IBM918();
-
- public String getCharacterEncoding() {
- return "Cp918";
- }
-
- public ByteToCharCp918() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp921.java b/jdk/src/share/classes/sun/io/ByteToCharCp921.java
deleted file mode 100644
index 4105b07..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp921.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM921;
-
-/**
- * A table to convert to Cp921 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp921 extends ByteToCharSingleByte {
-
- private final static IBM921 nioCoder = new IBM921();
-
- public String getCharacterEncoding() {
- return "Cp921";
- }
-
- public ByteToCharCp921() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp922.java b/jdk/src/share/classes/sun/io/ByteToCharCp922.java
deleted file mode 100644
index fa66bea..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp922.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM922;
-
-/**
- * A table to convert to Cp922 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharCp922 extends ByteToCharSingleByte {
-
- private final static IBM922 nioCoder = new IBM922();
-
- public String getCharacterEncoding() {
- return "Cp922";
- }
-
- public ByteToCharCp922() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp930.java b/jdk/src/share/classes/sun/io/ByteToCharCp930.java
deleted file mode 100644
index 0e47346..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp930.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp930 extends ByteToCharDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp930";
- }
-
- public ByteToCharCp930() {
- super((DoubleByte.Decoder)new IBM930().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp933.java b/jdk/src/share/classes/sun/io/ByteToCharCp933.java
deleted file mode 100644
index 6310f2d..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp933.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp933 extends ByteToCharDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp933";
- }
-
- public ByteToCharCp933() {
- super((DoubleByte.Decoder)new IBM933().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp935.java b/jdk/src/share/classes/sun/io/ByteToCharCp935.java
deleted file mode 100644
index 2c67eec..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp935.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp935 extends ByteToCharDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp935";
- }
-
- public ByteToCharCp935() {
- super((DoubleByte.Decoder)new IBM935().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp937.java b/jdk/src/share/classes/sun/io/ByteToCharCp937.java
deleted file mode 100644
index cd4ed0e..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp937.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp937 extends ByteToCharDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp937";
- }
-
- public ByteToCharCp937() {
- super((DoubleByte.Decoder)new IBM937().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp939.java b/jdk/src/share/classes/sun/io/ByteToCharCp939.java
deleted file mode 100644
index e4d81b1..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp939.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp939 extends ByteToCharDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp939";
- }
-
- public ByteToCharCp939() {
- super((DoubleByte.Decoder)new IBM939().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp942.java b/jdk/src/share/classes/sun/io/ByteToCharCp942.java
deleted file mode 100644
index 5970999..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp942.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp942 extends ByteToCharDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp942";
- }
-
- public ByteToCharCp942() {
- super((DoubleByte.Decoder)new IBM942().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp942C.java b/jdk/src/share/classes/sun/io/ByteToCharCp942C.java
deleted file mode 100644
index 8b03dc4..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp942C.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp942C extends ByteToCharDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp942C";
- }
-
- public ByteToCharCp942C() {
- super((DoubleByte.Decoder)new IBM942C().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp943.java b/jdk/src/share/classes/sun/io/ByteToCharCp943.java
deleted file mode 100644
index 798e696..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp943.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp943 extends ByteToCharDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp943";
- }
-
- public ByteToCharCp943() {
- super((DoubleByte.Decoder)new IBM943().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp943C.java b/jdk/src/share/classes/sun/io/ByteToCharCp943C.java
deleted file mode 100644
index ea99f9f..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp943C.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp943C extends ByteToCharDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp943C";
- }
-
- public ByteToCharCp943C() {
- super((DoubleByte.Decoder)new IBM943C().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp948.java b/jdk/src/share/classes/sun/io/ByteToCharCp948.java
deleted file mode 100644
index 0c68eda..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp948.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp948 extends ByteToCharDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp948";
- }
-
- public ByteToCharCp948() {
- super((DoubleByte.Decoder)new IBM948().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp949.java b/jdk/src/share/classes/sun/io/ByteToCharCp949.java
deleted file mode 100644
index ab239a7..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp949.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp949 extends ByteToCharDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp949";
- }
-
- public ByteToCharCp949() {
- super((DoubleByte.Decoder)new IBM949().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp949C.java b/jdk/src/share/classes/sun/io/ByteToCharCp949C.java
deleted file mode 100644
index 894bd3d..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp949C.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp949C extends ByteToCharDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp949C";
- }
-
- public ByteToCharCp949C() {
- super((DoubleByte.Decoder)new IBM949C().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp950.java b/jdk/src/share/classes/sun/io/ByteToCharCp950.java
deleted file mode 100644
index fc5ca80..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp950.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp950 extends ByteToCharDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp950";
- }
-
- public ByteToCharCp950() {
- super((DoubleByte.Decoder)new IBM950().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp964.java b/jdk/src/share/classes/sun/io/ByteToCharCp964.java
deleted file mode 100644
index 0bcef26..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp964.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.IBM964;
-
-/**
-* @author Malcolm Ayres
-*/
-public class ByteToCharCp964 extends ByteToCharConverter
-{
- private final static IBM964 nioCoder = new IBM964();
-
- private final int G0 = 0;
- private final int G1 = 1;
- private final int G2 = 2;
- private final int G3 = 3;
- private final int G4 = 4;
- private final int SS2 = 0x8E;
- private final int SS3 = 0x8F;
-
- private int firstByte, state;
-
- private String byteToCharTable;
- private String mappingTableG1;
- private String mappingTableG2;
- private String mappingTableG2a2;
- private String mappingTableG2ac;
- private String mappingTableG2ad;
-
-
- public ByteToCharCp964() {
- super();
- state = G0;
- byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- mappingTableG1 = nioCoder.getDecoderMappingTableG1();
- mappingTableG2a2 = nioCoder.getDecoderMappingTableG2a2();
- mappingTableG2ac = nioCoder.getDecoderMappingTableG2ac();
- mappingTableG2ad = nioCoder.getDecoderMappingTableG2ad();
- }
-
- /**
- * Return the character set id
- */
- public String getCharacterEncoding()
- {
- return "Cp964";
- }
-
- /**
- * flush out any residual data and reset the buffer state
- */
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (state != G0) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- reset();
- return 0;
- }
-
- /**
- * Resets the converter.
- */
- public void reset() {
- state = G0;
- charOff = byteOff = 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
-
- int byte1;
- char outputChar = '\uFFFD';
-
- byteOff = inOff;
- charOff = outOff;
-
- while (byteOff < inEnd) {
-
- byte1 = input[byteOff];
- if (byte1 < 0)
- byte1 += 256;
-
- switch (state) {
- case G0:
- if (byte1 == SS2)
- state = G2;
- else if (byte1 == SS3) {
- badInputLength = 1;
- throw new MalformedInputException();
- }
- else if ( byte1 <= 0x9f ) // valid single byte
- outputChar = byteToCharTable.charAt(byte1);
- else if (byte1 < 0xa1 || byte1 > 0xfe) {
- badInputLength = 1;
- throw new MalformedInputException();
- } else { // valid 1st byte for G1
- firstByte = byte1;
- state = G1;
- }
- break;
-
- case G1:
- state = G0;
- if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid second byte for G1
- badInputLength = 1;
- throw new MalformedInputException();
- }
- outputChar = mappingTableG1.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
- break;
-
- case G2:
- // set the correct mapping table for supported G2 sets
- if ( byte1 == 0xa2)
- mappingTableG2 = mappingTableG2a2;
- else
- if ( byte1 == 0xac)
- mappingTableG2 = mappingTableG2ac;
- else
- if ( byte1 == 0xad)
- mappingTableG2 = mappingTableG2ad;
- else {
- state = G0;
- badInputLength = 1;
- throw new MalformedInputException();
- }
- state = G3;
- break;
-
- case G3:
- if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid 1st byte for G2 set
- state = G0;
- badInputLength = 1;
- throw new MalformedInputException();
- }
- firstByte = byte1;
- state = G4;
- break;
-
- case G4:
- state = G0;
- if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid 2nd byte for G2 set
- badInputLength = 1;
- throw new MalformedInputException();
- }
- outputChar = mappingTableG2.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
- break;
-
- }
-
- if (state == G0) {
- if (outputChar == '\uFFFD') {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- output[charOff++] = outputChar;
- }
-
- byteOff++;
-
- }
-
- return charOff - outOff;
-
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp970.java b/jdk/src/share/classes/sun/io/ByteToCharCp970.java
deleted file mode 100644
index 03c272d..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharCp970.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharCp970 extends ByteToCharEUC2 {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp970";
- }
-
- public ByteToCharCp970() {
- super((DoubleByte.Decoder)new IBM970().newDecoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharDBCS_ASCII.java b/jdk/src/share/classes/sun/io/ByteToCharDBCS_ASCII.java
deleted file mode 100644
index ee93c03..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharDBCS_ASCII.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import static sun.nio.cs.CharsetMapping.*;
-
-public abstract class ByteToCharDBCS_ASCII extends ByteToCharConverter
-{
- private boolean savedBytePresent;
- private int savedByte;
-
- private DoubleByte.Decoder dec;
-
- public ByteToCharDBCS_ASCII(DoubleByte.Decoder dec) {
- super();
- savedBytePresent = false;
- this.dec = dec;
- }
-
- char decodeSingle(int b) {
- return dec.decodeSingle(b);
- }
-
- char decodeDouble(int b1, int b2) {
- return dec.decodeDouble(b1, b2);
- }
-
- public int flush(char [] output, int outStart, int outEnd)
- throws MalformedInputException
- {
-
- if (savedBytePresent) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- reset();
- return 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int inputSize;
- char outputChar = UNMAPPABLE_DECODING;
-
- charOff = outOff;
- byteOff = inOff;
-
- while(byteOff < inEnd)
- {
- int byte1;
-
- if (!savedBytePresent) {
- byte1 = input[byteOff] & 0xff;
- inputSize = 1;
- } else {
- byte1 = savedByte;
- savedBytePresent = false;
- inputSize = 0;
- }
-
- outputChar = decodeSingle(byte1);
- if (outputChar == UNMAPPABLE_DECODING) {
-
- if (byteOff + inputSize >= inEnd) {
- savedByte = byte1;
- savedBytePresent = true;
- byteOff += inputSize;
- break;
- }
-
- outputChar = decodeDouble(byte1, input[byteOff+inputSize] & 0xff);
- inputSize++;
- }
-
- if (outputChar == UNMAPPABLE_DECODING) {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = inputSize;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- output[charOff++] = outputChar;
- byteOff += inputSize;
-
- }
-
- return charOff - outOff;
- }
-
- /**
- * Resets the converter.
- */
- public void reset() {
- charOff = byteOff = 0;
- savedBytePresent = false;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharDBCS_EBCDIC.java b/jdk/src/share/classes/sun/io/ByteToCharDBCS_EBCDIC.java
deleted file mode 100644
index 37442f4..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharDBCS_EBCDIC.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import static sun.nio.cs.CharsetMapping.*;
-
-public abstract class ByteToCharDBCS_EBCDIC extends ByteToCharConverter
-{
-
- private static final int SBCS = 0;
- private static final int DBCS = 1;
-
- private static final int SO = 0x0e;
- private static final int SI = 0x0f;
-
- private int currentState;
- private boolean savedBytePresent;
- private int savedByte;
-
- private DoubleByte.Decoder dec;
-
- public ByteToCharDBCS_EBCDIC(DoubleByte.Decoder dec) {
- super();
- currentState = SBCS;
- savedBytePresent = false;
- this.dec = dec;
- }
-
- char decodeSingle(int b) {
- return dec.decodeSingle(b);
- }
-
- char decodeDouble(int b1, int b2) {
- return dec.decodeDouble(b1, b2);
- }
-
- public int flush(char [] output, int outStart, int outEnd)
- throws MalformedInputException
- {
-
- if (savedBytePresent) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- reset();
- return 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int inputSize;
- char outputChar = UNMAPPABLE_DECODING;
-
- charOff = outOff;
- byteOff = inOff;
-
- while(byteOff < inEnd) {
- int byte1, byte2;
-
- if (!savedBytePresent) {
- byte1 = input[byteOff] & 0xff;
- inputSize = 1;
- } else {
- byte1 = savedByte;
- savedBytePresent = false;
- inputSize = 0;
- }
-
- if (byte1 == SO) {
-
- // For SO characters - simply validate the state and if OK
- // update the state and go to the next byte
-
- if (currentState != SBCS) {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
- currentState = DBCS;
- byteOff += inputSize;
- }
- }
-
- else
- if (byte1 == SI) {
- // For SI characters - simply validate the state and if OK
- // update the state and go to the next byte
-
- if (currentState != DBCS) {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
- currentState = SBCS;
- byteOff+= inputSize;
- }
- } else {
-
- // Process the real data characters
-
- if (currentState == SBCS) {
- outputChar = decodeSingle(byte1);
- } else {
-
- // for a DBCS character - architecture dictates the
- // valid range of 1st bytes
-
- if (byte1 < 0x40 || byte1 > 0xfe) {
- badInputLength = 1;
- throw new MalformedInputException();
- }
-
- if (byteOff + inputSize >= inEnd) {
- // We have been split in the middle if a character
- // save the first byte for next time around
-
- savedByte = byte1;
- savedBytePresent = true;
- byteOff += inputSize;
- break;
- }
-
- byte2 = input[byteOff+inputSize] & 0xff;
- inputSize++;
-
- // validate the pair of bytes meet the architecture
-
- if ((byte1 != 0x40 || byte2 != 0x40) &&
- (byte2 < 0x41 || byte2 > 0xfe)) {
- badInputLength = 2;
- throw new MalformedInputException();
- }
-
- outputChar = decodeDouble(byte1, byte2);
- }
-
- if (outputChar == UNMAPPABLE_DECODING) {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = inputSize;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- output[charOff++] = outputChar;
- byteOff += inputSize;
- }
-
- }
-
- return charOff - outOff;
- }
-
-
- /**
- * Resets the converter.
- */
- public void reset() {
- charOff = byteOff = 0;
- currentState = SBCS;
- savedBytePresent = false;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharDoubleByte.java b/jdk/src/share/classes/sun/io/ByteToCharDoubleByte.java
deleted file mode 100644
index 7e78e3b..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharDoubleByte.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * @author Limin Shi
- * Sean Jiang
- */
-
-public abstract class ByteToCharDoubleByte extends ByteToCharConverter {
- protected byte savedByte;
-
- /*
- * 1st level index, provided by subclass
- */
- protected short index1[];
-
- /*
- * 2nd level index, provided by subclass
- * every string has 0x10*(end-start+1) characters.
- */
- protected String index2[];
-
- protected int start;
- protected int end;
-
- /*
- * Size of bad input that caused conversion to stop
- */
- protected int badInputLength;
-
- public ByteToCharDoubleByte() {
- super();
- savedByte = 0;
- }
-
-
- public short[] getIndex1() {
- return(index1);
- }
-
- public String[] getIndex2() {
- return(index2);
- }
-
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (savedByte != 0) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
- reset();
- return 0;
- }
-
- /**
- * Converts sequences of bytes to characters.
- * Conversions that result in Exceptions can be restarted by calling
- * convert again, with appropriately modified parameters.
- * @return the characters written to output.
- * @param input byte array containing text in Double/single Byte
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output character array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last byte to be written to
- * @throw UnsupportedCharacterException for any bytes
- * that cannot be converted to the external character set.
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- char outputChar = REPLACE_CHAR;
- int inputSize = 0; // Size of input
-
- // Record beginning offsets
- charOff = outOff;
- byteOff = inOff;
-
- // Loop until we hit the end of the input
- while (byteOff < inEnd) {
- int byte1, byte2;
-
- if (savedByte == 0) {
- byte1 = input[byteOff];
- inputSize = 1;
- } else {
- byte1 = savedByte;
- savedByte = 0;
- inputSize = 0;
- }
-
- outputChar = convSingleByte(byte1);
-
- if (outputChar == REPLACE_CHAR) { // DoubleByte char
- if (byteOff + inputSize >= inEnd) {
- // split in the middle of a character
- // save the first byte for next time around
- savedByte = (byte) byte1;
- byteOff += inputSize;
- break;
- }
-
- byte1 &= 0xff;
- byte2 = input[byteOff + inputSize] & 0xff;
-
- inputSize++;
- outputChar = getUnicode(byte1, byte2);
- }
-
- if (outputChar == REPLACE_CHAR) {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = inputSize;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- output[charOff++] = outputChar;
- byteOff += inputSize;
- }
-
- return charOff - outOff;
- }
-
- /**
- * Resets the converter.
- * Call this method to reset the converter to its initial state
- */
- public void reset() {
- byteOff = charOff = 0;
- savedByte = 0;
- }
-
-
- /*
- * Can be changed by subclass
- */
- protected char convSingleByte(int b) {
- if (b >= 0)
- return (char) b;
- return REPLACE_CHAR;
- }
-
- /*
- * Can be changed by subclass
- */
- protected char getUnicode(int byte1, int byte2) {
- // Fix for bug 4117820 - similar fix for bug 4121358 put
- // into ByteToCharEUC_JP.getUnicode()
- if (((byte1 < 0) || (byte1 > index1.length))
- || ((byte2 < start) || (byte2 > end)))
- return REPLACE_CHAR;
-
- int n = (index1[byte1] & 0xf) * (end - start + 1) + (byte2 - start);
- return index2[index1[byte1] >> 4].charAt(n);
- }
-
- protected final static char REPLACE_CHAR = '\uFFFD';
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharEUC.java b/jdk/src/share/classes/sun/io/ByteToCharEUC.java
deleted file mode 100644
index 94a9801..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharEUC.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-/**
-* @author Malcolm Ayres
-*/
-public abstract class ByteToCharEUC extends ByteToCharConverter
-{
- private final int G0 = 0;
- private final int G1 = 1;
- private final int SS2 = 0x8E;
- private final int SS3 = 0x8F;
-
- private int firstByte, state;
-
- protected String mappingTableG1;
- protected String byteToCharTable;
-
-
- public ByteToCharEUC() {
- super();
- state = G0;
- }
-
- /**
- * flush out any residual data and reset the buffer state
- */
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (state != G0) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- reset();
- return 0;
- }
-
- /**
- * Resets the converter.
- */
- public void reset() {
- state = G0;
- charOff = byteOff = 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
-
- int byte1;
- char outputChar = '\uFFFD';
-
- byteOff = inOff;
- charOff = outOff;
-
- while (byteOff < inEnd) {
-
- byte1 = input[byteOff];
- if (byte1 < 0)
- byte1 += 256;
-
- switch (state) {
- case G0:
- if (byte1 == SS2 || // no general support
- byte1 == SS3 ) { // for g2 or g3
- badInputLength = 1;
- throw new MalformedInputException();
- }
-
- if ( byte1 <= 0x9f ) // < 0x9f has its own table
- outputChar = byteToCharTable.charAt(byte1);
- else
- if (byte1 < 0xa1 || byte1 > 0xfe) { // byte within range?
- badInputLength = 1;
- throw new MalformedInputException();
- } else { // G1 set first byte
- firstByte = byte1;
- state = G1;
- }
- break;
-
- case G1:
-
- state = G0;
- if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid G1 set second byte
- badInputLength = 1;
- throw new MalformedInputException();
- }
-
- outputChar = mappingTableG1.charAt(((firstByte - 0xa1) * 94) + byte1 - 0xa1);
- break;
-
- }
-
- if (state == G0) {
- if (outputChar == '\uFFFD') {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- output[charOff++] = outputChar;
- }
-
- byteOff++;
-
- }
-
- return charOff - outOff;
-
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharEUC2.java b/jdk/src/share/classes/sun/io/ByteToCharEUC2.java
deleted file mode 100644
index e5d50ce..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharEUC2.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import static sun.nio.cs.CharsetMapping.*;
-
-public abstract class ByteToCharEUC2 extends ByteToCharConverter
-{
- private final int G0 = 0;
- private final int G1 = 1;
- private final int SS2 = 0x8E;
- private final int SS3 = 0x8F;
-
- private int firstByte, state;
-
- private DoubleByte.Decoder dec;
-
- public ByteToCharEUC2(DoubleByte.Decoder dec) {
- super();
- state = G0;
- this.dec = dec;
- }
-
- char decodeSingle(int b) {
- return dec.decodeSingle(b);
- }
-
- char decodeDouble(int b1, int b2) {
- return dec.decodeDouble(b1, b2);
- }
-
- /**
- * flush out any residual data and reset the buffer state
- */
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (state != G0) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- reset();
- return 0;
- }
-
- /**
- * Resets the converter.
- */
- public void reset() {
- state = G0;
- charOff = byteOff = 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int byte1;
- char outputChar = UNMAPPABLE_DECODING;
- byteOff = inOff;
- charOff = outOff;
-
- while (byteOff < inEnd) {
- byte1 = input[byteOff] & 0xff;
- switch (state) {
- case G0:
- if (byte1 == SS2 || // no general support
- byte1 == SS3 ) { // for g2 or g3
- badInputLength = 1;
- throw new MalformedInputException();
- }
- if ( byte1 <= 0x9f ) // < 0x9f has its own table
- outputChar = decodeSingle(byte1);
- else
- if (byte1 < 0xa1 || byte1 > 0xfe) { // byte within range?
- badInputLength = 1;
- throw new MalformedInputException();
- } else { // G1 set first byte
- firstByte = byte1;
- state = G1;
- }
- break;
- case G1:
- state = G0;
- if ( byte1 < 0xa1 || byte1 > 0xfe) { // valid G1 set second byte
- badInputLength = 1;
- throw new MalformedInputException();
- }
- outputChar = decodeDouble(firstByte, byte1);
- break;
- }
- if (state == G0) {
- if (outputChar == UNMAPPABLE_DECODING) {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
- output[charOff++] = outputChar;
- }
- byteOff++;
- }
- return charOff - outOff;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharEUC_CN.java b/jdk/src/share/classes/sun/io/ByteToCharEUC_CN.java
deleted file mode 100644
index b30f3c7..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharEUC_CN.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharEUC_CN extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new EUC_CN().newDecoder();
-
- public String getCharacterEncoding() {
- return "EUC_CN";
- }
-
- public ByteToCharEUC_CN() {
- super(dec);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharEUC_JP.java b/jdk/src/share/classes/sun/io/ByteToCharEUC_JP.java
deleted file mode 100644
index bcf0c70..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharEUC_JP.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * @author Limin Shi
- */
-
-public class ByteToCharEUC_JP extends ByteToCharJIS0208 {
- private byte savedSecond = 0;
-
- ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
- ByteToCharJIS0212 bcJIS0212 = new ByteToCharJIS0212();
-
- public ByteToCharEUC_JP() {
- super();
- start = 0xA1;
- end = 0xFE;
- savedSecond = 0;
- }
-
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (savedSecond != 0) {
- reset();
- throw new MalformedInputException();
- }
- reset();
- return 0;
- }
-
- /**
- * Resets the converter.
- * Call this method to reset the converter to its initial state
- */
- public void reset() {
- super.reset();
- savedSecond = 0;
- }
-
- public String getCharacterEncoding() {
- return "EUC_JP";
- }
-
- protected char convSingleByte(int b) {
- if (b < 0 || b > 0x7F)
- return REPLACE_CHAR;
- return bcJIS0201.getUnicode(b);
- }
-
- protected char getUnicode(int byte1, int byte2) {
- if (byte1 == 0x8E) {
- return bcJIS0201.getUnicode(byte2 - 256);
- }
- // Fix for bug 4121358 - similar fix for bug 4117820 put
- // into ByteToCharDoubleByte.getUnicode()
- if (((byte1 < 0) || (byte1 > index1.length))
- || ((byte2 < start) || (byte2 > end)))
- return REPLACE_CHAR;
-
- int n = (index1[byte1 - 0x80] & 0xf) * (end - start + 1)
- + (byte2 - start);
- return index2[index1[byte1 - 0x80] >> 4].charAt(n);
- }
-
- protected char decode0212(int byte1, int byte2) {
- return bcJIS0212.getUnicode(byte1, byte2);
- }
-
- /**
- * Converts sequences of bytes to characters.
- * Conversions that result in Exceptions can be restarted by calling
- * convert again, with appropriately modified parameters.
- * @return the characters written to output.
- * @param input byte array containing text in Double/single Byte
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output character array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last byte to be written to
- * @throw UnsupportedCharacterException for any bytes
- * that cannot be converted to the external character set.
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException,
- ConversionBufferFullException
- {
- char outputChar = REPLACE_CHAR;
- int inputSize = 0; // Size of input
-
- // Record beginning offsets
- charOff = outOff;
- byteOff = inOff;
-
- // Loop until we hit the end of the input
- while (byteOff < inEnd) {
- int byte1, byte2;
-
- if (savedByte == 0) {
- byte1 = input[byteOff];
- inputSize = 1;
- } else {
- byte1 = savedByte;
- savedByte = 0;
- inputSize = 0;
- }
-
- outputChar = convSingleByte(byte1);
-
- if (outputChar == REPLACE_CHAR) { // Multibyte char
- if ((byte1 & 0xff) == 0x8F) { // JIS0212
- if (byteOff + inputSize + 1 >= inEnd) {
- // split in the middle of a character
- // save the first 2 bytes for next time around
- savedByte = (byte) byte1;
- byteOff += inputSize;
- if (byteOff < inEnd) {
- savedSecond = input[byteOff];
- byteOff++;
- }
- break;
- }
- if (savedSecond != 0) {
- byte1 = savedSecond & 0xff;
- savedSecond = 0;
- } else {
- byte1 = input[byteOff + inputSize] & 0xff;
- inputSize++;
- }
- byte2 = input[byteOff + inputSize] & 0xff;
- inputSize++;
- outputChar = decode0212(byte1-0x80, byte2-0x80);
- } else { // JIS0208
- if (byteOff + inputSize >= inEnd) {
- // split in the middle of a character
- // save the first byte for next time around
- savedByte = (byte) byte1;
- byteOff += inputSize;
- break;
- }
- byte1 &= 0xff;
- byte2 = input[byteOff + inputSize] & 0xff;
- inputSize++;
- outputChar = getUnicode(byte1, byte2);
- }
- }
-
- if (outputChar == REPLACE_CHAR) {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = inputSize;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- output[charOff++] = outputChar;
- byteOff += inputSize;
- }
-
- return charOff - outOff;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharEUC_JP_LINUX.java b/jdk/src/share/classes/sun/io/ByteToCharEUC_JP_LINUX.java
deleted file mode 100644
index 5cf0b20..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharEUC_JP_LINUX.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * Class for converting bytes to characters for the EUC-JP encoding in
- * linux. This converter supports the JIS0201 and the JIS0208 encoding and
- * omits support for the JIS212 encoding.
- *
- * @author Naveen Sanjeeva
- */
-
-public class ByteToCharEUC_JP_LINUX extends ByteToCharJIS0208 {
- private byte savedSecond = 0;
- ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
-
- public ByteToCharEUC_JP_LINUX() {
- super();
- start = 0xA1;
- end = 0xFE;
- savedSecond = 0;
- }
-
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (savedSecond != 0) {
- reset();
- throw new MalformedInputException();
- }
- reset();
- return 0;
- }
-
- /**
- * Resets the converter.
- * Call this method to reset the converter to its initial state
- */
- public void reset() {
- super.reset();
- savedSecond = 0;
- }
-
- public String getCharacterEncoding() {
- return "EUC_JP_LINUX";
- }
-
- protected char convSingleByte(int b) {
- if (b < 0 || b > 0x7F)
- return REPLACE_CHAR;
- return bcJIS0201.getUnicode(b);
- }
-
- protected char getUnicode(int byte1, int byte2) {
- if (byte1 == 0x8E) {
- return bcJIS0201.getUnicode(byte2 - 256);
- }
- // Fix for bug 4121358 - similar fix for bug 4117820 put
- // into ByteToCharDoubleByte.getUnicode()
- if (((byte1 < 0) || (byte1 > index1.length))
- || ((byte2 < start) || (byte2 > end)))
- return REPLACE_CHAR;
-
- int n = (index1[byte1 - 0x80] & 0xf) * (end - start + 1)
- + (byte2 - start);
- return index2[index1[byte1 - 0x80] >> 4].charAt(n);
- }
-
- /**
- * Converts sequences of bytes to characters.
- * Conversions that result in Exceptions can be restarted by calling
- * convert again, with appropriately modified parameters.
- * @return the characters written to output.
- * @param input byte array containing text in Double/single Byte
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output character array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last byte to be written to
- * @throw UnsupportedCharacterException for any bytes
- * that cannot be converted to the external character set.
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException,
- ConversionBufferFullException
- {
- char outputChar = REPLACE_CHAR;
- int inputSize = 0; // Size of input
-
- // Record beginning offsets
- charOff = outOff;
- byteOff = inOff;
-
- // Loop until we hit the end of the input
- while (byteOff < inEnd) {
- int byte1, byte2;
-
- if (savedByte == 0) {
- byte1 = input[byteOff];
- inputSize = 1;
- } else {
- byte1 = savedByte;
- savedByte = 0;
- inputSize = 0;
- }
-
- outputChar = convSingleByte(byte1);
-
- if (outputChar == REPLACE_CHAR) { // Multibyte char
- if ((byte1 & 0xff) != 0x8F) { // JIS0208
- if (byteOff + inputSize >= inEnd) {
- // split in the middle of a character
- // save the first byte for next time around
- savedByte = (byte) byte1;
- byteOff += inputSize;
- break;
- }
- byte1 &= 0xff;
- byte2 = input[byteOff + inputSize] & 0xff;
- inputSize++;
- outputChar = getUnicode(byte1, byte2);
- } else if ((byte1 & 0xff) == 0x8F) { // JIS0212
- // Handling of 3-byte sequences for this converter involves
- // just ignoring the relevant bytes and returning a
- // suitable substitute char if one exists.
- if (byteOff + inputSize + 1 >= inEnd) {
- // split in the middle of a character
- // save the first 2 bytes for next time around
- savedByte = (byte) byte1;
- byteOff += inputSize;
- if (byteOff < inEnd) {
- savedSecond = input[byteOff];
- byteOff++;
- }
- break;
- }
-
- // Skip over the saved bytes if any
- if (savedSecond != 0) {
- savedSecond = 0;
- } else {
- inputSize++;
- }
- inputSize++;
- }
- }
-
- if (outputChar == REPLACE_CHAR) {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = inputSize;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- output[charOff++] = outputChar;
- byteOff += inputSize;
- }
-
- return charOff - outOff;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharEUC_JP_Solaris.java b/jdk/src/share/classes/sun/io/ByteToCharEUC_JP_Solaris.java
deleted file mode 100644
index 3353a74..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharEUC_JP_Solaris.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0208_Solaris_Decoder;
-import sun.nio.cs.ext.JIS_X_0212_Solaris_Decoder;
-/**
- *
- * @author Limin Shi
- * @author Ian Little
- *
- * EUC_JP variant converter for Solaris with vendor defined chars
- * added (4765370)
- */
-
-
-public class ByteToCharEUC_JP_Solaris extends ByteToCharEUC_JP {
- private byte savedSecond = 0;
-
- ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
- ByteToCharJIS0212_Solaris bcJIS0212 = new ByteToCharJIS0212_Solaris();
-
- short[] j0208Index1 = JIS_X_0208_Solaris_Decoder.getIndex1();
- String[] j0208Index2 = JIS_X_0208_Solaris_Decoder.getIndex2();
- ByteToCharJIS0212_Solaris j0212Decoder = new ByteToCharJIS0212_Solaris();
-
- public ByteToCharEUC_JP_Solaris() {
- super();
- start = 0xA1;
- end = 0xFE;
- savedSecond = 0;
- }
-
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (savedSecond != 0) {
- reset();
- throw new MalformedInputException();
- }
- reset();
- return 0;
- }
-
- /**
- * Resets the converter.
- * Call this method to reset the converter to its initial state
- */
- public void reset() {
- super.reset();
- savedSecond = 0;
- }
-
- public String getCharacterEncoding() {
- return "eucJP-open";
- }
-
- protected char convSingleByte(int b) {
- if (b < 0 || b > 0x7F)
- return REPLACE_CHAR;
- return bcJIS0201.getUnicode(b);
- }
-
- protected char getUnicode(int byte1, int byte2) {
- if (byte1 == 0x8E) {
- return bcJIS0201.getUnicode(byte2 - 256);
- }
- // Fix for bug 4121358 - similar fix for bug 4117820 put
- // into ByteToCharDoubleByte.getUnicode()
- if (((byte1 < 0) || (byte1 > j0208Index1.length))
- || ((byte2 < start) || (byte2 > end)))
- return REPLACE_CHAR;
-
- char result = super.getUnicode(byte1, byte2);
- if (result != '\uFFFD') {
- return result;
- } else {
- int n = (j0208Index1[byte1 - 0x80] & 0xf) * (end - start + 1)
- + (byte2 - start);
- return j0208Index2[j0208Index1[byte1 - 0x80] >> 4].charAt(n);
- }
- }
-
- protected char decode0212(int byte1, int byte2) {
- return j0212Decoder.getUnicode(byte1, byte2);
- }
-
- /**
- * Converts sequences of bytes to characters.
- * Conversions that result in Exceptions can be restarted by calling
- * convert again, with appropriately modified parameters.
- * @return the characters written to output.
- * @param input byte array containing text in Double/single Byte
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output character array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last byte to be written to
- * @throw UnsupportedCharacterException for any bytes
- * that cannot be converted to the external character set.
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException,
- ConversionBufferFullException
- {
- char outputChar = REPLACE_CHAR;
- int inputSize = 0; // Size of input
-
- // Record beginning offsets
- charOff = outOff;
- byteOff = inOff;
-
- // Loop until we hit the end of the input
- while (byteOff < inEnd) {
- int byte1, byte2;
-
- if (savedByte == 0) {
- byte1 = input[byteOff];
- inputSize = 1;
- } else {
- byte1 = savedByte;
- savedByte = 0;
- inputSize = 0;
- }
-
- outputChar = convSingleByte(byte1);
-
- if (outputChar == REPLACE_CHAR) { // Multibyte char
- if ((byte1 & 0xff) == 0x8F) { // JIS0212
- if (byteOff + inputSize + 1 >= inEnd) {
- // split in the middle of a character
- // save the first 2 bytes for next time around
- savedByte = (byte) byte1;
- byteOff += inputSize;
- if (byteOff < inEnd) {
- savedSecond = input[byteOff];
- byteOff++;
- }
- break;
- }
- if (savedSecond != 0) {
- byte1 = savedSecond & 0xff;
- savedSecond = 0;
- } else {
- byte1 = input[byteOff + inputSize] & 0xff;
- inputSize++;
- }
- byte2 = input[byteOff + inputSize] & 0xff;
- inputSize++;
- outputChar = bcJIS0212.getUnicode(byte1-0x80, byte2-0x80);
- } else { // JIS0208
- if (byteOff + inputSize >= inEnd) {
- // split in the middle of a character
- // save the first byte for next time around
- savedByte = (byte) byte1;
- byteOff += inputSize;
- break;
- }
- byte1 &= 0xff;
- byte2 = input[byteOff + inputSize] & 0xff;
- inputSize++;
- outputChar = getUnicode(byte1, byte2);
- }
- }
-
- if (outputChar == REPLACE_CHAR) {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = inputSize;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- output[charOff++] = outputChar;
- byteOff += inputSize;
- }
-
- return charOff - outOff;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharEUC_KR.java b/jdk/src/share/classes/sun/io/ByteToCharEUC_KR.java
deleted file mode 100644
index 5b1901a..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharEUC_KR.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharEUC_KR extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new EUC_KR().newDecoder();
-
- public String getCharacterEncoding() {
- return "EUC_KR";
- }
-
- public ByteToCharEUC_KR() {
- super(dec);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharEUC_TW.java b/jdk/src/share/classes/sun/io/ByteToCharEUC_TW.java
deleted file mode 100644
index 97493c3..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharEUC_TW.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.EUC_TW;
-
-/*
- * @author Limin Shi
- */
-public class ByteToCharEUC_TW extends ByteToCharConverter
-{
- private final byte G0 = 0;
- private final byte G1 = 1;
- private final byte G2 = 2;
- private final byte G3 = 3;
- private final byte G4 = 4;
- private final byte MSB = (byte) 0x80;
- private final byte SS2 = (byte) 0x8E;
-
- private byte firstByte = 0, state = G0;
- private int cnsPlane = 0;
-
- private EUC_TW.Decoder dec = (EUC_TW.Decoder)(new EUC_TW().newDecoder());
-
- public ByteToCharEUC_TW() {
- }
-
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (state != G0) {
- state = G0;
- firstByte = 0;
- badInputLength = 0;
- throw new MalformedInputException();
- }
- reset();
- return 0;
- }
-
- public void reset() {
- dec.reset();
- state = G0;
- firstByte = 0;
- byteOff = charOff = 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int inputSize = 0;
- char[] c1 = new char[1];
-
- byteOff = inOff;
- charOff = outOff;
-
- cnsPlane = 3;
- while (byteOff < inEnd) {
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
- char[] outputChar = null;
- switch (state) {
- case G0:
- if ( (input[byteOff] & MSB) == 0) { // ASCII
- outputChar = c1;
- outputChar[0] = (char) input[byteOff];
- } else if (input[byteOff] == SS2) { // Codeset 2
- state = G2;
- } else { // Codeset 1
- firstByte = input[byteOff];
- state = G1;
- }
- break;
- case G1:
- inputSize = 2;
- if ( (input[byteOff] & MSB) != 0) { // 2nd byte
- cnsPlane = 0;
- outputChar = dec.toUnicode(firstByte & 0xff,
- input[byteOff] & 0xff,
- cnsPlane);
- } else { // Error
- badInputLength = 1;
- throw new MalformedInputException();
- }
- firstByte = 0;
- state = G0;
- break;
- case G2:
- cnsPlane = (input[byteOff] & (byte)0x0f);
- // Adjust String array index for plan 15
- cnsPlane = (cnsPlane == 15)? 8 : cnsPlane;
-
- if (cnsPlane < 15) {
- state = G3;
- } else {
- badInputLength = 2;
- throw new MalformedInputException();
- }
-
- break;
- case G3:
- if ( (input[byteOff] & MSB) != 0) { // 1st byte
- firstByte = input[byteOff];
- state = G4;
- } else { // Error
- state = G0;
- badInputLength = 2;
- throw new MalformedInputException();
- }
- break;
- case G4:
- if ( (input[byteOff] & MSB) != 0) { // 2nd byte
- outputChar = dec.toUnicode(firstByte & 0xff,
- input[byteOff] & 0xff,
- cnsPlane - 1);
- } else { // Error
- badInputLength = 3;
- throw new MalformedInputException();
- }
- firstByte = 0;
- state = G0;
- break;
- }
- byteOff++;
- if (state == G0) {
- if (outputChar == null) {
- if (subMode) { // substitution enabled
- outputChar = c1;
- outputChar[0] = subChars[0];
- } else {
- badInputLength = inputSize;
- throw new UnknownCharacterException();
- }
- }
- output[charOff++] = outputChar[0];
- }
- }
- return charOff - outOff;
- }
-
-
- /**
- * Return the character set ID
- */
- public String getCharacterEncoding() {
- return "EUC_TW";
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharGB18030.java b/jdk/src/share/classes/sun/io/ByteToCharGB18030.java
deleted file mode 100644
index 52b1f76..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharGB18030.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.GB18030;
-
-public class ByteToCharGB18030 extends ByteToCharGB18030DB {
-
- private static final int GB18030_SINGLE_BYTE = 1;
- private static final int GB18030_DOUBLE_BYTE = 2;
- private static final int GB18030_FOUR_BYTE = 3;
- private static short[] decoderIndex1;
- private static String[] decoderIndex2;
-
- private int currentState;
- private int savedSize;
- private byte[] savedBytes;
-
- public ByteToCharGB18030() {
- super();
- GB18030 nioCoder = new GB18030();
- savedBytes = new byte[3];
- currentState = GB18030_DOUBLE_BYTE;
- decoderIndex1 = nioCoder.getDecoderIndex1();
- decoderIndex2 = nioCoder.getDecoderIndex2();
- savedSize = 0;
- }
-
- public short[] getOuter() {
- return(index1);
- }
-
- public String[] getInner() {
- return(index2);
- }
-
- public short[] getDBIndex1() {
- return(super.index1);
- }
-
- public String[] getDBIndex2() {
- return(super.index2);
- }
-
- public int flush(char [] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (savedSize != 0) {
- savedSize = 0;
- currentState = GB18030_DOUBLE_BYTE;
- badInputLength = 0;
- throw new MalformedInputException();
- }
- byteOff = charOff = 0;
- return 0;
- }
-
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int inputSize = 0;
- char outputChar = '\uFFFD';
- // readOff keeps the actual buffer's pointer.
- // byteOff keeps original buffer's pointer.
- int readOff = byteOff = inOff;
-
- if (savedSize != 0) {
- // Filter illegal bytes when they are detected in saved
- // partial input from a previous conversion attempt.
- if (((savedBytes[0] & 0xFF) < 0x81 || savedBytes[0] > 0xFE) ||
- (savedSize > 1 &&
- (savedBytes[1] & 0xFF) < 0x30 ) ||
- (savedSize > 2 &&
- ((savedBytes[2] & 0xFF) < 0x81 ||
- (savedBytes[2] & 0xFF) > 0xFE ))) {
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- byte[] newBuf = new byte[inEnd - inOff + savedSize];
- for (int i = 0; i < savedSize; i++) {
- newBuf[i] = savedBytes[i];
- }
- System.arraycopy(input, inOff, newBuf, savedSize, inEnd - inOff);
- byteOff -= savedSize;
- input = newBuf;
- inOff = 0;
- inEnd = newBuf.length;
- savedSize = 0;
- }
-
- charOff = outOff;
- readOff = inOff;
-
- while(readOff < inEnd) {
- int byte1 = 0 , byte2 = 0, byte3 = 0, byte4 = 0;
-
- // Is there room in the output buffer for the result?
- if (charOff >= outEnd) {
- throw new ConversionBufferFullException();
- }
-
- // Get the input byte
- byte1 = input[readOff++] & 0xFF;
- inputSize = 1;
-
- if ((byte1 & (byte)0x80) == 0){ // US-ASCII range
- outputChar = (char)byte1;
- currentState = GB18030_SINGLE_BYTE;
- }
-
- else if (byte1 < 0x81 || byte1 > 0xfe) {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- else {
- // Either 2 or 4 byte sequence follows
- // If an underrun is detected save for later
- // replay.
-
- if (readOff + inputSize > inEnd) {
- savedBytes[0]=(byte)byte1;
- savedSize = 1;
- break;
- }
-
- byte2 = input[readOff++] & 0xFF;
- inputSize = 2;
-
- if (byte2 < 0x30) {
- badInputLength = 1;
- throw new MalformedInputException();
- }
- else if (byte2 >= 0x30 && byte2 <= 0x39) {
- currentState = GB18030_FOUR_BYTE;
- inputSize = 4;
-
- if (readOff + 2 > inEnd) {
- if (readOff + 1 > inEnd) {
- savedBytes[0] = (byte)byte1;
- savedBytes[1] = (byte)byte2;
- savedSize = 2;
- }
- else {
- savedBytes[0] = (byte)byte1;
- savedBytes[1] = (byte)byte2;
- savedBytes[2] = input[readOff++];
- savedSize = 3;
- }
- break;
- }
- byte3 = input[readOff++] & 0xFF;
- if (byte3 < 0x81 || byte3 > 0xfe) {
- badInputLength = 3;
- throw new MalformedInputException();
- }
-
- byte4 = input[readOff++] & 0xFF;
-
- if (byte4 < 0x30 || byte4 > 0x39) {
- badInputLength = 4;
- throw new MalformedInputException();
- }
- }
- else if (byte2 == 0x7f || byte2 == 0xff ||
- (byte2 < 0x40 )) {
- badInputLength = 2;
- throw new MalformedInputException();
- }
- else
- currentState = GB18030_DOUBLE_BYTE;
- }
-
- switch (currentState){
- case GB18030_SINGLE_BYTE:
- output[charOff++] = (char)(byte1);
- break;
- case GB18030_DOUBLE_BYTE:
- output[charOff++] = super.getUnicode(byte1, byte2);
- break;
- case GB18030_FOUR_BYTE:
- int offset = (((byte1 - 0x81) * 10 +
- (byte2 - 0x30)) * 126 +
- byte3 - 0x81) * 10 + byte4 - 0x30;
- int hiByte = (offset >>8) & 0xFF;
- int lowByte = (offset & 0xFF);
-
- // Mixture of table lookups and algorithmic calculation
- // of character values.
-
- // BMP Ranges
-
- if (offset <= 0x4A62)
- output[charOff++] = getChar(offset);
- else if (offset > 0x4A62 && offset <= 0x82BC)
- output[charOff++] = (char) (offset + 0x5543);
- else if (offset >= 0x82BD && offset <= 0x830D)
- output[charOff++] = getChar(offset);
- else if (offset >= 0x830D && offset <= 0x93A8)
- output[charOff++] = (char) (offset + 0x6557);
- else if (offset >= 0x93A9 && offset <= 0x99FB)
- output[charOff++] = getChar(offset);
- // Supplemental UCS planes handled via surrogates
- else if (offset >= 0x2E248 && offset < 0x12E248) {
- if (offset >= 0x12E248) {
- if (subMode)
- return subChars[0];
- else {
- badInputLength = 4;
- throw new UnknownCharacterException();
- }
- }
-
- if (charOff +2 > outEnd) {
- throw new ConversionBufferFullException();
- }
- offset -= 0x1e248;
- char highSurr = (char) ((offset - 0x10000) / 0x400 + 0xD800);
- char lowSurr = (char) ((offset - 0x10000) % 0x400 + 0xDC00);
- output[charOff++] = highSurr;
- output[charOff++] = lowSurr;
- }
- else {
- badInputLength = 4;
- throw new MalformedInputException();
- }
- break;
- }
- byteOff += inputSize;
- }
-
- byteOff += savedSize;
- return charOff - outOff;
- }
-
- public void reset() {
- byteOff = charOff = 0;
- currentState = GB18030_DOUBLE_BYTE;
- savedSize = 0;
- }
-
- public String getCharacterEncoding() {
- return "GB18030";
- }
-
- private char getChar(int offset) throws UnknownCharacterException {
- int byte1 = (offset >>8) & 0xFF;
- int byte2 = (offset & 0xFF);
- int start = 0, end = 0xFF;
-
- if (((byte1 < 0) || (byte1 > getOuter().length))
- || ((byte2 < start) || (byte2 > end))) {
- if (subMode)
- return subChars[0];
- else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
-
- int n = (decoderIndex1[byte1] & 0xf) * (end - start + 1) + (byte2 - start);
- return decoderIndex2[decoderIndex1[byte1] >> 4].charAt(n);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharGB18030DB.java b/jdk/src/share/classes/sun/io/ByteToCharGB18030DB.java
deleted file mode 100644
index d1766df..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharGB18030DB.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.GB18030;
-
-
-/**
- * Tables and data to convert the two-byte portion of GB18030 to Unicode
- * The class is package level accessibility as it is just used for the
- * convenience of the main GB18030 converter.
- *
- * @author ConverterGenerator tool
- */
-
-abstract class ByteToCharGB18030DB extends ByteToCharDoubleByte {
-
- public String getCharacterEncoding() {
- return "ByteToCharGB18030DB";
- }
-
- public ByteToCharGB18030DB() {
- GB18030 nioCoder = new GB18030();
- super.index1 = nioCoder.getSubDecoderIndex1();
- super.index2 = nioCoder.getSubDecoderIndex2();
- start = 0x40;
- end = 0xFE;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharGBK.java b/jdk/src/share/classes/sun/io/ByteToCharGBK.java
deleted file mode 100644
index 2840489..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharGBK.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharGBK extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new GBK().newDecoder();
-
- public String getCharacterEncoding() {
- return "GBK";
- }
-
- public ByteToCharGBK() {
- super(dec);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISCII91.java b/jdk/src/share/classes/sun/io/ByteToCharISCII91.java
deleted file mode 100644
index baa1bca..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISCII91.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.ISCII91;
-
-/*
- * Copyright (c) 1998 International Business Machines.
- * All Rights Reserved.
- *
- * Author : Sunanda Bera, C. Thirumalesh
- * Last Modified : 23,November,1998
- *
- * Purpose : Defines class ByteToCharISCII91.
- *
- *
- * Revision History
- * ======== =======
- *
- * Date By Description
- * ---- -- -----------
- *
- *
- */
-
-/**
- * Converter class. Converts between Unicode encoding and ISCII91 encoding.
- * ISCII91 is the character encoding as defined in Indian Standard document
- * IS 13194:1991 ( Indian Script Code for Information Interchange ).
- *
- * @see sun.io.ByteToCharConverter
- */
-public class ByteToCharISCII91 extends ByteToCharConverter {
-
- private static final char[] directMapTable = ISCII91.getDirectMapTable();
-
- private static final char NUKTA_CHAR = '\u093c';
- private static final char HALANT_CHAR = '\u094d';
- private static final char ZWNJ_CHAR = '\u200c';
- private static final char ZWJ_CHAR = '\u200d';
- private static final char INVALID_CHAR = '\uffff';
-
- private char contextChar = INVALID_CHAR;
- private boolean needFlushing = false;
-
-/**
- * Converts ISCII91 characters to Unicode.
- * @see sun.io.ByteToCharConverter#convert
- */
- public int convert(byte input[], int inStart, int inEnd,
- char output[], int outStart, int outEnd)
- throws ConversionBufferFullException, UnknownCharacterException {
- /*Rules:
- * 1)ATR,EXT,following character to be replaced with '\ufffd'
- * 2)Halant + Halant => '\u094d' (Virama) + '\u200c'(ZWNJ)
- * 3)Halant + Nukta => '\u094d' (Virama) + '\u200d'(ZWJ)
- */
- charOff = outStart;
- byteOff = inStart;
- while (byteOff < inEnd) {
- if (charOff >= outEnd) {
- throw new ConversionBufferFullException();
- }
- int index = input[byteOff++];
- index = ( index < 0 )? ( index + 255 ):index;
- char currentChar = directMapTable[index];
-
- // if the contextChar is either ATR || EXT set the output to '\ufffd'
- if(contextChar == '\ufffd') {
- output[charOff++] = '\ufffd';
- contextChar = INVALID_CHAR;
- needFlushing = false;
- continue;
- }
-
- switch(currentChar) {
- case '\u0901':
- case '\u0907':
- case '\u0908':
- case '\u090b':
- case '\u093f':
- case '\u0940':
- case '\u0943':
- case '\u0964':
- if(needFlushing) {
- output[charOff++] = contextChar;
- contextChar = currentChar;
- continue;
- }
- contextChar = currentChar;
- needFlushing = true;
- continue;
- case NUKTA_CHAR:
- switch(contextChar) {
- case '\u0901':
- output[charOff] = '\u0950';
- break;
- case '\u0907':
- output[charOff] = '\u090c';
- break;
- case '\u0908':
- output[charOff] = '\u0961';
- break;
- case '\u090b':
- output[charOff] = '\u0960';
- break;
- case '\u093f':
- output[charOff] = '\u0962';
- break;
- case '\u0940':
- output[charOff] = '\u0963';
- break;
- case '\u0943':
- output[charOff] = '\u0944';
- break;
- case '\u0964':
- output[charOff] = '\u093d';
- break;
- case HALANT_CHAR:
- if(needFlushing) {
- output[charOff++] = contextChar;
- contextChar = currentChar;
- continue;
- }
- output[charOff] = ZWJ_CHAR;
- break;
- default:
- if(needFlushing) {
- output[charOff++] = contextChar;
- contextChar = currentChar;
- continue;
- }
- output[charOff] = NUKTA_CHAR;
- }
- break;
- case HALANT_CHAR:
- if(needFlushing) {
- output[charOff++] = contextChar;
- contextChar = currentChar;
- continue;
- }
- if(contextChar == HALANT_CHAR) {
- output[charOff] = ZWNJ_CHAR;
- break;
- }
- output[charOff] = HALANT_CHAR;
- break;
- case INVALID_CHAR:
- if(needFlushing) {
- output[charOff++] = contextChar;
- contextChar = currentChar;
- continue;
- }
- if(subMode) {
- output[charOff] = subChars[0];
- break;
- } else {
- contextChar = INVALID_CHAR;
- throw new UnknownCharacterException();
- }
- default:
- if(needFlushing) {
- output[charOff++] = contextChar;
- contextChar = currentChar;
- continue;
- }
- output[charOff] = currentChar;
- break;
- }//end switch
-
- contextChar = currentChar;
- needFlushing = false;
- charOff++;
- }//end while
- return charOff - outStart;
- } //convert()
-
-/**
- * @see sun.io.ByteToCharConverter#flush
- */
- public int flush( char[] output, int outStart, int outEnd )
- throws MalformedInputException, ConversionBufferFullException
- {
- int charsWritten = 0;
- //if the last char was not flushed, flush it!
- if(needFlushing) {
- output[outStart] = contextChar;
- charsWritten = 1;
- }
- contextChar = INVALID_CHAR;
- needFlushing = false;
- byteOff = charOff = 0;
- return charsWritten;
- }//flush()
-/**
- * Returns the character set id for the conversion.
- */
- public String getCharacterEncoding()
- {
- return "ISCII91";
- }//getCharacterEncoding()
-/**
- * @see sun.io.ByteToCharConverter#reset
- */
- public void reset()
- {
- byteOff = charOff = 0;
- }//reset()
-
-}//end of class definition
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO2022.java b/jdk/src/share/classes/sun/io/ByteToCharISO2022.java
deleted file mode 100644
index f827972..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO2022.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * An algorithmic conversion from ISO 2022 to Unicode
- *
- * @author Tom Zhou
- */
-public abstract class ByteToCharISO2022 extends ByteToCharConverter
-{
- // Value to be filled by subclass
- protected String SODesignator[];
- protected String SS2Designator[] = null;
- protected String SS3Designator[] = null;
-
- protected ByteToCharConverter SOConverter[];
- protected ByteToCharConverter SS2Converter[] = null;
- protected ByteToCharConverter SS3Converter[] = null;
-
- private static final byte ISO_ESC = 0x1b;
- private static final byte ISO_SI = 0x0f;
- private static final byte ISO_SO = 0x0e;
- private static final byte ISO_SS2_7 = 0x4e;
- private static final byte ISO_SS3_7 = 0x4f;
- private static final byte MSB = (byte)0x80;
- private static final char REPLACE_CHAR = '\uFFFD';
- private static final byte maximumDesignatorLength = 3;
-
- private static final byte SOFlag = 0;
- private static final byte SS2Flag = 1;
- private static final byte SS3Flag = 2;
- private static final byte G0 = 0;
- private static final byte G1 = 1;
-
- private ByteToCharConverter tmpConverter[];
-
- private int curSODes, curSS2Des, curSS3Des;
- private boolean shiftout;
-
- private byte remainByte[] = new byte[10];
- private int remainIndex = -1;
- private byte state, firstByte;
-
- public void reset()
- {
- int i = 0;
-
- shiftout = false;
- state = G0;
- firstByte = 0;
-
- curSODes = 0;
- curSS2Des = 0;
- curSS3Des = 0;
-
- charOff = byteOff = 0;
- remainIndex = -1;
-
- for(i = 0; i < remainByte.length; i++)
- remainByte[i] = 0;
- }
-
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- int i;
- if (state != G0) {
- badInputLength = 0;
- throw new MalformedInputException();
- }
- reset();
- return 0;
- }
-
- private byte[] savetyGetSrc(byte[] input, int inOff, int inEnd, int nbytes)
- {
- int i;
- byte tmp[];
-
- if(inOff <= (inEnd-nbytes+1))
- tmp = new byte[nbytes];
- else
- tmp = new byte[inEnd-inOff];
-
- for(i = 0; i < tmp.length; i++)
- tmp[i] = input[inOff+i];
- return tmp;
- }
-
- private char getUnicode(byte byte1, byte byte2, byte shiftFlag)
- {
- byte1 |= MSB;
- byte2 |= MSB;
-
- byte[] tmpByte = {byte1,byte2};
- char[] tmpChar = new char[1];
- int i = 0,
- tmpIndex = 0;
-
- switch(shiftFlag) {
- case SOFlag:
- tmpIndex = curSODes;
- tmpConverter = SOConverter;
- break;
- case SS2Flag:
- tmpIndex = curSS2Des;
- tmpConverter = SS2Converter;
- break;
- case SS3Flag:
- tmpIndex = curSS3Des;
- tmpConverter = SS3Converter;
- break;
- }
-
- for(i = 0; i < tmpConverter.length; i++) {
- if(tmpIndex == i) {
- try {
- tmpConverter[i].convert(tmpByte, 0, 2, tmpChar, 0, 1);
- } catch (Exception e) {}
- return tmpChar[0];
- }
- }
- return REPLACE_CHAR;
- }
-
- public final int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws ConversionBufferFullException,
- MalformedInputException
- {
- int i;
- int DesignatorLength = 0;
- charOff = outOff;
- byteOff = inOff;
-
- // Loop until we hit the end of the input
- while (byteOff < inEnd) {
- // If we don't have room for the output, throw an exception
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
- if(remainIndex < 0) {
- remainByte[0] = input[byteOff];
- remainIndex = 0;
- byteOff++;
- }
- switch (remainByte[0]) {
- case ISO_SO:
- shiftout = true;
- if(remainIndex > 0)
- System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
- remainIndex--;
- break;
- case ISO_SI:
- shiftout = false;
- if(remainIndex > 0)
- System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
- remainIndex--;
- break;
- case ISO_ESC:
- byte tmp[] = savetyGetSrc(input, byteOff, inEnd,
- (maximumDesignatorLength-remainIndex));
- System.arraycopy(tmp, 0, remainByte, remainIndex+1, tmp.length);
- remainIndex += tmp.length;
- byteOff += tmp.length;
- if(tmp.length<(maximumDesignatorLength-remainIndex))
- break;
- String tmpString = new String(remainByte, 1, remainIndex);
- for (i = 0; i < SODesignator.length; i++) {
- if(tmpString.indexOf(SODesignator[i]) == 0) {
- curSODes = i;
- DesignatorLength = SODesignator[i].length();
- break;
- }
- }
-
- if (DesignatorLength == 0 ) { // Designator not recognized
- badInputLength = tmp.length;
- throw new MalformedInputException();
- }
-
- if (i == SODesignator.length) {
- for (i = 0; i < SS2Designator.length; i++) {
- if(tmpString.indexOf(SS2Designator[i]) == 0) {
- curSS2Des = i;
- DesignatorLength = SS2Designator[i].length();
- break;
- }
- }
- if(i == SS2Designator.length) {
- for(i = 0; i < SS3Designator.length; i++) {
- if (tmpString.indexOf(SS3Designator[i]) == 0) {
- curSS3Des = i;
- DesignatorLength = SS3Designator[i].length();
- break;
- }
- }
- if (i == SS3Designator.length) {
- switch(remainByte[1]) {
- case ISO_SS2_7:
- output[charOff] = getUnicode(remainByte[2],
- remainByte[3],
- SS2Flag);
- charOff++;
- DesignatorLength = 3;
- break;
- case ISO_SS3_7:
- output[charOff] = getUnicode(remainByte[2],
- remainByte[3],
- SS3Flag);
- charOff++;
- DesignatorLength = 3;
- break;
- default:
- DesignatorLength = 0;
- }
- }
- }
- }
- if (remainIndex > DesignatorLength) {
- for(i = 0; i < remainIndex-DesignatorLength; i++)
- remainByte[i] = remainByte[DesignatorLength+1+i];
- remainIndex = i-1;
- } else {
- remainIndex = -1;
- }
- break;
- default:
- if (!shiftout) {
- output[charOff] = (char)remainByte[0];
- charOff++;
- } else {
- switch (state) {
- case G0:
- firstByte = remainByte[0];
- state = G1;
- break;
- case G1:
- output[charOff] = getUnicode(firstByte, remainByte[0],
- SOFlag);
- charOff++;
- state = G0;
- break;
- }
- }
- if (remainIndex > 0)
- System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
- remainIndex--;
- }
- }
- return charOff - outOff;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO2022CN.java b/jdk/src/share/classes/sun/io/ByteToCharISO2022CN.java
deleted file mode 100644
index 1213606..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO2022CN.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * @author Tom Zhou
- */
-public class ByteToCharISO2022CN extends ByteToCharConverter
-{
- private String SODesignator[];
- private String SS2Designator[] = null;
- private String SS3Designator[] = null;
- private ByteToCharConverter SOConverter[];
- private ByteToCharConverter SS2Converter[] = null;
- private ByteToCharConverter SS3Converter[] = null;
-
- private static final byte ISO_ESC = 0x1b;
- private static final byte ISO_SI = 0x0f;
- private static final byte ISO_SO = 0x0e;
- private static final byte ISO_SS2_7 = 0x4e;
- private static final byte ISO_SS3_7 = 0x4f;
- private static final byte MSB = (byte)0x80;
- private static final char REPLACE_CHAR = '\uFFFD';
- private static final byte maximumDesignatorLength = 3;
-
- private static final byte SOFlag = 0;
- private static final byte SS2Flag = 1;
- private static final byte SS3Flag = 2;
- private static final byte G0 = 0;
- private static final byte G1 = 1;
-
- private ByteToCharConverter tmpConverter[];
-
- private int curSODes, curSS2Des, curSS3Des;
- private boolean shiftout;
-
- private byte remainByte[] = new byte[10];
- private int remainIndex = -1;
- private byte state, firstByte;
-
- public void reset()
- {
- int i = 0;
-
- shiftout = false;
- state = G0;
- firstByte = 0;
-
- curSODes = 0;
- curSS2Des = 0;
- curSS3Des = 0;
-
- charOff = byteOff = 0;
- remainIndex = -1;
-
- for(i = 0; i < remainByte.length; i++)
- remainByte[i] = 0;
- }
-
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- int i;
- if (state != G0) {
- badInputLength = 0;
- throw new MalformedInputException();
- }
- reset();
- return 0;
- }
-
- private byte[] savetyGetSrc(byte[] input, int inOff, int inEnd, int nbytes)
- {
- int i;
- byte tmp[];
-
- if(inOff <= (inEnd-nbytes+1))
- tmp = new byte[nbytes];
- else
- tmp = new byte[inEnd-inOff];
-
- for(i = 0; i < tmp.length; i++)
- tmp[i] = input[inOff+i];
- return tmp;
- }
-
- private char getUnicode(byte byte1, byte byte2, byte shiftFlag)
- {
- byte1 |= MSB;
- byte2 |= MSB;
- char[] tmpChar = new char[1];
-
- switch(shiftFlag) {
- case SOFlag:
- try {
- byte[] tmpByte = {byte1,byte2};
- SOConverter[curSODes].convert(tmpByte, 0, 2, tmpChar, 0, 1);
- }
- catch (Exception e) {}
- break;
- case SS2Flag:
- try {
- byte[] tmpByte = {(byte)0x8e, (byte)0xa2, byte1, byte2};
- SS2Converter[curSS2Des].convert(tmpByte, 0, 4, tmpChar, 0, 1);
- }
- catch (Exception e){}
- break;
- case SS3Flag:
- try {
- byte[] tmpByte = {(byte)0x8e, (byte)0xa3, byte1,byte2};
- SS3Converter[curSS3Des].convert(tmpByte, 0, 4, tmpChar, 0, 1);
- }
- catch (Exception e){}
- break;
- default:
- tmpChar[0] = REPLACE_CHAR;
- }
- return tmpChar[0];
- }
-
- public final int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws ConversionBufferFullException,
- MalformedInputException
- {
- int i;
- int DesignatorLength = 0;
- charOff = outOff;
- byteOff = inOff;
-
- // Loop until we hit the end of the input
- while (byteOff < inEnd) {
- // If we don't have room for the output, throw an exception
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
- if(remainIndex < 0) {
- remainByte[0] = input[byteOff];
- remainIndex = 0;
- byteOff++;
- }
- switch (remainByte[0]) {
- case ISO_SO:
- shiftout = true;
- if(remainIndex > 0)
- System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
- remainIndex--;
- break;
- case ISO_SI:
- shiftout = false;
- if(remainIndex > 0)
- System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
- remainIndex--;
- break;
- case ISO_ESC:
- byte tmp[] = savetyGetSrc(input, byteOff, inEnd,
- (maximumDesignatorLength-remainIndex));
- System.arraycopy(tmp, 0, remainByte, remainIndex+1, tmp.length);
-
- remainIndex += tmp.length;
- byteOff += tmp.length;
- if(tmp.length<(maximumDesignatorLength-remainIndex))
- break;
- String tmpString = new String(remainByte, 1, remainIndex);
- for (i = 0; i < SODesignator.length; i++) {
- if(tmpString.indexOf(SODesignator[i]) == 0) {
- curSODes = i;
- DesignatorLength = SODesignator[i].length();
- break;
- }
- }
-
- if (DesignatorLength == 0) { // designator not recognized
- badInputLength = tmp.length;
- throw new MalformedInputException();
- }
-
- if (i == SODesignator.length) {
- for (i = 0; i < SS2Designator.length; i++) {
- if(tmpString.indexOf(SS2Designator[i]) == 0) {
- curSS2Des = i;
- DesignatorLength = SS2Designator[i].length();
- break;
- }
- }
- if(i == SS2Designator.length) {
- for(i = 0; i < SS3Designator.length; i++) {
- if (tmpString.indexOf(SS3Designator[i]) == 0) {
- curSS3Des = i;
- DesignatorLength = SS3Designator[i].length();
- break;
- }
- }
- if (i == SS3Designator.length) {
- switch(remainByte[1]) {
- case ISO_SS2_7:
- output[charOff] = getUnicode(remainByte[2],
- remainByte[3],
- SS2Flag);
- charOff++;
- DesignatorLength = 3;
- break;
- case ISO_SS3_7:
- output[charOff] = getUnicode(remainByte[2],
- remainByte[3],
- SS3Flag);
- charOff++;
- DesignatorLength = 3;
- break;
- default:
- DesignatorLength = 0;
- }
- }
- }
- }
- if (remainIndex > DesignatorLength) {
- for(i = 0; i < remainIndex-DesignatorLength; i++)
- remainByte[i] = remainByte[DesignatorLength+1+i];
- remainIndex = i-1;
- } else {
- remainIndex = -1;
- }
- break;
- default:
- if (!shiftout) {
- output[charOff] = (char)remainByte[0];
- charOff++;
- } else {
- switch (state) {
- case G0:
- firstByte = remainByte[0];
- state = G1;
- break;
- case G1:
- output[charOff] = getUnicode(firstByte, remainByte[0],
- SOFlag);
- charOff++;
- state = G0;
- break;
- }
- }
- if (remainIndex > 0)
- System.arraycopy(remainByte, 1, remainByte, 0, remainIndex);
- remainIndex--;
- }
- }
- return charOff - outOff;
- }
-
- public ByteToCharISO2022CN()
- {
- SODesignator = new String[3];
- SODesignator[0] = "$A";
- SODesignator[1] = "$)A";
- SODesignator[2] = "$)G";
- SS2Designator = new String[1];
- SS2Designator[0] = "$*H";
- SS3Designator = new String[1];
- SS3Designator[0] = "$+I";
-
- SOConverter = new ByteToCharConverter[3];
- SS2Converter = new ByteToCharConverter[1];
- SS3Converter = new ByteToCharConverter[1];
-
- try {
- SOConverter[0] = SOConverter[1]
- = ByteToCharConverter.getConverter("GB2312");
- SOConverter[2] = SS2Converter[0] = SS3Converter[0]
- = ByteToCharConverter.getConverter("CNS11643");
- } catch (Exception e) {};
- }
-
- // Return the character set id
- public String getCharacterEncoding()
- {
- return "ISO2022CN";
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO2022JP.java b/jdk/src/share/classes/sun/io/ByteToCharISO2022JP.java
deleted file mode 100644
index 0519cf9..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO2022JP.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-public class ByteToCharISO2022JP extends ByteToCharJIS0208 {
-
- private static final int ASCII = 0; // ESC ( B
- private static final int JISX0201_1976 = 1; // ESC ( J
- private static final int JISX0208_1978 = 2; // ESC $ @
- private static final int JISX0208_1983 = 3; // ESC $ B
- private static final int JISX0201_1976_KANA = 4; // ESC ( I
- private static final int SHIFTOUT = 5; // SO (0x0e)
-
- private int currentState;
- private int savedSize;
- private byte[] savedBytes;
-
- public ByteToCharISO2022JP() {
- super();
- savedBytes = new byte[2];
- currentState = ASCII;
- savedSize = 0;
- }
-
- public int flush(char [] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (savedSize != 0) {
- savedSize = 0;
- currentState = ASCII;
- badInputLength = 0;
- throw new MalformedInputException();
- }
- byteOff = charOff = 0;
- return 0;
- }
-
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int previousState = ASCII;
- int inputSize = 0;
- char outputChar = '\uFFFD';
- // readOff keeps the actual buffer's pointer.
- // byteOff keeps original buffer's pointer.
- int readOff = byteOff = inOff;
-
- if (savedSize != 0) {
- if (savedBytes[0] == 0x1b) { // ESC
- if ((savedSize == 2 &&
- (savedBytes[1] == 0x28 &&
- input[0] != 'B' &&
- input[0] != 'J' &&
- input[0] != 'I') &&
- (savedBytes[1] == 0x24 &&
- input[0] != '@' &&
- input[0] != 'B')) ||
- ((savedSize == 1) &&
- (input[0] != 0x28 &&
- input[0] != 0x24))) {
- badInputLength = 0;
- throw new MalformedInputException();
- }
- if ((inEnd - inOff) == 1 && savedSize == 1 &&
- savedBytes[0] == 0x1b) {
- savedSize = 2;
- savedBytes[1] = input[0];
- byteOff++;
- return 0;
- }
- }
- byte[] newBuf = new byte[inEnd - inOff + savedSize];
- for (int i = 0; i < savedSize; i++) {
- newBuf[i] = savedBytes[i];
- }
- System.arraycopy(input, inOff, newBuf, savedSize, inEnd - inOff);
- byteOff -= savedSize;
- input = newBuf;
- inOff = 0;
- inEnd = newBuf.length;
- savedSize = 0;
- }
-
- charOff = outOff;
- readOff = inOff;
-
- while(readOff < inEnd) {
- int byte1, byte2, byte3;
- boolean noOutput = false;
-
- // Is there room in the output buffer for the result?
- if (charOff >= outEnd) {
- throw new ConversionBufferFullException();
- }
-
- // Get the input byte
- byte1 = input[readOff] & 0xFF;
- inputSize = 1;
-
- if ((byte1 & (byte)0x80) != 0){
- badInputLength = 1;
- throw new MalformedInputException();
- }
-
- // Is this a escape sequence?
- while (byte1 == 0x1b || byte1 == 0x0e || byte1 == 0x0f) {
- if (byte1 == 0x1b){ // ESC
- if (readOff + inputSize + 1 >= inEnd) {
- if (readOff + inputSize >= inEnd) {
- savedSize = 1;
- savedBytes[0] = (byte)byte1;
- } else {
- savedSize = 2;
- savedBytes[0] = (byte)byte1;
- savedBytes[1] = input[readOff + inputSize];
- inputSize++;
- }
- break;
- }
- byte2 = input[readOff + inputSize] & 0xFF;
- inputSize++;
- if ((byte2 & (byte)0x80) != 0){
- badInputLength = 2;
- throw new MalformedInputException();
- }
- if (byte2 == 0x28){
- byte3 = input[readOff + inputSize] & 0xFF;
- inputSize++;
- if (byte3 == 'B'){
- currentState = ASCII;
- } else if (byte3 == 'J'){
- currentState = JISX0201_1976;
- } else if (byte3 == 'I'){
- currentState = JISX0201_1976_KANA;
- } else {
- // illegal ESC sequence
- badInputLength = 3;
- throw new MalformedInputException();
- }
- } else if (byte2 == '$'){
- byte3 = input[readOff + inputSize] & 0xFF;
- inputSize++;
- if ((byte3 & (byte)0x80) != 0){
- badInputLength = 3;
- throw new MalformedInputException();
- }
- if (byte3 == '@'){
- currentState = JISX0208_1978;
- } else if (byte3 == 'B'){
- currentState = JISX0208_1983;
- } else {
- // illegal ESC sequence
- badInputLength = 3;
- throw new MalformedInputException();
- }
- } else {
- // illegal ESC sequence
- badInputLength = 2;
- throw new MalformedInputException();
- }
- if (readOff + inputSize >= inEnd) {
- noOutput = true;
- break;
- } else {
- byte1 = input[readOff + inputSize];
- inputSize++;
- }
- } else if (byte1 == 0x0e){ // shift out for one byte kana
- previousState = currentState;
- currentState = SHIFTOUT;
- if (readOff + inputSize >= inEnd) {
- noOutput = true;
- break;
- }
- byte1 = input[readOff + inputSize];
- inputSize++;
- if ((byte1 & (byte)0x80) != 0){
- badInputLength = 1;
- throw new MalformedInputException();
- }
- } else if (byte1 == 0x0f){ // shift in for previous mode
- currentState = previousState;
- if (readOff + inputSize >= inEnd) {
- noOutput = true;
- break;
- }
- byte1 = input[readOff + inputSize];
- inputSize++;
- if ((byte1 & (byte)0x80) != 0){
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- }
- if (noOutput || savedSize != 0) {
- byteOff += inputSize;
- break;
- }
- noOutput = false;
- switch (currentState){
- case ASCII:
- outputChar = (char)(byte1 & 0xff);
- break;
- case JISX0201_1976:
- switch (byte1) {
- case 0x5c:
- outputChar = '\u00a5';
- break;
- case 0x7e:
- outputChar = '\u203e';
- break;
- default:
- outputChar = (char)byte1;
- break;
- }
- break;
- case JISX0208_1978:
- case JISX0208_1983:
- if (readOff + inputSize >= inEnd) {
- savedSize = 1;
- savedBytes[0] = (byte)byte1;
- break;
- }
- byte2 = input[readOff + inputSize] & 0xff;
- inputSize++;
- if ((byte2 & (byte)0x80) != 0){
- badInputLength = 1;
- throw new MalformedInputException();
- }
- // jisx0208Chars table convert FULLWIDTH_REVERSE_SOLIDUS
- // 0x2140 to REVERSE_SOLIDUS (BACKSLASH) 0x5c.
- // This behavior causes problem because
- // 0x5c is special escape character for java.
- if (byte1 == 0x21 && byte2 == 0x40) {
- outputChar = '\uFF3C';
- } else {
- try {
- outputChar = getUnicode(byte1, byte2);
- } catch (ArrayIndexOutOfBoundsException e) {
- outputChar = '\uFFFD';
- }
- }
- break;
- case JISX0201_1976_KANA:
- case SHIFTOUT:
- if (byte1 > 0x60) {
- badInputLength = 1;
- throw new MalformedInputException();
- }
- outputChar = (char)(byte1 + 0xff40);
- break;
- }
-
- if (savedSize != 0) {
- byteOff += inputSize;
- break;
- }
-
- if (outputChar == '\uFFFD') {
- if (subMode)
- outputChar = subChars[0];
- else {
- badInputLength = inputSize;
- throw new UnknownCharacterException();
- }
- }
- readOff += inputSize;
- byteOff += inputSize;
- output[charOff++] = outputChar;
- }
-
- return charOff - outOff;
- }
-
- public void reset() {
- byteOff = charOff = 0;
- currentState = ASCII;
- savedSize = 0;
- }
-
- public String getCharacterEncoding() {
- return "ISO2022JP";
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO2022KR.java b/jdk/src/share/classes/sun/io/ByteToCharISO2022KR.java
deleted file mode 100644
index 40514db..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO2022KR.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-public class ByteToCharISO2022KR extends ByteToCharISO2022
-{
- public ByteToCharISO2022KR()
- {
- SODesignator = new String[1];
- SODesignator[0] = "$)C";
-
- SOConverter = new ByteToCharConverter[1];
-
- try {
- SOConverter[0] = ByteToCharConverter.getConverter("KSC5601");
- } catch (Exception e) {};
- }
-
- // Return the character set id
- public String getCharacterEncoding()
- {
- return "ISO2022KR";
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_1.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_1.java
deleted file mode 100644
index b9cb76a..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_1.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-/**
-* A algorithmic conversion from ISO 8859-1 to Unicode
-*
-* @author Lloyd Honomichl
-* @author Asmus Freytag
-*/
-public class ByteToCharISO8859_1 extends ByteToCharConverter {
-
- // Return the character set id
- public String getCharacterEncoding()
- {
- return "ISO8859_1";
- }
-
- public int flush(char[] output, int outStart, int outEnd) {
- // This converter will not buffer any data.
- byteOff = charOff = 0;
- return 0;
- }
-
- /**
- * Algorithmic character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
-
- throws ConversionBufferFullException
- {
- int bound = inOff + (outEnd - outOff);
- if (bound >= inEnd) {
- bound = inEnd;
- }
- int bytesWritten = inEnd - inOff;
-
-
- // Loop until we hit the end of the input
- try {
- while(inOff < bound) {
- output[outOff++] = (char) (0xff & input[inOff++]);
- }
- } finally {
- charOff = outOff;
- byteOff = inOff;
- }
-
- // If we don't have room for the output, throw an exception
- if (bound < inEnd)
- throw new ConversionBufferFullException();
-
- // Return the length written to the output buffer
- return bytesWritten;
- }
-
- /*
- Reset after finding bad input
- */
- public void reset() {
- byteOff = charOff = 0;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_13.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_13.java
deleted file mode 100644
index a6d0e1b..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_13.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_13;
-
-/**
- * A table to convert ISO8859_13 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_13 extends ByteToCharSingleByte {
-
- private final static ISO_8859_13 nioCoder = new ISO_8859_13();
-
- public String getCharacterEncoding() {
- return "ISO8859_13";
- }
-
- public ByteToCharISO8859_13() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_15.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_15.java
deleted file mode 100644
index 40428f4..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_15.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_15;
-
-/**
- * A table to convert ISO8859_15 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_15 extends ByteToCharSingleByte {
-
- private final static ISO_8859_15 nioCoder = new ISO_8859_15();
-
- public String getCharacterEncoding() {
- return "ISO8859_15";
- }
-
- public ByteToCharISO8859_15() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_2.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_2.java
deleted file mode 100644
index 21befbf..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_2.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_2;
-
-/**
- * A table to convert ISO8859_2 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_2 extends ByteToCharSingleByte {
-
- private final static ISO_8859_2 nioCoder = new ISO_8859_2();
-
- public String getCharacterEncoding() {
- return "ISO8859_2";
- }
-
- public ByteToCharISO8859_2() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_3.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_3.java
deleted file mode 100644
index 1d84bbb..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_3.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.ISO_8859_3;
-
-/**
- * A table to convert ISO8859_3 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_3 extends ByteToCharSingleByte {
-
- private final static ISO_8859_3 nioCoder = new ISO_8859_3();
-
- public String getCharacterEncoding() {
- return "ISO8859_3";
- }
-
- public ByteToCharISO8859_3() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_4.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_4.java
deleted file mode 100644
index 6281b55..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_4.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_4;
-
-/**
- * A table to convert ISO8859_4 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_4 extends ByteToCharSingleByte {
-
- private final static ISO_8859_4 nioCoder = new ISO_8859_4();
-
- public String getCharacterEncoding() {
- return "ISO8859_4";
- }
-
- public ByteToCharISO8859_4() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_5.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_5.java
deleted file mode 100644
index bf798bd..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_5.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_5;
-
-/**
- * A table to convert ISO8859_5 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_5 extends ByteToCharSingleByte {
-
- private final static ISO_8859_5 nioCoder = new ISO_8859_5();
-
- public String getCharacterEncoding() {
- return "ISO8859_5";
- }
-
- public ByteToCharISO8859_5() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_6.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_6.java
deleted file mode 100644
index 2acee21..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_6.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.ISO_8859_6;
-
-/**
- * A table to convert ISO8859_6 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_6 extends ByteToCharSingleByte {
-
- private final static ISO_8859_6 nioCoder = new ISO_8859_6();
-
- public String getCharacterEncoding() {
- return "ISO8859_6";
- }
-
- public ByteToCharISO8859_6() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_7.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_7.java
deleted file mode 100644
index 440e76c..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_7.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_7;
-
-
-/**
- * A table to convert ISO8859_7 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_7 extends ByteToCharSingleByte {
-
- private final static ISO_8859_7 nioCoder = new ISO_8859_7();
-
- public String getCharacterEncoding() {
- return "ISO8859_7";
- }
-
- public ByteToCharISO8859_7() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_8.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_8.java
deleted file mode 100644
index 565e3bd..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_8.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.ISO_8859_8;
-
-/**
- * A table to convert ISO8859_8 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_8 extends ByteToCharSingleByte {
-
- private final static ISO_8859_8 nioCoder = new ISO_8859_8();
-
- public String getCharacterEncoding() {
- return "ISO8859_8";
- }
-
- public ByteToCharISO8859_8() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO8859_9.java b/jdk/src/share/classes/sun/io/ByteToCharISO8859_9.java
deleted file mode 100644
index 7bedec0..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharISO8859_9.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_9;
-
-/**
- * A table to convert ISO8859_9 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharISO8859_9 extends ByteToCharSingleByte {
-
- private final static ISO_8859_9 nioCoder = new ISO_8859_9();
-
- public String getCharacterEncoding() {
- return "ISO8859_9";
- }
-
- public ByteToCharISO8859_9() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharJIS0201.java b/jdk/src/share/classes/sun/io/ByteToCharJIS0201.java
deleted file mode 100644
index e84cab6..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharJIS0201.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table to convert JIS0201 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-class ByteToCharJIS0201 extends ByteToCharSingleByte {
-
- public String getCharacterEncoding() {
- return "JIS0201";
- }
-
- public ByteToCharJIS0201() {
- super.byteToCharTable = byteToCharTable;
- }
-
- private final static String byteToCharTable =
-
- "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x80 - 0x87
- "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F
- "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x90 - 0x97
- "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x98 - 0x9F
- "\uFFFD\uFF61\uFF62\uFF63\uFF64\uFF65\uFF66\uFF67" + // 0xA0 - 0xA7
- "\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F" + // 0xA8 - 0xAF
- "\uFF70\uFF71\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77" + // 0xB0 - 0xB7
- "\uFF78\uFF79\uFF7A\uFF7B\uFF7C\uFF7D\uFF7E\uFF7F" + // 0xB8 - 0xBF
- "\uFF80\uFF81\uFF82\uFF83\uFF84\uFF85\uFF86\uFF87" + // 0xC0 - 0xC7
- "\uFF88\uFF89\uFF8A\uFF8B\uFF8C\uFF8D\uFF8E\uFF8F" + // 0xC8 - 0xCF
- "\uFF90\uFF91\uFF92\uFF93\uFF94\uFF95\uFF96\uFF97" + // 0xD0 - 0xD7
- "\uFF98\uFF99\uFF9A\uFF9B\uFF9C\uFF9D\uFF9E\uFF9F" + // 0xD8 - 0xDF
- "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xE0 - 0xE7
- "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xE8 - 0xEF
- "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF0 - 0xF7
- "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF8 - 0xFF
- "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07
- "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F
- "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17
- "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F
- "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27
- "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F
- "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37
- "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F
- "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47
- "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F
- "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57
- "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F
- "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67
- "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F
- "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77
- "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharJIS0208.java b/jdk/src/share/classes/sun/io/ByteToCharJIS0208.java
deleted file mode 100644
index fb674e2..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharJIS0208.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-/**
- * Tables and data to convert JIS0208 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-import sun.nio.cs.ext.JIS_X_0208_Decoder;
-
-public class ByteToCharJIS0208 extends ByteToCharDoubleByte {
-
- public String getCharacterEncoding() {
- return "JIS0208";
- }
-
- public ByteToCharJIS0208() {
- super.index1 = JIS_X_0208_Decoder.getIndex1();
- super.index2 = JIS_X_0208_Decoder.getIndex2();
- start = 0x21;
- end = 0x7E;
- }
-
- protected char convSingleByte(int b) {
- //Fix bug#4179800 - JIS0208 is 7bit,double-byte encoding
- return REPLACE_CHAR;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharJIS0208_Solaris.java b/jdk/src/share/classes/sun/io/ByteToCharJIS0208_Solaris.java
deleted file mode 100644
index 2b64b6e..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharJIS0208_Solaris.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0208_Solaris_Decoder;
-
-/**
- * Tables and data to convert JIS0208_Solaris to Unicode
- *
- * Vendor defined chars added for benefit of vendor defined character
- * supplemented mappings for EUC-JP-Solaris/PCK Solaris variants of EUC-JP
- * and SJIS/Shift_JIS (4765370)
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharJIS0208_Solaris extends ByteToCharDoubleByte {
-
- public String getCharacterEncoding() {
- return "JIS0208_Solaris";
- }
-
- protected char convSingleByte(int b) {
- //Fix bug#4179800 - JIS0208 is 7bit,double-byte encoding
- return REPLACE_CHAR;
- }
-
- public ByteToCharJIS0208_Solaris() {
- super.index1 = JIS_X_0208_Solaris_Decoder.getIndex1();
- super.index2 = JIS_X_0208_Solaris_Decoder.getIndex2();
- start = 0x21;
- end = 0x7E;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharJIS0212.java b/jdk/src/share/classes/sun/io/ByteToCharJIS0212.java
deleted file mode 100644
index bc9486f..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharJIS0212.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0212_Decoder;
-
-/**
- * Tables and data to convert JIS0212 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-
-public class ByteToCharJIS0212 extends ByteToCharDoubleByte {
-
- public String getCharacterEncoding() {
- return "JIS0212";
- }
-
- protected char convSingleByte(int b) {
- //Fix bug#4179800 - JIS0212 is 7bit,double-byte encoding
- return REPLACE_CHAR;
- }
-
- public ByteToCharJIS0212() {
- super.index1 = JIS_X_0212_Decoder.getIndex1();
- super.index2 = JIS_X_0212_Decoder.getIndex2();
- start = 0x21;
- end = 0x7E;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharJIS0212_Solaris.java b/jdk/src/share/classes/sun/io/ByteToCharJIS0212_Solaris.java
deleted file mode 100644
index 8ea0247..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharJIS0212_Solaris.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0212_Solaris_Decoder;
-
-/**
- * Tables and data to convert JIS0212_Solaris to Unicode
- * Solaris ==> vendor defined characters -- NEC row 13 + IBM extended
- * selected character set.
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharJIS0212_Solaris extends ByteToCharDoubleByte {
-
- public String getCharacterEncoding() {
- return "JIS0212_Solaris";
- }
-
- protected char convSingleByte(int b) {
- //Fix bug#4179800 - JIS0212 is 7bit,double-byte encoding
- return REPLACE_CHAR;
- }
-
- public ByteToCharJIS0212_Solaris() {
- super.index1 = JIS_X_0212_Solaris_Decoder.getIndex1();
- super.index2 = JIS_X_0212_Solaris_Decoder.getIndex2();
- start = 0x21;
- end = 0x7E;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharJISAutoDetect.java b/jdk/src/share/classes/sun/io/ByteToCharJISAutoDetect.java
deleted file mode 100644
index 47cc33c..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharJISAutoDetect.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import java.io.UnsupportedEncodingException;
-import sun.nio.cs.ext.JISAutoDetect;
-
-public class ByteToCharJISAutoDetect extends ByteToCharConverter {
-
- private final static int EUCJP_MASK = 0x01;
- private final static int SJIS2B_MASK = 0x02;
- private final static int SJIS1B_MASK = 0x04;
- private final static int EUCJP_KANA1_MASK = 0x08;
- private final static int EUCJP_KANA2_MASK = 0x10;
- private final static byte[] maskTable1 = JISAutoDetect.getByteMask1();
- private final static byte[] maskTable2 = JISAutoDetect.getByteMask2();
-
- private final static int SS2 = 0x8e;
- private final static int SS3 = 0x8f;
-
- // SJISName is set to either "SJIS" or "MS932"
- private String SJISName;
- private String EUCJPName;
-
- private String convName = null;
- private ByteToCharConverter detectedConv = null;
- private ByteToCharConverter defaultConv = null;
-
- public ByteToCharJISAutoDetect() {
- super();
- SJISName = CharacterEncoding.getSJISName();
- EUCJPName = CharacterEncoding.getEUCJPName();
- defaultConv = new ByteToCharISO8859_1();
- defaultConv.subChars = subChars;
- defaultConv.subMode = subMode;
- }
-
- public int flush(char [] output, int outStart, int outEnd)
- throws MalformedInputException, ConversionBufferFullException
- {
- badInputLength = 0;
- if(detectedConv != null)
- return detectedConv.flush(output, outStart, outEnd);
- else
- return defaultConv.flush(output, outStart, outEnd);
- }
-
-
- /**
- * Character conversion
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int num = 0;
-
- charOff = outOff;
- byteOff = inOff;
-
- try {
- if (detectedConv == null) {
- int euckana = 0;
- int ss2count = 0;
- int firstmask = 0;
- int secondmask = 0;
- int cnt;
- boolean nonAsciiFound = false;
-
- for (cnt = inOff; cnt < inEnd; cnt++) {
- firstmask = 0;
- secondmask = 0;
- int byte1 = input[cnt]&0xff;
- int byte2;
-
- // TODO: should check valid escape sequences!
- if (byte1 == 0x1b) {
- convName = "ISO2022JP";
- break;
- }
-
- // Try to convert all leading ASCII characters.
- if ((nonAsciiFound == false) && (byte1 < 0x80)) {
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
- output[charOff++] = (char) byte1;
- byteOff++;
- num++;
- continue;
- }
-
- // We can no longer convert ASCII.
- nonAsciiFound = true;
-
- firstmask = maskTable1[byte1];
- if (byte1 == SS2)
- ss2count++;
-
- if (firstmask != 0) {
- if (cnt+1 < inEnd) {
- byte2 = input[++cnt] & 0xff;
- secondmask = maskTable2[byte2];
- int mask = firstmask & secondmask;
- if (mask == EUCJP_MASK) {
- convName = EUCJPName;
- break;
- }
- if ((mask == SJIS2B_MASK) || (mask == SJIS1B_MASK)
- || (JISAutoDetect.canBeSJIS1B(firstmask) && secondmask == 0)) {
- convName = SJISName;
- break;
- }
-
- // If the first byte is a SS3 and the third byte
- // is not an EUC byte, it should be SJIS.
- // Otherwise, we can't determine it yet, but it's
- // very likely SJIS. So we don't take the EUCJP CS3
- // character boundary. If we tried both
- // possibilities here, it might be able to be
- // determined correctly.
- if ((byte1 == SS3) && JISAutoDetect.canBeEUCJP(secondmask)) {
- if (cnt+1 < inEnd) {
- int nextbyte = input[cnt+1] & 0xff;
- if (! JISAutoDetect.canBeEUCJP(maskTable2[nextbyte]))
- convName = SJISName;
- } else
- convName = SJISName;
- }
- if (JISAutoDetect.canBeEUCKana(firstmask, secondmask))
- euckana++;
- } else {
- if ((firstmask & SJIS1B_MASK) != 0) {
- convName = SJISName;
- break;
- }
- }
- }
- }
-
- if (nonAsciiFound && (convName == null)) {
- if ((euckana > 1) || (ss2count > 1))
- convName = EUCJPName;
- else
- convName = SJISName;
- }
-
- if (convName != null) {
- try {
- detectedConv = ByteToCharConverter.getConverter(convName);
- detectedConv.subChars = subChars;
- detectedConv.subMode = subMode;
- } catch (UnsupportedEncodingException e){
- detectedConv = null;
- convName = null;
- }
- }
- }
- } catch (ConversionBufferFullException bufferFullException) {
- throw bufferFullException;
- } catch (Exception e) {
- // If we fail to detect the converter needed for any reason,
- // use the default converter.
- detectedConv = defaultConv;
- }
-
- // If we've converted all ASCII characters, then return.
- if (byteOff == inEnd) {
- return num;
- }
-
- if(detectedConv != null) {
- try {
- num += detectedConv.convert(input, inOff + num, inEnd,
- output, outOff + num, outEnd);
- } finally {
- charOff = detectedConv.nextCharIndex();
- byteOff = detectedConv.nextByteIndex();
- badInputLength = detectedConv.badInputLength;
- }
- } else {
- try {
- num += defaultConv.convert(input, inOff + num, inEnd,
- output, outOff + num, outEnd);
- } finally {
- charOff = defaultConv.nextCharIndex();
- byteOff = defaultConv.nextByteIndex();
- badInputLength = defaultConv.badInputLength;
- }
- }
- return num;
- }
-
- public void reset() {
- if(detectedConv != null) {
- detectedConv.reset();
- detectedConv = null;
- convName = null;
- } else
- defaultConv.reset();
- charOff = byteOff = 0;
- }
-
- public String getCharacterEncoding() {
- return "JISAutoDetect";
- }
-
- public String toString() {
- String s = getCharacterEncoding();
- if (detectedConv != null) {
- s += "[" + detectedConv.getCharacterEncoding() + "]";
- } else {
- s += "[unknown]";
- }
- return s;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharJohab.java b/jdk/src/share/classes/sun/io/ByteToCharJohab.java
deleted file mode 100644
index aa1c0da..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharJohab.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharJohab extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new Johab().newDecoder();
-
- public String getCharacterEncoding() {
- return "Johab";
- }
-
- public ByteToCharJohab() {
- super(dec);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharKOI8_R.java b/jdk/src/share/classes/sun/io/ByteToCharKOI8_R.java
deleted file mode 100644
index 877077a..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharKOI8_R.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.KOI8_R;
-
-/**
- * A table to convert KOI8_R to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharKOI8_R extends ByteToCharSingleByte {
-
- private final static KOI8_R nioCoder = new KOI8_R();
-
- public String getCharacterEncoding() {
- return "KOI8_R";
- }
-
- public ByteToCharKOI8_R() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMS874.java b/jdk/src/share/classes/sun/io/ByteToCharMS874.java
deleted file mode 100644
index 290ecc1..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMS874.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MS874;
-
-/**
- * A table to convert MS874 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMS874 extends ByteToCharSingleByte {
-
- private final static MS874 nioCoder = new MS874();
-
- public String getCharacterEncoding() {
- return "MS874";
- }
-
- public ByteToCharMS874() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMS932.java b/jdk/src/share/classes/sun/io/ByteToCharMS932.java
deleted file mode 100644
index 6dcd8f9..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMS932.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharMS932 extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new MS932().newDecoder();
-
- public String getCharacterEncoding() {
- return "MS932";
- }
-
- public ByteToCharMS932() {
- super(dec);
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMS936.java b/jdk/src/share/classes/sun/io/ByteToCharMS936.java
deleted file mode 100644
index 6ad7bbc..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMS936.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharMS936 extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new MS936().newDecoder();
-
- public String getCharacterEncoding() {
- return "MS936";
- }
-
- public ByteToCharMS936() {
- super(dec);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMS949.java b/jdk/src/share/classes/sun/io/ByteToCharMS949.java
deleted file mode 100644
index 1506166..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMS949.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharMS949 extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new MS949().newDecoder();
-
-
- public String getCharacterEncoding() {
- return "MS949";
- }
-
- public ByteToCharMS949() {
- super(dec);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMS950.java b/jdk/src/share/classes/sun/io/ByteToCharMS950.java
deleted file mode 100644
index 1d6026c..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMS950.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class ByteToCharMS950 extends ByteToCharDBCS_ASCII {
-
- private static DoubleByte.Decoder dec =
- (DoubleByte.Decoder)new MS950().newDecoder();
-
- public String getCharacterEncoding() {
- return "MS950";
- }
-
- public ByteToCharMS950() {
- super(dec);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMS950_HKSCS.java b/jdk/src/share/classes/sun/io/ByteToCharMS950_HKSCS.java
deleted file mode 100644
index f03b641..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMS950_HKSCS.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.HKSCS;
-import sun.nio.cs.ext.MS950_HKSCS;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class ByteToCharMS950_HKSCS extends ByteToCharDBCS_ASCII {
-
- private static HKSCS.Decoder dec =
- (HKSCS.Decoder)new MS950_HKSCS().newDecoder();
-
- public String getCharacterEncoding() {
- return "MS950_HKSCS";
- }
-
- public ByteToCharMS950_HKSCS() {
- super(dec);
- }
-
- protected char decodeDouble(int byte1, int byte2) {
- char c = dec.decodeDouble(byte1, byte2);
- if (c == UNMAPPABLE_DECODING)
- c = dec.decodeBig5(byte1, byte2);
- return c;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacArabic.java b/jdk/src/share/classes/sun/io/ByteToCharMacArabic.java
deleted file mode 100644
index f2c69e5..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacArabic.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacArabic;
-
-/**
- * A table to convert to MacArabic to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacArabic extends ByteToCharSingleByte {
-
- private final static MacArabic nioCoder = new MacArabic();
-
- public String getCharacterEncoding() {
- return "MacArabic";
- }
-
- public ByteToCharMacArabic() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacCentralEurope.java b/jdk/src/share/classes/sun/io/ByteToCharMacCentralEurope.java
deleted file mode 100644
index 3b9c02f..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacCentralEurope.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacCentralEurope;
-
-/**
- * A table to convert to MacCentralEurope to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacCentralEurope extends ByteToCharSingleByte {
-
- private final static MacCentralEurope nioCoder = new MacCentralEurope();
-
- public String getCharacterEncoding() {
- return "MacCentralEurope";
- }
-
- public ByteToCharMacCentralEurope() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacCroatian.java b/jdk/src/share/classes/sun/io/ByteToCharMacCroatian.java
deleted file mode 100644
index 5c9202e..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacCroatian.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacCroatian;
-
-/**
- * A table to convert to MacCroatian to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacCroatian extends ByteToCharSingleByte {
-
- private final static MacCroatian nioCoder = new MacCroatian();
-
- public String getCharacterEncoding() {
- return "MacCroatian";
- }
-
- public ByteToCharMacCroatian() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacCyrillic.java b/jdk/src/share/classes/sun/io/ByteToCharMacCyrillic.java
deleted file mode 100644
index 63f66d3..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacCyrillic.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacCyrillic;
-
-/**
- * A table to convert to MacCyrillic to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacCyrillic extends ByteToCharSingleByte {
-
- private final static MacCyrillic nioCoder = new MacCyrillic();
-
- public String getCharacterEncoding() {
- return "MacCyrillic";
- }
-
- public ByteToCharMacCyrillic() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacDingbat.java b/jdk/src/share/classes/sun/io/ByteToCharMacDingbat.java
deleted file mode 100644
index ac04fc0..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacDingbat.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacDingbat;
-
-/**
- * A table to convert to MacDingbat to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacDingbat extends ByteToCharSingleByte {
-
- private final static MacDingbat nioCoder = new MacDingbat();
-
- public String getCharacterEncoding() {
- return "MacDingbat";
- }
-
- public ByteToCharMacDingbat() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacGreek.java b/jdk/src/share/classes/sun/io/ByteToCharMacGreek.java
deleted file mode 100644
index d7274ba..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacGreek.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacGreek;
-
-/**
- * A table to convert to MacGreek to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacGreek extends ByteToCharSingleByte {
-
- private final static MacGreek nioCoder = new MacGreek();
-
- public String getCharacterEncoding() {
- return "MacGreek";
- }
-
- public ByteToCharMacGreek() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacHebrew.java b/jdk/src/share/classes/sun/io/ByteToCharMacHebrew.java
deleted file mode 100644
index 562c165..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacHebrew.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacHebrew;
-
-/**
- * A table to convert to MacHebrew to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacHebrew extends ByteToCharSingleByte {
-
- private final static MacHebrew nioCoder = new MacHebrew();
-
- public String getCharacterEncoding() {
- return "MacHebrew";
- }
-
- public ByteToCharMacHebrew() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacIceland.java b/jdk/src/share/classes/sun/io/ByteToCharMacIceland.java
deleted file mode 100644
index 9322d4c..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacIceland.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacIceland;
-
-/**
- * A table to convert to MacIceland to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacIceland extends ByteToCharSingleByte {
-
- private final static MacIceland nioCoder = new MacIceland();
-
- public String getCharacterEncoding() {
- return "MacIceland";
- }
-
- public ByteToCharMacIceland() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacRoman.java b/jdk/src/share/classes/sun/io/ByteToCharMacRoman.java
deleted file mode 100644
index bb64677..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacRoman.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacRoman;
-
-/**
- * A table to convert to MacRoman to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacRoman extends ByteToCharSingleByte {
-
- private final static MacRoman nioCoder = new MacRoman();
-
- public String getCharacterEncoding() {
- return "MacRoman";
- }
-
- public ByteToCharMacRoman() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacRomania.java b/jdk/src/share/classes/sun/io/ByteToCharMacRomania.java
deleted file mode 100644
index 9567cc1..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacRomania.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacRomania;
-
-/**
- * A table to convert to MacRomania to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacRomania extends ByteToCharSingleByte {
-
- private final static MacRomania nioCoder = new MacRomania();
-
- public String getCharacterEncoding() {
- return "MacRomania";
- }
-
- public ByteToCharMacRomania() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacSymbol.java b/jdk/src/share/classes/sun/io/ByteToCharMacSymbol.java
deleted file mode 100644
index 3a5b7a3..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacSymbol.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacSymbol;
-
-/**
- * A table to convert to MacSymbol to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacSymbol extends ByteToCharSingleByte {
-
- private final static MacSymbol nioCoder = new MacSymbol();
-
- public String getCharacterEncoding() {
- return "MacSymbol";
- }
-
- public ByteToCharMacSymbol() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacThai.java b/jdk/src/share/classes/sun/io/ByteToCharMacThai.java
deleted file mode 100644
index bcef9e8..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacThai.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacThai;
-
-/**
- * A table to convert to MacThai to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacThai extends ByteToCharSingleByte {
-
- private final static MacThai nioCoder = new MacThai();
-
- public String getCharacterEncoding() {
- return "MacThai";
- }
-
- public ByteToCharMacThai() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacTurkish.java b/jdk/src/share/classes/sun/io/ByteToCharMacTurkish.java
deleted file mode 100644
index 7ab11b0..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacTurkish.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacTurkish;
-
-/**
- * A table to convert to MacTurkish to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacTurkish extends ByteToCharSingleByte {
-
- private final static MacTurkish nioCoder = new MacTurkish();
-
- public String getCharacterEncoding() {
- return "MacTurkish";
- }
-
- public ByteToCharMacTurkish() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharMacUkraine.java b/jdk/src/share/classes/sun/io/ByteToCharMacUkraine.java
deleted file mode 100644
index f24d777..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharMacUkraine.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MacUkraine;
-
-/**
- * A table to convert to MacUkraine to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharMacUkraine extends ByteToCharSingleByte {
-
- private final static MacUkraine nioCoder = new MacUkraine();
-
- public String getCharacterEncoding() {
- return "MacUkraine";
- }
-
- public ByteToCharMacUkraine() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharPCK.java b/jdk/src/share/classes/sun/io/ByteToCharPCK.java
deleted file mode 100644
index 0646f68..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharPCK.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0208_Solaris_Decoder;
-
-/**
- *
- * @author Limin Shi
- * @author Mark Son-Bell
- * @author Ian Little
- *
- *
- * PCK Converter for Solaris ja locales
- * refer to : Solaris manpage man PCK(5)
- * Incorporates mappings from NEC row 13 and IBM select extension chars
- * in addition to those defined within JIS X0208:1997 (bugID: 4765370)
- *
- */
-
-public class ByteToCharPCK extends ByteToCharSJIS {
- ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
- ByteToCharJIS0208_Solaris bcJIS0208 = new ByteToCharJIS0208_Solaris();
-
- public String getCharacterEncoding() {
- return "PCK";
- }
-
- protected char convSingleByte(int b) {
- // If the high bits are all off, it's ASCII == Unicode
- if ((b & 0xFF80) == 0) {
- return (char)b;
- }
- return bcJIS0201.getUnicode(b);
- }
-
- protected char getUnicode(int c1, int c2) {
- char outChar;
- if ((outChar = super.getUnicode(c1, c2)) != '\uFFFD') {
- // Map JIS X 0208:1983 0x213D <--> U+2015
- return ((outChar != '\u2014')? outChar: '\u2015');
- } else {
- int adjust = c2 < 0x9F ? 1 : 0;
- int rowOffset = c1 < 0xA0 ? 0x70 : 0xB0;
- int cellOffset = (adjust == 1) ? (c2 > 0x7F ? 0x20 : 0x1F) : 0x7E;
- int b1 = ((c1 - rowOffset) << 1) - adjust;
- int b2 = c2 - cellOffset;
- outChar = bcJIS0208.getUnicode(b1, b2);
- return outChar;
- }
- }
-
- String prt(int i) {
- return Integer.toString(i,16);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharSJIS.java b/jdk/src/share/classes/sun/io/ByteToCharSJIS.java
deleted file mode 100644
index 79ae211..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharSJIS.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * The SJIS converters follow the Shift JIS definition in the JIS
- * X0208:1997 standard as much as possible. The MS932 converters must
- * be used where the Microsoft Code Page 932 character repertoire and
- * Unicode mappings are required.
- *
- * @author Limin Shi
- * @author Mark Son-Bell
- */
-
-public class ByteToCharSJIS extends ByteToCharJIS0208 {
- ByteToCharJIS0201 bcJIS0201 = new ByteToCharJIS0201();
-
- public String getCharacterEncoding() {
- return "SJIS";
- }
-
- protected char convSingleByte(int b) {
- // If the high bits are all off, it's ASCII == Unicode
- if ((b & 0xFF80) == 0) {
- return (char)b;
- }
- return bcJIS0201.getUnicode(b);
- }
-
- protected char getUnicode(int c1, int c2) {
- int adjust = c2 < 0x9F ? 1 : 0;
- int rowOffset = c1 < 0xA0 ? 0x70 : 0xB0;
- int cellOffset = (adjust == 1) ? (c2 > 0x7F ? 0x20 : 0x1F) : 0x7E;
- int b1 = ((c1 - rowOffset) << 1) - adjust;
- int b2 = c2 - cellOffset;
- return super.getUnicode(b1, b2);
- }
-
- String prt(int i) {
- return Integer.toString(i,16);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharSingleByte.java b/jdk/src/share/classes/sun/io/ByteToCharSingleByte.java
deleted file mode 100644
index c271262..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharSingleByte.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * A table driven conversion from byte to char for single byte character sets.
- * The needed data tables will reside in a character set specific subclass.
- *
- * @author Lloyd Honomichl
- * @author Asmus Freytag
- */
-public abstract class ByteToCharSingleByte extends ByteToCharConverter {
-
- /**
- * Mapping table. Values supplied by subclass
- */
- protected String byteToCharTable;
-
- public String getByteToCharTable() {
- return byteToCharTable;
- }
-
- public int flush(char[] output, int outStart, int outEnd) {
- byteOff = charOff = 0;
- return 0;
- }
-
- /**
- * Converts bytes to characters according to the selected character
- * encoding.
- * Maintains internal state, so that conversions that result in
- * exceptions can be restarted by calling convert again, with
- * appropriately modified parameters.
- * Call reset before converting input that is not a continuation of
- * the previous call.
- * @return the number of characters written to output.
- * @param input byte array containing text in character set
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output character array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last character to be written to
- * @throw MalformedInputException for any sequence of bytes that is
- * illegal for the input character set, including any partial multi-byte
- * sequence which occurs at the end of an input buffer.
- * @throw UnsupportedCharacterException for any sequence of bytes that
- * contain a character not supported in the current conversion.
- * @throw BufferFullException whenever the output buffer is full
- * before the input is exhausted.
- * @see #reset
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws UnknownCharacterException,
- MalformedInputException,
- ConversionBufferFullException
- {
- char outputChar;
- int byteIndex;
-
- charOff = outOff;
- byteOff = inOff;
-
- // Loop until we hit the end of the input
- while(byteOff < inEnd) {
-
- byteIndex = input[byteOff];
-
- /* old source
- *outputChar = byteToCharTable[input[byteOff] + 128];
- */
- // Lookup the output character
- outputChar = getUnicode(byteIndex);
-
- // Is the output unmappable?
- if (outputChar == '\uFFFD') {
- if (subMode) {
- outputChar = subChars[0];
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
-
- // If we don't have room for the output, throw an exception
- if (charOff >= outEnd)
- throw new ConversionBufferFullException();
-
- // Put the character in the output buffer
- output[charOff]= outputChar;
- charOff++;
- byteOff++;
- }
-
- // Return the length written to the output buffer
- return charOff-outOff;
- }
-
- protected char getUnicode(int byteIndex) {
- int n = byteIndex + 128;
- if (n >= byteToCharTable.length() || n < 0)
- return '\uFFFD';
- return byteToCharTable.charAt(n);
- }
-
- /**
- * Resets the converter.
- * Call this method to reset the converter to its initial state
- */
- public void reset() {
- byteOff = charOff = 0;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharTIS620.java b/jdk/src/share/classes/sun/io/ByteToCharTIS620.java
deleted file mode 100644
index 7826b5b..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharTIS620.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.TIS_620;
-
-/**
- * A table to convert TIS620 to Unicode
- *
- * @author ConverterGenerator tool
- */
-
-public class ByteToCharTIS620 extends ByteToCharSingleByte {
-
- private final static TIS_620 nioCoder = new TIS_620();
-
- public String getCharacterEncoding() {
- return "TIS620";
- }
-
- public ByteToCharTIS620() {
- super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharUTF16.java b/jdk/src/share/classes/sun/io/ByteToCharUTF16.java
deleted file mode 100644
index ae5616b..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharUTF16.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-
-/**
- * Convert byte arrays containing Unicode characters into arrays of actual
- * Unicode characters, assuming an initial byte-order mark.
- */
-
-public class ByteToCharUTF16 extends ByteToCharUnicode {
-
- public ByteToCharUTF16() {
- super(AUTO, true);
- }
-
- public String getCharacterEncoding() {
- return "UTF-16";
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharUTF8.java b/jdk/src/share/classes/sun/io/ByteToCharUTF8.java
deleted file mode 100644
index 3abe593..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharUTF8.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-
-/**
- * UCS Transformation Format 8 (UTF-8) -> UCS2 (UTF16) converter
- *
- * see CharToByteUTF8.java about UTF-8 format
- */
-
-public class ByteToCharUTF8 extends ByteToCharConverter {
-
- private int savedSize;
- private byte[] savedBytes;
-
- public ByteToCharUTF8() {
- super();
- savedSize = 0;
- savedBytes = new byte[5];
- }
-
- public int flush(char[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (savedSize != 0) {
- savedSize = 0;
- badInputLength = 0;
- throw new MalformedInputException();
- }
- byteOff = charOff = 0;
- return 0;
- }
-
- /**
- * Character converson
- */
- public int convert(byte[] input, int inOff, int inEnd,
- char[] output, int outOff, int outEnd)
- throws MalformedInputException, ConversionBufferFullException
- {
- int byte1, byte2, byte3, byte4;
- char[] outputChar = new char[2];
- int outputSize;
- int byteOffAdjustment = 0;
-
- if (savedSize != 0) {
- byte[] newBuf;
- newBuf = new byte[inEnd - inOff + savedSize];
- for (int i = 0; i < savedSize; i++) {
- newBuf[i] = savedBytes[i];
- }
- System.arraycopy(input, inOff, newBuf, savedSize, inEnd - inOff);
- input = newBuf;
- inOff = 0;
- inEnd = newBuf.length;
- byteOffAdjustment = -savedSize;
- savedSize = 0;
- }
-
- charOff = outOff;
- byteOff = inOff;
- int startByteOff;
-
- while(byteOff < inEnd) {
-
- startByteOff = byteOff;
- byte1 = input[byteOff++] & 0xff;
-
- if ((byte1 & 0x80) == 0){
- outputChar[0] = (char)byte1;
- outputSize = 1;
- } else if ((byte1 & 0xe0) == 0xc0) {
- if (byteOff >= inEnd) {
- savedSize = 1;
- savedBytes[0] = (byte)byte1;
- break;
- }
- byte2 = input[byteOff++] & 0xff;
- if ((byte2 & 0xc0) != 0x80) {
- badInputLength = 2;
- byteOff += byteOffAdjustment;
- throw new MalformedInputException();
- }
- outputChar[0] = (char)(((byte1 & 0x1f) << 6) | (byte2 & 0x3f));
- outputSize = 1;
- } else if ((byte1 & 0xf0) == 0xe0){
- if (byteOff + 1 >= inEnd) {
- savedBytes[0] = (byte)byte1;
- if (byteOff >= inEnd) {
- savedSize = 1;
- } else {
- savedSize = 2;
- savedBytes[1] = input[byteOff++];
- }
- break;
- }
- byte2 = input[byteOff++] & 0xff;
- byte3 = input[byteOff++] & 0xff;
- if ((byte2 & 0xc0) != 0x80 || (byte3 & 0xc0) != 0x80) {
- badInputLength = 3;
- byteOff += byteOffAdjustment;
- throw new MalformedInputException();
- }
- outputChar[0] = (char)(((byte1 & 0x0f) << 12)
- | ((byte2 & 0x3f) << 6)
- | (byte3 & 0x3f));
- outputSize = 1;
- } else if ((byte1 & 0xf8) == 0xf0) {
- if (byteOff + 2 >= inEnd) {
- savedBytes[0] = (byte)byte1;
- if (byteOff >= inEnd) {
- savedSize = 1;
- } else if (byteOff + 1 >= inEnd) {
- savedSize = 2;
- savedBytes[1] = input[byteOff++];
- } else {
- savedSize = 3;
- savedBytes[1] = input[byteOff++];
- savedBytes[2] = input[byteOff++];
- }
- break;
- }
- byte2 = input[byteOff++] & 0xff;
- byte3 = input[byteOff++] & 0xff;
- byte4 = input[byteOff++] & 0xff;
- if ((byte2 & 0xc0) != 0x80 ||
- (byte3 & 0xc0) != 0x80 ||
- (byte4 & 0xc0) != 0x80) {
- badInputLength = 4;
- byteOff += byteOffAdjustment;
- throw new MalformedInputException();
- }
- // this byte sequence is UTF16 character
- int ucs4 = (0x07 & byte1) << 18 |
- (0x3f & byte2) << 12 |
- (0x3f & byte3) << 6 |
- (0x3f & byte4);
- outputChar[0] = (char)((ucs4 - 0x10000) / 0x400 + 0xd800);
- outputChar[1] = (char)((ucs4 - 0x10000) % 0x400 + 0xdc00);
- outputSize = 2;
- } else {
- badInputLength = 1;
- byteOff += byteOffAdjustment;
- throw new MalformedInputException();
- }
-
- if (charOff + outputSize > outEnd) {
- byteOff = startByteOff;
- byteOff += byteOffAdjustment;
- throw new ConversionBufferFullException();
- }
-
- for (int i = 0; i < outputSize; i++) {
- output[charOff + i] = outputChar[i];
- }
- charOff += outputSize;
- }
-
- byteOff += byteOffAdjustment;
- return charOff - outOff;
- }
-
- /*
- * Return the character set id
- */
- public String getCharacterEncoding() {
- return "UTF8";
- }
-
- /*
- * Reset after finding bad input
- */
- public void reset() {
- byteOff = charOff = 0;
- savedSize = 0;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharUnicode.java b/jdk/src/share/classes/sun/io/ByteToCharUnicode.java
deleted file mode 100644
index 083cf99..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharUnicode.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-import java.io.*;
-
-
-/**
- * Convert byte arrays containing Unicode characters into arrays of actual
- * Unicode characters. This class may be used directly, in which case it
- * expects the input byte array to begin with a byte-order mark, or it may be
- * subclassed in order to preset the byte order and mark behavior.
- *
- * <p> Whether or not a mark is expected, if a mark that does not match the
- * established byte order is later discovered then a
- * <tt>MalformedInputException</tt> will be thrown by the <tt>convert</tt>
- * method. If a correct mark is seen later in the input stream, it is passed
- * through as a character.
- *
- * @see ByteToCharUnicodeLittle
- * @see ByteToCharUnicodeLittleUnmarked
- * @see ByteToCharUnicodeBig
- * @see ByteToCharUnicodeBigUnmarked
- *
- * @author Mark Reinhold
- */
-
-public class ByteToCharUnicode extends ByteToCharConverter {
-
- static final char BYTE_ORDER_MARK = (char) 0xfeff;
- static final char REVERSED_MARK = (char) 0xfffe;
-
- static final int AUTO = 0;
- static final int BIG = 1;
- static final int LITTLE = 2;
-
- int originalByteOrder; /* Byte order specified at creation */
- int byteOrder; /* Byte order in use */
- boolean usesMark; /* Look for a mark and interpret it */
-
- /**
- * Creates a Unicode byte-to-char converter that expects the first pair of
- * input bytes to be a byte-order mark, which will be interpreted and
- * discarded. If the first pair of bytes is not such a mark then a
- * <tt>MalformedInputException</tt> will be thrown by the convert method.
- */
- public ByteToCharUnicode() {
- originalByteOrder = byteOrder = AUTO;
- usesMark = true;
- }
-
- /**
- * Creates a Unicode byte-to-char converter that uses the given byte order
- * and may or may not insist upon an initial byte-order mark.
- */
- protected ByteToCharUnicode(int bo, boolean m) {
- originalByteOrder = byteOrder = bo;
- usesMark = m;
- }
-
- public String getCharacterEncoding() {
- switch (originalByteOrder) {
- case BIG:
- return usesMark ? "UnicodeBig" : "UnicodeBigUnmarked";
- case LITTLE:
- return usesMark ? "UnicodeLittle" : "UnicodeLittleUnmarked";
- default:
- return "Unicode";
- }
- }
-
- boolean started = false;
- int leftOverByte;
- boolean leftOver = false;
-
- public int convert(byte[] in, int inOff, int inEnd,
- char[] out, int outOff, int outEnd)
- throws ConversionBufferFullException, MalformedInputException
- {
- byteOff = inOff;
- charOff = outOff;
-
- if (inOff >= inEnd)
- return 0;
-
- int b1, b2;
- int bc = 0;
- int inI = inOff, outI = outOff;
-
- if (leftOver) {
- b1 = leftOverByte & 0xff;
- leftOver = false;
- }
- else {
- b1 = in[inI++] & 0xff;
- }
- bc = 1;
-
- if (usesMark && !started) { /* Read initial byte-order mark */
- if (inI < inEnd) {
- b2 = in[inI++] & 0xff;
- bc = 2;
-
- char c = (char) ((b1 << 8) | b2);
- int bo = AUTO;
-
- if (c == BYTE_ORDER_MARK)
- bo = BIG;
- else if (c == REVERSED_MARK)
- bo = LITTLE;
-
- if (byteOrder == AUTO) {
- if (bo == AUTO) {
- badInputLength = bc;
- throw new
- MalformedInputException("Missing byte-order mark");
- }
- byteOrder = bo;
- if (inI < inEnd) {
- b1 = in[inI++] & 0xff;
- bc = 1;
- }
- }
- else if (bo == AUTO) {
- inI--;
- bc = 1;
- }
- else if (byteOrder == bo) {
- if (inI < inEnd) {
- b1 = in[inI++] & 0xff;
- bc = 1;
- }
- }
- else {
- badInputLength = bc;
- throw new
- MalformedInputException("Incorrect byte-order mark");
- }
-
- started = true;
- }
- }
-
- /* Loop invariant: (b1 contains the next input byte) && (bc == 1) */
- while (inI < inEnd) {
- b2 = in[inI++] & 0xff;
- bc = 2;
-
- char c;
- if (byteOrder == BIG)
- c = (char) ((b1 << 8) | b2);
- else
- c = (char) ((b2 << 8) | b1);
-
- if (c == REVERSED_MARK)
- throw new
- MalformedInputException("Reversed byte-order mark");
-
- if (outI >= outEnd)
- throw new ConversionBufferFullException();
- out[outI++] = c;
- byteOff = inI;
- charOff = outI;
-
- if (inI < inEnd) {
- b1 = in[inI++] & 0xff;
- bc = 1;
- }
- }
-
- if (bc == 1) {
- leftOverByte = b1;
- byteOff = inI;
- leftOver = true;
- }
-
- return outI - outOff;
- }
-
- public void reset() {
- leftOver = false;
- byteOff = charOff = 0;
- started = false;
- byteOrder = originalByteOrder;
- }
-
- public int flush(char buf[], int off, int len)
- throws MalformedInputException
- {
- if (leftOver) {
- reset();
- throw new MalformedInputException();
- }
- byteOff = charOff = 0;
- return 0;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharUnicodeBig.java b/jdk/src/share/classes/sun/io/ByteToCharUnicodeBig.java
deleted file mode 100644
index 40ccbed..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharUnicodeBig.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-import java.io.*;
-
-
-/**
- * Convert byte arrays containing Unicode characters into arrays of actual
- * Unicode characters, assuming a big-endian byte order.
- *
- * @author Mark Reinhold
- */
-
-public class ByteToCharUnicodeBig extends ByteToCharUnicode {
-
- public ByteToCharUnicodeBig() {
- super(BIG, true);
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharUnicodeBigUnmarked.java b/jdk/src/share/classes/sun/io/ByteToCharUnicodeBigUnmarked.java
deleted file mode 100644
index 01a1a8f..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharUnicodeBigUnmarked.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-import java.io.*;
-
-
-/**
- * Convert byte arrays containing Unicode characters into arrays of actual
- * Unicode characters, assuming a big-endian byte order and requiring no
- * byte-order mark.
- *
- * @author Mark Reinhold
- */
-
-public class ByteToCharUnicodeBigUnmarked extends ByteToCharUnicode {
-
- public ByteToCharUnicodeBigUnmarked() {
- super(BIG, false);
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharUnicodeLittle.java b/jdk/src/share/classes/sun/io/ByteToCharUnicodeLittle.java
deleted file mode 100644
index cc5a158..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharUnicodeLittle.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-import java.io.*;
-
-
-/**
- * Convert byte arrays containing Unicode characters into arrays of actual
- * Unicode characters, assuming a little-endian byte order.
- *
- * @author Mark Reinhold
- */
-
-public class ByteToCharUnicodeLittle extends ByteToCharUnicode {
-
- public ByteToCharUnicodeLittle() {
- super(LITTLE, true);
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/ByteToCharUnicodeLittleUnmarked.java b/jdk/src/share/classes/sun/io/ByteToCharUnicodeLittleUnmarked.java
deleted file mode 100644
index f77eb83..0000000
--- a/jdk/src/share/classes/sun/io/ByteToCharUnicodeLittleUnmarked.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-import java.io.*;
-
-
-/**
- * Convert byte arrays containing Unicode characters into arrays of actual
- * Unicode characters, assuming a little-endian byte order and requiring no
- * byte-order mark.
- *
- * @author Mark Reinhold
- */
-
-public class ByteToCharUnicodeLittleUnmarked extends ByteToCharUnicode {
-
- public ByteToCharUnicodeLittleUnmarked() {
- super(LITTLE, false);
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteASCII.java b/jdk/src/share/classes/sun/io/CharToByteASCII.java
deleted file mode 100644
index 51895be..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteASCII.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-public class CharToByteASCII extends CharToByteConverter {
-
- // Return the character set ID
- public String getCharacterEncoding()
- {
- return "ASCII";
- }
-
- private char highHalfZoneCode;
-
- public int flush(byte[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (highHalfZoneCode != 0) {
- highHalfZoneCode = 0;
- throw new MalformedInputException
- ("String ends with <High Half Zone code> of UTF16");
- }
- byteOff = charOff = 0;
- return 0;
- }
-
- /*
- * Character conversion
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws MalformedInputException,
- UnknownCharacterException,
- ConversionBufferFullException
- {
- char inputChar; // Input character to be converted
- byte[] outputByte; // Output byte written to output
- byte[] tmpArray = new byte[1];
- int inputSize; // Size of input
- int outputSize; // Size of output
-
- // Record beginning offsets
- charOff = inOff;
- byteOff = outOff;
-
- if (highHalfZoneCode != 0) {
- inputChar = highHalfZoneCode;
- highHalfZoneCode = 0;
- if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
- // This is legal UTF16 sequence.
- badInputLength = 1;
- throw new UnknownCharacterException();
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException
- ("Previous converted string ends with " +
- "<High Half Zone Code> of UTF16 " +
- ", but this string is not begin with <Low Half Zone>");
- }
- }
-
- // Loop until we hit the end of the input
- while(charOff < inEnd) {
- outputByte = tmpArray;
-
- // Get the input character
- inputChar = input[charOff];
-
- // default outputSize
- outputSize = 1;
-
- // Assume this is a simple character
- inputSize = 1;
-
- // Is this a high surrogate?
- if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
- // Is this the last character in the input?
- if (charOff + 1 == inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + 1];
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- // We have a valid surrogate pair. Too bad we don't map
- // surrogates. Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- inputSize = 2;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- // Is this an unaccompanied low surrogate?
- else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- }
- // Not part of a surrogate, so try to convert
- else {
- // Is this character mappable?
- if (inputChar <= '\u007F') {
- outputByte[0] = (byte)inputChar;
- } else {
- // Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- }
-
- // If we don't have room for the output, throw an exception
- if (byteOff + outputSize > outEnd)
- throw new ConversionBufferFullException();
-
- // Put the byte in the output buffer
- for (int i = 0; i < outputSize; i++) {
- output[byteOff++] = outputByte[i];
- }
- charOff += inputSize;
- }
-
- // Return the length written to the output buffer
- return byteOff-outOff;
- }
-
- // Determine if a character is mappable or not
- public boolean canConvert(char ch)
- {
- return (ch <= '\u007F');
- }
-
- // Reset the converter
- public void reset()
- {
- byteOff = charOff = 0;
- highHalfZoneCode = 0;
- }
-
- /**
- * returns the maximum number of bytes needed to convert a char
- */
- public int getMaxBytesPerChar()
- {
- return 1;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteBig5.java b/jdk/src/share/classes/sun/io/CharToByteBig5.java
deleted file mode 100644
index c6ef3e4..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteBig5.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import sun.nio.cs.ext.Big5;
-
-/**
- * Tables and data to convert Unicode to Big5
- *
- */
-
-public class CharToByteBig5 extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new Big5().newEncoder();
-
- public String getCharacterEncoding() {
- return "Big5";
- }
-
- public CharToByteBig5() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteBig5_HKSCS.java b/jdk/src/share/classes/sun/io/CharToByteBig5_HKSCS.java
deleted file mode 100644
index 706e905..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteBig5_HKSCS.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import sun.nio.cs.ext.Big5_HKSCS;
-
-public class CharToByteBig5_HKSCS extends CharToByteDBCS_ASCII {
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new Big5_HKSCS().newEncoder();
-
- public String getCharacterEncoding() {
- return "Big5_HKSCS";
- }
-
- public CharToByteBig5_HKSCS() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteBig5_Solaris.java b/jdk/src/share/classes/sun/io/CharToByteBig5_Solaris.java
deleted file mode 100644
index 503d7b2..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteBig5_Solaris.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import sun.nio.cs.ext.Big5_Solaris;
-
-public class CharToByteBig5_Solaris extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new Big5_Solaris().newEncoder();
-
- public String getCharacterEncoding() {
- return "Big5_Solaris";
- }
-
- public CharToByteBig5_Solaris() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteConverter.java b/jdk/src/share/classes/sun/io/CharToByteConverter.java
deleted file mode 100644
index 2a8a9b7..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteConverter.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import java.io.*;
-
-
-/**
- * An abstract base class for subclasses which convert Unicode
- * characters into an external encoding.
- *
- * @author Asmus Freytag
- * @author Lloyd Honomichl, Novell, Inc.
- *
- * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
- * REMOVED IN J2SE 1.6.
- */
- at Deprecated
-public abstract class CharToByteConverter {
-
- /**
- * Substitution mode flag.
- */
- protected boolean subMode = true;
-
- /**
- * Bytes to substitute for unmappable input.
- */
- protected byte[] subBytes = { (byte)'?' };
-
- /**
- * Offset of next character to be converted.
- */
- protected int charOff;
-
- /**
- * Offset of next byte to be output.
- */
- protected int byteOff;
-
- /**
- * Length of bad input that caused conversion to stop.
- */
- protected int badInputLength;
-
- /**
- * Create an instance of the default CharToByteConverter subclass.
- */
- public static CharToByteConverter getDefault() {
- Object cvt;
- cvt = Converters.newDefaultConverter(Converters.CHAR_TO_BYTE);
- return (CharToByteConverter)cvt;
- }
-
- /**
- * Returns appropriate CharToByteConverter subclass instance.
- * @param string represets encoding
- */
- public static CharToByteConverter getConverter(String encoding)
- throws UnsupportedEncodingException
- {
- Object cvt;
- cvt = Converters.newConverter(Converters.CHAR_TO_BYTE, encoding);
- return (CharToByteConverter)cvt;
- }
-
- /**
- * Returns the character set id for the conversion.
- */
- public abstract String getCharacterEncoding();
-
- /**
- * Converts an array of Unicode characters into an array of bytes
- * in the target character encoding. This method allows a buffer by
- * buffer conversion of a data stream. The state of the conversion is
- * saved between calls to convert. If a call to convert results in
- * an exception, the conversion may be continued by calling convert again
- * with suitably modified parameters. All conversions should be finished
- * with a call to the flush method.
- *
- * @return the number of bytes written to output.
- * @param input array containing Unicode characters to be converted.
- * @param inStart begin conversion at this offset in input array.
- * @param inEnd stop conversion at this offset in input array (exclusive).
- * @param output byte array to receive conversion result.
- * @param outStart start writing to output array at this offset.
- * @param outEnd stop writing to output array at this offset (exclusive).
- * @exception MalformedInputException if the input buffer contains any
- * sequence of chars that is illegal in Unicode (principally unpaired
- * surrogates and \uFFFF or \uFFFE). After this exception is thrown,
- * the method nextCharIndex can be called to obtain the index of the
- * first invalid input character. The MalformedInputException can
- * be queried for the length of the invalid input.
- * @exception UnknownCharacterException for any character that
- * that cannot be converted to the external character encoding. Thrown
- * only when converter is not in substitution mode.
- * @exception ConversionBufferFullException if output array is filled prior
- * to converting all the input.
- */
- public abstract int convert(char[] input, int inStart, int inEnd,
- byte[] output, int outStart, int outEnd)
- throws MalformedInputException,
- UnknownCharacterException,
- ConversionBufferFullException;
-
- /*
- * Converts any array of characters, including malformed surrogate
- * pairs, into an array of bytes in the target character encoding.
- * A precondition is that substitution mode is turned on. This method
- * allows a buffer by buffer conversion of a data stream.
- * The state of the conversion is saved between calls to convert.
- * All conversions should be finished with a call to the flushAny method.
- *
- * @return the number of bytes written to output.
- * @param input array containing Unicode characters to be converted.
- * @param inStart begin conversion at this offset in input array.
- * @param inEnd stop conversion at this offset in input array (exclusive).
- * @param output byte array to receive conversion result.
- * @param outStart start writing to output array at this offset.
- * @param outEnd stop writing to output array at this offset (exclusive).
- * @exception ConversionBufferFullException if output array is filled prior
- * to converting all the input.
- */
- public int convertAny(char[] input, int inStart, int inEnd,
- byte[] output, int outStart, int outEnd)
- throws ConversionBufferFullException
- {
- if (!subMode) { /* Precondition: subMode == true */
- throw new IllegalStateException("Substitution mode is not on");
- }
- /* Rely on the untested precondition that the indices are meaningful */
- /* For safety, use the public interface to charOff and byteOff, but
- badInputLength is directly modified.*/
- int localInOff = inStart;
- int localOutOff = outStart;
- while(localInOff < inEnd) {
- try {
- int discard = convert(input, localInOff, inEnd,
- output, localOutOff, outEnd);
- return (nextByteIndex() - outStart);
- } catch (MalformedInputException e) {
- byte[] s = subBytes;
- int subSize = s.length;
- localOutOff = nextByteIndex();
- if ((localOutOff + subSize) > outEnd)
- throw new ConversionBufferFullException();
- for (int i = 0; i < subSize; i++)
- output[localOutOff++] = s[i];
- localInOff = nextCharIndex();
- localInOff += badInputLength;
- badInputLength = 0;
- if (localInOff >= inEnd){
- byteOff = localOutOff;
- return (byteOff - outStart);
- }
- continue;
- }catch (UnknownCharacterException e) {
- /* Should never occur, since subMode == true */
- throw new Error("UnknownCharacterException thrown "
- + "in substititution mode",
- e);
- }
- }
- return (nextByteIndex() - outStart);
- }
-
-
-
- /**
- * Converts an array of Unicode characters into an array of bytes
- * in the target character encoding. Unlike convert, this method
- * does not do incremental conversion. It assumes that the given
- * input array contains all the characters to be converted. The
- * state of the converter is reset at the beginning of this method
- * and is left in the reset state on successful termination.
- * The converter is not reset if an exception is thrown.
- * This allows the caller to determine where the bad input
- * was encountered by calling nextCharIndex.
- * <p>
- * This method uses substitution mode when performing the conversion.
- * The method setSubstitutionBytes may be used to determine what
- * bytes are substituted. Even though substitution mode is used,
- * the state of the converter's substitution mode is not changed
- * at the end of this method.
- *
- * @return an array of bytes containing the converted characters.
- * @param input array containing Unicode characters to be converted.
- * @exception MalformedInputException if the input buffer contains any
- * sequence of chars that is illegal in Unicode (principally unpaired
- * surrogates and \uFFFF or \uFFFE). After this exception is thrown,
- * the method nextCharIndex can be called to obtain the index of the
- * first invalid input character and getBadInputLength can be called
- * to determine the length of the invalid input.
- *
- * @see #nextCharIndex
- * @see #setSubstitutionMode
- * @see #setSubstitutionBytes
- * @see #getBadInputLength
- */
- public byte[] convertAll( char input[] ) throws MalformedInputException {
- reset();
- boolean savedSubMode = subMode;
- subMode = true;
-
- byte[] output = new byte[ getMaxBytesPerChar() * input.length ];
-
- try {
- int outputLength = convert( input, 0, input.length,
- output, 0, output.length );
- outputLength += flush( output, nextByteIndex(), output.length );
-
- byte [] returnedOutput = new byte[ outputLength ];
- System.arraycopy( output, 0, returnedOutput, 0, outputLength );
- return returnedOutput;
- }
- catch( ConversionBufferFullException e ) {
- //Not supposed to happen. If it does, getMaxBytesPerChar() lied.
- throw new
- InternalError("this.getMaxBytesPerChar returned bad value");
- }
- catch( UnknownCharacterException e ) {
- // Not supposed to happen since we're in substitution mode.
- throw new InternalError();
- }
- finally {
- subMode = savedSubMode;
- }
- }
-
- /**
- * Writes any remaining output to the output buffer and resets the
- * converter to its initial state.
- *
- * @param output byte array to receive flushed output.
- * @param outStart start writing to output array at this offset.
- * @param outEnd stop writing to output array at this offset (exclusive).
- * @exception MalformedInputException if the output to be flushed contained
- * a partial or invalid multibyte character sequence. Will occur if the
- * input buffer on the last call to convert ended with the first character
- * of a surrogate pair. flush will write what it can to the output buffer
- * and reset the converter before throwing this exception. An additional
- * call to flush is not required.
- * @exception ConversionBufferFullException if output array is filled
- * before all the output can be flushed. flush will write what it can
- * to the output buffer and remember its state. An additional call to
- * flush with a new output buffer will conclude the operation.
- */
- public abstract int flush( byte[] output, int outStart, int outEnd )
- throws MalformedInputException, ConversionBufferFullException;
-
- /**
- * Writes any remaining output to the output buffer and resets the
- * converter to its initial state. May only be called when substitution
- * mode is turned on, and never complains about malformed input (always
- * substitutes).
- *
- * @param output byte array to receive flushed output.
- * @param outStart start writing to output array at this offset.
- * @param outEnd stop writing to output array at this offset (exclusive).
- * @return number of bytes writter into output.
- * @exception ConversionBufferFullException if output array is filled
- * before all the output can be flushed. flush will write what it can
- * to the output buffer and remember its state. An additional call to
- * flush with a new output buffer will conclude the operation.
- */
- public int flushAny( byte[] output, int outStart, int outEnd )
- throws ConversionBufferFullException
- {
- if (!subMode) { /* Precondition: subMode == true */
- throw new IllegalStateException("Substitution mode is not on");
- }
- try {
- return flush(output, outStart, outEnd);
- } catch (MalformedInputException e) {
- /* Assume that if a malformed input exception has occurred,
- no useful data has been placed in the output buffer.
- i.e. there is no mixture of left over good + some bad data.
- Usually occurs with a trailing high surrogate pair element.
- Special cases occur in Cp970, 949c and 933 that seem
- to be covered, but may require further investigation */
- int subSize = subBytes.length;
- byte[] s = subBytes;
- int outIndex = outStart;
- if ((outStart + subSize) > outEnd)
- throw new ConversionBufferFullException();
- for (int i = 0; i < subSize; i++)
- output[outIndex++] = s[i];
- byteOff = charOff = 0; // Reset the internal state.
- badInputLength = 0;
- return subSize;
- }
- }
-
- /**
- * Resets converter to its initial state.
- */
- public abstract void reset();
-
- /**
- * Returns true if the given character can be converted to the
- * target character encoding.
- * @return true if given character is translatable, false otherwise.
- * @param c character to test
- */
- public boolean canConvert(char c) {
- try {
- //FIXME output buffer size should use getMaxBytesPerChar value.
- char[] input = new char[1];
- byte[] output = new byte[3];
- input[0] = c;
- convert(input, 0, 1, output, 0, 3);
- return true;
- } catch(CharConversionException e){
- return false;
- }
- }
-
- /**
- * Returns the maximum number of bytes needed to convert a char. Useful
- * for calculating the maximum output buffer size needed for a particular
- * input buffer.
- */
- public abstract int getMaxBytesPerChar();
-
- /**
- * Returns the length, in chars, of the input which caused a
- * MalformedInputException. Always refers to the last
- * MalformedInputException thrown by the converter. If none have
- * ever been thrown, returns 0.
- */
- public int getBadInputLength() {
- return badInputLength;
- }
-
- /**
- * Returns the index of the character just past
- * the last character successfully converted by the previous call
- * to convert.
- */
- public int nextCharIndex() {
- return charOff;
- }
-
- /**
- * Returns the index of the byte just past the last byte written by
- * the previous call to convert.
- */
- public int nextByteIndex() {
- return byteOff;
- }
-
- /**
- * Sets converter into substitution mode. In substitution mode,
- * the converter will replace untranslatable characters in the source
- * encoding with the substitution character set by setSubstitutionBytes.
- * When not in substitution mode, the converter will throw an
- * UnknownCharacterException when it encounters untranslatable input.
- *
- * @param doSub if true, enable substitution mode.
- * @see #setSubstitutionBytes
- */
- public void setSubstitutionMode(boolean doSub) {
- subMode = doSub;
- }
-
- /**
- * Sets the substitution bytes to use when the converter is in
- * substitution mode. The given bytes should represent a valid
- * character in the target character encoding and must not be
- * longer than the value returned by getMaxBytesPerChar for this
- * converter.
- *
- * @param newSubBytes the substitution bytes
- * @exception IllegalArgumentException if given byte array is longer than
- * the value returned by the method getMaxBytesPerChar.
- * @see #setSubstitutionMode
- * @see #getMaxBytesPerChar
- */
- public void setSubstitutionBytes( byte[] newSubBytes )
- throws IllegalArgumentException
- {
- if( newSubBytes.length > getMaxBytesPerChar() ) {
- throw new IllegalArgumentException();
- }
-
- subBytes = new byte[ newSubBytes.length ];
- System.arraycopy( newSubBytes, 0, subBytes, 0, newSubBytes.length );
- }
-
- /**
- * Returns a string representation of the class.
- */
- public String toString() {
- return "CharToByteConverter: " + getCharacterEncoding();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp037.java b/jdk/src/share/classes/sun/io/CharToByteCp037.java
deleted file mode 100644
index 91a8bf6..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp037.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM037;
-
-/**
- * Tables and data to convert Unicode to Cp037
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp037 extends CharToByteSingleByte {
-
- private final static IBM037 nioCoder = new IBM037();
-
- public String getCharacterEncoding() {
- return "Cp037";
- }
-
- public CharToByteCp037() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1006.java b/jdk/src/share/classes/sun/io/CharToByteCp1006.java
deleted file mode 100644
index b55c112..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1006.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1006;
-
-/**
- * Tables and data to convert Unicode to Cp1006
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1006 extends CharToByteSingleByte {
-
- private final static IBM1006 nioCoder = new IBM1006();
-
- public String getCharacterEncoding() {
- return "Cp1006";
- }
-
- public CharToByteCp1006() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1025.java b/jdk/src/share/classes/sun/io/CharToByteCp1025.java
deleted file mode 100644
index 247ae26..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1025.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1025;
-
-/**
- * Tables and data to convert Unicode to Cp1025
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1025 extends CharToByteSingleByte {
-
- private final static IBM1025 nioCoder = new IBM1025();
-
- public String getCharacterEncoding() {
- return "Cp1025";
- }
-
- public CharToByteCp1025() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1026.java b/jdk/src/share/classes/sun/io/CharToByteCp1026.java
deleted file mode 100644
index 74962a8..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1026.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1026;
-
-/**
- * Tables and data to convert Unicode to Cp1026
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1026 extends CharToByteSingleByte {
-
- private final static IBM1026 nioCoder = new IBM1026();
-
- public String getCharacterEncoding() {
- return "Cp1026";
- }
-
- public CharToByteCp1026() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1046.java b/jdk/src/share/classes/sun/io/CharToByteCp1046.java
deleted file mode 100644
index 4bd9a3c..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1046.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1046;
-
-/**
- * Tables and data to convert Unicode to Cp1046
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1046 extends CharToByteSingleByte {
-
- private final static IBM1046 nioCoder = new IBM1046();
-
- public String getCharacterEncoding() {
- return "Cp1046";
- }
-
- public CharToByteCp1046() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1047.java b/jdk/src/share/classes/sun/io/CharToByteCp1047.java
deleted file mode 100644
index 0cb64cc..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1047.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1047;
-
-/**
- * Tables and data to convert Unicode to Cp1047
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1047 extends CharToByteSingleByte {
-
- private final static IBM1047 nioCoder = new IBM1047();
-
- public String getCharacterEncoding() {
- return "Cp1047";
- }
-
- public CharToByteCp1047() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1097.java b/jdk/src/share/classes/sun/io/CharToByteCp1097.java
deleted file mode 100644
index 812467e..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1097.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1097;
-
-/**
- * Tables and data to convert Unicode to Cp1097
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1097 extends CharToByteSingleByte {
-
- private final static IBM1097 nioCoder = new IBM1097();
-
- public String getCharacterEncoding() {
- return "Cp1097";
- }
-
- public CharToByteCp1097() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1098.java b/jdk/src/share/classes/sun/io/CharToByteCp1098.java
deleted file mode 100644
index a291bda..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1098.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1098;
-
-/**
- * Tables and data to convert Unicode to Cp1098
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1098 extends CharToByteSingleByte {
-
- private final static IBM1098 nioCoder = new IBM1098();
-
- public String getCharacterEncoding() {
- return "Cp1098";
- }
-
- public CharToByteCp1098() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1112.java b/jdk/src/share/classes/sun/io/CharToByteCp1112.java
deleted file mode 100644
index 460b663..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1112.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1112;
-
-/**
- * Tables and data to convert Unicode to Cp1112
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1112 extends CharToByteSingleByte {
-
- private final static IBM1112 nioCoder = new IBM1112();
-
- public String getCharacterEncoding() {
- return "Cp1112";
- }
-
- public CharToByteCp1112() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1122.java b/jdk/src/share/classes/sun/io/CharToByteCp1122.java
deleted file mode 100644
index 3eb8d35..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1122.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1122;
-
-/**
- * Tables and data to convert Unicode to Cp1122
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1122 extends CharToByteSingleByte {
-
- private final static IBM1122 nioCoder = new IBM1122();
-
- public String getCharacterEncoding() {
- return "Cp1122";
- }
-
- public CharToByteCp1122() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1123.java b/jdk/src/share/classes/sun/io/CharToByteCp1123.java
deleted file mode 100644
index 9c7e287..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1123.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1123;
-
-/**
- * Tables and data to convert Unicode to Cp1123
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1123 extends CharToByteSingleByte {
-
- private final static IBM1123 nioCoder = new IBM1123();
-
- public String getCharacterEncoding() {
- return "Cp1123";
- }
-
- public CharToByteCp1123() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1124.java b/jdk/src/share/classes/sun/io/CharToByteCp1124.java
deleted file mode 100644
index 5948002..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1124.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1124;
-
-/**
- * Tables and data to convert Unicode to Cp1124
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1124 extends CharToByteSingleByte {
-
- private final static IBM1124 nioCoder = new IBM1124();
-
- public String getCharacterEncoding() {
- return "Cp1124";
- }
-
- public CharToByteCp1124() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1140.java b/jdk/src/share/classes/sun/io/CharToByteCp1140.java
deleted file mode 100644
index 5b17ee4..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1140.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1140;
-
-/**
- * Tables and data to convert Unicode to Cp1140
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1140 extends CharToByteSingleByte {
-
- private final static IBM1140 nioCoder = new IBM1140();
-
- public String getCharacterEncoding() {
- return "Cp1140";
- }
-
- public CharToByteCp1140() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1141.java b/jdk/src/share/classes/sun/io/CharToByteCp1141.java
deleted file mode 100644
index fd662c7..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1141.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1141;
-
-/**
- * Tables and data to convert Unicode to Cp1141
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1141 extends CharToByteSingleByte {
-
- private final static IBM1141 nioCoder = new IBM1141();
-
- public String getCharacterEncoding() {
- return "Cp1141";
- }
-
- public CharToByteCp1141() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1142.java b/jdk/src/share/classes/sun/io/CharToByteCp1142.java
deleted file mode 100644
index 0b3a11c..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1142.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1142;
-
-/**
- * Tables and data to convert Unicode to Cp1142
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1142 extends CharToByteSingleByte {
-
- private final static IBM1142 nioCoder = new IBM1142();
-
- public String getCharacterEncoding() {
- return "Cp1142";
- }
-
- public CharToByteCp1142() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1143.java b/jdk/src/share/classes/sun/io/CharToByteCp1143.java
deleted file mode 100644
index 5417a92..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1143.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1143;
-
-/**
- * Tables and data to convert Unicode to Cp1143
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1143 extends CharToByteSingleByte {
-
- private final static IBM1143 nioCoder = new IBM1143();
-
- public String getCharacterEncoding() {
- return "Cp1143";
- }
-
- public CharToByteCp1143() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1144.java b/jdk/src/share/classes/sun/io/CharToByteCp1144.java
deleted file mode 100644
index d7eaa74..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1144.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1144;
-
-/**
- * Tables and data to convert Unicode to Cp1144
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1144 extends CharToByteSingleByte {
-
- private final static IBM1144 nioCoder = new IBM1144();
-
- public String getCharacterEncoding() {
- return "Cp1144";
- }
-
- public CharToByteCp1144() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1145.java b/jdk/src/share/classes/sun/io/CharToByteCp1145.java
deleted file mode 100644
index 637af83..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1145.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1145;
-
-/**
- * Tables and data to convert Unicode to Cp1145
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1145 extends CharToByteSingleByte {
-
- private final static IBM1145 nioCoder = new IBM1145();
-
- public String getCharacterEncoding() {
- return "Cp1145";
- }
-
- public CharToByteCp1145() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1146.java b/jdk/src/share/classes/sun/io/CharToByteCp1146.java
deleted file mode 100644
index 580209d..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1146.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1146;
-
-/**
- * Tables and data to convert Unicode to Cp1146
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1146 extends CharToByteSingleByte {
-
- private final static IBM1146 nioCoder = new IBM1146();
-
- public String getCharacterEncoding() {
- return "Cp1146";
- }
-
- public CharToByteCp1146() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1147.java b/jdk/src/share/classes/sun/io/CharToByteCp1147.java
deleted file mode 100644
index f88a3a9..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1147.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1147;
-
-/**
- * Tables and data to convert Unicode to Cp1147
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1147 extends CharToByteSingleByte {
-
- private final static IBM1147 nioCoder = new IBM1147();
-
- public String getCharacterEncoding() {
- return "Cp1147";
- }
-
- public CharToByteCp1147() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1148.java b/jdk/src/share/classes/sun/io/CharToByteCp1148.java
deleted file mode 100644
index 421761b..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1148.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1148;
-
-/**
- * Tables and data to convert Unicode to Cp1148
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1148 extends CharToByteSingleByte {
-
- private final static IBM1148 nioCoder = new IBM1148();
-
- public String getCharacterEncoding() {
- return "Cp1148";
- }
-
- public CharToByteCp1148() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1149.java b/jdk/src/share/classes/sun/io/CharToByteCp1149.java
deleted file mode 100644
index 3103faf..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1149.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM1149;
-
-/**
- * Tables and data to convert Unicode to Cp1149
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1149 extends CharToByteSingleByte {
-
- private final static IBM1149 nioCoder = new IBM1149();
-
- public String getCharacterEncoding() {
- return "Cp1149";
- }
-
- public CharToByteCp1149() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1250.java b/jdk/src/share/classes/sun/io/CharToByteCp1250.java
deleted file mode 100644
index 7561b5c..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1250.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.MS1250;
-
-/**
- * Tables and data to convert Unicode to Cp1250
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1250 extends CharToByteSingleByte {
-
- private final static MS1250 nioCoder = new MS1250();
-
- public String getCharacterEncoding() {
- return "Cp1250";
- }
-
- public CharToByteCp1250() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1251.java b/jdk/src/share/classes/sun/io/CharToByteCp1251.java
deleted file mode 100644
index 9eb0dcb..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1251.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.MS1251;
-
-/**
- * Tables and data to convert Unicode to Cp1251
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1251 extends CharToByteSingleByte {
-
- private final static MS1251 nioCoder = new MS1251();
-
- public String getCharacterEncoding() {
- return "Cp1251";
- }
-
- public CharToByteCp1251() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1252.java b/jdk/src/share/classes/sun/io/CharToByteCp1252.java
deleted file mode 100644
index 0bfc2cd..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1252.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.MS1252;
-
-/**
- * Tables and data to convert Unicode to Cp1252
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1252 extends CharToByteSingleByte {
-
- private final static MS1252 nioCoder = new MS1252();
-
- public String getCharacterEncoding() {
- return "Cp1252";
- }
-
- public CharToByteCp1252() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1253.java b/jdk/src/share/classes/sun/io/CharToByteCp1253.java
deleted file mode 100644
index 7aaef74..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1253.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.MS1253;
-
-/**
- * Tables and data to convert Unicode to Cp1253
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1253 extends CharToByteSingleByte {
-
- private final static MS1253 nioCoder = new MS1253();
-
- public String getCharacterEncoding() {
- return "Cp1253";
- }
-
- public CharToByteCp1253() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1254.java b/jdk/src/share/classes/sun/io/CharToByteCp1254.java
deleted file mode 100644
index 8ebc626..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1254.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.MS1254;
-
-/**
- * Tables and data to convert Unicode to Cp1254
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1254 extends CharToByteSingleByte {
-
- private final static MS1254 nioCoder = new MS1254();
-
- public String getCharacterEncoding() {
- return "Cp1254";
- }
-
- public CharToByteCp1254() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1255.java b/jdk/src/share/classes/sun/io/CharToByteCp1255.java
deleted file mode 100644
index 4bb8da7..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1255.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MS1255;
-
-/**
- * Tables and data to convert Unicode to Cp1255
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1255 extends CharToByteSingleByte {
-
- private final static MS1255 nioCoder = new MS1255();
-
- public String getCharacterEncoding() {
- return "Cp1255";
- }
-
- public CharToByteCp1255() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1256.java b/jdk/src/share/classes/sun/io/CharToByteCp1256.java
deleted file mode 100644
index 638df51..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1256.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MS1256;
-
-/**
- * Tables and data to convert Unicode to Cp1256
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1256 extends CharToByteSingleByte {
-
- private final static MS1256 nioCoder = new MS1256();
-
- public String getCharacterEncoding() {
- return "Cp1256";
- }
-
- public CharToByteCp1256() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1257.java b/jdk/src/share/classes/sun/io/CharToByteCp1257.java
deleted file mode 100644
index d5c174f..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1257.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.MS1257;
-
-/**
- * Tables and data to convert Unicode to Cp1257
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1257 extends CharToByteSingleByte {
-
- private final static MS1257 nioCoder = new MS1257();
-
- public String getCharacterEncoding() {
- return "Cp1257";
- }
-
- public CharToByteCp1257() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1258.java b/jdk/src/share/classes/sun/io/CharToByteCp1258.java
deleted file mode 100644
index b6e2711..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1258.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MS1258;
-
-/**
- * Tables and data to convert Unicode to Cp1258
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp1258 extends CharToByteSingleByte {
-
- private final static MS1258 nioCoder = new MS1258();
-
- public String getCharacterEncoding() {
- return "Cp1258";
- }
-
- public CharToByteCp1258() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1381.java b/jdk/src/share/classes/sun/io/CharToByteCp1381.java
deleted file mode 100644
index 06dfc91..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1381.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp1381 extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp1381";
- }
-
- public CharToByteCp1381() {
- super((DoubleByte.Encoder)new IBM1381().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp1383.java b/jdk/src/share/classes/sun/io/CharToByteCp1383.java
deleted file mode 100644
index 7e61beb..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp1383.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp1383 extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp1383";
- }
-
- public CharToByteCp1383() {
- super((DoubleByte.Encoder)new IBM1383().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp273.java b/jdk/src/share/classes/sun/io/CharToByteCp273.java
deleted file mode 100644
index dc617bf..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp273.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM273;
-
-/**
- * Tables and data to convert Unicode to Cp273
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp273 extends CharToByteSingleByte {
-
- private final static IBM273 nioCoder = new IBM273();
-
- public String getCharacterEncoding() {
- return "Cp273";
- }
-
- public CharToByteCp273() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp277.java b/jdk/src/share/classes/sun/io/CharToByteCp277.java
deleted file mode 100644
index 7d36a3e..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp277.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM277;
-
-/**
- * Tables and data to convert Unicode to Cp277
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp277 extends CharToByteSingleByte {
-
- private final static IBM277 nioCoder = new IBM277();
-
- public String getCharacterEncoding() {
- return "Cp277";
- }
-
- public CharToByteCp277() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp278.java b/jdk/src/share/classes/sun/io/CharToByteCp278.java
deleted file mode 100644
index 555dac4..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp278.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM278;
-
-/**
- * Tables and data to convert Unicode to Cp278
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp278 extends CharToByteSingleByte {
-
- private final static IBM278 nioCoder = new IBM278();
-
- public String getCharacterEncoding() {
- return "Cp278";
- }
-
- public CharToByteCp278() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp280.java b/jdk/src/share/classes/sun/io/CharToByteCp280.java
deleted file mode 100644
index e02c1ed..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp280.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM280;
-
-/**
- * Tables and data to convert Unicode to Cp280
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp280 extends CharToByteSingleByte {
-
- private final static IBM280 nioCoder = new IBM280();
-
- public String getCharacterEncoding() {
- return "Cp280";
- }
-
- public CharToByteCp280() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp284.java b/jdk/src/share/classes/sun/io/CharToByteCp284.java
deleted file mode 100644
index 110463c..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp284.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM284;
-
-/**
- * Tables and data to convert Unicode to Cp284
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp284 extends CharToByteSingleByte {
-
- private final static IBM284 nioCoder = new IBM284();
-
- public String getCharacterEncoding() {
- return "Cp284";
- }
-
- public CharToByteCp284() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp285.java b/jdk/src/share/classes/sun/io/CharToByteCp285.java
deleted file mode 100644
index f26a378..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp285.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM285;
-
-/**
- * Tables and data to convert Unicode to Cp285
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp285 extends CharToByteSingleByte {
-
- private final static IBM285 nioCoder = new IBM285();
-
- public String getCharacterEncoding() {
- return "Cp285";
- }
-
- public CharToByteCp285() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp297.java b/jdk/src/share/classes/sun/io/CharToByteCp297.java
deleted file mode 100644
index e459019..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp297.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM297;
-
-/**
- * Tables and data to convert Unicode to Cp297
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp297 extends CharToByteSingleByte {
-
- private final static IBM297 nioCoder = new IBM297();
-
- public String getCharacterEncoding() {
- return "Cp297";
- }
-
- public CharToByteCp297() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp33722.java b/jdk/src/share/classes/sun/io/CharToByteCp33722.java
deleted file mode 100644
index be12f54..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp33722.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.IBM33722;
-
-/**
-* Tables and data to convert Unicode to Cp33722
-*
-* @author Malcolm Ayres, assisted by UniMap program
-*/
-public class CharToByteCp33722
- extends CharToByteEUC
-
-{
- private final static IBM33722 nioCoder = new IBM33722();
-
- // Return the character set id
- public String getCharacterEncoding()
- {
- return "Cp33722";
- }
-
- public int getMaxBytesPerChar() {
- return 3;
- }
-
- public CharToByteCp33722()
- {
- super();
- super.mask1 = 0xFFE0;
- super.mask2 = 0x001F;
- super.shift = 5;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- super.index2a = nioCoder.getEncoderIndex2a();
- super.index2b = nioCoder.getEncoderIndex2b();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp420.java b/jdk/src/share/classes/sun/io/CharToByteCp420.java
deleted file mode 100644
index e4dbf42..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp420.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM420;
-
-/**
- * Tables and data to convert Unicode to Cp420
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp420 extends CharToByteSingleByte {
-
- private final static IBM420 nioCoder = new IBM420();
-
- public String getCharacterEncoding() {
- return "Cp420";
- }
-
- public CharToByteCp420() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp424.java b/jdk/src/share/classes/sun/io/CharToByteCp424.java
deleted file mode 100644
index 99f2ca4..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp424.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM424;
-
-/**
- * Tables and data to convert Unicode to Cp424
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp424 extends CharToByteSingleByte {
-
- private final static IBM424 nioCoder = new IBM424();
-
- public String getCharacterEncoding() {
- return "Cp424";
- }
-
- public CharToByteCp424() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp437.java b/jdk/src/share/classes/sun/io/CharToByteCp437.java
deleted file mode 100644
index 8c24b71..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp437.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM437;
-
-/**
- * Tables and data to convert Unicode to Cp437
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp437 extends CharToByteSingleByte {
-
- private final static IBM437 nioCoder = new IBM437();
-
- public String getCharacterEncoding() {
- return "Cp437";
- }
-
- public CharToByteCp437() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp500.java b/jdk/src/share/classes/sun/io/CharToByteCp500.java
deleted file mode 100644
index 6a0bf25..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp500.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM500;
-
-/**
- * Tables and data to convert Unicode to Cp500
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp500 extends CharToByteSingleByte {
-
- private final static IBM500 nioCoder = new IBM500();
-
- public String getCharacterEncoding() {
- return "Cp500";
- }
-
- public CharToByteCp500() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp737.java b/jdk/src/share/classes/sun/io/CharToByteCp737.java
deleted file mode 100644
index f1f26e4..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp737.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM737;
-
-/**
- * Tables and data to convert Unicode to Cp737
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp737 extends CharToByteSingleByte {
-
- private final static IBM737 nioCoder = new IBM737();
-
- public String getCharacterEncoding() {
- return "Cp737";
- }
-
- public CharToByteCp737() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp775.java b/jdk/src/share/classes/sun/io/CharToByteCp775.java
deleted file mode 100644
index 7dba769..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp775.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM775;
-
-/**
- * Tables and data to convert Unicode to Cp775
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp775 extends CharToByteSingleByte {
-
- private final static IBM775 nioCoder = new IBM775();
-
- public String getCharacterEncoding() {
- return "Cp775";
- }
-
- public CharToByteCp775() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp833.java b/jdk/src/share/classes/sun/io/CharToByteCp833.java
deleted file mode 100644
index 23f34c5..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp833.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM833;
-
-public class CharToByteCp833 extends CharToByteSingleByte {
-
- private final static IBM833 nioCoder = new IBM833();
-
- public String getCharacterEncoding() {
- return "Cp833";
- }
-
- public CharToByteCp833() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
-
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp834.java b/jdk/src/share/classes/sun/io/CharToByteCp834.java
deleted file mode 100644
index 9494c07..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp834.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-//EBIDIC DBCSONLY Korean
-
-public class CharToByteCp834 extends CharToByteDBCS_ASCII {
-
- public CharToByteCp834() {
- super((DoubleByte.Encoder)new IBM834().newEncoder());
- subBytes = new byte[] {(byte)0xfe, (byte)0xfe};
- }
-
- public int getMaxBytesPerChar() {
- return 2;
- }
-
- public String getCharacterEncoding() {
- return "Cp834";
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp838.java b/jdk/src/share/classes/sun/io/CharToByteCp838.java
deleted file mode 100644
index ee750db..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp838.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM838;
-
-/**
- * Tables and data to convert Unicode to Cp838
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp838 extends CharToByteSingleByte {
-
- private final static IBM838 nioCoder = new IBM838();
-
- public String getCharacterEncoding() {
- return "Cp838";
- }
-
- public CharToByteCp838() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp850.java b/jdk/src/share/classes/sun/io/CharToByteCp850.java
deleted file mode 100644
index c79e0c4..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp850.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM850;
-
-/**
- * Tables and data to convert Unicode to Cp850
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp850 extends CharToByteSingleByte {
-
- private final static IBM850 nioCoder = new IBM850();
-
- public String getCharacterEncoding() {
- return "Cp850";
- }
-
- public CharToByteCp850() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp852.java b/jdk/src/share/classes/sun/io/CharToByteCp852.java
deleted file mode 100644
index 47c17ef..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp852.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM852;
-
-/**
- * Tables and data to convert Unicode to Cp852
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp852 extends CharToByteSingleByte {
-
- private final static IBM852 nioCoder = new IBM852();
-
- public String getCharacterEncoding() {
- return "Cp852";
- }
-
- public CharToByteCp852() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp855.java b/jdk/src/share/classes/sun/io/CharToByteCp855.java
deleted file mode 100644
index e16fc69..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp855.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM855;
-
-/**
- * Tables and data to convert Unicode to Cp855
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp855 extends CharToByteSingleByte {
-
- private final static IBM855 nioCoder = new IBM855();
-
- public String getCharacterEncoding() {
- return "Cp855";
- }
-
- public CharToByteCp855() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp856.java b/jdk/src/share/classes/sun/io/CharToByteCp856.java
deleted file mode 100644
index d18d47b..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp856.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM856;
-
-/**
- * Tables and data to convert Unicode to Cp856
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp856 extends CharToByteSingleByte {
-
- private final static IBM856 nioCoder = new IBM856();
-
- public String getCharacterEncoding() {
- return "Cp856";
- }
-
- public CharToByteCp856() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp857.java b/jdk/src/share/classes/sun/io/CharToByteCp857.java
deleted file mode 100644
index 79055f0..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp857.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM857;
-
-/**
- * Tables and data to convert Unicode to Cp857
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp857 extends CharToByteSingleByte {
-
- private final static IBM857 nioCoder = new IBM857();
-
- public String getCharacterEncoding() {
- return "Cp857";
- }
-
- public CharToByteCp857() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp858.java b/jdk/src/share/classes/sun/io/CharToByteCp858.java
deleted file mode 100644
index 3d6b849..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp858.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM858;
-
-/**
- * Tables and data to convert Unicode to Cp858
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp858 extends CharToByteSingleByte {
-
- public String getCharacterEncoding() {
- return "Cp858";
- }
-
- private final static IBM858 nioCoder = new IBM858();
-
- public CharToByteCp858() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp860.java b/jdk/src/share/classes/sun/io/CharToByteCp860.java
deleted file mode 100644
index 46b07ee..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp860.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM860;
-
-/**
- * Tables and data to convert Unicode to Cp860
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp860 extends CharToByteSingleByte {
-
- private final static IBM860 nioCoder = new IBM860();
-
- public String getCharacterEncoding() {
- return "Cp860";
- }
-
- public CharToByteCp860() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp861.java b/jdk/src/share/classes/sun/io/CharToByteCp861.java
deleted file mode 100644
index d0c1f32..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp861.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM861;
-
-/**
- * Tables and data to convert Unicode to Cp861
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp861 extends CharToByteSingleByte {
-
- private final static IBM861 nioCoder = new IBM861();
-
- public String getCharacterEncoding() {
- return "Cp861";
- }
-
- public CharToByteCp861() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp862.java b/jdk/src/share/classes/sun/io/CharToByteCp862.java
deleted file mode 100644
index c819680..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp862.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM862;
-
-/**
- * Tables and data to convert Unicode to Cp862
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp862 extends CharToByteSingleByte {
-
- private final static IBM862 nioCoder = new IBM862();
-
- public String getCharacterEncoding() {
- return "Cp862";
- }
-
- public CharToByteCp862() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp863.java b/jdk/src/share/classes/sun/io/CharToByteCp863.java
deleted file mode 100644
index 1786e8c..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp863.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM863;
-
-/**
- * Tables and data to convert Unicode to Cp863
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp863 extends CharToByteSingleByte {
-
- private final static IBM863 nioCoder = new IBM863();
-
- public String getCharacterEncoding() {
- return "Cp863";
- }
-
- public CharToByteCp863() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp864.java b/jdk/src/share/classes/sun/io/CharToByteCp864.java
deleted file mode 100644
index 08381d2..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp864.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM864;
-
-/**
- * Tables and data to convert Unicode to Cp864
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp864 extends CharToByteSingleByte {
-
- private final static IBM864 nioCoder = new IBM864();
-
- public String getCharacterEncoding() {
- return "Cp864";
- }
-
- public CharToByteCp864() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp865.java b/jdk/src/share/classes/sun/io/CharToByteCp865.java
deleted file mode 100644
index 36da989..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp865.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM865;
-
-/**
- * Tables and data to convert Unicode to Cp865
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp865 extends CharToByteSingleByte {
-
- private final static IBM865 nioCoder = new IBM865();
-
- public String getCharacterEncoding() {
- return "Cp865";
- }
-
- public CharToByteCp865() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp866.java b/jdk/src/share/classes/sun/io/CharToByteCp866.java
deleted file mode 100644
index 73bd8f3..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp866.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM866;
-
-/**
- * Tables and data to convert Unicode to Cp866
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp866 extends CharToByteSingleByte {
-
- private final static IBM866 nioCoder = new IBM866();
-
- public String getCharacterEncoding() {
- return "Cp866";
- }
-
- public CharToByteCp866() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp868.java b/jdk/src/share/classes/sun/io/CharToByteCp868.java
deleted file mode 100644
index af40daf..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp868.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM868;
-
-/**
- * Tables and data to convert Unicode to Cp868
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp868 extends CharToByteSingleByte {
-
- private final static IBM868 nioCoder = new IBM868();
-
- public String getCharacterEncoding() {
- return "Cp868";
- }
-
- public CharToByteCp868() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp869.java b/jdk/src/share/classes/sun/io/CharToByteCp869.java
deleted file mode 100644
index d431953..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp869.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM869;
-
-/**
- * Tables and data to convert Unicode to Cp869
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp869 extends CharToByteSingleByte {
-
- private final static IBM869 nioCoder = new IBM869();
-
- public String getCharacterEncoding() {
- return "Cp869";
- }
-
- public CharToByteCp869() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp870.java b/jdk/src/share/classes/sun/io/CharToByteCp870.java
deleted file mode 100644
index f7e6217..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp870.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM870;
-
-/**
- * Tables and data to convert Unicode to Cp870
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp870 extends CharToByteSingleByte {
-
- private final static IBM870 nioCoder = new IBM870();
-
- public String getCharacterEncoding() {
- return "Cp870";
- }
-
- public CharToByteCp870() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp871.java b/jdk/src/share/classes/sun/io/CharToByteCp871.java
deleted file mode 100644
index 3b79a90..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp871.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM871;
-
-/**
- * Tables and data to convert Unicode to Cp871
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp871 extends CharToByteSingleByte {
-
- private final static IBM871 nioCoder = new IBM871();
-
- public String getCharacterEncoding() {
- return "Cp871";
- }
-
- public CharToByteCp871() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp874.java b/jdk/src/share/classes/sun/io/CharToByteCp874.java
deleted file mode 100644
index 4b5461f..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp874.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.IBM874;
-
-/**
- * Tables and data to convert Unicode to Cp874
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp874 extends CharToByteSingleByte {
-
- private final static IBM874 nioCoder = new IBM874();
-
- public String getCharacterEncoding() {
- return "Cp874";
- }
-
- public CharToByteCp874() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp875.java b/jdk/src/share/classes/sun/io/CharToByteCp875.java
deleted file mode 100644
index 503582d..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp875.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM875;
-
-/**
- * Tables and data to convert Unicode to Cp875
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp875 extends CharToByteSingleByte {
-
- private final static IBM875 nioCoder = new IBM875();
-
- public String getCharacterEncoding() {
- return "Cp875";
- }
-
- public CharToByteCp875() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp918.java b/jdk/src/share/classes/sun/io/CharToByteCp918.java
deleted file mode 100644
index ce51a36..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp918.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM918;
-
-/**
- * Tables and data to convert Unicode to Cp918
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp918 extends CharToByteSingleByte {
-
- private final static IBM918 nioCoder = new IBM918();
-
- public String getCharacterEncoding() {
- return "Cp918";
- }
-
- public CharToByteCp918() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp921.java b/jdk/src/share/classes/sun/io/CharToByteCp921.java
deleted file mode 100644
index 1589592..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp921.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM921;
-
-/**
- * Tables and data to convert Unicode to Cp921
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp921 extends CharToByteSingleByte {
-
- private final static IBM921 nioCoder = new IBM921();
-
- public String getCharacterEncoding() {
- return "Cp921";
- }
-
- public CharToByteCp921() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp922.java b/jdk/src/share/classes/sun/io/CharToByteCp922.java
deleted file mode 100644
index 222d67d..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp922.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.IBM922;
-
-/**
- * Tables and data to convert Unicode to Cp922
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteCp922 extends CharToByteSingleByte {
-
- private final static IBM922 nioCoder = new IBM922();
-
- public String getCharacterEncoding() {
- return "Cp922";
- }
-
- public CharToByteCp922() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp930.java b/jdk/src/share/classes/sun/io/CharToByteCp930.java
deleted file mode 100644
index 9e5132b..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp930.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp930 extends CharToByteDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp930";
- }
-
- public CharToByteCp930() {
- super((DoubleByte.Encoder)new IBM930().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp933.java b/jdk/src/share/classes/sun/io/CharToByteCp933.java
deleted file mode 100644
index 2146278..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp933.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp933 extends CharToByteDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp933";
- }
-
- public CharToByteCp933() {
- super((DoubleByte.Encoder)new IBM933().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp935.java b/jdk/src/share/classes/sun/io/CharToByteCp935.java
deleted file mode 100644
index e72126f..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp935.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp935 extends CharToByteDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp935";
- }
-
- public CharToByteCp935() {
- super((DoubleByte.Encoder)new IBM935().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp937.java b/jdk/src/share/classes/sun/io/CharToByteCp937.java
deleted file mode 100644
index c698cd4..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp937.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp937 extends CharToByteDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp937";
- }
-
- public CharToByteCp937() {
- super((DoubleByte.Encoder)new IBM937().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp939.java b/jdk/src/share/classes/sun/io/CharToByteCp939.java
deleted file mode 100644
index c9d7c00..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp939.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp939 extends CharToByteDBCS_EBCDIC {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp939";
- }
-
- public CharToByteCp939() {
- super((DoubleByte.Encoder)new IBM939().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp942.java b/jdk/src/share/classes/sun/io/CharToByteCp942.java
deleted file mode 100644
index 7abd3e1..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp942.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp942 extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp942";
- }
-
- public CharToByteCp942() {
- super((DoubleByte.Encoder)new IBM942().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp942C.java b/jdk/src/share/classes/sun/io/CharToByteCp942C.java
deleted file mode 100644
index 55778c1..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp942C.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp942C extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp942C";
- }
-
- public CharToByteCp942C() {
- super((DoubleByte.Encoder)new IBM942C().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp943.java b/jdk/src/share/classes/sun/io/CharToByteCp943.java
deleted file mode 100644
index 794a3f5..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp943.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp943 extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp943";
- }
-
- public CharToByteCp943() {
- super((DoubleByte.Encoder)new IBM943().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp943C.java b/jdk/src/share/classes/sun/io/CharToByteCp943C.java
deleted file mode 100644
index c43ee4e..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp943C.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp943C extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp943C";
- }
-
- public CharToByteCp943C() {
- super((DoubleByte.Encoder)new IBM943C().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp948.java b/jdk/src/share/classes/sun/io/CharToByteCp948.java
deleted file mode 100644
index 3f74a10..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp948.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp948 extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp948";
- }
-
- public CharToByteCp948() {
- super((DoubleByte.Encoder)new IBM948().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp949.java b/jdk/src/share/classes/sun/io/CharToByteCp949.java
deleted file mode 100644
index 573dae9..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp949.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp949 extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp949";
- }
-
- public CharToByteCp949() {
- super((DoubleByte.Encoder)new IBM949().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp949C.java b/jdk/src/share/classes/sun/io/CharToByteCp949C.java
deleted file mode 100644
index e72b679..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp949C.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp949C extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp949C";
- }
-
- public CharToByteCp949C() {
- super((DoubleByte.Encoder)new IBM949C().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp950.java b/jdk/src/share/classes/sun/io/CharToByteCp950.java
deleted file mode 100644
index ac58ebf..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp950.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteCp950 extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp950";
- }
-
- public CharToByteCp950() {
- super((DoubleByte.Encoder)new IBM950().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp964.java b/jdk/src/share/classes/sun/io/CharToByteCp964.java
deleted file mode 100644
index 4a09cd0..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp964.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.IBM964;
-
-/**
-* Tables and data to convert Unicode to Cp964
-*
-* @author Malcolm Ayres, assisted by UniMap program
-*/
-public class CharToByteCp964
- extends CharToByteEUC
-
-{
- private final static IBM964 nioCoder = new IBM964();
-
- // Return the character set id
- public String getCharacterEncoding()
- {
- return "Cp964";
- }
-
- public int getMaxBytesPerChar() {
- return 4;
- }
-
- public CharToByteCp964()
- {
- super();
- super.mask1 = 0xFFC0;
- super.mask2 = 0x003F;
- super.shift = 6;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- super.index2a = nioCoder.getEncoderIndex2a();
- super.index2b = nioCoder.getEncoderIndex2b();
- super.index2c = nioCoder.getEncoderIndex2c();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteCp970.java b/jdk/src/share/classes/sun/io/CharToByteCp970.java
deleted file mode 100644
index 4041ca7..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteCp970.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-// EUC_Simple is the same as DBCS_ASCII
-public class CharToByteCp970 extends CharToByteDBCS_ASCII {
-
- // Return the character set id
- public String getCharacterEncoding() {
- return "Cp970";
- }
-
- public CharToByteCp970() {
- super((DoubleByte.Encoder)new IBM970().newEncoder());
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteDBCS_ASCII.java b/jdk/src/share/classes/sun/io/CharToByteDBCS_ASCII.java
deleted file mode 100644
index ca261fc..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteDBCS_ASCII.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import static sun.nio.cs.CharsetMapping.*;
-
-public abstract class CharToByteDBCS_ASCII extends CharToByteConverter
-{
-
- private char highHalfZoneCode;
- private byte[] outputByte = new byte[2];
-
- private DoubleByte.Encoder enc;
-
- public CharToByteDBCS_ASCII(DoubleByte.Encoder enc) {
- super();
- this.enc = enc;
- }
-
- int encodeChar(char c) {
- return enc.encodeChar(c);
- }
-
- /**
- * flush out any residual data and reset the buffer state
- */
- public int flush(byte [] output, int outStart, int outEnd)
- throws MalformedInputException, ConversionBufferFullException
- {
-
- if (highHalfZoneCode != 0) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- reset();
- return 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- char inputChar;
- int inputSize;
-
- byteOff = outOff;
- charOff = inOff;
-
- while(charOff < inEnd) {
- int index;
- int theBytes;
- int spaceNeeded;
-
- if (highHalfZoneCode == 0) {
- inputChar = input[charOff];
- inputSize = 1;
- } else {
- inputChar = highHalfZoneCode;
- inputSize = 0;
- highHalfZoneCode = 0;
- }
-
- // Is this a high surrogate?
- if (Character.isHighSurrogate(inputChar)) {
- // Is this the last character of the input?
- if (charOff + inputSize >= inEnd) {
- highHalfZoneCode = inputChar;
- charOff += inputSize;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + inputSize];
- if (Character.isLowSurrogate(inputChar)) {
- // We have a valid surrogate pair. Too bad we don't do
- // surrogates. Is substitution enabled?
- if (subMode) {
- if (subBytes.length == 1) {
- outputByte[0] = 0x00;
- outputByte[1] = subBytes[0];
- }
- else {
- outputByte[0] = subBytes[0];
- outputByte[1] = subBytes[1];
- }
- inputSize++;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- // Is this an unaccompanied low surrogate?
- else if (Character.isLowSurrogate(inputChar)) {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
-
- // We have a valid character, get the bytes for it
- theBytes = encodeChar(inputChar);
- if (theBytes == UNMAPPABLE_ENCODING) {
- // if there was no mapping - look for substitution characters
- if (subMode) {
- if (subBytes.length == 1) {
- outputByte[0] = 0x00;
- outputByte[1] = subBytes[0];
- } else {
- outputByte[0] = subBytes[0];
- outputByte[1] = subBytes[1];
- }
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- } else {
- outputByte[0] = (byte)(theBytes >>8);
- outputByte[1] = (byte)theBytes;
- }
- }
- if (outputByte[0] == 0x00)
- spaceNeeded = 1;
- else
- spaceNeeded = 2;
-
- if (byteOff + spaceNeeded > outEnd)
- throw new ConversionBufferFullException();
-
- if (spaceNeeded == 1)
- output[byteOff++] = outputByte[1];
- else {
- output[byteOff++] = outputByte[0];
- output[byteOff++] = outputByte[1];
- }
-
- charOff += inputSize;
- }
- return byteOff - outOff;
- }
-
- /**
- * Resets converter to its initial state.
- */
- public void reset() {
- charOff = byteOff = 0;
- highHalfZoneCode = 0;
- }
-
- /**
- * Returns the maximum number of bytes needed to convert a char.
- */
- public int getMaxBytesPerChar() {
- return 2;
- }
-
- /**
- * Returns true if the given character can be converted to the
- * target character encoding.
- */
- public boolean canConvert(char c) {
- return encodeChar(c) != UNMAPPABLE_ENCODING;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteDBCS_EBCDIC.java b/jdk/src/share/classes/sun/io/CharToByteDBCS_EBCDIC.java
deleted file mode 100644
index 8a7a1fd..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteDBCS_EBCDIC.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import static sun.nio.cs.CharsetMapping.*;
-
-public abstract class CharToByteDBCS_EBCDIC extends CharToByteConverter
-{
- private static final int SBCS = 0;
- private static final int DBCS = 1;
-
- private static final byte SO = 0x0e;
- private static final byte SI = 0x0f;
-
- private int currentState;
- private char highHalfZoneCode;
- private byte[] outputByte = new byte[2];
-
- private DoubleByte.Encoder enc;
-
- public CharToByteDBCS_EBCDIC(DoubleByte.Encoder enc) {
- super();
- highHalfZoneCode = 0;
- currentState = SBCS;
- this.enc = enc;
- }
-
- int encodeChar(char c) {
- return enc.encodeChar(c);
- }
-
- /**
- * flush out any residual data and reset the buffer state
- */
- public int flush(byte [] output, int outStart, int outEnd)
- throws MalformedInputException, ConversionBufferFullException
- {
- int bytesOut = 0;
-
- if (highHalfZoneCode != 0) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- if (currentState == DBCS) {
- if (outStart >= outEnd)
- throw new ConversionBufferFullException();
- output[outStart] = SI;
- bytesOut++;
- }
-
- reset();
- return bytesOut;
- }
-
- /**
- * Character conversion
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- char inputChar;
- int inputSize;
-
- byteOff = outOff;
- charOff = inOff;
-
- while(charOff < inEnd) {
-
- int index;
- int theBytes;
- int spaceNeeded;
-
- if (highHalfZoneCode == 0) {
- inputChar = input[charOff];
- inputSize = 1;
- } else {
- inputChar = highHalfZoneCode;
- inputSize = 0;
- highHalfZoneCode = 0;
- }
-
- // Is this a high surrogate?
- if (Character.isHighSurrogate(inputChar)) {
- // Is this the last character of the input?
- if (charOff + inputSize >= inEnd) {
- highHalfZoneCode = inputChar;
- charOff += inputSize;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + inputSize];
- if (Character.isLowSurrogate(inputChar)) {
- // We have a valid surrogate pair. Too bad we don't do
- // surrogates. Is substitution enabled?
- if (subMode) {
- if (subBytes.length == 1) {
- outputByte[0] = 0x00;
- outputByte[1] = subBytes[0];
- }
- else {
- outputByte[0] = subBytes[0];
- outputByte[1] = subBytes[1];
- }
- inputSize++;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- // Is this an unaccompanied low surrogate?
- else if (Character.isLowSurrogate(inputChar)) {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
-
- // We have a valid character, get the bytes for it
- theBytes = encodeChar(inputChar);
- if (theBytes == UNMAPPABLE_ENCODING) {
- // if there was no mapping - look for substitution characters
- if (subMode) {
- if (subBytes.length == 1) {
- outputByte[0] = 0x00;
- outputByte[1] = subBytes[0];
- } else {
- outputByte[0] = subBytes[0];
- outputByte[1] = subBytes[1];
- }
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- } else {
- outputByte[0] = (byte)((theBytes & 0x0000ff00)>>8);
- outputByte[1] = (byte)(theBytes & 0x000000ff);
- }
- }
-
- //Set the output buffer into the correct state
-
- if (currentState == DBCS && outputByte[0] == 0x00) {
- if (byteOff >= outEnd)
- throw new ConversionBufferFullException();
- currentState = SBCS;
- output[byteOff++] = SI;
- } else
- if (currentState == SBCS && outputByte[0] != 0x00) {
- if (byteOff >= outEnd) {
- throw new ConversionBufferFullException();
- }
- currentState = DBCS;
- output[byteOff++] = SO;
- }
-
- if (currentState == DBCS)
- spaceNeeded = 2;
- else
- spaceNeeded = 1;
-
- if (byteOff + spaceNeeded > outEnd) {
- throw new ConversionBufferFullException();
- }
-
- if (currentState == SBCS)
- output[byteOff++] = outputByte[1];
- else {
- output[byteOff++] = outputByte[0];
- output[byteOff++] = outputByte[1];
- }
-
- charOff += inputSize;
- }
- return byteOff - outOff;
- }
-
-
-
- /**
- * Resets converter to its initial state.
- */
- public void reset() {
- charOff = byteOff = 0;
- highHalfZoneCode = 0;
- currentState = SBCS;
- }
-
-
- /**
- * Returns the maximum number of bytes needed to convert a char.
- */
- public int getMaxBytesPerChar() {
- return 4; //Fixed with bug 4199599 so tests would pass.
- }
-
-
- /**
- * Sets the substitution bytes to use when the converter is in
- * substitution mode. The given bytes should represent a valid
- * character in the target character encoding.
- */
-
- public void setSubstitutionBytes( byte[] newSubBytes )
- throws IllegalArgumentException
- {
- if( newSubBytes.length > 2 || newSubBytes.length == 0) {
- throw new IllegalArgumentException();
- }
-
- subBytes = new byte[ newSubBytes.length ];
- System.arraycopy( newSubBytes, 0, subBytes, 0, newSubBytes.length );
-
- }
-
- /**
- * Returns true if the given character can be converted to the
- * target character encoding.
- */
- public boolean canConvert(char c) {
- return encodeChar(c) != UNMAPPABLE_ENCODING;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteDoubleByte.java b/jdk/src/share/classes/sun/io/CharToByteDoubleByte.java
deleted file mode 100644
index d39fde7..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteDoubleByte.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * @author Limin Shi
- */
-
-public abstract class CharToByteDoubleByte extends CharToByteConverter {
-
- /*
- * 1st level index, provided by subclass
- */
- protected short index1[];
-
- /*
- * 2nd level index, provided by subclass
- */
- protected String index2[];
-
- protected char highHalfZoneCode;
-
- public short[] getIndex1() {
- return index1;
- }
-
- public String[] getIndex2() {
- return index2;
- }
-
- public int flush(byte[] output, int outStart, int outEnd)
- throws MalformedInputException, ConversionBufferFullException
- {
- if (highHalfZoneCode != 0) {
- highHalfZoneCode = 0;
- badInputLength = 0;
- throw new MalformedInputException();
- }
- byteOff = charOff = 0;
- return 0;
- }
-
- /**
- * Converts characters to sequences of bytes.
- * Conversions that result in Exceptions can be restarted by calling
- * convert again, with appropriately modified parameters.
- * @return the characters written to output.
- * @param input char array containing text in Unicode
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output byte array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last byte to be written to
- * @throw UnsupportedCharacterException for any character
- * that cannot be converted to the external character set.
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws MalformedInputException, UnknownCharacterException,
- ConversionBufferFullException
- {
- char inputChar; // Input character to be converted
- byte[] outputByte; // Output byte written to output
- int inputSize = 0; // Size of input
- int outputSize = 0; // Size of output
- byte[] tmpbuf = new byte[2];
-
- // Record beginning offsets
- charOff = inOff;
- byteOff = outOff;
-
- if (highHalfZoneCode != 0) {
- inputChar = highHalfZoneCode;
- highHalfZoneCode = 0;
- if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
- // This is legal UTF16 sequence.
- badInputLength = 1;
- throw new UnknownCharacterException();
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException();
- }
- }
-
- // Loop until we hit the end of the input
- while(charOff < inEnd) {
- inputSize = 1;
- outputByte = tmpbuf;
- inputChar = input[charOff]; // Get the input character
-
- // Is this a high surrogate?
- if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
- // Is this the last character of the input?
- if (charOff + 1 >= inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + 1];
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- // We have a valid surrogate pair. Too bad we don't do
- // surrogates. Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- inputSize = 2;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- // Is this an unaccompanied low surrogate?
- else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
- outputSize = convSingleByte(inputChar, outputByte);
- if (outputSize == 0) { // DoubleByte
- int ncode = getNative(inputChar);
- if (ncode != 0 ) {
- outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
- outputByte[1] = (byte) (ncode & 0xff);
- outputSize = 2;
- } else {
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- }
- }
-
- // If we don't have room for the output, throw an exception
- if (byteOff + outputSize > outEnd)
- throw new ConversionBufferFullException();
-
- // Put the byte in the output buffer
- for (int i = 0; i < outputSize; i++) {
- output[byteOff++] = outputByte[i];
- }
- charOff += inputSize;
- }
- // Return the length written to the output buffer
- return byteOff - outOff;
- }
-
-
- /**
- * the maximum number of bytes needed to hold a converted char
- * @returns the maximum number of bytes needed for a converted char
- */
- public int getMaxBytesPerChar() {
- return 2;
- }
-
- /**
- * Resets the converter.
- * Call this method to reset the converter to its initial state
- */
- public void reset() {
- byteOff = charOff = 0;
- highHalfZoneCode = 0;
- }
-
- /**
- * Return whether a character is mappable or not
- * @return true if a character is mappable
- */
- public boolean canConvert(char ch) {
- byte[] outByte = new byte[2];
-
- if ((ch == (char) 0) || (convSingleByte(ch, outByte) != 0))
- return true;
- if (this.getNative(ch) != 0)
- return true;
- return false;
- }
-
-
- /*
- * Can be changed by subclass
- */
- protected int convSingleByte(char inputChar, byte[] outputByte) {
- if (inputChar < 0x80) {
- outputByte[0] = (byte)(inputChar & 0x7f);
- return 1;
- }
- return 0;
- }
-
- /*
- * Can be changed by subclass
- */
- protected int getNative(char ch) {
- int offset = index1[((ch & 0xff00) >> 8 )] << 8;
- return index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteEUC.java b/jdk/src/share/classes/sun/io/CharToByteEUC.java
deleted file mode 100644
index dd02692..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteEUC.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-public abstract class CharToByteEUC extends CharToByteConverter
-{
-
- private char highHalfZoneCode;
- private byte[] outputByte;
-
- protected short index1[];
- protected String index2;
- protected String index2a;
- protected String index2b;
- protected String index2c;
- protected int mask1;
- protected int mask2;
- protected int shift;
-
- private byte[] workByte = new byte[4];
-
- /**
- * flush out any residual data and reset the buffer state
- */
- public int flush(byte [] output, int outStart, int outEnd)
- throws MalformedInputException, ConversionBufferFullException
- {
-
- if (highHalfZoneCode != 0) {
- reset();
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- reset();
- return 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- char inputChar;
- int inputSize;
-
- byteOff = outOff;
- charOff = inOff;
-
- while(charOff < inEnd) {
-
- outputByte = workByte;
-
- int index;
- int theBytes;
- int spaceNeeded;
- boolean allZeroes = true;
- int i;
-
-
- if (highHalfZoneCode == 0) {
- inputChar = input[charOff];
- inputSize = 1;
- } else {
- inputChar = highHalfZoneCode;
- inputSize = 0;
- highHalfZoneCode = 0;
- }
-
-
- // Is this a high surrogate?
- if(inputChar >= '\ud800' && inputChar <= '\udbff') {
- // Is this the last character of the input?
- if (charOff + inputSize >= inEnd) {
- highHalfZoneCode = inputChar;
- charOff += inputSize;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + inputSize];
- if (inputChar >= '\udc00' && inputChar <= '\udfff') {
-
- // We have a valid surrogate pair. Too bad we don't do
- // surrogates. Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- inputSize++;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
-
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
-
- // Is this an unaccompanied low surrogate?
- else
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
-
- String theChars;
- char aChar;
-
- // We have a valid character, get the bytes for it
- index = index1[((inputChar & mask1) >> shift)] + (inputChar & mask2);
-
- if (index < 7500)
- theChars = index2;
- else
- if (index < 15000) {
- index = index - 7500;
- theChars = index2a;
- }
- else
- if (index < 22500){
- index = index - 15000;
- theChars = index2b;
- }
- else {
- index = index - 22500;
- theChars = index2c;
- }
-
- aChar = theChars.charAt(2*index);
- outputByte[0] = (byte)((aChar & 0xff00)>>8);
- outputByte[1] = (byte)(aChar & 0x00ff);
- aChar = theChars.charAt(2*index + 1);
- outputByte[2] = (byte)((aChar & 0xff00)>>8);
- outputByte[3] = (byte)(aChar & 0x00ff);
- }
-
- // if there was no mapping - look for substitution characters
-
- for (i = 0; i < outputByte.length; i++) {
- if (outputByte[i] != 0x00) {
- allZeroes = false;
- break;
- }
- }
-
- if (allZeroes && inputChar != '\u0000')
- {
- if (subMode) {
- outputByte = subBytes;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
-
- int oindex = 0;
- for (spaceNeeded = outputByte.length; spaceNeeded > 1; spaceNeeded--){
- if (outputByte[oindex++] != 0x00 )
- break;
- }
-
- if (byteOff + spaceNeeded > outEnd)
- throw new ConversionBufferFullException();
-
-
- for (i = outputByte.length - spaceNeeded; i < outputByte.length; i++) {
- output[byteOff++] = outputByte[i];
- }
-
- charOff += inputSize;
- }
-
- return byteOff - outOff;
- }
-
- /**
- * Resets converter to its initial state.
- */
- public void reset() {
- charOff = byteOff = 0;
- highHalfZoneCode = 0;
- }
-
- /**
- * Returns the maximum number of bytes needed to convert a char.
- */
- public int getMaxBytesPerChar() {
- return 2;
- }
-
-
- /**
- * Returns true if the given character can be converted to the
- * target character encoding.
- */
- public boolean canConvert(char ch) {
- int index;
- String theChars;
-
- index = index1[((ch & mask1) >> shift)] + (ch & mask2);
-
- if (index < 7500)
- theChars = index2;
- else
- if (index < 15000) {
- index = index - 7500;
- theChars = index2a;
- }
- else
- if (index < 22500){
- index = index - 15000;
- theChars = index2b;
- }
- else {
- index = index - 22500;
- theChars = index2c;
- }
-
- if (theChars.charAt(2*index) != '\u0000' ||
- theChars.charAt(2*index + 1) != '\u0000')
- return (true);
-
- // only return true if input char was unicode null - all others are
- // undefined
- return( ch == '\u0000');
-
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteEUC_CN.java b/jdk/src/share/classes/sun/io/CharToByteEUC_CN.java
deleted file mode 100644
index aa286b0..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteEUC_CN.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteEUC_CN extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new EUC_CN().newEncoder();
-
- public String getCharacterEncoding() {
- return "EUC_CN";
- }
-
- public CharToByteEUC_CN() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteEUC_JP.java b/jdk/src/share/classes/sun/io/CharToByteEUC_JP.java
deleted file mode 100644
index 797c9e7..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteEUC_JP.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * @author Limin Shi
- */
-
-public class CharToByteEUC_JP extends CharToByteJIS0208 {
- CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
- CharToByteJIS0212 cbJIS0212 = new CharToByteJIS0212();
-
- public String getCharacterEncoding() {
- return "EUC_JP";
- }
-
- protected int convSingleByte(char inputChar, byte[] outputByte) {
- byte b;
-
- if (inputChar == 0) {
- outputByte[0] = (byte)0;
- return 1;
- }
-
- if ((b = cbJIS0201.getNative(inputChar)) == 0)
- return 0;
-
- if (b > 0 && b < 128) {
- outputByte[0] = b;
- return 1;
- }
- outputByte[0] = (byte)0x8E;
- outputByte[1] = b;
- return 2;
- }
-
- protected int getNative(char ch) {
- int offset = index1[((ch & 0xff00) >> 8 )] << 8;
- int r = index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
- if (r != 0)
- return r + 0x8080;
- r = cbJIS0212.getNative(ch);
- if (r == 0)
- return r;
- return r + 0x8F8080;
- }
-
-
- /**
- * Converts characters to sequences of bytes.
- * Conversions that result in Exceptions can be restarted by calling
- * convert again, with appropriately modified parameters.
- * @return the characters written to output.
- * @param input char array containing text in Unicode
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output byte array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last byte to be written to
- * @throw UnsupportedCharacterException for any character
- * that cannot be converted to the external character set.
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws MalformedInputException, UnknownCharacterException,
- ConversionBufferFullException
- {
- char inputChar; // Input character to be converted
- byte[] outputByte; // Output byte written to output
- int inputSize = 0; // Size of input
- int outputSize = 0; // Size of output
- byte[] tmpbuf = new byte[4];
-
- // Record beginning offsets
- charOff = inOff;
- byteOff = outOff;
-
- if (highHalfZoneCode != 0) {
- inputChar = highHalfZoneCode;
- highHalfZoneCode = 0;
- if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
- // This is legal UTF16 sequence.
- badInputLength = 1;
- throw new UnknownCharacterException();
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException();
- }
- }
-
- // Loop until we hit the end of the input
- while(charOff < inEnd) {
- inputSize = 1;
- outputByte = tmpbuf;
- inputChar = input[charOff]; // Get the input character
-
- // Is this a high surrogate?
- if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
- // Is this the last character of the input?
- if (charOff + 1 >= inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + 1];
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- // We have a valid surrogate pair. Too bad we don't do
- // surrogates. Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- inputSize = 2;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- // Is this an unaccompanied low surrogate?
- else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
- outputSize = convSingleByte(inputChar, outputByte);
- if (outputSize == 0) { // DoubleByte
- int ncode = getNative(inputChar);
- if (ncode != 0 ) {
- if ((ncode & 0xFF0000) == 0) {
- outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
- outputByte[1] = (byte) (ncode & 0xff);
- outputSize = 2;
- } else {
- outputByte[0] = (byte) 0x8F;
- outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
- outputByte[2] = (byte) (ncode & 0xff);
- outputSize = 3;
- }
- } else {
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- }
- }
-
- // If we don't have room for the output, throw an exception
- if (byteOff + outputSize > outEnd)
- throw new ConversionBufferFullException();
-
- // Put the byte in the output buffer
- for (int i = 0; i < outputSize; i++) {
- output[byteOff++] = outputByte[i];
- }
- charOff += inputSize;
- }
- // Return the length written to the output buffer
- return byteOff - outOff;
- }
-
-
- /**
- * the maximum number of bytes needed to hold a converted char
- * @returns the maximum number of bytes needed for a converted char
- */
- public int getMaxBytesPerChar() {
- return 3;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteEUC_JP_LINUX.java b/jdk/src/share/classes/sun/io/CharToByteEUC_JP_LINUX.java
deleted file mode 100644
index dc0c0dc..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteEUC_JP_LINUX.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * Class for converting characters to bytes for the EUC-JP encoding in
- * linux. This converter supports the JIS0201 and the JIS0208 encoding and
- * omits support for the JIS212 encoding.
- *
- * @author Naveen Sanjeeva
- */
-
-public class CharToByteEUC_JP_LINUX extends CharToByteJIS0208 {
- CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
-
- public String getCharacterEncoding() {
- return "EUC_JP_LINUX";
- }
-
- protected int convSingleByte(char inputChar, byte[] outputByte) {
- byte b;
-
- if (inputChar == 0) {
- outputByte[0] = (byte)0;
- return 1;
- }
-
- if ((b = cbJIS0201.getNative(inputChar)) == 0)
- return 0;
-
- if (b > 0 && b < 128) {
- outputByte[0] = b;
- return 1;
- }
- outputByte[0] = (byte)0x8E;
- outputByte[1] = b;
- return 2;
- }
-
- protected int getNative(char ch) {
- int offset = index1[((ch & 0xff00) >> 8 )] << 8;
- int r = index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
- if (r != 0)
- return r + 0x8080;
- return r;
- }
-
- /**
- * Converts characters to sequences of bytes.
- * Conversions that result in Exceptions can be restarted by calling
- * convert again, with appropriately modified parameters.
- * @return the characters written to output.
- * @param input char array containing text in Unicode
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output byte array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last byte to be written to
- * @throw UnsupportedCharacterException for any character
- * that cannot be converted to the external character set.
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws MalformedInputException, UnknownCharacterException,
- ConversionBufferFullException
- {
- char inputChar; // Input character to be converted
- byte[] outputByte; // Output byte written to output
- int inputSize = 0; // Size of input
- int outputSize = 0; // Size of output
- byte[] tmpbuf = new byte[4];
-
- // Record beginning offsets
- charOff = inOff;
- byteOff = outOff;
-
- if (highHalfZoneCode != 0) {
- inputChar = highHalfZoneCode;
- highHalfZoneCode = 0;
- if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
- // This is legal UTF16 sequence.
- badInputLength = 1;
- throw new UnknownCharacterException();
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException();
- }
- }
-
- // Loop until we hit the end of the input
- while(charOff < inEnd) {
- inputSize = 1;
- outputByte = tmpbuf;
- inputChar = input[charOff]; // Get the input character
-
- // Is this a high surrogate?
- if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
- // Is this the last character of the input?
- if (charOff + 1 >= inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + 1];
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- // We have a valid surrogate pair. Too bad we don't do
- // surrogates. Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- inputSize = 2;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- // Is this an unaccompanied low surrogate?
- else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
- outputSize = convSingleByte(inputChar, outputByte);
- if (outputSize == 0) { // DoubleByte
- int ncode = getNative(inputChar);
- if (ncode != 0 && ((ncode & 0xFF0000) == 0)) {
- outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
- outputByte[1] = (byte) (ncode & 0xff);
- outputSize = 2;
- } else {
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- }
- }
-
- // If we don't have room for the output, throw an exception
- if (byteOff + outputSize > outEnd)
- throw new ConversionBufferFullException();
-
- // Put the byte in the output buffer
- for (int i = 0; i < outputSize; i++) {
- output[byteOff++] = outputByte[i];
- }
- charOff += inputSize;
- }
- // Return the length written to the output buffer
- return byteOff - outOff;
- }
-
-
- /**
- * the maximum number of bytes needed to hold a converted char
- * @returns the maximum number of bytes needed for a converted char
- */
- public int getMaxBytesPerChar() {
- return 2;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteEUC_JP_Solaris.java b/jdk/src/share/classes/sun/io/CharToByteEUC_JP_Solaris.java
deleted file mode 100644
index 73337d5..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteEUC_JP_Solaris.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0208_Solaris_Encoder;
-import sun.nio.cs.ext.JIS_X_0212_Solaris_Encoder;
-
-/**
- * @author Limin Shi
- * @author Ian Little
- *
- * EUC_JP variant converter for Solaris with vendor defined chars
- * added (4765370)
- */
-
-public class CharToByteEUC_JP_Solaris extends CharToByteEUC_JP {
- CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
- CharToByteJIS0212_Solaris cbJIS0212 = new CharToByteJIS0212_Solaris();
-
- short[] j0208Index1 = JIS_X_0208_Solaris_Encoder.getIndex1();
- String[] j0208Index2 = JIS_X_0208_Solaris_Encoder.getIndex2();
-
- public String getCharacterEncoding() {
- return "eucJP-open";
- }
-
- protected int convSingleByte(char inputChar, byte[] outputByte) {
- byte b;
-
- if (inputChar == 0) {
- outputByte[0] = (byte)0;
- return 1;
- }
-
- if ((b = cbJIS0201.getNative(inputChar)) == 0)
- return 0;
-
- if (b > 0 && b < 128) {
- outputByte[0] = b;
- return 1;
- }
- outputByte[0] = (byte)0x8E;
- outputByte[1] = b;
- return 2;
- }
-
- protected int getNative(char ch) {
- int r = super.getNative(ch);
- if (r != 0) {
- return r;
- } else {
- int offset = j0208Index1[((ch & 0xff00) >> 8 )] << 8;
- r = j0208Index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
- if (r > 0x7500)
- return 0x8f8080 + cbJIS0212.getNative(ch);
- }
- return (r == 0)? r : r + 0x8080;
- }
-
-
- /**
- * Converts characters to sequences of bytes.
- * Conversions that result in Exceptions can be restarted by calling
- * convert again, with appropriately modified parameters.
- * @return the characters written to output.
- * @param input char array containing text in Unicode
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output byte array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last byte to be written to
- * @throw UnsupportedCharacterException for any character
- * that cannot be converted to the external character set.
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws MalformedInputException, UnknownCharacterException,
- ConversionBufferFullException
- {
- char inputChar; // Input character to be converted
- byte[] outputByte; // Output byte written to output
- int inputSize = 0; // Size of input
- int outputSize = 0; // Size of output
- byte[] tmpbuf = new byte[4];
-
- // Record beginning offsets
- charOff = inOff;
- byteOff = outOff;
-
- if (highHalfZoneCode != 0) {
- inputChar = highHalfZoneCode;
- highHalfZoneCode = 0;
- if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
- // This is legal UTF16 sequence.
- badInputLength = 1;
- throw new UnknownCharacterException();
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException();
- }
- }
-
- // Loop until we hit the end of the input
- while(charOff < inEnd) {
- inputSize = 1;
- outputByte = tmpbuf;
- inputChar = input[charOff]; // Get the input character
-
- // Is this a high surrogate?
- if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
- // Is this the last character of the input?
- if (charOff + 1 >= inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + 1];
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- // We have a valid surrogate pair. Too bad we don't do
- // surrogates. Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- inputSize = 2;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- // Is this an unaccompanied low surrogate?
- else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
- outputSize = convSingleByte(inputChar, outputByte);
- if (outputSize == 0) { // DoubleByte
- int ncode = getNative(inputChar);
- if (ncode != 0 ) {
- if ((ncode & 0xFF0000) == 0) {
- outputByte[0] = (byte) ((ncode & 0xff00) >> 8);
- outputByte[1] = (byte) (ncode & 0xff);
- outputSize = 2;
- } else {
- outputByte[0] = (byte) 0x8F;
- outputByte[1] = (byte) ((ncode & 0xff00) >> 8);
- outputByte[2] = (byte) (ncode & 0xff);
- outputSize = 3;
- }
- } else {
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- }
- }
-
- // If we don't have room for the output, throw an exception
- if (byteOff + outputSize > outEnd)
- throw new ConversionBufferFullException();
-
- // Put the byte in the output buffer
- for (int i = 0; i < outputSize; i++) {
- output[byteOff++] = outputByte[i];
- }
- charOff += inputSize;
- }
- // Return the length written to the output buffer
- return byteOff - outOff;
- }
-
-
- /**
- * the maximum number of bytes needed to hold a converted char
- * @returns the maximum number of bytes needed for a converted char
- */
- public int getMaxBytesPerChar() {
- return 3;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteEUC_KR.java b/jdk/src/share/classes/sun/io/CharToByteEUC_KR.java
deleted file mode 100644
index 9796ebe..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteEUC_KR.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteEUC_KR extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new EUC_KR().newEncoder();
-
- public String getCharacterEncoding() {
- return "EUC_KR";
- }
-
- public CharToByteEUC_KR() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteEUC_TW.java b/jdk/src/share/classes/sun/io/CharToByteEUC_TW.java
deleted file mode 100644
index a8d46eb..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteEUC_TW.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.EUC_TW;
-
-/*
- * @author Limin Shi
- */
-
-public class CharToByteEUC_TW extends CharToByteConverter
-{
- private final EUC_TW.Encoder enc = (EUC_TW.Encoder)(new EUC_TW().newEncoder());
-
- public int flush(byte[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- reset();
- return 0;
- }
-
- public void reset() {
- byteOff = charOff = 0;
- }
-
- public boolean canConvert(char ch){
- return enc.canEncode(ch);
- }
-
- /**
- * Character conversion
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int outputSize;
- byte [] tmpbuf = new byte[4];;
- byte [] outputByte;
- byteOff = outOff;
-
- //Fixed 4122961 by bringing the charOff++ out to this
- // loop where it belongs, changing the loop from
- // while(){} to for(){}.
- for (charOff = inOff; charOff < inEnd; charOff++) {
- outputByte = tmpbuf;
- if ( input[charOff] < 0x80) { // ASCII
- outputSize = 1;
- outputByte[0] = (byte)(input[charOff] & 0x7f);
- } else {
- outputSize = enc.toEUC(input[charOff], outputByte);
- }
-
- if (outputSize == -1) {
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
-
- if (outEnd - byteOff < outputSize)
- throw new ConversionBufferFullException();
-
- for (int i = 0; i < outputSize; i++)
- output[byteOff++] = outputByte[i];
- }
-
- return byteOff - outOff;
-
- }
-
- /**
- * returns the maximum number of bytes needed to convert a char
- */
- public int getMaxBytesPerChar() {
- return 4;
- }
-
- /**
- * Return the character set ID
- */
- public String getCharacterEncoding() {
- return "EUC_TW";
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteGB18030.java b/jdk/src/share/classes/sun/io/CharToByteGB18030.java
deleted file mode 100644
index 0dce04d..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteGB18030.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- */
-
-
-package sun.io;
-import sun.nio.cs.ext.GB18030;
-
-public class CharToByteGB18030 extends CharToByteConverter
-{
-
- private char highHalfZoneCode;
- boolean flushed = true;
-
- private final static int GB18030_SINGLE_BYTE = 1;
- private final static int GB18030_DOUBLE_BYTE = 2;
- private final static int GB18030_FOUR_BYTE = 3;
- private static short[] index1;
- private static String[] index2;
- private int currentState;
-
- public CharToByteGB18030() {
- GB18030 nioCoder = new GB18030();
- currentState = GB18030_DOUBLE_BYTE;
- subBytes = new byte[1];
- subBytes[0] = (byte)'?';
- index1 = nioCoder.getEncoderIndex1();
- index2 = nioCoder.getEncoderIndex2();
- }
-
- public int flush(byte[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (highHalfZoneCode != 0) {
- highHalfZoneCode = 0;
- badInputLength = 0;
- throw new MalformedInputException();
- }
- reset();
- flushed = true;
- return 0;
- }
-
- public void reset() {
- byteOff = charOff = 0;
- currentState = GB18030_DOUBLE_BYTE;
- }
-
- public boolean canConvert(char c) {
- // converts all but unpaired surrogates
- // and illegal chars, U+FFFE & U+FFFF
-
- if ((c >= 0xd800 && c <=0xdfff) || (c >= 0xfffe))
- return false;
- else
- return true;
- }
-
- /**
- * Character conversion
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int linearDiffValue = 0;
- int hiByte = 0 , loByte = 0; // low and high order bytes
- char inputChar; // Input character to be converted
- charOff = inOff;
- byteOff = outOff;
- int inputSize; // Size of the input
- int outputSize; // Size of the output
-
- flushed = false;
-
- if (highHalfZoneCode != 0) {
- if (input[inOff] >= 0xDC00 && input[inOff] <= 0xDFFF) {
-
- // This is legal UTF16 sequence, so shunt in the high
- // surrogate for conversion by convert() loop.
-
- char[] newBuf = new char[inEnd - inOff + 1];
- newBuf[0] = highHalfZoneCode;
- System.arraycopy(input, inOff, newBuf, 1, inEnd - inOff);
- charOff -= 1;
- input = newBuf;
- inOff = 0;
- inEnd = newBuf.length;
- highHalfZoneCode = 0;
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException();
- }
- }
-
- // Main encode loop
-
- while (charOff < inEnd) {
- inputChar = input[charOff++];
-
- if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
- // Is this the last character of the input?
- if (charOff + 1 > inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
-
- char previousChar = inputChar;
- inputChar = input[charOff];
-
- // Is there a low surrogate following?
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- inputSize = 2;
- charOff++;
- linearDiffValue = ( previousChar - 0xD800) * 0x400 +
- ( inputChar - 0xDC00) + 0x2E248;
-
- currentState = GB18030_FOUR_BYTE;
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- // Is this an unaccompanied low surrogate?
- else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- }
-
- // Not part of a surrogate
- else if (inputChar >= 0x0000 && inputChar <= 0x007F) {
- if (byteOff >= outEnd) {
- throw new ConversionBufferFullException();
- }
- currentState = GB18030_SINGLE_BYTE;
- output[byteOff++] = (byte) inputChar;
- }
- else if (inputChar <= 0xA4C6 || inputChar >= 0xE000) {
- int outByteVal = getGB18030(index1, index2, inputChar);
-
- if (outByteVal == 0xFFFD ) {
- if (subMode) {
- if (byteOff >= outEnd) {
- throw new ConversionBufferFullException();
- } else {
- output[byteOff++] = subBytes[0];
- continue;
- }
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
-
- hiByte = (outByteVal & 0xFF00) >> 8;
- loByte = (outByteVal & 0xFF);
-
- linearDiffValue = (hiByte - 0x20) * 256 + loByte;
-
- if (inputChar >= 0xE000 && inputChar < 0xF900)
- linearDiffValue += 0x82BD;
- else if (inputChar >= 0xF900)
- linearDiffValue += 0x93A9;
-
- if (hiByte > 0x80)
- currentState = GB18030_DOUBLE_BYTE;
- else
- currentState = GB18030_FOUR_BYTE;
- }
- else if (inputChar >= 0xA4C7 && inputChar <= 0xD7FF) {
- linearDiffValue = inputChar - 0x5543;
- currentState = GB18030_FOUR_BYTE;
- }
- else {
- badInputLength = 1;
- throw new MalformedInputException();
- }
-
- if (currentState == GB18030_SINGLE_BYTE)
- continue;
-
- if (currentState == GB18030_DOUBLE_BYTE) {
- if (byteOff + 2 > outEnd) {
- throw new ConversionBufferFullException();
- }
- output[byteOff++] = (byte)hiByte;
- output[byteOff++] = (byte)loByte;
- }
- else { // Four Byte encoding
- if (byteOff + 4 > outEnd) {
- throw new ConversionBufferFullException();
- }
-
- byte b1, b2, b3, b4;
-
- b4 = (byte)((linearDiffValue % 10) + 0x30);
- linearDiffValue /= 10;
- b3 = (byte)((linearDiffValue % 126) + 0x81);
- linearDiffValue /= 126;
- b2 = (byte)((linearDiffValue % 10) + 0x30);
- b1 = (byte)((linearDiffValue / 10) + 0x81);
- output[byteOff++] = b1;
- output[byteOff++] = b2;
- output[byteOff++] = b3;
- output[byteOff++] = b4;
- }
- }
- // Return number of bytes written to the output buffer.
- return byteOff - outOff;
- }
-
-
- /**
- * returns the maximum number of bytes needed to convert a char
- */
- public int getMaxBytesPerChar() {
- return 4;
- }
-
-
- /**
- * Return the character set ID
- */
- public String getCharacterEncoding() {
- return "GB18030";
- }
-
- private int getGB18030(short[] outerIndex, String[] innerIndex, char ch) {
- int offset = outerIndex[((ch & 0xff00) >> 8 )] << 8;
-
- return innerIndex[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteGBK.java b/jdk/src/share/classes/sun/io/CharToByteGBK.java
deleted file mode 100644
index 85beef0..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteGBK.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteGBK extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new GBK().newEncoder();
-
- public String getCharacterEncoding() {
- return "GBK";
- }
-
- public CharToByteGBK() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISCII91.java b/jdk/src/share/classes/sun/io/CharToByteISCII91.java
deleted file mode 100644
index b500aaa..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISCII91.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.ISCII91;
-
-/*
- * Copyright (c) 1998 International Business Machines.
- * All Rights Reserved.
- *
- * Author : Sunanda Bera, C. Thirumalesh
- * Last Modified : 11,December,1998
- *
- * Purpose : Defines class CharToByteISCII91.
- *
- *
- * Revision History
- * ======== =======
- *
- * Date By Description
- * ---- -- -----------
- * March 29, 1999 John Raley Removed MalformedInputException; modified substitution logic
- *
- */
-
-/**
- * Converter class. Converts between ISCII91 encoding and Unicode encoding.
- * ISCII91 is the character encoding as defined in Indian Standard document
- * IS 13194:1991 ( Indian Script Code for Information Interchange ).
- *
- * @see sun.io.CharToByteConverter
- */
-
-/*
- * {jbr} I am not sure this class adheres to code converter conventions.
- * Need to investigate.
- * Might should recode as a subclass of CharToByteSingleByte.
- */
-
-public class CharToByteISCII91 extends CharToByteConverter {
-
- private static final byte NO_CHAR = (byte)255;
-
- //private final static ISCII91 nioCoder = new ISCII91();
- private final static byte[] directMapTable = ISCII91.getEncoderMappingTable();
-
- private static final char NUKTA_CHAR = '\u093c';
- private static final char HALANT_CHAR = '\u094d';
-
-
-/**
- * @return true for Devanagari and ASCII range and for the special characters
- * Zero Width Joiner and Zero Width Non-Joiner
- * @see sun.io.CharToByteConverter#canConvert
- *
- */
- public boolean canConvert(char ch) {
- //check for Devanagari range,ZWJ,ZWNJ and ASCII range.
- return ((ch >= 0x0900 && ch <= 0x097f) || (ch == 0x200d || ch == 0x200c)
- || (ch >= 0x0000 && ch <= 0x007f) );
- } //canConvert()
-/**
- * Converts both Devanagari and ASCII range of characters.
- * @see sun.io.CharToByteConverter#convert
- */
- public int convert(char[] input, int inStart, int inEnd, byte[] output, int outStart, int outEnd) throws MalformedInputException, UnknownCharacterException, ConversionBufferFullException {
-
- charOff = inStart;
- byteOff = outStart;
-
- for (;charOff < inEnd; charOff++) {
-
- char inputChar = input[charOff];
- int index = Integer.MIN_VALUE;
- boolean isSurrogatePair = false;
-
- //check if input is in ASCII RANGE
- if (inputChar >= 0x0000 && inputChar <= 0x007f) {
- if (byteOff >= outEnd) {
- throw new ConversionBufferFullException();
- }
- output[byteOff++] = (byte) inputChar;
- continue;
- }
-
- // if inputChar == ZWJ replace it with halant
- // if inputChar == ZWNJ replace it with Nukta
- if (inputChar == 0x200c) {
- inputChar = HALANT_CHAR;
- }
- else if (inputChar == 0x200d) {
- inputChar = NUKTA_CHAR;
- }
-
- if (inputChar >= 0x0900 && inputChar <= 0x097f) {
- index = ((int)(inputChar) - 0x0900)*2;
- }
-
- // If input char is a high surrogate, ensure that the following
- // char is a low surrogate. If not, throw a MalformedInputException.
- // Leave index untouched so substitution or an UnknownCharacterException
- // will result.
- else if (inputChar >= 0xd800 && inputChar <= 0xdbff) {
- if (charOff < inEnd-1) {
- char nextChar = input[charOff];
- if (nextChar >= 0xdc00 && nextChar <= 0xdfff) {
- charOff++;
- isSurrogatePair = true;
- }
- }
- if (!isSurrogatePair) {
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- else if (inputChar >= 0xdc00 && inputChar <= 0xdfff) {
- badInputLength = 1;
- throw new MalformedInputException();
- }
-
- if (index == Integer.MIN_VALUE || directMapTable[index] == NO_CHAR) {
- if (subMode) {
- if (byteOff + subBytes.length >= outEnd) {
- throw new ConversionBufferFullException();
- }
- System.arraycopy(subBytes, 0, output, byteOff, subBytes.length);
- byteOff += subBytes.length;
- } else {
- badInputLength = isSurrogatePair? 2 : 1;
- throw new UnknownCharacterException();
- }
- }
- else {
- if(byteOff >= outEnd) {
- throw new ConversionBufferFullException();
- }
- output[byteOff++] = directMapTable[index++];
- if(directMapTable[index] != NO_CHAR) {
- if(byteOff >= outEnd) {
- throw new ConversionBufferFullException();
- }
- output[byteOff++] = directMapTable[index];
- }
- }
-
- } //end for
-
- return byteOff - outStart;
- } //end of routine convert.
-
-/**
-* @see sun.io.CharToByteConverter#flush
-*/
- public int flush( byte[] output, int outStart, int outEnd )
- throws MalformedInputException, ConversionBufferFullException {
- byteOff = charOff = 0;
- return 0;
- }//flush()
-/**
- * @return The character encoding as a String.
- */
- public String getCharacterEncoding() {
- return "ISCII91";
- }//getCharacterEncoding
-/**
- * @see sun.io.CharToByteConverter#getMaxBytesPerChar
- */
- public int getMaxBytesPerChar() {
- return 2;
- }//getMaxBytesPerChar()
-/**
- * @see sun.io.CharToByteConverter#reset
- */
- public void reset() {
- byteOff = charOff = 0;
- }
-} //end of class definition
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO2022.java b/jdk/src/share/classes/sun/io/CharToByteISO2022.java
deleted file mode 100644
index b49690c..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO2022.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
-* @author Tom Zhou
-*/
-
-public abstract class CharToByteISO2022 extends CharToByteConverter
-{
- private final byte ISO_ESC = 0x1b;
- private final byte ISO_SI = 0x0f;
- private final byte ISO_SO = 0x0e;
- private final byte ISO_SS2_7 = 0x4e;
- private final byte ISO_SS3_7 = 0x4f;
- private final byte SS2 = (byte)0x8e;
- private final byte P2 = (byte)0xA2;
- private final byte P3 = (byte)0xA3;
- private final byte MSB = (byte)0x80;
-
- protected final byte maximumDesignatorLength = 4;
-
- protected String SODesignator,
- SS2Designator = null,
- SS3Designator = null;
-
- protected CharToByteConverter codeConverter;
-
- private boolean shiftout = false;
- private boolean SODesDefined = false;
- private boolean SS2DesDefined = false;
- private boolean SS3DesDefined = false;
-
- private boolean newshiftout = false;
- private boolean newSODesDefined = false;
- private boolean newSS2DesDefined = false;
- private boolean newSS3DesDefined = false;
-
- public int flush(byte[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- reset();
- return 0;
- }
-
- public void reset() {
- shiftout = false;
- SODesDefined = false;
- SS2DesDefined = false;
- SS3DesDefined = false;
- byteOff = charOff = 0;
- }
-
- public boolean canConvert(char ch)
- {
- if (ch<0x80)
- return true;
- return codeConverter.canConvert(ch);
- }
-
- private int unicodeToNative(char unicode, byte ebyte[])
- {
- int index = 0;
- byte tmpByte[];
- byte convByte[] = new byte[codeConverter.getMaxBytesPerChar()];
- char convChar[] = {unicode};
- int converted;
-
- try{
- converted = codeConverter.convert(convChar, 0, 1, convByte, 0,
- codeConverter.getMaxBytesPerChar());
- } catch(Exception e) {
- return -1;
- }
-
- if (converted == 2) {
- if (!SODesDefined) {
- newSODesDefined = true;
- ebyte[0] = ISO_ESC;
- tmpByte = SODesignator.getBytes();
- System.arraycopy(tmpByte,0,ebyte,1,tmpByte.length);
- index = tmpByte.length+1;
- }
- if (!shiftout) {
- newshiftout = true;
- ebyte[index++] = ISO_SO;
- }
- ebyte[index++] = (byte)(convByte[0]&0x7f);
- ebyte[index++] = (byte)(convByte[1]&0x7f);
- } else {
- if((convByte[0] == SS2)&&(convByte[1] == P2)) {
- if (!SS2DesDefined) {
- newSS2DesDefined = true;
- ebyte[0] = ISO_ESC;
- tmpByte = SS2Designator.getBytes();
- System.arraycopy(tmpByte,0,ebyte,1,tmpByte.length);
- index = tmpByte.length+1;
- }
- ebyte[index++] = ISO_ESC;
- ebyte[index++] = ISO_SS2_7;
- ebyte[index++] = (byte)(convByte[2]&0x7f);
- ebyte[index++] = (byte)(convByte[3]&0x7f);
- }
- if((convByte[0] == SS2)&&(convByte[1] == 0xA3))
- {
- if(!SS3DesDefined){
- newSS3DesDefined = true;
- ebyte[0] = ISO_ESC;
- tmpByte = SS3Designator.getBytes();
- System.arraycopy(tmpByte,0,ebyte,1,tmpByte.length);
- index = tmpByte.length+1;
- }
- ebyte[index++] = ISO_ESC;
- ebyte[index++] = ISO_SS3_7;
- ebyte[index++] = (byte)(convByte[2]&0x7f);
- ebyte[index++] = (byte)(convByte[3]&0x7f);
- }
- }
- return index;
- }
-
- /**
- * Character conversion
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws UnknownCharacterException, MalformedInputException,
- ConversionBufferFullException
- {
- int outputSize;
- byte [] tmpbuf = new byte[this.getMaxBytesPerChar()];
- byte [] outputByte;
-
- byteOff = outOff;
-
- newshiftout = shiftout;
- newSODesDefined = SODesDefined;
- newSS2DesDefined = SS2DesDefined;
- newSS3DesDefined = SS3DesDefined;
-
- //Fixed 4122961 by bringing the charOff++ out to this
- // loop where it belongs, changing the loop from
- // while(){} to for(){}.
- for (charOff = inOff; charOff < inEnd; charOff++) {
- outputByte = tmpbuf;
- if (input[charOff] < 0x80) { // ASCII
- if (shiftout){
- newshiftout = false;
- outputSize = 2;
- outputByte[0] = ISO_SI;
- outputByte[1] = (byte)(input[charOff] & 0x7f);
- } else {
- outputSize = 1;
- outputByte[0] = (byte)(input[charOff] & 0x7f);
- }
- if(input[charOff] == '\n'){
- newSODesDefined = false;
- newSS2DesDefined = false;
- newSS3DesDefined = false;
- }
- } else {
- outputSize = unicodeToNative(input[charOff], outputByte);
- }
-
- if (outputSize == -1) {
- if (subMode) {
- if(!newSODesDefined){
- newSODesDefined = !newSODesDefined;
- outputByte[0] = ISO_SO;
- outputByte[1] = (byte)'?';
- outputSize = 2;
- } else {
- outputByte = subBytes;
- outputSize = subBytes.length;
- }
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
-
- if (outEnd - byteOff < outputSize)
- throw new ConversionBufferFullException();
-
- for (int i = 0; i < outputSize; i++)
- output[byteOff++] = outputByte[i];
-
- // Bug 4266772. Update statuses only when output buffer has been
- // updated. When ConversionBufferFullException() has been throwed
- // we want to keep old statuses for next call.
- shiftout = newshiftout;
- SODesDefined = newSODesDefined;
- SS2DesDefined = newSS2DesDefined;
- SS3DesDefined = newSS3DesDefined;
- }
- return byteOff - outOff;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO2022CN_CNS.java b/jdk/src/share/classes/sun/io/CharToByteISO2022CN_CNS.java
deleted file mode 100644
index 0c1ef30..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO2022CN_CNS.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
-* @author Tom Zhou
-*/
-
-public class CharToByteISO2022CN_CNS extends CharToByteISO2022
-{
- public CharToByteISO2022CN_CNS()
- {
- SODesignator = "$)G";
- SS2Designator = "$*H";
- SS3Designator = "$+I";
- try {
- codeConverter = CharToByteConverter.getConverter("CNS11643");
- } catch (Exception e) {};
- }
-
- /**
- * returns the maximum number of bytes needed to convert a char
- */
- public int getMaxBytesPerChar()
- {
- return maximumDesignatorLength+4;
- }
-
- /**
- * Return the character set ID
- */
- public String getCharacterEncoding()
- {
- return "ISO2022CN_CNS";
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO2022CN_GB.java b/jdk/src/share/classes/sun/io/CharToByteISO2022CN_GB.java
deleted file mode 100644
index 7edbc9f..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO2022CN_GB.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
-* @author Tom Zhou
-*/
-
-public class CharToByteISO2022CN_GB extends CharToByteISO2022
-{
- public CharToByteISO2022CN_GB()
- {
- SODesignator = "$)A";
- try {
- codeConverter = CharToByteConverter.getConverter("GB2312");
- } catch (Exception e) {};
- }
-
- /**
- * returns the maximum number of bytes needed to convert a char
- */
- public int getMaxBytesPerChar()
- {
- return maximumDesignatorLength+4;
- }
-
- /**
- * Return the character set ID
- */
- public String getCharacterEncoding()
- {
- return "ISO2022CN_GB";
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO2022JP.java b/jdk/src/share/classes/sun/io/CharToByteISO2022JP.java
deleted file mode 100644
index 3cf4d77..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO2022JP.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-import java.io.*;
-
-public class CharToByteISO2022JP extends CharToByteJIS0208 {
-
- private static final int ASCII = 0; // ESC ( B
- private static final int JISX0201_1976 = 1; // ESC ( J
- private static final int JISX0208_1978 = 2; // ESC $ @
- private static final int JISX0208_1983 = 3; // ESC $ B
- private static final int JISX0201_1976_KANA = 4; // ESC ( I
-
- private char highHalfZoneCode;
- private boolean flushed = true;
-
- // JIS is state full encoding, so currentMode keep the
- // current codeset
- private int currentMode = ASCII;
-
- /**
- * Bytes for substitute for unmappable input.
- */
- // XXX: Assumes subBytes are ASCII string. Need to change Escape sequence
- // for other character sets.
- protected byte[] subBytesEscape = { (byte)0x1b, (byte)0x28, (byte)0x42 }; // ESC ( B
- protected int subBytesMode = ASCII;
-
- public int flush(byte[] output, int outStart, int outEnd)
- throws MalformedInputException, ConversionBufferFullException
- {
- if (highHalfZoneCode != 0) {
- highHalfZoneCode = 0;
- badInputLength = 0;
- throw new MalformedInputException();
- }
-
- if (!flushed && (currentMode != ASCII)) {
- if (outEnd - outStart < 3) {
- throw new ConversionBufferFullException();
- }
- output[outStart] = (byte)0x1b;
- output[outStart + 1] = (byte)0x28;
- output[outStart + 2] = (byte)0x42;
- byteOff += 3;
- byteOff = charOff = 0;
- flushed = true;
- currentMode = ASCII;
- return 3;
- }
- return 0;
- }
-
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws MalformedInputException, UnknownCharacterException,
- ConversionBufferFullException
-
- {
- char inputChar; // Input character to be converted
- int inputSize; // Size of the input
- int outputSize; // Size of the output
-
- // Buffer for output bytes
- byte[] tmpArray = new byte[6];
- byte[] outputByte;
-
- flushed = false;
-
- // Make copies of input and output indexes
- charOff = inOff;
- byteOff = outOff;
-
- if (highHalfZoneCode != 0) {
- inputChar = highHalfZoneCode;
- highHalfZoneCode = 0;
- if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
- // This is legal UTF16 sequence.
- badInputLength = 1;
- throw new UnknownCharacterException();
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException();
- }
- }
-
- // Loop until we run out of input
- while(charOff < inEnd) {
- outputByte = tmpArray;
- int newMode = currentMode; // Trace character mode changing
-
- // Get the input character
- inputChar = input[charOff];
- inputSize = 1;
- outputSize = 1;
-
- // Is this a high surrogate?
- if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
- // Is this the last character of the input?
- if (charOff + 1 >= inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + 1];
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- // We have a valid surrogate pair. Too bad we don't do
- // surrogates. Is substitution enabled?
- if (subMode) {
- if (currentMode != subBytesMode) {
- System.arraycopy(subBytesEscape, 0, outputByte, 0,
- subBytesEscape.length);
- outputSize = subBytesEscape.length;
- System.arraycopy(subBytes, 0, outputByte,
- outputSize, subBytes.length);
- outputSize += subBytes.length;
- newMode = subBytesMode;
- } else {
- outputByte = subBytes;
- outputSize = subBytes.length;
- }
- inputSize = 2;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
-
- // Is this an unaccompanied low surrogate?
- else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- } else {
- // Not part of a surrogate
-
- // Does this map to the Roman range?
- if (inputChar <= '\u007F') {
- if (currentMode != ASCII) {
- outputByte[0] = (byte)0x1b;
- outputByte[1] = (byte)0x28;
- outputByte[2] = (byte)0x42;
- outputByte[3] = (byte)inputChar;
- outputSize = 4;
- newMode = ASCII;
- } else {
- outputByte[0] = (byte)inputChar;
- outputSize = 1;
- }
- }
- // Is it a single byte kana?
- else if (inputChar >= 0xFF61 && inputChar <= 0xFF9F) {
- if (currentMode != JISX0201_1976_KANA) {
- outputByte[0] = (byte)0x1b;
- outputByte[1] = (byte)0x28;
- outputByte[2] = (byte)0x49;
- outputByte[3] = (byte)(inputChar - 0xff40);
- outputSize = 4;
- newMode = JISX0201_1976_KANA;
- } else {
- outputByte[0] = (byte)(inputChar - 0xff40);
- outputSize = 1;
- }
- }
- // Is it a yen sign?
- else if (inputChar == '\u00A5') {
- if (currentMode != JISX0201_1976) {
- outputByte[0] = (byte)0x1b;
- outputByte[1] = (byte)0x28;
- outputByte[2] = (byte)0x4a;
- outputByte[3] = (byte)0x5c;
- outputSize = 4;
- newMode = JISX0201_1976;
- } else {
- outputByte[0] = (byte)0x5C;
- outputSize = 1;
- }
- }
- // Is it a tilde?
- else if (inputChar == '\u203E')
- {
- if (currentMode != JISX0201_1976) {
- outputByte[0] = (byte)0x1b;
- outputByte[1] = (byte)0x28;
- outputByte[2] = (byte)0x4a;
- outputByte[3] = (byte)0x7e;
- outputSize = 4;
- newMode = JISX0201_1976;
- } else {
- outputByte[0] = (byte)0x7e;
- outputSize = 1;
- }
- }
- // Is it a JIS-X-0208 character?
- else {
- int index = getNative(inputChar);
- if (index != 0) {
- if (currentMode != JISX0208_1983) {
- outputByte[0] = (byte)0x1b;
- outputByte[1] = (byte)0x24;
- outputByte[2] = (byte)0x42;
- outputByte[3] = (byte)(index >> 8);
- outputByte[4] = (byte)(index & 0xff);
- outputSize = 5;
- newMode = JISX0208_1983;
- } else {
- outputByte[0] = (byte)(index >> 8);
- outputByte[1] = (byte)(index & 0xff);
- outputSize = 2;
- }
- }
- // It doesn't map to JIS-0208!
- else {
- if (subMode) {
- if (currentMode != subBytesMode) {
- System.arraycopy(subBytesEscape, 0, outputByte, 0,
- subBytesEscape.length);
- outputSize = subBytesEscape.length;
- System.arraycopy(subBytes, 0, outputByte,
- outputSize, subBytes.length);
- outputSize += subBytes.length;
- newMode = subBytesMode;
- } else {
- outputByte = subBytes;
- outputSize = subBytes.length;
- }
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- }
- }
-
- // Is there room in the output buffer?
- // XXX: The code assumes output buffer can hold at least 5 bytes,
- // in this coverter case. However, there is no way for apps to
- // see how many bytes will be necessary for next call.
- // getMaxBytesPerChar() should be overriden in every subclass of
- // CharToByteConverter and reflect real value (5 for this).
- if (byteOff + outputSize > outEnd)
- throw new ConversionBufferFullException();
-
- // Put the output into the buffer
- for ( int i = 0 ; i < outputSize ; i++ )
- output[byteOff++] = outputByte[i];
-
- // Advance the input pointer
- charOff += inputSize;
-
- // We can successfuly output the characters, changes
- // current mode. Fix for 4251646.
- currentMode = newMode;
- }
-
- // return mode ASCII at the end
- if (currentMode != ASCII){
- if (byteOff + 3 > outEnd)
- throw new ConversionBufferFullException();
-
- output[byteOff++] = 0x1b;
- output[byteOff++] = 0x28;
- output[byteOff++] = 0x42;
- currentMode = ASCII;
- }
-
- // Return the length written to the output buffer
- return byteOff-outOff;
- }
-
- // Reset
- public void reset() {
- highHalfZoneCode = 0;
- byteOff = charOff = 0;
- currentMode = ASCII;
- }
-
- /**
- * returns the maximum number of bytes needed to convert a char
- */
- public int getMaxBytesPerChar() {
- return 8;
- }
-
- // Return the character set ID
- public String getCharacterEncoding() {
- return "ISO2022JP";
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO2022KR.java b/jdk/src/share/classes/sun/io/CharToByteISO2022KR.java
deleted file mode 100644
index 092cc2b..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO2022KR.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-public class CharToByteISO2022KR extends CharToByteISO2022
-{
- public CharToByteISO2022KR()
- {
- SODesignator = "$)C";
- try {
- codeConverter = CharToByteConverter.getConverter("KSC5601");
- } catch (Exception e) {};
- }
-
- /**
- * returns the maximum number of bytes needed to convert a char
- */
- public int getMaxBytesPerChar()
- {
- return maximumDesignatorLength+4;
- }
-
- /**
- * Return the character set ID
- */
- public String getCharacterEncoding()
- {
- return "ISO2022KR";
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_1.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_1.java
deleted file mode 100644
index 1708600..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_1.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-public class CharToByteISO8859_1 extends CharToByteConverter {
-
- // Return the character set ID
- public String getCharacterEncoding()
- {
- return "ISO8859_1";
- }
-
- private char highHalfZoneCode;
-
- public int flush(byte[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (highHalfZoneCode != 0) {
- highHalfZoneCode = 0;
- throw new MalformedInputException
- ("String ends with <High Half Zone code> of UTF16");
- }
- byteOff = charOff = 0;
- return 0;
- }
-
- /*
- * Character conversion
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws MalformedInputException,
- UnknownCharacterException,
- ConversionBufferFullException
-
- {
-
- char inputChar; // Input character to be converted
- byte[] outputByte; // Output byte written to output
- byte[] tmpArray = new byte[1];
- int inputSize; // Size of input
- int outputSize; // Size of output
-
- // Record beginning offsets
- charOff = inOff;
- byteOff = outOff;
-
- if (highHalfZoneCode != 0) {
- inputChar = highHalfZoneCode;
- highHalfZoneCode = 0;
- if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
- // This is legal UTF16 sequence.
- if (subMode) {
- outputSize = subBytes.length;
- if (byteOff + outputSize > outEnd)
- throw new ConversionBufferFullException();
- for(int i = 0; i < outputSize; i++)
- output[byteOff++] = subBytes[i];
- charOff += 1;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException
- ("Previous converted string ends with " +
- "<High Half Zone Code> of UTF16 " +
- ", but this string is not begin with <Low Half Zone>");
- }
- }
-
- // Loop until we hit the end of the input
- while(charOff < inEnd) {
- outputByte = tmpArray;
-
- // Get the input character
- inputChar = input[charOff];
-
- // default outputSize
- outputSize = 1;
-
- // Assume this is a simple character
- inputSize = 1;
-
- // Is this a high surrogate?
- if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
- // Is this the last character in the input?
- if (charOff + 1 == inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + 1];
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- // We have a valid surrogate pair. Too bad we don't map
- // surrogates. Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- inputSize = 2;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
- // Is this an unaccompanied low surrogate?
- else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- }
- // Not part of a surrogate, so try to convert
- else {
- // Is this character mappable?
- if (inputChar <= '\u00FF') {
- outputByte[0] = (byte)inputChar;
- } else {
- // Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- }
-
- // If we don't have room for the output, throw an exception
- if (byteOff + outputSize > outEnd)
- throw new ConversionBufferFullException();
-
- // Put the byte in the output buffer
- for (int i = 0; i < outputSize; i++) {
- output[byteOff++] = outputByte[i];
- }
- charOff += inputSize;
- }
-
- // Return the length written to the output buffer
- return byteOff-outOff;
- }
-
- // Determine if a character is mappable or not
- public boolean canConvert(char ch)
- {
- return (ch <= '\u00FF');
- }
-
- // Reset the converter
- public void reset()
- {
- byteOff = charOff = 0;
- highHalfZoneCode = 0;
- }
-
- /**
- * returns the maximum number of bytes needed to convert a char
- */
- public int getMaxBytesPerChar()
- {
- return 1;
- }
-
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_13.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_13.java
deleted file mode 100644
index 4158595..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_13.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_13;
-
-/**
- * Tables and data to convert Unicode to ISO8859_13
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_13 extends CharToByteSingleByte {
-
- private final static ISO_8859_13 nioCoder = new ISO_8859_13();
-
- public String getCharacterEncoding() {
- return "ISO8859_13";
- }
-
- public CharToByteISO8859_13() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_15.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_15.java
deleted file mode 100644
index 65436ff..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_15.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998 - All Rights Reserved
- *
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_15;
-
-/**
- * Tables and data to convert Unicode to ISO8859_15
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_15 extends CharToByteSingleByte {
-
- private final static ISO_8859_15 nioCoder = new ISO_8859_15();
-
- public String getCharacterEncoding() {
- return "ISO8859_15";
- }
-
- public CharToByteISO8859_15() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_2.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_2.java
deleted file mode 100644
index 0ea9562..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_2.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_2;
-
-/**
- * Tables and data to convert Unicode to ISO8859_2
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_2 extends CharToByteSingleByte {
-
- private final static ISO_8859_2 nioCoder = new ISO_8859_2();
-
- public String getCharacterEncoding() {
- return "ISO8859_2";
- }
-
- public CharToByteISO8859_2() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_3.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_3.java
deleted file mode 100644
index 78b29f4..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_3.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.ISO_8859_3;
-
-/**
- * Tables and data to convert Unicode to ISO8859_3
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_3 extends CharToByteSingleByte {
-
- private final static ISO_8859_3 nioCoder = new ISO_8859_3();
-
- public String getCharacterEncoding() {
- return "ISO8859_3";
- }
-
- public CharToByteISO8859_3() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_4.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_4.java
deleted file mode 100644
index c6055e1..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_4.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_4;
-
-/**
- * Tables and data to convert Unicode to ISO8859_4
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_4 extends CharToByteSingleByte {
-
- private final static ISO_8859_4 nioCoder = new ISO_8859_4();
-
- public String getCharacterEncoding() {
- return "ISO8859_4";
- }
-
- public CharToByteISO8859_4() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_5.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_5.java
deleted file mode 100644
index 84e8f4d..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_5.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_5;
-
-/**
- * Tables and data to convert Unicode to ISO8859_5
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_5 extends CharToByteSingleByte {
-
- private final static ISO_8859_5 nioCoder = new ISO_8859_5();
-
- public String getCharacterEncoding() {
- return "ISO8859_5";
- }
-
- public CharToByteISO8859_5() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_6.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_6.java
deleted file mode 100644
index d724187..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_6.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.ISO_8859_6;
-
-/**
- * Tables and data to convert Unicode to ISO8859_6
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_6 extends CharToByteSingleByte {
-
- private final static ISO_8859_6 nioCoder = new ISO_8859_6();
-
- public String getCharacterEncoding() {
- return "ISO8859_6";
- }
-
- public CharToByteISO8859_6() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_7.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_7.java
deleted file mode 100644
index 3607958..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_7.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_7;
-
-
-/**
- * Tables and data to convert Unicode to ISO8859_7
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_7 extends CharToByteSingleByte {
-
- public String getCharacterEncoding() {
- return "ISO8859_7";
- }
-
- private final static ISO_8859_7 nioCoder = new ISO_8859_7();
-
- public CharToByteISO8859_7() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_8.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_8.java
deleted file mode 100644
index 47465f9..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_8.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.ISO_8859_8;
-
-/**
- * Tables and data to convert Unicode to ISO8859_8
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_8 extends CharToByteSingleByte {
-
- private final static ISO_8859_8 nioCoder = new ISO_8859_8();
-
- public String getCharacterEncoding() {
- return "ISO8859_8";
- }
-
- public CharToByteISO8859_8() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteISO8859_9.java b/jdk/src/share/classes/sun/io/CharToByteISO8859_9.java
deleted file mode 100644
index 58ce4dc..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteISO8859_9.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ISO_8859_9;
-
-/**
- * Tables and data to convert Unicode to ISO8859_9
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteISO8859_9 extends CharToByteSingleByte {
-
- private final static ISO_8859_9 nioCoder = new ISO_8859_9();
-
- public String getCharacterEncoding() {
- return "ISO8859_9";
- }
-
- public CharToByteISO8859_9() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteJIS0201.java b/jdk/src/share/classes/sun/io/CharToByteJIS0201.java
deleted file mode 100644
index cc4c6bf..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteJIS0201.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * Tables and data to convert Unicode to JIS0201
- *
- * @author ConverterGenerator tool
- * @version >= JDK1.1.6
- */
-
-class CharToByteJIS0201 extends CharToByteSingleByte {
-
- public String getCharacterEncoding() {
- return "JIS0201";
- }
-
- public CharToByteJIS0201() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- /*
- super.index1 = index1;
- super.index2 = index2;
- */
- }
-
- public byte getNative(char inputChar) {
- return (byte)index2.charAt(index1[(inputChar & mask1) >> shift]
- + (inputChar & mask2));
- }
-
- public boolean canConvert(char ch) {
- if (index2.charAt(index1[((ch & mask1) >> shift)] + (ch & mask2)) != '\u0000')
- return true;
- return (ch == '\u0000');
- }
-
- private final static String index2 =
-
- "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" +
- "\b\t\n\u000B\f\r\u000E\u000F" +
- "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" +
- "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" +
- "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" +
- "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" +
- "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" +
- "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" +
- "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" +
- "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" +
- "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" +
- "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" +
- "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" +
- "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" +
- "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" +
- "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\\\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u007E\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8" +
- "\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF\u00B0" +
- "\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8" +
- "\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0" +
- "\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8" +
- "\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0" +
- "\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8" +
- "\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
- "\u0000\u0000\u0000\u0000\u0000\u0000\u0000";
-
- private final static short index1[] = {
- 0, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 360, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 519,
- };
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteJIS0208.java b/jdk/src/share/classes/sun/io/CharToByteJIS0208.java
deleted file mode 100644
index 367f1fa..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteJIS0208.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0208_Encoder;
-
-/**
- * Tables and data to convert Unicode to JIS0208
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteJIS0208 extends CharToByteDoubleByte {
-
- public String getCharacterEncoding() {
- return "JIS0208";
- }
-
- public CharToByteJIS0208() {
- super.index1 = JIS_X_0208_Encoder.getIndex1();
- super.index2 = JIS_X_0208_Encoder.getIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteJIS0208_Solaris.java b/jdk/src/share/classes/sun/io/CharToByteJIS0208_Solaris.java
deleted file mode 100644
index f026f28..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteJIS0208_Solaris.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0208_Solaris_Encoder;
-
-/**
- * Tables and data to convert Unicode to JIS0208_Solaris
- *
- *
- * Vendor defined chars added for benefit of vendor defined character
- * supplemented mappings for EUC-JP-Solaris/PCK Solaris variants of EUC-JP
- * and SJIS/Shift_JIS (4765370)
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteJIS0208_Solaris extends CharToByteDoubleByte {
-
- public String getCharacterEncoding() {
- return "JIS0208_Solaris";
- }
-
- public CharToByteJIS0208_Solaris() {
- super.index1 = JIS_X_0208_Solaris_Encoder.getIndex1();
- super.index2 = JIS_X_0208_Solaris_Encoder.getIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteJIS0212.java b/jdk/src/share/classes/sun/io/CharToByteJIS0212.java
deleted file mode 100644
index 18607555..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteJIS0212.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-import sun.nio.cs.ext.JIS_X_0212_Encoder;
-
-/**
- * Tables and data to convert Unicode to JIS0212
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteJIS0212 extends CharToByteDoubleByte {
- public String getCharacterEncoding() {
- return "JIS0212";
- }
-
- public CharToByteJIS0212() {
- super.index1 = JIS_X_0212_Encoder.getIndex1();
- super.index2 = JIS_X_0212_Encoder.getIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteJIS0212_Solaris.java b/jdk/src/share/classes/sun/io/CharToByteJIS0212_Solaris.java
deleted file mode 100644
index 43c4670..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteJIS0212_Solaris.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0212_Solaris_Encoder;
-
-/**
- * Tables and data to convert Unicode to JIS0212_Solaris
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteJIS0212_Solaris extends CharToByteDoubleByte {
-
- public String getCharacterEncoding() {
- return "JIS0212_Solaris";
- }
-
- public CharToByteJIS0212_Solaris() {
- super.index1 = JIS_X_0212_Solaris_Encoder.getIndex1();
- super.index2 = JIS_X_0212_Solaris_Encoder.getIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteJohab.java b/jdk/src/share/classes/sun/io/CharToByteJohab.java
deleted file mode 100644
index d0536f1..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteJohab.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteJohab extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new Johab().newEncoder();
-
- public String getCharacterEncoding() {
- return "Johab";
- }
-
- public CharToByteJohab() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteKOI8_R.java b/jdk/src/share/classes/sun/io/CharToByteKOI8_R.java
deleted file mode 100644
index 7688541..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteKOI8_R.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.KOI8_R;
-
-/**
- * Tables and data to convert Unicode to KOI8_R
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteKOI8_R extends CharToByteSingleByte {
-
- private final static KOI8_R nioCoder = new KOI8_R();
-
- public String getCharacterEncoding() {
- return "KOI8_R";
- }
-
- public CharToByteKOI8_R() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMS874.java b/jdk/src/share/classes/sun/io/CharToByteMS874.java
deleted file mode 100644
index b855d63..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMS874.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.MS874;
-
-/**
- * Tables and data to convert Unicode to MS874
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMS874 extends CharToByteSingleByte {
-
- private final static MS874 nioCoder = new MS874();
-
- public String getCharacterEncoding() {
- return "MS874";
- }
-
- public CharToByteMS874() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMS932.java b/jdk/src/share/classes/sun/io/CharToByteMS932.java
deleted file mode 100644
index 1768752..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMS932.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteMS932 extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new MS932().newEncoder();
-
- public String getCharacterEncoding() {
- return "MS932";
- }
-
- public CharToByteMS932() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMS936.java b/jdk/src/share/classes/sun/io/CharToByteMS936.java
deleted file mode 100644
index 362c3a9..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMS936.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteMS936 extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new MS936().newEncoder();
-
- public String getCharacterEncoding() {
- return "MS936";
- }
-
- public CharToByteMS936() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMS949.java b/jdk/src/share/classes/sun/io/CharToByteMS949.java
deleted file mode 100644
index 11e678d..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMS949.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteMS949 extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new MS949().newEncoder();
-
- public String getCharacterEncoding() {
- return "MS949";
- }
-
- public CharToByteMS949() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMS950.java b/jdk/src/share/classes/sun/io/CharToByteMS950.java
deleted file mode 100644
index 8ec65a9..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMS950.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.io;
-
-import sun.nio.cs.ext.*;
-
-public class CharToByteMS950 extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new MS950().newEncoder();
-
- public String getCharacterEncoding() {
- return "MS950";
- }
-
- public CharToByteMS950() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMS950_HKSCS.java b/jdk/src/share/classes/sun/io/CharToByteMS950_HKSCS.java
deleted file mode 100644
index 540d3aa..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMS950_HKSCS.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.DoubleByte;
-import sun.nio.cs.ext.MS950_HKSCS;
-
-public class CharToByteMS950_HKSCS extends CharToByteDBCS_ASCII {
-
- private static DoubleByte.Encoder enc =
- (DoubleByte.Encoder)new MS950_HKSCS().newEncoder();
-
- public String getCharacterEncoding() {
- return "MS950_HKSCS";
- }
-
- public CharToByteMS950_HKSCS() {
- super(enc);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacArabic.java b/jdk/src/share/classes/sun/io/CharToByteMacArabic.java
deleted file mode 100644
index 1cd58c8..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacArabic.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacArabic;
-
-/**
- * Tables and data to convert Unicode to MacArabic
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacArabic extends CharToByteSingleByte {
-
- private final static MacArabic nioCoder = new MacArabic();
-
- public String getCharacterEncoding() {
- return "MacArabic";
- }
-
- public CharToByteMacArabic() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacCentralEurope.java b/jdk/src/share/classes/sun/io/CharToByteMacCentralEurope.java
deleted file mode 100644
index 7ddfd29..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacCentralEurope.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacCentralEurope;
-
-/**
- * Tables and data to convert Unicode to MacCentralEurope
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacCentralEurope extends CharToByteSingleByte {
-
- private final static MacCentralEurope nioCoder = new MacCentralEurope();
-
- public String getCharacterEncoding() {
- return "MacCentralEurope";
- }
-
- public CharToByteMacCentralEurope() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacCroatian.java b/jdk/src/share/classes/sun/io/CharToByteMacCroatian.java
deleted file mode 100644
index 2ff6d0a..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacCroatian.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacCroatian;
-
-/**
- * Tables and data to convert Unicode to MacCroatian
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacCroatian extends CharToByteSingleByte {
-
- private final static MacCroatian nioCoder = new MacCroatian();
-
- public String getCharacterEncoding() {
- return "MacCroatian";
- }
-
- public CharToByteMacCroatian() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacCyrillic.java b/jdk/src/share/classes/sun/io/CharToByteMacCyrillic.java
deleted file mode 100644
index 17aefef..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacCyrillic.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacCyrillic;
-
-/**
- * Tables and data to convert Unicode to MacCyrillic
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacCyrillic extends CharToByteSingleByte {
-
- private final static MacCyrillic nioCoder = new MacCyrillic();
-
- public String getCharacterEncoding() {
- return "MacCyrillic";
- }
-
- public CharToByteMacCyrillic() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacDingbat.java b/jdk/src/share/classes/sun/io/CharToByteMacDingbat.java
deleted file mode 100644
index 0d53511..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacDingbat.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacDingbat;
-
-/**
- * Tables and data to convert Unicode to MacDingbat
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacDingbat extends CharToByteSingleByte {
-
- private final static MacDingbat nioCoder = new MacDingbat();
-
- public String getCharacterEncoding() {
- return "MacDingbat";
- }
-
- public CharToByteMacDingbat() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacGreek.java b/jdk/src/share/classes/sun/io/CharToByteMacGreek.java
deleted file mode 100644
index a520a13..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacGreek.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacGreek;
-
-/**
- * Tables and data to convert Unicode to MacGreek
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacGreek extends CharToByteSingleByte {
-
- private final static MacGreek nioCoder = new MacGreek();
-
- public String getCharacterEncoding() {
- return "MacGreek";
- }
-
- public CharToByteMacGreek() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacHebrew.java b/jdk/src/share/classes/sun/io/CharToByteMacHebrew.java
deleted file mode 100644
index c725c90..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacHebrew.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacHebrew;
-
-/**
- * Tables and data to convert Unicode to MacHebrew
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacHebrew extends CharToByteSingleByte {
-
- private final static MacHebrew nioCoder = new MacHebrew();
-
- public String getCharacterEncoding() {
- return "MacHebrew";
- }
-
- public CharToByteMacHebrew() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacIceland.java b/jdk/src/share/classes/sun/io/CharToByteMacIceland.java
deleted file mode 100644
index 8b4d2dc..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacIceland.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacIceland;
-
-/**
- * Tables and data to convert Unicode to MacIceland
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacIceland extends CharToByteSingleByte {
-
- private final static MacIceland nioCoder = new MacIceland();
-
- public String getCharacterEncoding() {
- return "MacIceland";
- }
-
- public CharToByteMacIceland() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacRoman.java b/jdk/src/share/classes/sun/io/CharToByteMacRoman.java
deleted file mode 100644
index ea6b1a2..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacRoman.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacRoman;
-
-/**
- * Tables and data to convert Unicode to MacRoman
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacRoman extends CharToByteSingleByte {
-
- private final static MacRoman nioCoder = new MacRoman();
-
- public String getCharacterEncoding() {
- return "MacRoman";
- }
-
- public CharToByteMacRoman() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacRomania.java b/jdk/src/share/classes/sun/io/CharToByteMacRomania.java
deleted file mode 100644
index bad0a86..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacRomania.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacRomania;
-
-/**
- * Tables and data to convert Unicode to MacRomania
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacRomania extends CharToByteSingleByte {
-
- private final static MacRomania nioCoder = new MacRomania();
-
- public String getCharacterEncoding() {
- return "MacRomania";
- }
-
- public CharToByteMacRomania() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacSymbol.java b/jdk/src/share/classes/sun/io/CharToByteMacSymbol.java
deleted file mode 100644
index 6043cd0..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacSymbol.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacSymbol;
-
-/**
- * Tables and data to convert Unicode to MacSymbol
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacSymbol extends CharToByteSingleByte {
-
- private final static MacSymbol nioCoder = new MacSymbol();
-
- public String getCharacterEncoding() {
- return "MacSymbol";
- }
-
- public CharToByteMacSymbol() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacThai.java b/jdk/src/share/classes/sun/io/CharToByteMacThai.java
deleted file mode 100644
index 3d6f73f..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacThai.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacThai;
-
-/**
- * Tables and data to convert Unicode to MacThai
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacThai extends CharToByteSingleByte {
-
- private final static MacThai nioCoder = new MacThai();
-
- public String getCharacterEncoding() {
- return "MacThai";
- }
-
- public CharToByteMacThai() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacTurkish.java b/jdk/src/share/classes/sun/io/CharToByteMacTurkish.java
deleted file mode 100644
index 3e8aaa1..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacTurkish.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacTurkish;
-
-/**
- * Tables and data to convert Unicode to MacTurkish
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacTurkish extends CharToByteSingleByte {
-
- private final static MacTurkish nioCoder = new MacTurkish();
-
- public String getCharacterEncoding() {
- return "MacTurkish";
- }
-
- public CharToByteMacTurkish() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteMacUkraine.java b/jdk/src/share/classes/sun/io/CharToByteMacUkraine.java
deleted file mode 100644
index 714fd38..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteMacUkraine.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.MacUkraine;
-
-/**
- * Tables and data to convert Unicode to MacUkraine
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteMacUkraine extends CharToByteSingleByte {
-
- private final static MacUkraine nioCoder = new MacUkraine();
-
- public String getCharacterEncoding() {
- return "MacUkraine";
- }
-
- public CharToByteMacUkraine() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToBytePCK.java b/jdk/src/share/classes/sun/io/CharToBytePCK.java
deleted file mode 100644
index 89c13cd..0000000
--- a/jdk/src/share/classes/sun/io/CharToBytePCK.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.JIS_X_0208_Solaris_Encoder;
-
-/**
- * @author Limin Shi
- * @author Mark Son-Bell
- * @author Ian Little
- *
- * PCK char->byte converter for Solaris platform containing additional
- * mappings for vendor defined chars (NEC row 13 & IBM extension chars)
- * (bugID 4765370)
- */
-public class CharToBytePCK extends CharToByteSJIS {
- CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
- short[] j0208Index1 = JIS_X_0208_Solaris_Encoder.getIndex1();
- String[] j0208Index2 = JIS_X_0208_Solaris_Encoder.getIndex2();
-
- public String getCharacterEncoding() {
- return "PCK";
- }
-
- protected int convSingleByte(char inputChar, byte[] outputByte) {
- byte b;
-
- // \u0000 - \u007F map straight through
- if ((inputChar & 0xFF80) == 0) {
- outputByte[0] = (byte)inputChar;
- return 1;
- }
-
- if ((b = cbJIS0201.getNative(inputChar)) == 0)
- return 0;
-
- outputByte[0] = b;
- return 1;
- }
-
- protected int getNative(char ch) {
- int result = 0;
-
- switch (ch) {
- case '\u2015':
- return 0x815C;
- case '\u2014':
- return 0;
- default:
- break;
- }
-
- if ((result = super.getNative(ch)) != 0) {
- return result;
- } else {
- int offset = j0208Index1[ch >> 8] << 8;
- int pos = j0208Index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
-
- if (pos != 0) {
- /*
- * This algorithm for converting from JIS to SJIS comes from Ken Lunde's
- * "Understanding Japanese Information Processing", pg 163.
- */
- int c1 = (pos >> 8) & 0xff;
- int c2 = pos & 0xff;
- int rowOffset = c1 < 0x5F ? 0x70 : 0xB0;
- int cellOffset = (c1 % 2 == 1) ? (c2 > 0x5F ? 0x20 : 0x1F) : 0x7E;
- result = ((((c1 + 1 ) >> 1) + rowOffset) << 8) | (c2 + cellOffset);
- }
- }
- return result;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteSJIS.java b/jdk/src/share/classes/sun/io/CharToByteSJIS.java
deleted file mode 100644
index 1c5969d..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteSJIS.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-/**
- * @author Limin Shi
- * @author Mark Son-Bell
- */
-
-public class CharToByteSJIS extends CharToByteJIS0208 {
- CharToByteJIS0201 cbJIS0201 = new CharToByteJIS0201();
-
- public String getCharacterEncoding() {
- return "SJIS";
- }
-
- protected int convSingleByte(char inputChar, byte[] outputByte) {
- byte b;
-
- // \u0000 - \u007F map straight through
- if ((inputChar & 0xFF80) == 0) {
- outputByte[0] = (byte)inputChar;
- return 1;
- }
-
- if ((b = cbJIS0201.getNative(inputChar)) == 0)
- return 0;
-
- outputByte[0] = b;
- return 1;
- }
-
- protected int getNative(char ch) {
- int offset = index1[ch >> 8] << 8;
- int pos = index2[offset >> 12].charAt((offset & 0xfff) + (ch & 0xff));
- if (pos == 0) {
- /* Zero value indicates this Unicode has no mapping to JIS0208.
- * We bail here because the JIS -> SJIS algorithm produces
- * bogus SJIS values for invalid JIS input. Zero should be the
- * only invalid JIS value in our table.
- */
- return 0;
- }
- /*
- * This algorithm for converting from JIS to SJIS comes from Ken Lunde's
- * "Understanding Japanese Information Processing", pg 163.
- */
- int c1 = (pos >> 8) & 0xff;
- int c2 = pos & 0xff;
- int rowOffset = c1 < 0x5F ? 0x70 : 0xB0;
- int cellOffset = (c1 % 2 == 1) ? (c2 > 0x5F ? 0x20 : 0x1F) : 0x7E;
- return ((((c1 + 1 ) >> 1) + rowOffset) << 8) | (c2 + cellOffset);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteSingleByte.java b/jdk/src/share/classes/sun/io/CharToByteSingleByte.java
deleted file mode 100644
index 026a066..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteSingleByte.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import static sun.nio.cs.CharsetMapping.*;
-
-/**
-* A table driven conversion from char to byte for single byte
-* character sets. Tables will reside in the class CharToByteYYYYY,
-* where YYYYY is a unique character set identifier
-
- < TBD: Tables are of the form... >
-
-*
-* @author Lloyd Honomichl
-* @author Asmus Freytag
-* @version 8/28/96
-*/
-
-public abstract class CharToByteSingleByte extends CharToByteConverter {
-
- /*
- * 1st level index, provided by subclass
- */
- protected char[] index1;
-
- /*
- * 2nd level index, provided by subclass
- */
- protected char[] index2;
-
- /*
- * Mask to isolate bits for 1st level index, from subclass
- */
- protected int mask1;
-
- /*
- * Mask to isolate bits for 2nd level index, from subclass
- */
- protected int mask2;
-
- /*
- * Shift to isolate bits for 1st level index, from subclass
- */
- protected int shift;
-
- private char highHalfZoneCode;
-
- public char[] getIndex1() {
- return index1;
- }
-
- public char[] getIndex2() {
- return index2;
- }
- public int flush(byte[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (highHalfZoneCode != 0) {
- highHalfZoneCode = 0;
- badInputLength = 0;
- throw new MalformedInputException();
- }
- byteOff = charOff = 0;
- return 0;
- }
-
- /**
- * Converts characters to sequences of bytes.
- * Conversions that result in Exceptions can be restarted by calling
- * convert again, with appropriately modified parameters.
- * @return the characters written to output.
- * @param input char array containing text in Unicode
- * @param inStart offset in input array
- * @param inEnd offset of last byte to be converted
- * @param output byte array to receive conversion result
- * @param outStart starting offset
- * @param outEnd offset of last byte to be written to
- * @throw MalformedInputException for any sequence of chars that is
- * illegal in Unicode (principally unpaired surrogates
- * and \uFFFF or \uFFFE), including any partial surrogate pair
- * which occurs at the end of an input buffer.
- * @throw UnsupportedCharacterException for any character that
- * that cannot be converted to the external character set.
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws MalformedInputException,
- UnknownCharacterException,
- ConversionBufferFullException
- {
- char inputChar; // Input character to be converted
- byte[] outputByte; // Output byte written to output
- int inputSize; // Size of input
- int outputSize; // Size of output
-
- byte[] tmpArray = new byte[1];
-
- // Record beginning offsets
- charOff = inOff;
- byteOff = outOff;
-
- if (highHalfZoneCode != 0) {
- inputChar = highHalfZoneCode;
- highHalfZoneCode = 0;
- if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
- // This is legal UTF16 sequence.
- badInputLength = 1;
- throw new UnknownCharacterException();
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException();
- }
- }
-
- // Loop until we hit the end of the input
- while(charOff < inEnd) {
-
- outputByte = tmpArray;
-
- // Get the input character
- inputChar = input[charOff];
-
- // Default output size
- outputSize = 1;
-
- // Assume this is a simple character
- inputSize = 1;
-
- // Is this a high surrogate?
- if(inputChar >= '\uD800' && inputChar <= '\uDBFF') {
- // Is this the last character in the input?
- if (charOff + 1 >= inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
-
- // Is there a low surrogate following?
- inputChar = input[charOff + 1];
- if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- // We have a valid surrogate pair. Too bad we don't map
- // surrogates. Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- inputSize = 2;
- } else {
- badInputLength = 2;
- throw new UnknownCharacterException();
- }
- } else {
- // We have a malformed surrogate pair
- badInputLength = 1;
- throw new MalformedInputException();
- }
- }
-
- // Is this an unaccompanied low surrogate?
- else if (inputChar >= '\uDC00' && inputChar <= '\uDFFF') {
- badInputLength = 1;
- throw new MalformedInputException();
- }
-
- // Not part of a surrogate, so look it up
- else {
- // Get output using two level lookup
- outputByte[0] = getNative(inputChar);
-
- // Might this character be unmappable?
- if (outputByte[0] == 0) {
- // If outputByte is zero because the input was zero
- // then this character is actually mappable
- if (input[charOff] != '\u0000') {
- // We have an unmappable character
- // Is substitution enabled?
- if (subMode) {
- outputByte = subBytes;
- outputSize = subBytes.length;
- } else {
- badInputLength = 1;
- throw new UnknownCharacterException();
- }
- }
- }
- }
-
- // If we don't have room for the output, throw an exception
- if (byteOff + outputSize > outEnd)
- throw new ConversionBufferFullException();
-
- // Put the byte in the output buffer
- for (int i = 0; i < outputSize; i++) {
- output[byteOff++] = outputByte[i];
- }
- charOff += inputSize;
-
- }
-
- // Return the length written to the output buffer
- return byteOff - outOff;
- }
-
- /**
- * the maximum number of bytes needed to hold a converted char
- * @returns the maximum number of bytes needed for a converted char
- */
- public int getMaxBytesPerChar() {
- return 1;
- }
-
- int encodeChar(char ch) {
- char index = index1[ch >> 8];
- if (index == UNMAPPABLE_ENCODING)
- return UNMAPPABLE_ENCODING;
- return index2[index + (ch & 0xff)];
- }
-
- public byte getNative(char inputChar) {
- int b = encodeChar(inputChar);
- if (b == UNMAPPABLE_ENCODING)
- return 0;
- return (byte)b;
- }
-
- /**
- * Resets the converter.
- * Call this method to reset the converter to its initial state
- */
- public void reset() {
- byteOff = charOff = 0;
- highHalfZoneCode = 0;
- }
-
- /**
- * Return whether a character is mappable or not
- * @return true if a character is mappable
- */
- public boolean canConvert(char ch) {
- return encodeChar(ch) != UNMAPPABLE_ENCODING;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteTIS620.java b/jdk/src/share/classes/sun/io/CharToByteTIS620.java
deleted file mode 100644
index 9ab8977..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteTIS620.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import sun.nio.cs.ext.TIS_620;
-
-/**
- * Tables and data to convert Unicode to TIS620
- *
- * @author ConverterGenerator tool
- */
-
-public class CharToByteTIS620 extends CharToByteSingleByte {
-
- private final static TIS_620 nioCoder = new TIS_620();
-
- public String getCharacterEncoding() {
- return "TIS620";
- }
-
- public CharToByteTIS620() {
- super.mask1 = 0xFF00;
- super.mask2 = 0x00FF;
- super.shift = 8;
- super.index1 = nioCoder.getEncoderIndex1();
- super.index2 = nioCoder.getEncoderIndex2();
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteUTF16.java b/jdk/src/share/classes/sun/io/CharToByteUTF16.java
deleted file mode 100644
index bebdda2..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteUTF16.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-
-/**
- * Convert arrays containing Unicode characters into arrays of bytes, using
- * big-endian byte order and writing an initial byte-order mark.
- */
-
-public class CharToByteUTF16 extends CharToByteUnicode {
-
- public CharToByteUTF16() {
- super(BIG, true);
- }
-
- public String getCharacterEncoding() {
- return "UTF-16";
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteUTF8.java b/jdk/src/share/classes/sun/io/CharToByteUTF8.java
deleted file mode 100644
index b25a2f2..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteUTF8.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.io;
-
-
-/**
- * UCS2 (UTF16) -> UCS Transformation Format 8 (UTF-8) converter
- * It's represented like below.
- *
- * # Bits Bit pattern
- * 1 7 0xxxxxxx
- * 2 11 110xxxxx 10xxxxxx
- * 3 16 1110xxxx 10xxxxxx 10xxxxxx
- * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
- * 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
- * 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
- *
- * UCS2 uses 1-3 / UTF16 uses 1-4 / UCS4 uses 1-6
- */
-
-public class CharToByteUTF8 extends CharToByteConverter {
-
- private char highHalfZoneCode;
-
- public int flush(byte[] output, int outStart, int outEnd)
- throws MalformedInputException
- {
- if (highHalfZoneCode != 0) {
- highHalfZoneCode = 0;
- badInputLength = 0;
- throw new MalformedInputException();
- }
- byteOff = charOff = 0;
- return 0;
- }
-
- /**
- * Character conversion
- */
- public int convert(char[] input, int inOff, int inEnd,
- byte[] output, int outOff, int outEnd)
- throws ConversionBufferFullException, MalformedInputException
- {
- char inputChar;
- byte[] outputByte = new byte[6];
- int inputSize;
- int outputSize;
-
- charOff = inOff;
- byteOff = outOff;
-
- if (highHalfZoneCode != 0) {
- inputChar = highHalfZoneCode;
- highHalfZoneCode = 0;
- if (input[inOff] >= 0xdc00 && input[inOff] <= 0xdfff) {
- // This is legal UTF16 sequence.
- int ucs4 = (highHalfZoneCode - 0xd800) * 0x400
- + (input[inOff] - 0xdc00) + 0x10000;
- output[0] = (byte)(0xf0 | ((ucs4 >> 18)) & 0x07);
- output[1] = (byte)(0x80 | ((ucs4 >> 12) & 0x3f));
- output[2] = (byte)(0x80 | ((ucs4 >> 6) & 0x3f));
- output[3] = (byte)(0x80 | (ucs4 & 0x3f));
- charOff++;
- highHalfZoneCode = 0;
- } else {
- // This is illegal UTF16 sequence.
- badInputLength = 0;
- throw new MalformedInputException();
- }
- }
-
- while(charOff < inEnd) {
- inputChar = input[charOff];
- if (inputChar < 0x80) {
- outputByte[0] = (byte)inputChar;
- inputSize = 1;
- outputSize = 1;
- } else if (inputChar < 0x800) {
- outputByte[0] = (byte)(0xc0 | ((inputChar >> 6) & 0x1f));
- outputByte[1] = (byte)(0x80 | (inputChar & 0x3f));
- inputSize = 1;
- outputSize = 2;
- } else if (inputChar >= 0xd800 && inputChar <= 0xdbff) {
- // this is <high-half zone code> in UTF-16
- if (charOff + 1 >= inEnd) {
- highHalfZoneCode = inputChar;
- break;
- }
- // check next char is valid <low-half zone code>
- char lowChar = input[charOff + 1];
- if (lowChar < 0xdc00 || lowChar > 0xdfff) {
- badInputLength = 1;
- throw new MalformedInputException();
- }
- int ucs4 = (inputChar - 0xd800) * 0x400 + (lowChar - 0xdc00)
- + 0x10000;
- outputByte[0] = (byte)(0xf0 | ((ucs4 >> 18)) & 0x07);
- outputByte[1] = (byte)(0x80 | ((ucs4 >> 12) & 0x3f));
- outputByte[2] = (byte)(0x80 | ((ucs4 >> 6) & 0x3f));
- outputByte[3] = (byte)(0x80 | (ucs4 & 0x3f));
- outputSize = 4;
- inputSize = 2;
- } else {
- outputByte[0] = (byte)(0xe0 | ((inputChar >> 12)) & 0x0f);
- outputByte[1] = (byte)(0x80 | ((inputChar >> 6) & 0x3f));
- outputByte[2] = (byte)(0x80 | (inputChar & 0x3f));
- inputSize = 1;
- outputSize = 3;
- }
- if (byteOff + outputSize > outEnd) {
- throw new ConversionBufferFullException();
- }
- for (int i = 0; i < outputSize; i++) {
- output[byteOff++] = outputByte[i];
- }
- charOff += inputSize;
- }
- return byteOff - outOff;
- }
-
- public boolean canConvert(char ch) {
- return true;
- }
-
- public int getMaxBytesPerChar() {
- return 3;
- }
-
- public void reset() {
- byteOff = charOff = 0;
- highHalfZoneCode = 0;
- }
-
- public String getCharacterEncoding() {
- return "UTF8";
- }
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteUnicode.java b/jdk/src/share/classes/sun/io/CharToByteUnicode.java
deleted file mode 100644
index d7b19e1..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteUnicode.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-import java.io.*;
-
-
-/**
- * Convert arrays containing Unicode characters into arrays of bytes, using the
- * platform-default byte order.
- *
- * @author Mark Reinhold
- */
-
-public class CharToByteUnicode extends CharToByteConverter {
-
- static final char BYTE_ORDER_MARK = (char) 0xfeff;
- protected boolean usesMark = true; /* A mark should be written */
- private boolean markWritten = false; /* A mark has been written */
-
- static final int UNKNOWN = 0;
- static final int BIG = 1;
- static final int LITTLE = 2;
- protected int byteOrder = UNKNOWN;
-
- public CharToByteUnicode() {
- String enc = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("sun.io.unicode.encoding",
- "UnicodeBig"));
- if (enc.equals("UnicodeBig"))
- byteOrder = BIG;
- else if (enc.equals("UnicodeLittle"))
- byteOrder = LITTLE;
- else
- byteOrder = BIG;
- }
-
- public CharToByteUnicode(int byteOrder, boolean usesMark) {
- this.byteOrder = byteOrder;
- this.usesMark = usesMark;
- }
-
- public CharToByteUnicode(boolean usesMark) {
- this();
- this.usesMark = usesMark;
- }
-
- public String getCharacterEncoding() {
- switch (byteOrder) {
- case BIG:
- return usesMark ? "UnicodeBig" : "UnicodeBigUnmarked";
- case LITTLE:
- return usesMark ? "UnicodeLittle" : "UnicodeLittleUnmarked";
- default:
- return "UnicodeUnknown";
- }
- }
-
- public int convert(char in[], int inOff, int inEnd,
- byte out[], int outOff, int outEnd)
- throws ConversionBufferFullException, MalformedInputException
- {
- charOff = inOff;
- byteOff = outOff;
-
- if (inOff >= inEnd)
- return 0;
-
- int inI = inOff,
- outI = outOff,
- outTop = outEnd - 2;
-
- if (usesMark && !markWritten) {
- if (outI > outTop)
- throw new ConversionBufferFullException();
- if (byteOrder == BIG) {
- out[outI++] = (byte) (BYTE_ORDER_MARK >> 8);
- out[outI++] = (byte) (BYTE_ORDER_MARK & 0xff);
- }
- else {
- out[outI++] = (byte) (BYTE_ORDER_MARK & 0xff);
- out[outI++] = (byte) (BYTE_ORDER_MARK >> 8);
- }
- markWritten = true;
- }
-
- if (byteOrder == BIG) {
- while (inI < inEnd) {
- if (outI > outTop) {
- charOff = inI;
- byteOff = outI;
- throw new ConversionBufferFullException();
- }
- char c = in[inI++];
- out[outI++] = (byte) (c >> 8);
- out[outI++] = (byte) (c & 0xff);
- }
- }
- else {
- while (inI < inEnd) {
- if (outI > outTop) {
- charOff = inI;
- byteOff = outI;
- throw new ConversionBufferFullException();
- }
- char c = in[inI++];
- out[outI++] = (byte) (c & 0xff);
- out[outI++] = (byte) (c >> 8);
- }
- }
-
- charOff = inI;
- byteOff = outI;
- return outI - outOff;
- }
-
- public int flush(byte in[], int inOff, int inEnd) {
- byteOff = charOff = 0;
- return 0;
- }
-
- public void reset () {
- byteOff = charOff = 0;
- markWritten = false;
- }
-
- public int getMaxBytesPerChar() {
- return 4; /* To allow for writing the byte-order mark */
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteUnicodeBig.java b/jdk/src/share/classes/sun/io/CharToByteUnicodeBig.java
deleted file mode 100644
index c1c3892..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteUnicodeBig.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-
-/**
- * Convert arrays containing Unicode characters into arrays of bytes, using
- * big-endian byte order.
- *
- * @author Mark Reinhold
- */
-
-public class CharToByteUnicodeBig extends CharToByteUnicode {
-
- public CharToByteUnicodeBig () {
- byteOrder = BIG;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteUnicodeBigUnmarked.java b/jdk/src/share/classes/sun/io/CharToByteUnicodeBigUnmarked.java
deleted file mode 100644
index d6a7d27..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteUnicodeBigUnmarked.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-
-/**
- * Convert arrays containing Unicode characters into arrays of bytes, using
- * big-endian byte order; do not write a byte-order mark before the first
- * converted character.
- *
- * @author Mark Reinhold
- */
-
-public class CharToByteUnicodeBigUnmarked extends CharToByteUnicode {
-
- public CharToByteUnicodeBigUnmarked () {
- byteOrder = BIG;
- usesMark = false;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteUnicodeLittle.java b/jdk/src/share/classes/sun/io/CharToByteUnicodeLittle.java
deleted file mode 100644
index d734571..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteUnicodeLittle.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-
-/**
- * Convert arrays containing Unicode characters into arrays of bytes, using
- * little-endian byte order.
- *
- * @author Mark Reinhold
- */
-
-public class CharToByteUnicodeLittle extends CharToByteUnicode {
-
- public CharToByteUnicodeLittle () {
- byteOrder = LITTLE;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharToByteUnicodeLittleUnmarked.java b/jdk/src/share/classes/sun/io/CharToByteUnicodeLittleUnmarked.java
deleted file mode 100644
index 7595159..0000000
--- a/jdk/src/share/classes/sun/io/CharToByteUnicodeLittleUnmarked.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-
-/**
- * Convert arrays containing Unicode characters into arrays of bytes, using
- * little-endian byte order; do not write a byte-order mark before the first
- * converted character.
- *
- * @author Mark Reinhold
- */
-
-public class CharToByteUnicodeLittleUnmarked extends CharToByteUnicode {
-
- public CharToByteUnicodeLittleUnmarked () {
- byteOrder = LITTLE;
- usesMark = false;
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/CharacterEncoding.java b/jdk/src/share/classes/sun/io/CharacterEncoding.java
deleted file mode 100644
index f577a9b..0000000
--- a/jdk/src/share/classes/sun/io/CharacterEncoding.java
+++ /dev/null
@@ -1,900 +0,0 @@
-/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import sun.security.action.GetPropertyAction;
-
-/*
- * This class is public in sun.io, so other sun.* packages (such as
- * HotJava) can use it, without exposing it to java.*.
- * Translates IANA encoding name to the string which is the part of
- * converter class.
- */
-
-/**
- * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
- * REMOVED IN J2SE 1.6.
- */
- at Deprecated
-public class CharacterEncoding {
-
- private static boolean sjisIsMS932;
-
- private static Map<String,String> aliasTable;
- private static volatile boolean installedAll;
-
- static {
- aliasTable = new HashMap<>(460, 1.0f); /* MDA */
-
- aliasTable.put("us-ascii", "ASCII");
- aliasTable.put("ascii", "ASCII");
- aliasTable.put("646", "ASCII"); // Solaris POSIX locale
- aliasTable.put("iso_646.irv:1983", "ASCII"); // Linux POSIX locale
- aliasTable.put("ansi_x3.4-1968", "ASCII"); // Caldera linux
- aliasTable.put("iso646-us", "ASCII");
- aliasTable.put("default", "ASCII"); // compatibility with obsolete "Default" converters
- aliasTable.put("ascii7", "ASCII"); // compatibility with obsolete "Default" converters
-
- // Core encodings
- aliasTable.put("8859_1", "ISO8859_1");
- aliasTable.put("iso8859_1", "ISO8859_1");
- aliasTable.put("utf-8", "UTF8");
- aliasTable.put("utf8", "UTF8");
- aliasTable.put("utf-16le", "UnicodeLittleUnmarked");
-
- // Standard encodings used on Solaris and Linux
- aliasTable.put("iso8859-1", "ISO8859_1");
- aliasTable.put("iso8859-2", "ISO8859_2");
- aliasTable.put("iso8859-4", "ISO8859_4");
- aliasTable.put("iso8859-5", "ISO8859_5");
- aliasTable.put("iso8859-6", "ISO8859_6");
- aliasTable.put("iso8859-8", "ISO8859_8");
- aliasTable.put("iso8859-9", "ISO8859_9");
- aliasTable.put("iso8859-13", "ISO8859_13");
- aliasTable.put("iso8859-15", "ISO8859_15");
- aliasTable.put("5601", "EUC_KR");
- aliasTable.put("ansi-1251", "Cp1251");
- aliasTable.put("big5", "Big5");
- aliasTable.put("big5hk", "Big5_HKSCS");
- aliasTable.put("eucjp", "EUC_JP");
- aliasTable.put("cns11643", "EUC_TW");
- aliasTable.put("gb2312", "EUC_CN");
- aliasTable.put("gb18030", "GB18030");
- aliasTable.put("gbk", "GBK");
- aliasTable.put("koi8-r", "KOI8_R");
- aliasTable.put("tis620.2533", "TIS620");
-
- // Windows encodings
- aliasTable.put("cp1250", "Cp1250");
- aliasTable.put("cp1251", "Cp1251");
- aliasTable.put("cp1252", "Cp1252");
- aliasTable.put("cp1253", "Cp1253");
- aliasTable.put("cp1254", "Cp1254");
- aliasTable.put("cp1255", "Cp1255");
- aliasTable.put("cp1256", "Cp1256");
- aliasTable.put("cp1257", "Cp1257");
- aliasTable.put("cp1258", "Cp1258");
- aliasTable.put("ms874", "MS874");
- aliasTable.put("ms932", "MS932");
- aliasTable.put("ms949", "MS949");
- aliasTable.put("ms950", "MS950");
- aliasTable.put("ms1361", "MS1361");
- }
-
- public static String aliasName(String name){
-
- if (name.startsWith("\1")) {
- // Emergency access to old converters
- name = name.substring(1);
- }
- // need to use Locale.US so we can load ISO converters in tr_TR locale
- String lower = name.toLowerCase(Locale.US);
- String val = aliasTable.get(lower);
-
- if (val == null && !installedAll) {
- installAll();
- val = aliasTable.get(lower);
- }
- return val;
- }
-
- private static synchronized void installAll() {
- if (!installedAll) {
- GetPropertyAction a = new GetPropertyAction("sun.nio.cs.map");
- String map = AccessController.doPrivileged(a);
- if (map != null) {
- sjisIsMS932 = map.equalsIgnoreCase("Windows-31J/Shift_JIS");
- } else {
- sjisIsMS932 = false;
- }
-
- // MIBenum: 4
- aliasTable.put("8859_1", "ISO8859_1");
- aliasTable.put("iso_8859-1:1987", "ISO8859_1");
- aliasTable.put("iso-ir-100", "ISO8859_1");
- aliasTable.put("iso_8859-1", "ISO8859_1");
- aliasTable.put("iso-8859-1", "ISO8859_1");
- aliasTable.put("iso8859-1", "ISO8859_1");
- aliasTable.put("latin1", "ISO8859_1");
- aliasTable.put("l1", "ISO8859_1");
- aliasTable.put("ibm819", "ISO8859_1");
- aliasTable.put("ibm-819", "ISO8859_1");
- aliasTable.put("cp819", "ISO8859_1");
- aliasTable.put("819", "ISO8859_1");
- aliasTable.put("csisolatin1", "ISO8859_1");
-
- // MIBenum: 5
- aliasTable.put("8859_2", "ISO8859_2");
- aliasTable.put("iso_8859-2:1987", "ISO8859_2");
- aliasTable.put("iso-ir-101", "ISO8859_2");
- aliasTable.put("iso_8859-2", "ISO8859_2");
- aliasTable.put("iso-8859-2", "ISO8859_2");
- aliasTable.put("iso8859-2", "ISO8859_2");
- aliasTable.put("latin2", "ISO8859_2");
- aliasTable.put("l2", "ISO8859_2");
- aliasTable.put("ibm912", "ISO8859_2");
- aliasTable.put("ibm-912", "ISO8859_2");
- aliasTable.put("cp912", "ISO8859_2");
- aliasTable.put("912", "ISO8859_2");
- aliasTable.put("csisolatin2", "ISO8859_2");
-
- // MIBenum: 6
- aliasTable.put("8859_3", "ISO8859_3");
- aliasTable.put("iso_8859-3:1988", "ISO8859_3");
- aliasTable.put("iso-ir-109", "ISO8859_3");
- aliasTable.put("iso_8859-3", "ISO8859_3");
- aliasTable.put("iso-8859-3", "ISO8859_3");
- aliasTable.put("iso8859-3", "ISO8859_3");
- aliasTable.put("latin3", "ISO8859_3");
- aliasTable.put("l3", "ISO8859_3");
- aliasTable.put("ibm913", "ISO8859_3");
- aliasTable.put("ibm-913", "ISO8859_3");
- aliasTable.put("cp913", "ISO8859_3");
- aliasTable.put("913", "ISO8859_3");
- aliasTable.put("csisolatin3", "ISO8859_3");
-
- // MIBenum: 7
- aliasTable.put("8859_4", "ISO8859_4");
- aliasTable.put("iso_8859-4:1988", "ISO8859_4");
- aliasTable.put("iso-ir-110", "ISO8859_4");
- aliasTable.put("iso_8859-4", "ISO8859_4");
- aliasTable.put("iso-8859-4", "ISO8859_4");
- aliasTable.put("iso8859-4", "ISO8859_4");
- aliasTable.put("latin4", "ISO8859_4");
- aliasTable.put("l4", "ISO8859_4");
- aliasTable.put("ibm914", "ISO8859_4");
- aliasTable.put("ibm-914", "ISO8859_4");
- aliasTable.put("cp914", "ISO8859_4");
- aliasTable.put("914", "ISO8859_4");
- aliasTable.put("csisolatin4", "ISO8859_4");
-
- // MIBenum: 8
- aliasTable.put("8859_5", "ISO8859_5");
- aliasTable.put("iso_8859-5:1988", "ISO8859_5");
- aliasTable.put("iso-ir-144", "ISO8859_5");
- aliasTable.put("iso_8859-5", "ISO8859_5");
- aliasTable.put("iso-8859-5", "ISO8859_5");
- aliasTable.put("iso8859-5", "ISO8859_5");
- aliasTable.put("cyrillic", "ISO8859_5");
- aliasTable.put("csisolatincyrillic", "ISO8859_5");
- aliasTable.put("ibm915", "ISO8859_5");
- aliasTable.put("ibm-915", "ISO8859_5");
- aliasTable.put("cp915", "ISO8859_5");
- aliasTable.put("915", "ISO8859_5");
-
- // MIBenum: 9
- aliasTable.put("8859_6", "ISO8859_6");
- aliasTable.put("iso_8859-6:1987", "ISO8859_6");
- aliasTable.put("iso-ir-127", "ISO8859_6");
- aliasTable.put("iso_8859-6", "ISO8859_6");
- aliasTable.put("iso-8859-6", "ISO8859_6");
- aliasTable.put("iso8859-6", "ISO8859_6");
- aliasTable.put("ecma-114", "ISO8859_6");
- aliasTable.put("asmo-708", "ISO8859_6");
- aliasTable.put("arabic", "ISO8859_6");
- aliasTable.put("csisolatinarabic", "ISO8859_6");
- aliasTable.put("ibm1089", "ISO8859_6");
- aliasTable.put("ibm-1089", "ISO8859_6");
- aliasTable.put("cp1089", "ISO8859_6");
- aliasTable.put("1089", "ISO8859_6");
-
- // MIBenum: 10
- aliasTable.put("8859_7", "ISO8859_7");
- aliasTable.put("iso_8859-7:1987", "ISO8859_7");
- aliasTable.put("iso-ir-126", "ISO8859_7");
- aliasTable.put("iso_8859-7", "ISO8859_7");
- aliasTable.put("iso-8859-7", "ISO8859_7");
- aliasTable.put("iso8859-7", "ISO8859_7");
- aliasTable.put("elot_928", "ISO8859_7");
- aliasTable.put("ecma-118", "ISO8859_7");
- aliasTable.put("greek", "ISO8859_7");
- aliasTable.put("greek8", "ISO8859_7");
- aliasTable.put("csisolatingreek", "ISO8859_7");
- aliasTable.put("ibm813", "ISO8859_7");
- aliasTable.put("ibm-813", "ISO8859_7");
- aliasTable.put("cp813", "ISO8859_7");
- aliasTable.put("813", "ISO8859_7");
- aliasTable.put("sun_eu_greek", "ISO8859_7");
-
- // MIBenum: 11
- aliasTable.put("8859_8", "ISO8859_8");
- aliasTable.put("iso_8859-8:1988", "ISO8859_8");
- aliasTable.put("iso-ir-138", "ISO8859_8");
- aliasTable.put("iso_8859-8", "ISO8859_8");
- aliasTable.put("iso-8859-8", "ISO8859_8");
- aliasTable.put("iso8859-8", "ISO8859_8");
- aliasTable.put("hebrew", "ISO8859_8");
- aliasTable.put("csisolatinhebrew", "ISO8859_8");
- aliasTable.put("ibm916", "ISO8859_8");
- aliasTable.put("ibm-916", "ISO8859_8");
- aliasTable.put("cp916", "ISO8859_8");
- aliasTable.put("916", "ISO8859_8");
-
- // MIBenum: 12
- aliasTable.put("8859_9", "ISO8859_9");
- aliasTable.put("iso-ir-148", "ISO8859_9");
- aliasTable.put("iso_8859-9", "ISO8859_9");
- aliasTable.put("iso-8859-9", "ISO8859_9");
- aliasTable.put("iso8859-9", "ISO8859_9");
- aliasTable.put("latin5", "ISO8859_9");
- aliasTable.put("l5", "ISO8859_9");
- aliasTable.put("ibm920", "ISO8859_9");
- aliasTable.put("ibm-920", "ISO8859_9");
- aliasTable.put("cp920", "ISO8859_9");
- aliasTable.put("920", "ISO8859_9");
- aliasTable.put("csisolatin5", "ISO8859_9");
-
- // MIBenum: ???
- aliasTable.put("8859_13", "ISO8859_13");
- aliasTable.put("iso_8859-13", "ISO8859_13");
- aliasTable.put("iso-8859-13", "ISO8859_13");
- aliasTable.put("iso8859-13", "ISO8859_13");
-
-
- // MIBenum: ????
- aliasTable.put("8859_15", "ISO8859_15");
- aliasTable.put("iso-8859-15", "ISO8859_15");
- aliasTable.put("iso_8859-15", "ISO8859_15");
- aliasTable.put("iso8859-15", "ISO8859_15");
- aliasTable.put("ibm923", "ISO8859_15");
- aliasTable.put("ibm-923", "ISO8859_15");
- aliasTable.put("cp923", "ISO8859_15");
- aliasTable.put("923", "ISO8859_15");
- aliasTable.put("latin0", "ISO8859_15");
- aliasTable.put("latin9", "ISO8859_15");
- aliasTable.put("csisolatin0", "ISO8859_15");
- aliasTable.put("csisolatin9", "ISO8859_15");
-
- //For compatibility purpose
- aliasTable.put("iso8859_15_fdis", "ISO8859_15");
-
- // MIBenum: 106
- aliasTable.put("utf-8", "UTF8");
-
- // Alias recommended in RFC 1641
- aliasTable.put("unicode-1-1-utf-8", "UTF8");
-
- // MIBenum: 1010
- aliasTable.put("unicode-1-1", "UnicodeBigUnmarked");
-
- // MIBenum: 1000
- aliasTable.put("iso-10646-ucs-2", "UnicodeBigUnmarked");
-
- // Per Unicode standard
- aliasTable.put("utf-16be", "UnicodeBigUnmarked");
- aliasTable.put("utf-16le", "UnicodeLittleUnmarked");
- aliasTable.put("utf-16", "UTF16");
-
- // Used by drag-and-drop subsystem
- aliasTable.put("x-utf-16be", "UnicodeBigUnmarked");
- aliasTable.put("x-utf-16le", "UnicodeLittleUnmarked");
-
- aliasTable.put("unicode", "Unicode");
-
- // MIBenum: ????
- aliasTable.put("ibm037", "Cp037");
- aliasTable.put("ibm-037", "Cp037");
- aliasTable.put("cp037", "Cp037");
- aliasTable.put("037", "Cp037");
-
- // MIBenum: ????
- aliasTable.put("ibm273", "Cp273");
- aliasTable.put("ibm-273", "Cp273");
- aliasTable.put("cp273", "Cp273");
- aliasTable.put("273", "Cp273");
-
- // MIBenum: ????
- aliasTable.put("ibm277", "Cp277");
- aliasTable.put("ibm-277", "Cp277");
- aliasTable.put("cp277", "Cp277");
- aliasTable.put("277", "Cp277");
-
- // MIBenum: ????
- aliasTable.put("ibm278", "Cp278");
- aliasTable.put("ibm-278", "Cp278");
- aliasTable.put("cp278", "Cp278");
- aliasTable.put("278", "Cp278");
-
- // MIBenum: ????
- aliasTable.put("ibm280", "Cp280");
- aliasTable.put("ibm-280", "Cp280");
- aliasTable.put("cp280", "Cp280");
- aliasTable.put("280", "Cp280");
-
- // MIBenum: ????
- aliasTable.put("ibm284", "Cp284");
- aliasTable.put("ibm-284", "Cp284");
- aliasTable.put("cp284", "Cp284");
- aliasTable.put("284", "Cp284");
-
- // MIBenum: ????
- aliasTable.put("ibm285", "Cp285");
- aliasTable.put("ibm-285", "Cp285");
- aliasTable.put("cp285", "Cp285");
- aliasTable.put("285", "Cp285");
-
- // MIBenum: ????
- aliasTable.put("ibm297", "Cp297");
- aliasTable.put("ibm-297", "Cp297");
- aliasTable.put("cp297", "Cp297");
- aliasTable.put("297", "Cp297");
-
- // MIBenum: ????
- aliasTable.put("ibm420", "Cp420");
- aliasTable.put("ibm-420", "Cp420");
- aliasTable.put("cp420", "Cp420");
- aliasTable.put("420", "Cp420");
-
- // MIBenum: ????
- aliasTable.put("ibm424", "Cp424");
- aliasTable.put("ibm-424", "Cp424");
- aliasTable.put("cp424", "Cp424");
- aliasTable.put("424", "Cp424");
-
- // MIBenum: 2011
- aliasTable.put("ibm437", "Cp437");
- aliasTable.put("ibm-437", "Cp437");
- aliasTable.put("cp437", "Cp437");
- aliasTable.put("437", "Cp437");
- aliasTable.put("cspc8codepage437", "Cp437");
-
- // MIBenum: ????
- aliasTable.put("ibm500", "Cp500");
- aliasTable.put("ibm-500", "Cp500");
- aliasTable.put("cp500", "Cp500");
- aliasTable.put("500", "Cp500");
-
- // MIBenum: ????
- aliasTable.put("ibm737", "Cp737");
- aliasTable.put("ibm-737", "Cp737");
- aliasTable.put("cp737", "Cp737");
- aliasTable.put("737", "Cp737");
-
- // MIBenum: ????
- aliasTable.put("ibm775", "Cp775");
- aliasTable.put("ibm-775", "Cp775");
- aliasTable.put("cp775", "Cp775");
- aliasTable.put("775", "Cp775");
-
- aliasTable.put("ibm833", "Cp833");
- aliasTable.put("ibm-833", "Cp833");
- aliasTable.put("cp833", "Cp833");
- aliasTable.put("833", "Cp833");
-
- aliasTable.put("ibm834", "Cp834");
- aliasTable.put("ibm-834", "Cp834");
- aliasTable.put("cp834", "Cp834");
- aliasTable.put("834", "Cp834");
-
- // MIBenum: ????
- aliasTable.put("ibm838", "Cp838"); /* MDA */
- aliasTable.put("ibm-838", "Cp838"); /* MDA */
- aliasTable.put("cp838", "Cp838"); /* MDA */
- aliasTable.put("838", "Cp838"); /* MDA */
-
- // "Cp850"
- // MIBenum: 2009
- aliasTable.put("ibm850", "Cp850");
- aliasTable.put("ibm-850", "Cp850");
- aliasTable.put("cp850", "Cp850");
- aliasTable.put("850", "Cp850");
- aliasTable.put("cspc850multilingual", "Cp850");
-
- // "Cp852"
- // MIBenum: 2010
- aliasTable.put("ibm852", "Cp852");
- aliasTable.put("ibm-852", "Cp852");
- aliasTable.put("cp852", "Cp852");
- aliasTable.put("852", "Cp852");
- aliasTable.put("cspcp852", "Cp852");
-
- // "Cp855"
- // MIBenum: 2046
- aliasTable.put("ibm855", "Cp855");
- aliasTable.put("ibm-855", "Cp855");
- aliasTable.put("cp855", "Cp855");
- aliasTable.put("855", "Cp855");
- aliasTable.put("cspcp855", "Cp855");
-
- // "Cp855"
- // MIBenum: ???
- aliasTable.put("ibm856", "Cp856");
- aliasTable.put("ibm-856", "Cp856");
- aliasTable.put("cp856", "Cp856");
- aliasTable.put("856", "Cp856");
-
- // "Cp857"
- // MIBenum: 2047
- aliasTable.put("ibm857", "Cp857");
- aliasTable.put("ibm-857", "Cp857");
- aliasTable.put("cp857", "Cp857");
- aliasTable.put("857", "Cp857");
- aliasTable.put("csibm857", "Cp857");
-
- // "Cp860"
- // MIBenum: 2048
- aliasTable.put("ibm860", "Cp860");
- aliasTable.put("ibm-860", "Cp860");
- aliasTable.put("cp860", "Cp860");
- aliasTable.put("860", "Cp860");
- aliasTable.put("csibm860", "Cp860");
-
- // MIBenum: 2049
- aliasTable.put("ibm861", "Cp861");
- aliasTable.put("ibm-861", "Cp861");
- aliasTable.put("cp861", "Cp861");
- aliasTable.put("cp-is", "Cp861");
- aliasTable.put("861", "Cp861");
- aliasTable.put("csibm861", "Cp861");
-
- // MIBenum: 2013
- aliasTable.put("ibm862", "Cp862");
- aliasTable.put("ibm-862", "Cp862");
- aliasTable.put("cp862", "Cp862");
- aliasTable.put("862", "Cp862");
- aliasTable.put("cspc862latinhebrew", "Cp862");
-
- // MIBenum: 2050
- aliasTable.put("ibm863", "Cp863");
- aliasTable.put("ibm-863", "Cp863");
- aliasTable.put("cp863", "Cp863");
- aliasTable.put("863", "Cp863");
- aliasTable.put("csibm863", "Cp863");
-
- // MIBenum: 2051
- aliasTable.put("ibm864", "Cp864");
- aliasTable.put("ibm-864", "Cp864");
- aliasTable.put("cp864", "Cp864");
- aliasTable.put("csibm864", "Cp864");
-
- // MIBenum: 2052
- aliasTable.put("ibm865", "Cp865");
- aliasTable.put("ibm-865", "Cp865");
- aliasTable.put("cp865", "Cp865");
- aliasTable.put("865", "Cp865");
- aliasTable.put("csibm865", "Cp865");
-
- // MIBenum: ????
- aliasTable.put("ibm866", "Cp866");
- aliasTable.put("ibm-866", "Cp866");
- aliasTable.put("cp866", "Cp866");
- aliasTable.put("866", "Cp866");
- aliasTable.put("csibm866", "Cp866");
-
- // MIBenum: ????
- aliasTable.put("ibm868", "Cp868");
- aliasTable.put("ibm-868", "Cp868");
- aliasTable.put("cp868", "Cp868");
- aliasTable.put("868", "Cp868");
-
- // MIBenum: 2054
- aliasTable.put("ibm869", "Cp869");
- aliasTable.put("ibm-869", "Cp869");
- aliasTable.put("cp869", "Cp869");
- aliasTable.put("869", "Cp869");
- aliasTable.put("cp-gr", "Cp869");
- aliasTable.put("csibm869", "Cp869");
-
- // MIBenum: ????
- aliasTable.put("ibm870", "Cp870");
- aliasTable.put("ibm-870", "Cp870");
- aliasTable.put("cp870", "Cp870");
- aliasTable.put("870", "Cp870");
-
- // MIBenum: ????
- aliasTable.put("ibm871", "Cp871");
- aliasTable.put("ibm-871", "Cp871");
- aliasTable.put("cp871", "Cp871");
- aliasTable.put("871", "Cp871");
-
- // MIBenum: ????
- aliasTable.put("ibm874", "Cp874");
- aliasTable.put("ibm-874", "Cp874");
- aliasTable.put("cp874", "Cp874");
- aliasTable.put("874", "Cp874");
-
- // MIBenum: ????
- aliasTable.put("ibm875", "Cp875");
- aliasTable.put("ibm-875", "Cp875");
- aliasTable.put("cp875", "Cp875");
- aliasTable.put("875", "Cp875");
-
- // MIBenum: ????
- aliasTable.put("ibm918", "Cp918");
- aliasTable.put("ibm-918", "Cp918");
- aliasTable.put("cp918", "Cp918");
- aliasTable.put("918", "Cp918");
-
- // MIBenum: ????
- aliasTable.put("ibm921", "Cp921");
- aliasTable.put("ibm-921", "Cp921");
- aliasTable.put("cp921", "Cp921");
- aliasTable.put("921", "Cp921");
-
- // MIBenum: ????
- aliasTable.put("ibm922", "Cp922");
- aliasTable.put("ibm-922", "Cp922");
- aliasTable.put("cp922", "Cp922");
- aliasTable.put("922", "Cp922");
-
- // MIBenum: ????
- aliasTable.put("ibm930", "Cp930"); /* MDA */
- aliasTable.put("ibm-930", "Cp930"); /* MDA */
- aliasTable.put("cp930", "Cp930"); /* MDA */
- aliasTable.put("930", "Cp930"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm933", "Cp933"); /* MDA */
- aliasTable.put("ibm-933", "Cp933"); /* MDA */
- aliasTable.put("cp933", "Cp933"); /* MDA */
- aliasTable.put("933", "Cp933"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm935", "Cp935"); /* MDA */
- aliasTable.put("ibm-935", "Cp935"); /* MDA */
- aliasTable.put("cp935", "Cp935"); /* MDA */
- aliasTable.put("935", "Cp935"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm937", "Cp937"); /* MDA */
- aliasTable.put("ibm-937", "Cp937"); /* MDA */
- aliasTable.put("cp937", "Cp937"); /* MDA */
- aliasTable.put("937", "Cp937"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm939", "Cp939"); /* MDA */
- aliasTable.put("ibm-939", "Cp939"); /* MDA */
- aliasTable.put("cp939", "Cp939"); /* MDA */
- aliasTable.put("939", "Cp939"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm942", "Cp942"); /* MDA */
- aliasTable.put("ibm-942", "Cp942"); /* MDA */
- aliasTable.put("cp942", "Cp942"); /* MDA */
- aliasTable.put("942", "Cp942"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm943", "Cp943"); /* ibm.3158 */
- aliasTable.put("ibm-943", "Cp943"); /* ibm.3158 */
- aliasTable.put("cp943", "Cp943"); /* ibm.3158 */
- aliasTable.put("943", "Cp943"); /* ibm.3158 */
-
- // MIBenum: ????
- aliasTable.put("ibm948", "Cp948"); /* MDA */
- aliasTable.put("ibm-948", "Cp948"); /* MDA */
- aliasTable.put("cp948", "Cp948"); /* MDA */
- aliasTable.put("948", "Cp948"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm949", "Cp949"); /* MDA */
- aliasTable.put("ibm-949", "Cp949"); /* MDA */
- aliasTable.put("cp949", "Cp949"); /* MDA */
- aliasTable.put("949", "Cp949"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm950", "Cp950"); /* MDA */
- aliasTable.put("ibm-950", "Cp950"); /* MDA */
- aliasTable.put("cp950", "Cp950"); /* MDA */
- aliasTable.put("950", "Cp950"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm964", "Cp964"); /* MDA */
- aliasTable.put("ibm-964", "Cp964"); /* MDA */
- aliasTable.put("cp964", "Cp964"); /* MDA */
- aliasTable.put("964", "Cp964"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm970", "Cp970"); /* MDA */
- aliasTable.put("ibm-970", "Cp970"); /* MDA */
- aliasTable.put("cp970", "Cp970"); /* MDA */
- aliasTable.put("970", "Cp970"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm1006", "Cp1006");
- aliasTable.put("ibm-1006", "Cp1006");
- aliasTable.put("cp1006", "Cp1006");
- aliasTable.put("1006", "Cp1006");
-
- // MIBenum: ????
- aliasTable.put("ibm1025", "Cp1025");
- aliasTable.put("ibm-1025", "Cp1025");
- aliasTable.put("cp1025", "Cp1025");
- aliasTable.put("1025", "Cp1025");
-
- // MIBenum: ????
- aliasTable.put("ibm1026", "Cp1026");
- aliasTable.put("ibm-1026", "Cp1026");
- aliasTable.put("cp1026", "Cp1026");
- aliasTable.put("1026", "Cp1026");
-
- // MIBenum: ????
- aliasTable.put("ibm1097", "Cp1097");
- aliasTable.put("ibm-1097", "Cp1097");
- aliasTable.put("cp1097", "Cp1097");
- aliasTable.put("1097", "Cp1097");
-
- // MIBenum: ????
- aliasTable.put("ibm1098", "Cp1098");
- aliasTable.put("ibm-1098", "Cp1098");
- aliasTable.put("cp1098", "Cp1098");
- aliasTable.put("1098", "Cp1098");
-
- // MIBenum: ????
- aliasTable.put("ibm1112", "Cp1112");
- aliasTable.put("ibm-1112", "Cp1112");
- aliasTable.put("cp1112", "Cp1112");
- aliasTable.put("1112", "Cp1112");
-
- // MIBenum: ????
- aliasTable.put("ibm1122", "Cp1122");
- aliasTable.put("ibm-1122", "Cp1122");
- aliasTable.put("cp1122", "Cp1122");
- aliasTable.put("1122", "Cp1122");
-
- // MIBenum: ????
- aliasTable.put("ibm1123", "Cp1123");
- aliasTable.put("ibm-1123", "Cp1123");
- aliasTable.put("cp1123", "Cp1123");
- aliasTable.put("1123", "Cp1123");
-
- // MIBenum: ????
- aliasTable.put("ibm1124", "Cp1124");
- aliasTable.put("ibm-1124", "Cp1124");
- aliasTable.put("cp1124", "Cp1124");
- aliasTable.put("1124", "Cp1124");
-
- // MIBenum: ????
- aliasTable.put("ibm1381", "Cp1381"); /* MDA */
- aliasTable.put("ibm-1381", "Cp1381"); /* MDA */
- aliasTable.put("cp1381", "Cp1381"); /* MDA */
- aliasTable.put("1381", "Cp1381"); /* MDA */
-
- // MIBenum: ????
- aliasTable.put("ibm1383", "Cp1383"); /* MDA */
- aliasTable.put("ibm-1383", "Cp1383"); /* MDA */
- aliasTable.put("cp1383", "Cp1383"); /* MDA */
- aliasTable.put("1383", "Cp1383"); /* MDA */
-
- // Specialized auto-detection for Japanese charsets
- aliasTable.put("jis auto detect", "JISAutoDetect");
-
- // MIBenum: 16/39
- aliasTable.put("jis", "ISO2022JP");
- aliasTable.put("iso-2022-jp", "ISO2022JP");
- aliasTable.put("csiso2022jp", "ISO2022JP");
- aliasTable.put("jis_encoding", "ISO2022JP");
- aliasTable.put("csjisencoding", "ISO2022JP");
-
- // MIBenum: 17/2024
- aliasTable.put("windows-31j", "MS932");
- aliasTable.put("cswindows31j", "MS932");
-
- // JIS-defined Shift JIS
- aliasTable.put("\u30b7\u30d5\u30c8\u7b26\u53f7\u5316\u8868\u73fe",
- "SJIS"); // JIS name
- aliasTable.put("pck", "PCK"); // Case independent PCK alias
-
- if (sjisIsMS932) {
- aliasTable.put("shift_jis", "MS932"); // IANA shift jis aliases
- aliasTable.put("csshiftjis", "MS932"); // updated per 4556882
- aliasTable.put("x-sjis", "MS932");
- aliasTable.put("ms_kanji", "MS932");
- } else {
- aliasTable.put("shift_jis", "SJIS"); // IANA shift jis aliases
- aliasTable.put("csshiftjis", "SJIS");
- aliasTable.put("x-sjis", "SJIS");
- aliasTable.put("ms_kanji", "SJIS");
- }
-
- // MIBenum: 18
- // Japanese EUC
- aliasTable.put("eucjis", "EUC_JP");
- aliasTable.put("euc-jp", "EUC_JP");
- aliasTable.put("eucjp", "EUC_JP");
- aliasTable.put("extended_unix_code_packed_format_for_japanese",
- "EUC_JP");
- aliasTable.put("cseucpkdfmtjapanese", "EUC_JP");
- aliasTable.put("x-euc-jp", "EUC_JP");
- aliasTable.put("x-eucjp", "EUC_JP");
- aliasTable.put("eucjp-open", "EUC_JP_Solaris"); // 1.3.1_x compatibility
-
- // For handing only JIS0202 and JIS0208 in linux
- aliasTable.put("euc-jp-linux", "EUC_JP_LINUX");
-
- // MIBenum: 874
- aliasTable.put("windows-874", "MS874");
-
- // MIBenum: 2250
- aliasTable.put("windows-1250", "Cp1250");
-
- // MIBenum: 2251
- aliasTable.put("windows-1251", "Cp1251");
- aliasTable.put("ansi-1251", "Cp1251"); // Solaris ru_RU.ANSI1251 locale
-
- // MIBenum: 2252
- aliasTable.put("windows-1252", "Cp1252");
-
- // MIBenum: 2253
- aliasTable.put("windows-1253", "Cp1253");
-
- // MIBenum: 2254
- aliasTable.put("windows-1254", "Cp1254");
-
- // MIBenum: 2255
- aliasTable.put("windows-1255", "Cp1255");
-
- // MIBenum: 2256
- aliasTable.put("windows-1256", "Cp1256");
-
- // MIBenum: 2257
- aliasTable.put("windows-1257", "Cp1257");
-
- // MIBenum: 2258
- aliasTable.put("windows-1258", "Cp1258");
-
- // MIBenum: ????
- aliasTable.put("ibm33722", "Cp33722"); /* MDA */
- aliasTable.put("ibm-33722", "Cp33722"); /* MDA */
- aliasTable.put("cp33722", "Cp33722"); /* MDA */
- aliasTable.put("33722", "Cp33722"); /* MDA */
-
- // Russian KOI8-R
- aliasTable.put("koi8-r", "KOI8_R");
- aliasTable.put("koi8", "KOI8_R");
- aliasTable.put("cskoi8r", "KOI8_R");
-
- // Simplified Chinese
- aliasTable.put("gb2312", "EUC_CN");
- aliasTable.put("gb2312-80", "EUC_CN");
- aliasTable.put("gb2312-1980", "EUC_CN");
- aliasTable.put("euc-cn", "EUC_CN");
- aliasTable.put("euccn", "EUC_CN");
-
- aliasTable.put("big5", "Big5");
- aliasTable.put("big5hk", "Big5_HKSCS");
- aliasTable.put("big5-hkscs", "Big5_HKSCS");
- // Added for future compatibility, explicit mapping to Unicode 3.0
- aliasTable.put("big5-hkscs:unicode3.0", "Big5_HKSCS");
- aliasTable.put("big5_solaris", "Big5_Solaris");
-
- // Traditional Chinese
- aliasTable.put("cns11643", "EUC_TW");
- aliasTable.put("euc-tw", "EUC_TW");
- aliasTable.put("euctw", "EUC_TW");
-
- // Korean
- aliasTable.put("ksc5601", "EUC_KR");
- aliasTable.put("euc-kr", "EUC_KR");
- aliasTable.put("euckr", "EUC_KR");
- aliasTable.put("ks_c_5601-1987", "EUC_KR");
- aliasTable.put("ksc5601-1987", "EUC_KR");
- aliasTable.put("ksc5601_1987", "EUC_KR");
- aliasTable.put("ksc_5601", "EUC_KR");
- aliasTable.put("5601", "EUC_KR");
-
- aliasTable.put("ksc5601-1992", "Johab");
- aliasTable.put("ksc5601_1992", "Johab");
- aliasTable.put("ms1361", "Johab");
-
- aliasTable.put("windows-949", "MS949");
-
- //MIBenum: 37
- aliasTable.put("iso-2022-kr", "ISO2022KR");
- aliasTable.put("csiso2022kr", "ISO2022KR");
-
- // Thai
- aliasTable.put("tis620.2533", "TIS620");
- aliasTable.put("tis-620", "TIS620"); // Linux name
-
- // X11 Compound Text
- aliasTable.put("x-compound-text", "COMPOUND_TEXT");
- aliasTable.put("x11-compound_text", "COMPOUND_TEXT");
-
- // Variants
- aliasTable.put("cp942c", "Cp942C");
- aliasTable.put("cp943c", "Cp943C");
- aliasTable.put("cp949c", "Cp949C");
- aliasTable.put("iscii", "ISCII91");
-
- installedAll = true;
- }
- }
-
- /**
- * For Solaris:
- * always returns "PCK"
- *
- * For other platforms:
- * method returns "MS932" if the file.encoding property value is "MS932"
- * or an alias of "MS932"
- * otherwise, "SJIS", regardless of its
- * actual file.encoding value. This method is called from the JIS
- * Auto Detect converter.
- */
- static String getSJISName() {
- String encodeName = AccessController.doPrivileged(
- new PrivilegedAction<String>() {
- public String run() {
- String osName = System.getProperty("os.name");
- if (osName.equals("Solaris") || osName.equals("SunOS")){
- return "PCK";
- }
- else {
- return System.getProperty("file.encoding", null);
- }
- }
- });
-
- if (encodeName != null) {
- if (encodeName.equals("MS932"))
- return encodeName;
- encodeName = aliasName(encodeName);
- }
- return (encodeName != null && encodeName.equals("MS932")) ? encodeName : "SJIS";
- }
-
-
- static String getEUCJPName() {
- String encodeName = AccessController.doPrivileged(
- new PrivilegedAction<String>() {
- public String run() {
- String osName = System.getProperty("os.name");
- if (osName.equals("Solaris") || osName.equals("SunOS"))
- return "eucJP-open";
- else
- return "EUC_JP";
- }
- });
- return encodeName;
- }
-}
diff --git a/jdk/src/share/classes/sun/io/ConversionBufferFullException.java b/jdk/src/share/classes/sun/io/ConversionBufferFullException.java
deleted file mode 100644
index b267a9b..0000000
--- a/jdk/src/share/classes/sun/io/ConversionBufferFullException.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-
-/**
- * The output buffer for a character conversion is full, but additional
- * input remains to be converted
- *
- * @author Asmus Freytag
- *
- * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
- * REMOVED IN J2SE 1.6.
- */
- at Deprecated
-public class ConversionBufferFullException
- extends java.io.CharConversionException
-{
- private static final long serialVersionUID = -6537318994265003622L;
-
- /**
- * Constructs a BufferFullException with no detail message.
- * A detail message is a String that describes this particular exception.
- */
- public ConversionBufferFullException() {
- super();
- }
-
- /**
- * Constructs a BufferFullException with the specified detail message.
- * A detail message is a String that describes this particular exception.
- * @param s the String containing a detail message
- */
- public ConversionBufferFullException(String s) {
- super(s);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/Converters.java b/jdk/src/share/classes/sun/io/Converters.java
deleted file mode 100644
index d09bc1e..0000000
--- a/jdk/src/share/classes/sun/io/Converters.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-import java.io.UnsupportedEncodingException;
-import java.lang.ref.SoftReference;
-import java.util.Properties;
-
-/**
- * Package-private utility class that caches the default converter classes and
- * provides other logic common to both the ByteToCharConverter and
- * CharToByteConverter classes.
- *
- * @author Mark Reinhold
- * @since 1.2
- *
- * @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
- * REMOVED IN J2SE 1.6.
- */
- at Deprecated
-public class Converters {
-
- private Converters() { } /* To prevent instantiation */
-
- /* Lock for all static fields in this class */
- private static Object lock = Converters.class;
-
- /* Cached values of system properties */
- private static String converterPackageName = null; /* file.encoding.pkg */
- private static String defaultEncoding = null; /* file.encoding */
-
- /* Converter type constants and names */
- public static final int BYTE_TO_CHAR = 0;
- public static final int CHAR_TO_BYTE = 1;
- private static final String[] converterPrefix = { "ByteToChar",
- "CharToByte" };
-
-
- // -- Converter class cache --
-
- private static final int CACHE_SIZE = 3;
-
- /* For the default charset, whatever it turns out to be */
- private static final Object DEFAULT_NAME = new Object();
-
- /* Cached converter classes, CACHE_SIZE per converter type. Each cache
- * entry is a soft reference to a two-object array; the first element of
- * the array is the converter class, the second is an object (typically a
- * string) representing the encoding name that was used to request the
- * converter, e.g.,
- *
- * ((Object[])classCache[CHAR_TO_BYTE][i].get())[0]
- *
- * will be a CharToByteConverter and
- *
- * ((Object[])classCache[CHAR_TO_BYTE][i].get())[1]
- *
- * will be the string encoding name used to request it, assuming that cache
- * entry i is valid.
- *
- * Ordinarily we'd do this with a private static utility class, but since
- * this code can be involved in the startup sequence it's important to keep
- * the footprint down.
- */
- @SuppressWarnings("unchecked")
- private static SoftReference<Object[]>[][] classCache
- = (SoftReference<Object[]>[][]) new SoftReference<?>[][] {
- new SoftReference<?>[CACHE_SIZE],
- new SoftReference<?>[CACHE_SIZE]
- };
-
- private static void moveToFront(Object[] oa, int i) {
- Object ob = oa[i];
- for (int j = i; j > 0; j--)
- oa[j] = oa[j - 1];
- oa[0] = ob;
- }
-
- private static Class<?> cache(int type, Object encoding) {
- SoftReference<Object[]>[] srs = classCache[type];
- for (int i = 0; i < CACHE_SIZE; i++) {
- SoftReference<Object[]> sr = srs[i];
- if (sr == null)
- continue;
- Object[] oa = sr.get();
- if (oa == null) {
- srs[i] = null;
- continue;
- }
- if (oa[1].equals(encoding)) {
- moveToFront(srs, i);
- return (Class<?>)oa[0];
- }
- }
- return null;
- }
-
- private static Class<?> cache(int type, Object encoding, Class<?> c) {
- SoftReference<Object[]>[] srs = classCache[type];
- srs[CACHE_SIZE - 1] = new SoftReference<>(new Object[] { c, encoding });
- moveToFront(srs, CACHE_SIZE - 1);
- return c;
- }
-
- /* Used to avoid doing expensive charset lookups for charsets that are not
- * yet directly supported by NIO.
- */
- public static boolean isCached(int type, String encoding) {
- synchronized (lock) {
- SoftReference<Object[]>[] srs = classCache[type];
- for (int i = 0; i < CACHE_SIZE; i++) {
- SoftReference<Object[]> sr = srs[i];
- if (sr == null)
- continue;
- Object[] oa = sr.get();
- if (oa == null) {
- srs[i] = null;
- continue;
- }
- if (oa[1].equals(encoding))
- return true;
- }
- return false;
- }
- }
-
-
-
- /** Get the name of the converter package */
- private static String getConverterPackageName() {
- String cp = converterPackageName;
- if (cp != null) return cp;
- java.security.PrivilegedAction<String> pa =
- new sun.security.action.GetPropertyAction("file.encoding.pkg");
- cp = java.security.AccessController.doPrivileged(pa);
- if (cp != null) {
- /* Property is set, so take it as the true converter package */
- converterPackageName = cp;
- } else {
- /* Fall back to sun.io */
- cp = "sun.io";
- }
- return cp;
- }
-
- public static String getDefaultEncodingName() {
- synchronized (lock) {
- if (defaultEncoding == null) {
- java.security.PrivilegedAction<String> pa =
- new sun.security.action.GetPropertyAction("file.encoding");
- defaultEncoding = java.security.AccessController.doPrivileged(pa);
- }
- }
- return defaultEncoding;
- }
-
- public static void resetDefaultEncodingName() {
- // This method should only be called during VM initialization.
- if (sun.misc.VM.isBooted())
- return;
-
- synchronized (lock) {
- defaultEncoding = "ISO-8859-1";
- Properties p = System.getProperties();
- p.setProperty("file.encoding", defaultEncoding);
- System.setProperties(p);
- }
- }
-
- /**
- * Get the class that implements the given type of converter for the named
- * encoding, or throw an UnsupportedEncodingException if no such class can
- * be found
- */
- private static Class<?> getConverterClass(int type, String encoding)
- throws UnsupportedEncodingException
- {
- String enc = null;
-
- /* "ISO8859_1" is the canonical name for the ISO-Latin-1 encoding.
- Native code in the JDK commonly uses the alias "8859_1" instead of
- "ISO8859_1". We hardwire this alias here in order to avoid loading
- the full alias table just for this case. */
- if (!encoding.equals("ISO8859_1")) {
- if (encoding.equals("8859_1")) {
- enc = "ISO8859_1";
- /*
- * On Solaris with nl_langinfo() called in GetJavaProperties():
- *
- * locale undefined -> NULL -> hardcoded default
- * "C" locale -> "" -> hardcoded default (on 2.6)
- * "C" locale -> "646" (on 2.7)
- * "en_US" locale -> "ISO8859-1"
- * "en_GB" locale -> "ISO8859-1" (on 2.7)
- * "en_UK" locale -> "ISO8859-1" (on 2.6)
- */
- } else if (encoding.equals("ISO8859-1")) {
- enc = "ISO8859_1";
- } else if (encoding.equals("646")) {
- enc = "ASCII";
- } else {
- enc = CharacterEncoding.aliasName(encoding);
- }
- }
- if (enc == null) {
- enc = encoding;
- }
-
- try {
- return Class.forName(getConverterPackageName()
- + "." + converterPrefix[type] + enc);
- } catch(ClassNotFoundException e) {
- throw new UnsupportedEncodingException(enc);
- }
-
- }
-
- /**
- * Instantiate the given converter class, or throw an
- * UnsupportedEncodingException if it cannot be instantiated
- */
- private static Object newConverter(String enc, Class<?> c)
- throws UnsupportedEncodingException
- {
- try {
- return c.newInstance();
- } catch(InstantiationException e) {
- throw new UnsupportedEncodingException(enc);
- } catch(IllegalAccessException e) {
- throw new UnsupportedEncodingException(enc);
- }
- }
-
- /**
- * Create a converter object that implements the given type of converter
- * for the given encoding, or throw an UnsupportedEncodingException if no
- * appropriate converter class can be found and instantiated
- */
- static Object newConverter(int type, String enc)
- throws UnsupportedEncodingException
- {
- Class<?> c;
- synchronized (lock) {
- c = cache(type, enc);
- if (c == null) {
- c = getConverterClass(type, enc);
- if (!c.getName().equals("sun.io.CharToByteUTF8"))
- cache(type, enc, c);
- }
- }
- return newConverter(enc, c);
- }
-
- /**
- * Find the class that implements the given type of converter for the
- * default encoding. If the default encoding cannot be determined or is
- * not yet defined, return a class that implements the fallback default
- * encoding, which is just ISO 8859-1.
- */
- private static Class<?> getDefaultConverterClass(int type) {
- boolean fillCache = false;
- Class<?> c;
-
- /* First check the class cache */
- c = cache(type, DEFAULT_NAME);
- if (c != null)
- return c;
-
- /* Determine the encoding name */
- String enc = getDefaultEncodingName();
- if (enc != null) {
- /* file.encoding has been set, so cache the converter class */
- fillCache = true;
- } else {
- /* file.encoding has not been set, so use a default encoding which
- will not be cached */
- enc = "ISO8859_1";
- }
-
- /* We have an encoding name; try to find its class */
- try {
- c = getConverterClass(type, enc);
- if (fillCache) {
- cache(type, DEFAULT_NAME, c);
- }
- } catch (UnsupportedEncodingException x) {
- /* Can't find the default class, so fall back to ISO 8859-1 */
- try {
- c = getConverterClass(type, "ISO8859_1");
- } catch (UnsupportedEncodingException y) {
- throw new InternalError("Cannot find default "
- + converterPrefix[type]
- + " converter class");
- }
- }
- return c;
-
- }
-
- /**
- * Create a converter object that implements the given type of converter
- * for the default encoding, falling back to ISO 8859-1 if the default
- * encoding cannot be determined.
- */
- static Object newDefaultConverter(int type) {
- Class<?> c;
- synchronized (lock) {
- c = getDefaultConverterClass(type);
- }
- try {
- return newConverter("", c);
- } catch (UnsupportedEncodingException x) {
- throw new InternalError("Cannot instantiate default converter"
- + " class " + c.getName());
- }
- }
-
-}
diff --git a/jdk/src/share/classes/sun/io/MalformedInputException.java b/jdk/src/share/classes/sun/io/MalformedInputException.java
deleted file mode 100644
index 8788815..0000000
--- a/jdk/src/share/classes/sun/io/MalformedInputException.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-
-/**
-* The input string or input byte array to a character conversion
-* contains a malformed sequence of characters or bytes.
-*
-* @author Asmus Freytag
-*
-* @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
-* REMOVED IN J2SE 1.6.
-*/
- at Deprecated
-public class MalformedInputException
- extends java.io.CharConversionException
-{
- private static final long serialVersionUID = 2585413228493157652L;
-
- /**
- * Constructs a MalformedInputException with no detail message.
- * A detail message is a String that describes this particular exception.
- */
- public MalformedInputException() {
- super();
- }
-
- /**
- * Constructs a MalformedInputException with the specified detail message.
- * A detail message is a String that describes this particular exception.
- * @param s the String containing a detail message
- */
- public MalformedInputException(String s) {
- super(s);
- }
-}
diff --git a/jdk/src/share/classes/sun/io/UnknownCharacterException.java b/jdk/src/share/classes/sun/io/UnknownCharacterException.java
deleted file mode 100644
index efe33b9..0000000
--- a/jdk/src/share/classes/sun/io/UnknownCharacterException.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.io;
-
-
-/**
-* A character conversion encountered a character
-* that does not have an assigned mapping, and automatic
-* substitution is not selected
-*
-* @author Asmus Freytag
-* @deprecated Replaced by {@link java.nio.charset}. THIS API WILL BE
-* REMOVED IN J2SE 1.6.
-*/
- at Deprecated
-public class UnknownCharacterException
- extends java.io.CharConversionException
-{
- private static final long serialVersionUID = -8563196502398436986L;
-
- /**
- * Constructs a UnknownCharacterException with no detail message.
- * A detail message is a String that describes this particular exception.
- */
- public UnknownCharacterException() {
- super();
- }
-
- /**
- * Constructs a UnknownCharacterException with the specified detail message.
- * A detail message is a String that describes this particular exception.
- * @param s the String containing a detail message
- */
- public UnknownCharacterException(String s) {
- super(s);
- }
-}
diff --git a/jdk/src/share/classes/sun/security/pkcs/EncodingException.java b/jdk/src/share/classes/sun/security/pkcs/EncodingException.java
deleted file mode 100644
index 81650cd..0000000
--- a/jdk/src/share/classes/sun/security/pkcs/EncodingException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Generic PKCS Encoding exception.
- *
- * @author Benjamin Renaud
- */
-
-package sun.security.pkcs;
-
-public class EncodingException extends Exception {
-
- private static final long serialVersionUID = 4060198374240668325L;
-
- public EncodingException() {
- super();
- }
-
- public EncodingException(String s) {
- super(s);
- }
-}
diff --git a/jdk/src/share/classes/sun/security/pkcs/PKCS10.java b/jdk/src/share/classes/sun/security/pkcs/PKCS10.java
deleted file mode 100644
index 6303c8b..0000000
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS10.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.security.pkcs;
-
-import java.io.PrintStream;
-import java.io.IOException;
-import java.math.BigInteger;
-
-import java.security.cert.CertificateException;
-import java.security.NoSuchAlgorithmException;
-import java.security.InvalidKeyException;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.PublicKey;
-
-import sun.misc.BASE64Encoder;
-
-import sun.security.util.*;
-import sun.security.x509.AlgorithmId;
-import sun.security.x509.X509Key;
-import sun.security.x509.X500Name;
-
-/**
- * A PKCS #10 certificate request is created and sent to a Certificate
- * Authority, which then creates an X.509 certificate and returns it to
- * the entity that requested it. A certificate request basically consists
- * of the subject's X.500 name, public key, and optionally some attributes,
- * signed using the corresponding private key.
- *
- * The ASN.1 syntax for a Certification Request is:
- * <pre>
- * CertificationRequest ::= SEQUENCE {
- * certificationRequestInfo CertificationRequestInfo,
- * signatureAlgorithm SignatureAlgorithmIdentifier,
- * signature Signature
- * }
- *
- * SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
- * Signature ::= BIT STRING
- *
- * CertificationRequestInfo ::= SEQUENCE {
- * version Version,
- * subject Name,
- * subjectPublicKeyInfo SubjectPublicKeyInfo,
- * attributes [0] IMPLICIT Attributes
- * }
- * Attributes ::= SET OF Attribute
- * </pre>
- *
- * @author David Brownell
- * @author Amit Kapoor
- * @author Hemma Prafullchandra
- */
-public class PKCS10 {
- /**
- * Constructs an unsigned PKCS #10 certificate request. Before this
- * request may be used, it must be encoded and signed. Then it
- * must be retrieved in some conventional format (e.g. string).
- *
- * @param publicKey the public key that should be placed
- * into the certificate generated by the CA.
- */
- public PKCS10(PublicKey publicKey) {
- subjectPublicKeyInfo = publicKey;
- attributeSet = new PKCS10Attributes();
- }
-
- /**
- * Constructs an unsigned PKCS #10 certificate request. Before this
- * request may be used, it must be encoded and signed. Then it
- * must be retrieved in some conventional format (e.g. string).
- *
- * @param publicKey the public key that should be placed
- * into the certificate generated by the CA.
- * @param attributes additonal set of PKCS10 attributes requested
- * for in the certificate.
- */
- public PKCS10(PublicKey publicKey, PKCS10Attributes attributes) {
- subjectPublicKeyInfo = publicKey;
- attributeSet = attributes;
- }
-
- /**
- * Parses an encoded, signed PKCS #10 certificate request, verifying
- * the request's signature as it does so. This constructor would
- * typically be used by a Certificate Authority, from which a new
- * certificate would then be constructed.
- *
- * @param data the DER-encoded PKCS #10 request.
- * @exception IOException for low level errors reading the data
- * @exception SignatureException when the signature is invalid
- * @exception NoSuchAlgorithmException when the signature
- * algorithm is not supported in this environment
- */
- public PKCS10(byte[] data)
- throws IOException, SignatureException, NoSuchAlgorithmException {
- DerInputStream in;
- DerValue[] seq;
- AlgorithmId id;
- byte[] sigData;
- Signature sig;
-
- encoded = data;
-
- //
- // Outer sequence: request, signature algorithm, signature.
- // Parse, and prepare to verify later.
- //
- in = new DerInputStream(data);
- seq = in.getSequence(3);
-
- if (seq.length != 3)
- throw new IllegalArgumentException("not a PKCS #10 request");
-
- data = seq[0].toByteArray(); // reusing this variable
- id = AlgorithmId.parse(seq[1]);
- sigData = seq[2].getBitString();
-
- //
- // Inner sequence: version, name, key, attributes
- //
- BigInteger serial;
- DerValue val;
-
- serial = seq[0].data.getBigInteger();
- if (!serial.equals(BigInteger.ZERO))
- throw new IllegalArgumentException("not PKCS #10 v1");
-
- subject = new X500Name(seq[0].data);
- subjectPublicKeyInfo = X509Key.parse(seq[0].data.getDerValue());
-
- // Cope with a somewhat common illegal PKCS #10 format
- if (seq[0].data.available() != 0)
- attributeSet = new PKCS10Attributes(seq[0].data);
- else
- attributeSet = new PKCS10Attributes();
-
- if (seq[0].data.available() != 0)
- throw new IllegalArgumentException("illegal PKCS #10 data");
-
- //
- // OK, we parsed it all ... validate the signature using the
- // key and signature algorithm we found.
- //
- try {
- sig = Signature.getInstance(id.getName());
- sig.initVerify(subjectPublicKeyInfo);
- sig.update(data);
- if (!sig.verify(sigData))
- throw new SignatureException("Invalid PKCS #10 signature");
- } catch (InvalidKeyException e) {
- throw new SignatureException("invalid key");
- }
- }
-
- /**
- * Create the signed certificate request. This will later be
- * retrieved in either string or binary format.
- *
- * @param subject identifies the signer (by X.500 name).
- * @param signature private key and signing algorithm to use.
- * @exception IOException on errors.
- * @exception CertificateException on certificate handling errors.
- * @exception SignatureException on signature handling errors.
- */
- public void encodeAndSign(X500Name subject, Signature signature)
- throws CertificateException, IOException, SignatureException {
- DerOutputStream out, scratch;
- byte[] certificateRequestInfo;
- byte[] sig;
-
- if (encoded != null)
- throw new SignatureException("request is already signed");
-
- this.subject = subject;
-
- /*
- * Encode cert request info, wrap in a sequence for signing
- */
- scratch = new DerOutputStream();
- scratch.putInteger(BigInteger.ZERO); // PKCS #10 v1.0
- subject.encode(scratch); // X.500 name
- scratch.write(subjectPublicKeyInfo.getEncoded()); // public key
- attributeSet.encode(scratch);
-
- out = new DerOutputStream();
- out.write(DerValue.tag_Sequence, scratch); // wrap it!
- certificateRequestInfo = out.toByteArray();
- scratch = out;
-
- /*
- * Sign it ...
- */
- signature.update(certificateRequestInfo, 0,
- certificateRequestInfo.length);
- sig = signature.sign();
-
- /*
- * Build guts of SIGNED macro
- */
- AlgorithmId algId = null;
- try {
- algId = AlgorithmId.get(signature.getAlgorithm());
- } catch (NoSuchAlgorithmException nsae) {
- throw new SignatureException(nsae);
- }
- algId.encode(scratch); // sig algorithm
- scratch.putBitString(sig); // sig
-
- /*
- * Wrap those guts in a sequence
- */
- out = new DerOutputStream();
- out.write(DerValue.tag_Sequence, scratch);
- encoded = out.toByteArray();
- }
-
- /**
- * Returns the subject's name.
- */
- public X500Name getSubjectName() { return subject; }
-
- /**
- * Returns the subject's public key.
- */
- public PublicKey getSubjectPublicKeyInfo()
- { return subjectPublicKeyInfo; }
-
- /**
- * Returns the additional attributes requested.
- */
- public PKCS10Attributes getAttributes()
- { return attributeSet; }
-
- /**
- * Returns the encoded and signed certificate request as a
- * DER-encoded byte array.
- *
- * @return the certificate request, or null if encodeAndSign()
- * has not yet been called.
- */
- public byte[] getEncoded() {
- if (encoded != null)
- return encoded.clone();
- else
- return null;
- }
-
- /**
- * Prints an E-Mailable version of the certificate request on the print
- * stream passed. The format is a common base64 encoded one, supported
- * by most Certificate Authorities because Netscape web servers have
- * used this for some time. Some certificate authorities expect some
- * more information, in particular contact information for the web
- * server administrator.
- *
- * @param out the print stream where the certificate request
- * will be printed.
- * @exception IOException when an output operation failed
- * @exception SignatureException when the certificate request was
- * not yet signed.
- */
- public void print(PrintStream out)
- throws IOException, SignatureException {
- if (encoded == null)
- throw new SignatureException("Cert request was not signed");
-
- BASE64Encoder encoder = new BASE64Encoder();
-
- out.println("-----BEGIN NEW CERTIFICATE REQUEST-----");
- encoder.encodeBuffer(encoded, out);
- out.println("-----END NEW CERTIFICATE REQUEST-----");
- }
-
- /**
- * Provides a short description of this request.
- */
- public String toString() {
- return "[PKCS #10 certificate request:\n"
- + subjectPublicKeyInfo.toString()
- + " subject: <" + subject + ">" + "\n"
- + " attributes: " + attributeSet.toString()
- + "\n]";
- }
-
- /**
- * Compares this object for equality with the specified
- * object. If the <code>other</code> object is an
- * <code>instanceof</code> <code>PKCS10</code>, then
- * its encoded form is retrieved and compared with the
- * encoded form of this certificate request.
- *
- * @param other the object to test for equality with this object.
- * @return true iff the encoded forms of the two certificate
- * requests match, false otherwise.
- */
- public boolean equals(Object other) {
- if (this == other)
- return true;
- if (!(other instanceof PKCS10))
- return false;
- if (encoded == null) // not signed yet
- return false;
- byte[] otherEncoded = ((PKCS10)other).getEncoded();
- if (otherEncoded == null)
- return false;
-
- return java.util.Arrays.equals(encoded, otherEncoded);
- }
-
- /**
- * Returns a hashcode value for this certificate request from its
- * encoded form.
- *
- * @return the hashcode value.
- */
- public int hashCode() {
- int retval = 0;
- if (encoded != null)
- for (int i = 1; i < encoded.length; i++)
- retval += encoded[i] * i;
- return(retval);
- }
-
- private X500Name subject;
- private PublicKey subjectPublicKeyInfo;
- private PKCS10Attributes attributeSet;
- private byte[] encoded; // signed
-}
diff --git a/jdk/src/share/classes/sun/security/pkcs/PKCS10Attribute.java b/jdk/src/share/classes/sun/security/pkcs/PKCS10Attribute.java
deleted file mode 100644
index a838131..0000000
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS10Attribute.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.pkcs;
-
-import java.io.OutputStream;
-import java.io.IOException;
-
-import sun.security.util.*;
-
-/**
- * Represent a PKCS#10 Attribute.
- *
- * <p>Attributes are additonal information which can be inserted in a PKCS#10
- * certificate request. For example a "Driving License Certificate" could have
- * the driving license number as an attribute.
- *
- * <p>Attributes are represented as a sequence of the attribute identifier
- * (Object Identifier) and a set of DER encoded attribute values.
- *
- * ASN.1 definition of Attribute:
- * <pre>
- * Attribute :: SEQUENCE {
- * type AttributeType,
- * values SET OF AttributeValue
- * }
- * AttributeType ::= OBJECT IDENTIFIER
- * AttributeValue ::= ANY defined by type
- * </pre>
- *
- * @author Amit Kapoor
- * @author Hemma Prafullchandra
- */
-public class PKCS10Attribute implements DerEncoder {
-
- protected ObjectIdentifier attributeId = null;
- protected Object attributeValue = null;
-
- /**
- * Constructs an attribute from a DER encoding.
- * This constructor expects the value to be encoded as defined above,
- * i.e. a SEQUENCE of OID and SET OF value(s), not a literal
- * X.509 v3 extension. Only PKCS9 defined attributes are supported
- * currently.
- *
- * @param derVal the der encoded attribute.
- * @exception IOException on parsing errors.
- */
- public PKCS10Attribute(DerValue derVal) throws IOException {
- PKCS9Attribute attr = new PKCS9Attribute(derVal);
- this.attributeId = attr.getOID();
- this.attributeValue = attr.getValue();
- }
-
- /**
- * Constructs an attribute from individual components of
- * ObjectIdentifier and the value (any java object).
- *
- * @param attributeId the ObjectIdentifier of the attribute.
- * @param attributeValue an instance of a class that implements
- * the attribute identified by the ObjectIdentifier.
- */
- public PKCS10Attribute(ObjectIdentifier attributeId,
- Object attributeValue) {
- this.attributeId = attributeId;
- this.attributeValue = attributeValue;
- }
-
- /**
- * Constructs an attribute from PKCS9 attribute.
- *
- * @param attr the PKCS9Attribute to create from.
- */
- public PKCS10Attribute(PKCS9Attribute attr) {
- this.attributeId = attr.getOID();
- this.attributeValue = attr.getValue();
- }
-
- /**
- * DER encode this object onto an output stream.
- * Implements the <code>DerEncoder</code> interface.
- *
- * @param out
- * the OutputStream on which to write the DER encoding.
- *
- * @exception IOException on encoding errors.
- */
- public void derEncode(OutputStream out) throws IOException {
- PKCS9Attribute attr = new PKCS9Attribute(attributeId, attributeValue);
- attr.derEncode(out);
- }
-
- /**
- * Returns the ObjectIdentifier of the attribute.
- */
- public ObjectIdentifier getAttributeId() {
- return (attributeId);
- }
-
- /**
- * Returns the attribute value.
- */
- public Object getAttributeValue() {
- return (attributeValue);
- }
-
- /**
- * Returns the attribute in user readable form.
- */
- public String toString() {
- return (attributeValue.toString());
- }
-}
diff --git a/jdk/src/share/classes/sun/security/pkcs/PKCS10Attributes.java b/jdk/src/share/classes/sun/security/pkcs/PKCS10Attributes.java
deleted file mode 100644
index 8279ae2..0000000
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS10Attributes.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.pkcs;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.security.cert.CertificateException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import sun.security.util.*;
-
-/**
- * This class defines the PKCS10 attributes for the request.
- * The ASN.1 syntax for this is:
- * <pre>
- * Attributes ::= SET OF Attribute
- * </pre>
- *
- * @author Amit Kapoor
- * @author Hemma Prafullchandra
- * @see PKCS10
- * @see PKCS10Attribute
- */
-public class PKCS10Attributes implements DerEncoder {
-
- private Hashtable<String, PKCS10Attribute> map =
- new Hashtable<String, PKCS10Attribute>(3);
-
- /**
- * Default constructor for the PKCS10 attribute.
- */
- public PKCS10Attributes() { }
-
- /**
- * Create the object from the array of PKCS10Attribute objects.
- *
- * @param attrs the array of PKCS10Attribute objects.
- */
- public PKCS10Attributes(PKCS10Attribute[] attrs) {
- for (int i = 0; i < attrs.length; i++) {
- map.put(attrs[i].getAttributeId().toString(), attrs[i]);
- }
- }
-
- /**
- * Create the object, decoding the values from the passed DER stream.
- * The DER stream contains the SET OF Attribute.
- *
- * @param in the DerInputStream to read the attributes from.
- * @exception IOException on decoding errors.
- */
- public PKCS10Attributes(DerInputStream in) throws IOException {
- DerValue[] attrs = in.getSet(3, true);
-
- if (attrs == null)
- throw new IOException("Illegal encoding of attributes");
- for (int i = 0; i < attrs.length; i++) {
- PKCS10Attribute attr = new PKCS10Attribute(attrs[i]);
- map.put(attr.getAttributeId().toString(), attr);
- }
- }
-
- /**
- * Encode the attributes in DER form to the stream.
- *
- * @param out the OutputStream to marshal the contents to.
- * @exception IOException on encoding errors.
- */
- public void encode(OutputStream out) throws IOException {
- derEncode(out);
- }
-
- /**
- * Encode the attributes in DER form to the stream.
- * Implements the <code>DerEncoder</code> interface.
- *
- * @param out the OutputStream to marshal the contents to.
- * @exception IOException on encoding errors.
- */
- public void derEncode(OutputStream out) throws IOException {
- // first copy the elements into an array
- Collection<PKCS10Attribute> allAttrs = map.values();
- PKCS10Attribute[] attribs =
- allAttrs.toArray(new PKCS10Attribute[map.size()]);
-
- DerOutputStream attrOut = new DerOutputStream();
- attrOut.putOrderedSetOf(DerValue.createTag(DerValue.TAG_CONTEXT,
- true, (byte)0),
- attribs);
- out.write(attrOut.toByteArray());
- }
-
- /**
- * Set the attribute value.
- */
- public void setAttribute(String name, Object obj) {
- if (obj instanceof PKCS10Attribute) {
- map.put(name, (PKCS10Attribute)obj);
- }
- }
-
- /**
- * Get the attribute value.
- */
- public Object getAttribute(String name) {
- return map.get(name);
- }
-
- /**
- * Delete the attribute value.
- */
- public void deleteAttribute(String name) {
- map.remove(name);
- }
-
- /**
- * Return an enumeration of names of attributes existing within this
- * attribute.
- */
- public Enumeration<PKCS10Attribute> getElements() {
- return (map.elements());
- }
-
- /**
- * Return a Collection of attributes existing within this
- * PKCS10Attributes object.
- */
- public Collection<PKCS10Attribute> getAttributes() {
- return (Collections.unmodifiableCollection(map.values()));
- }
-
- /**
- * Compares this PKCS10Attributes for equality with the specified
- * object. If the <code>other</code> object is an
- * <code>instanceof</code> <code>PKCS10Attributes</code>, then
- * all the entries are compared with the entries from this.
- *
- * @param other the object to test for equality with this PKCS10Attributes.
- * @return true if all the entries match that of the Other,
- * false otherwise.
- */
- public boolean equals(Object other) {
- if (this == other)
- return true;
- if (!(other instanceof PKCS10Attributes))
- return false;
-
- Collection<PKCS10Attribute> othersAttribs =
- ((PKCS10Attributes)other).getAttributes();
- PKCS10Attribute[] attrs =
- othersAttribs.toArray(new PKCS10Attribute[othersAttribs.size()]);
- int len = attrs.length;
- if (len != map.size())
- return false;
- PKCS10Attribute thisAttr, otherAttr;
- String key = null;
- for (int i=0; i < len; i++) {
- otherAttr = attrs[i];
- key = otherAttr.getAttributeId().toString();
-
- if (key == null)
- return false;
- thisAttr = map.get(key);
- if (thisAttr == null)
- return false;
- if (! thisAttr.equals(otherAttr))
- return false;
- }
- return true;
- }
-
- /**
- * Returns a hashcode value for this PKCS10Attributes.
- *
- * @return the hashcode value.
- */
- public int hashCode() {
- return map.hashCode();
- }
-
- /**
- * Returns a string representation of this <tt>PKCS10Attributes</tt> object
- * in the form of a set of entries, enclosed in braces and separated
- * by the ASCII characters "<tt>, </tt>" (comma and space).
- * <p>Overrides the <tt>toString</tt> method of <tt>Object</tt>.
- *
- * @return a string representation of this PKCS10Attributes.
- */
- public String toString() {
- String s = map.size() + "\n" + map.toString();
- return s;
- }
-}
diff --git a/jdk/src/share/classes/sun/security/util/BigInt.java b/jdk/src/share/classes/sun/security/util/BigInt.java
deleted file mode 100644
index 4713cc4..0000000
--- a/jdk/src/share/classes/sun/security/util/BigInt.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.util;
-
-import java.math.BigInteger;
-
-
-/**
- * A low-overhead arbitrary-precision <em>unsigned</em> integer.
- * This is intended for use with ASN.1 parsing, and printing of
- * such parsed values. Convert to "BigInteger" if you need to do
- * arbitrary precision arithmetic, rather than just represent
- * the number as a wrapped array of bytes.
- *
- * <P><em><b>NOTE:</b> This class may eventually disappear, to
- * be supplanted by big-endian byte arrays which hold both signed
- * and unsigned arbitrary-precision integers.</em>
- *
- * @author David Brownell
- */
-public final class BigInt {
-
- // Big endian -- MSB first.
- private byte[] places;
-
- /**
- * Constructs a "Big" integer from a set of (big-endian) bytes.
- * Leading zeroes should be stripped off.
- *
- * @param data a sequence of bytes, most significant bytes/digits
- * first. CONSUMED.
- */
- public BigInt(byte[] data) { places = data.clone(); }
-
- /**
- * Constructs a "Big" integer from a "BigInteger", which must be
- * positive (or zero) in value.
- */
- public BigInt(BigInteger i) {
- byte[] temp = i.toByteArray();
-
- if ((temp[0] & 0x80) != 0)
- throw new IllegalArgumentException("negative BigInteger");
-
- // XXX we assume exactly _one_ sign byte is used...
-
- if (temp[0] != 0)
- places = temp;
- else {
- places = new byte[temp.length - 1];
- for (int j = 1; j < temp.length; j++)
- places[j - 1] = temp[j];
- }
- }
-
- /**
- * Constructs a "Big" integer from a normal Java integer.
- *
- * @param i the java primitive integer
- */
- public BigInt(int i) {
- if (i < (1 << 8)) {
- places = new byte[1];
- places[0] = (byte) i;
- } else if (i < (1 << 16)) {
- places = new byte[2];
- places[0] = (byte) (i >> 8);
- places[1] = (byte) i;
- } else if (i < (1 << 24)) {
- places = new byte[3];
- places[0] = (byte) (i >> 16);
- places[1] = (byte) (i >> 8);
- places[2] = (byte) i;
- } else {
- places = new byte[4];
- places[0] = (byte) (i >> 24);
- places[1] = (byte) (i >> 16);
- places[2] = (byte) (i >> 8);
- places[3] = (byte) i;
- }
- }
-
- /**
- * Converts the "big" integer to a java primitive integer.
- *
- * @excpet NumberFormatException if 32 bits is insufficient.
- */
- public int toInt() {
- if (places.length > 4)
- throw new NumberFormatException("BigInt.toLong, too big");
- int retval = 0, i = 0;
- for (; i < places.length; i++)
- retval = (retval << 8) + ((int)places[i] & 0xff);
- return retval;
- }
-
- /**
- * Returns a hexadecimal printed representation. The value is
- * formatted to fit on lines of at least 75 characters, with
- * embedded newlines. Words are separated for readability,
- * with eight words (32 bytes) per line.
- */
- public String toString() { return hexify(); }
-
- /**
- * Returns a BigInteger value which supports many arithmetic
- * operations. Assumes negative values will never occur.
- */
- public BigInteger toBigInteger()
- { return new BigInteger(1, places); }
-
- /**
- * Returns the data as a byte array. The most significant bit
- * of the array is bit zero (as in <code>java.math.BigInteger</code>).
- */
- public byte[] toByteArray() { return places.clone(); }
-
- private static final String digits = "0123456789abcdef";
- private String hexify() {
- if (places.length == 0)
- return " 0 ";
-
- StringBuffer buf = new StringBuffer(places.length * 2);
- buf.append(" "); // four spaces
- for (int i = 0; i < places.length; i++) {
- buf.append(digits.charAt((places[i] >> 4) & 0x0f));
- buf.append(digits.charAt(places[i] & 0x0f));
- if (((i + 1) % 32) == 0) {
- if ((i + 1) != places.length)
- buf.append("\n "); // line after four words
- } else if (((i + 1) % 4) == 0)
- buf.append(' '); // space between words
- }
- return buf.toString();
- }
-
- /**
- * Returns true iff the parameter is a numerically equivalent
- * BigInt.
- *
- * @param other the object being compared with this one.
- */
- public boolean equals(Object other) {
- if (other instanceof BigInt)
- return equals((BigInt) other);
- return false;
- }
-
- /**
- * Returns true iff the parameter is numerically equivalent.
- *
- * @param other the BigInt being compared with this one.
- */
- public boolean equals(BigInt other) {
- if (this == other)
- return true;
-
- byte[] otherPlaces = other.toByteArray();
- if (places.length != otherPlaces.length)
- return false;
- for (int i = 0; i < places.length; i++)
- if (places[i] != otherPlaces[i])
- return false;
- return true;
- }
-
- /**
- * Returns a hashcode for this BigInt.
- *
- * @return a hashcode for this BigInt.
- */
- public int hashCode() {
- return hexify().hashCode();
- }
-}
diff --git a/jdk/src/share/classes/sun/security/util/PathList.java b/jdk/src/share/classes/sun/security/util/PathList.java
deleted file mode 100644
index 4d1fa71..0000000
--- a/jdk/src/share/classes/sun/security/util/PathList.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.util;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.String;
-import java.util.StringTokenizer;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.MalformedURLException;
-
-/**
- * A utility class for handle path list
- *
- */
-public class PathList {
- /**
- * Utility method for appending path from pathFrom to pathTo.
- *
- * @param pathTo the target path
- * @param pathSource the path to be appended to pathTo
- * @return the resulting path
- */
- public static String appendPath(String pathTo, String pathFrom) {
- if (pathTo == null || pathTo.length() == 0) {
- return pathFrom;
- } else if (pathFrom == null || pathFrom.length() == 0) {
- return pathTo;
- } else {
- return pathTo + File.pathSeparator + pathFrom;
- }
- }
-
- /**
- * Utility method for converting a search path string to an array
- * of directory and JAR file URLs.
- *
- * @param path the search path string
- * @return the resulting array of directory and JAR file URLs
- */
- public static URL[] pathToURLs(String path) {
- StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
- URL[] urls = new URL[st.countTokens()];
- int count = 0;
- while (st.hasMoreTokens()) {
- URL url = fileToURL(new File(st.nextToken()));
- if (url != null) {
- urls[count++] = url;
- }
- }
- if (urls.length != count) {
- URL[] tmp = new URL[count];
- System.arraycopy(urls, 0, tmp, 0, count);
- urls = tmp;
- }
- return urls;
- }
-
- /**
- * Returns the directory or JAR file URL corresponding to the specified
- * local file name.
- *
- * @param file the File object
- * @return the resulting directory or JAR file URL, or null if unknown
- */
- private static URL fileToURL(File file) {
- String name;
- try {
- name = file.getCanonicalPath();
- } catch (IOException e) {
- name = file.getAbsolutePath();
- }
- name = name.replace(File.separatorChar, '/');
- if (!name.startsWith("/")) {
- name = "/" + name;
- }
- // If the file does not exist, then assume that it's a directory
- if (!file.isFile()) {
- name = name + "/";
- }
- try {
- return new URL("file", "", name);
- } catch (MalformedURLException e) {
- throw new IllegalArgumentException("file");
- }
- }
-}
diff --git a/jdk/src/share/classes/sun/security/x509/CertAndKeyGen.java b/jdk/src/share/classes/sun/security/x509/CertAndKeyGen.java
deleted file mode 100644
index f1560c7..0000000
--- a/jdk/src/share/classes/sun/security/x509/CertAndKeyGen.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.x509;
-
-import java.io.IOException;
-import java.security.cert.X509Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateEncodingException;
-import java.security.*;
-import java.util.Date;
-
-import sun.security.pkcs.PKCS10;
-
-
-/**
- * Generate a pair of keys, and provide access to them. This class is
- * provided primarily for ease of use.
- *
- * <P>This provides some simple certificate management functionality.
- * Specifically, it allows you to create self-signed X.509 certificates
- * as well as PKCS 10 based certificate signing requests.
- *
- * <P>Keys for some public key signature algorithms have algorithm
- * parameters, such as DSS/DSA. Some sites' Certificate Authorities
- * adopt fixed algorithm parameters, which speeds up some operations
- * including key generation and signing. <em>At this time, this interface
- * does not provide a way to provide such algorithm parameters, e.g.
- * by providing the CA certificate which includes those parameters.</em>
- *
- * <P>Also, note that at this time only signature-capable keys may be
- * acquired through this interface. Diffie-Hellman keys, used for secure
- * key exchange, may be supported later.
- *
- * @author David Brownell
- * @author Hemma Prafullchandra
- * @see PKCS10
- * @see X509CertImpl
- */
-public final class CertAndKeyGen {
- /**
- * Creates a CertAndKeyGen object for a particular key type
- * and signature algorithm.
- *
- * @param keyType type of key, e.g. "RSA", "DSA"
- * @param sigAlg name of the signature algorithm, e.g. "MD5WithRSA",
- * "MD2WithRSA", "SHAwithDSA".
- * @exception NoSuchAlgorithmException on unrecognized algorithms.
- */
- public CertAndKeyGen (String keyType, String sigAlg)
- throws NoSuchAlgorithmException
- {
- keyGen = KeyPairGenerator.getInstance(keyType);
- this.sigAlg = sigAlg;
- }
-
- /**
- * Creates a CertAndKeyGen object for a particular key type,
- * signature algorithm, and provider.
- *
- * @param keyType type of key, e.g. "RSA", "DSA"
- * @param sigAlg name of the signature algorithm, e.g. "MD5WithRSA",
- * "MD2WithRSA", "SHAwithDSA".
- * @param providerName name of the provider
- * @exception NoSuchAlgorithmException on unrecognized algorithms.
- * @exception NoSuchProviderException on unrecognized providers.
- */
- public CertAndKeyGen (String keyType, String sigAlg, String providerName)
- throws NoSuchAlgorithmException, NoSuchProviderException
- {
- if (providerName == null) {
- keyGen = KeyPairGenerator.getInstance(keyType);
- } else {
- try {
- keyGen = KeyPairGenerator.getInstance(keyType, providerName);
- } catch (Exception e) {
- // try first available provider instead
- keyGen = KeyPairGenerator.getInstance(keyType);
- }
- }
- this.sigAlg = sigAlg;
- }
-
- /**
- * Sets the source of random numbers used when generating keys.
- * If you do not provide one, a system default facility is used.
- * You may wish to provide your own source of random numbers
- * to get a reproducible sequence of keys and signatures, or
- * because you may be able to take advantage of strong sources
- * of randomness/entropy in your environment.
- */
- public void setRandom (SecureRandom generator)
- {
- prng = generator;
- }
-
- // want "public void generate (X509Certificate)" ... inherit DSA/D-H param
-
- /**
- * Generates a random public/private key pair, with a given key
- * size. Different algorithms provide different degrees of security
- * for the same key size, because of the "work factor" involved in
- * brute force attacks. As computers become faster, it becomes
- * easier to perform such attacks. Small keys are to be avoided.
- *
- * <P>Note that not all values of "keyBits" are valid for all
- * algorithms, and not all public key algorithms are currently
- * supported for use in X.509 certificates. If the algorithm
- * you specified does not produce X.509 compatible keys, an
- * invalid key exception is thrown.
- *
- * @param keyBits the number of bits in the keys.
- * @exception InvalidKeyException if the environment does not
- * provide X.509 public keys for this signature algorithm.
- */
- public void generate (int keyBits)
- throws InvalidKeyException
- {
- KeyPair pair;
-
- try {
- if (prng == null) {
- prng = new SecureRandom();
- }
- keyGen.initialize(keyBits, prng);
- pair = keyGen.generateKeyPair();
-
- } catch (Exception e) {
- throw new IllegalArgumentException(e.getMessage());
- }
-
- publicKey = pair.getPublic();
- privateKey = pair.getPrivate();
- }
-
-
- /**
- * Returns the public key of the generated key pair if it is of type
- * <code>X509Key</code>, or null if the public key is of a different type.
- *
- * XXX Note: This behaviour is needed for backwards compatibility.
- * What this method really should return is the public key of the
- * generated key pair, regardless of whether or not it is an instance of
- * <code>X509Key</code>. Accordingly, the return type of this method
- * should be <code>PublicKey</code>.
- */
- public X509Key getPublicKey()
- {
- if (!(publicKey instanceof X509Key)) {
- return null;
- }
- return (X509Key)publicKey;
- }
-
-
- /**
- * Returns the private key of the generated key pair.
- *
- * <P><STRONG><em>Be extremely careful when handling private keys.
- * When private keys are not kept secret, they lose their ability
- * to securely authenticate specific entities ... that is a huge
- * security risk!</em></STRONG>
- */
- public PrivateKey getPrivateKey ()
- {
- return privateKey;
- }
-
-
- /**
- * Returns a self-signed X.509v3 certificate for the public key.
- * The certificate is immediately valid. No extensions.
- *
- * <P>Such certificates normally are used to identify a "Certificate
- * Authority" (CA). Accordingly, they will not always be accepted by
- * other parties. However, such certificates are also useful when
- * you are bootstrapping your security infrastructure, or deploying
- * system prototypes.
- *
- * @param myname X.500 name of the subject (who is also the issuer)
- * @param firstDate the issue time of the certificate
- * @param validity how long the certificate should be valid, in seconds
- * @exception CertificateException on certificate handling errors.
- * @exception InvalidKeyException on key handling errors.
- * @exception SignatureException on signature handling errors.
- * @exception NoSuchAlgorithmException on unrecognized algorithms.
- * @exception NoSuchProviderException on unrecognized providers.
- */
- public X509Certificate getSelfCertificate (
- X500Name myname, Date firstDate, long validity)
- throws CertificateException, InvalidKeyException, SignatureException,
- NoSuchAlgorithmException, NoSuchProviderException
- {
- X509CertImpl cert;
- Date lastDate;
-
- try {
- lastDate = new Date ();
- lastDate.setTime (firstDate.getTime () + validity * 1000);
-
- CertificateValidity interval =
- new CertificateValidity(firstDate,lastDate);
-
- X509CertInfo info = new X509CertInfo();
- // Add all mandatory attributes
- info.set(X509CertInfo.VERSION,
- new CertificateVersion(CertificateVersion.V3));
- info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
- new java.util.Random().nextInt() & 0x7fffffff));
- AlgorithmId algID = AlgorithmId.get(sigAlg);
- info.set(X509CertInfo.ALGORITHM_ID,
- new CertificateAlgorithmId(algID));
- info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(myname));
- info.set(X509CertInfo.KEY, new CertificateX509Key(publicKey));
- info.set(X509CertInfo.VALIDITY, interval);
- info.set(X509CertInfo.ISSUER, new CertificateIssuerName(myname));
-
- cert = new X509CertImpl(info);
- cert.sign(privateKey, this.sigAlg);
-
- return (X509Certificate)cert;
-
- } catch (IOException e) {
- throw new CertificateEncodingException("getSelfCert: " +
- e.getMessage());
- }
- }
-
- // Keep the old method
- public X509Certificate getSelfCertificate (X500Name myname, long validity)
- throws CertificateException, InvalidKeyException, SignatureException,
- NoSuchAlgorithmException, NoSuchProviderException
- {
- return getSelfCertificate(myname, new Date(), validity);
- }
-
- /**
- * Returns a PKCS #10 certificate request. The caller uses either
- * <code>PKCS10.print</code> or <code>PKCS10.toByteArray</code>
- * operations on the result, to get the request in an appropriate
- * transmission format.
- *
- * <P>PKCS #10 certificate requests are sent, along with some proof
- * of identity, to Certificate Authorities (CAs) which then issue
- * X.509 public key certificates.
- *
- * @param myname X.500 name of the subject
- * @exception InvalidKeyException on key handling errors.
- * @exception SignatureException on signature handling errors.
- */
- public PKCS10 getCertRequest (X500Name myname)
- throws InvalidKeyException, SignatureException
- {
- PKCS10 req = new PKCS10 (publicKey);
-
- try {
- Signature signature = Signature.getInstance(sigAlg);
- signature.initSign (privateKey);
- req.encodeAndSign(myname, signature);
-
- } catch (CertificateException e) {
- throw new SignatureException (sigAlg + " CertificateException");
-
- } catch (IOException e) {
- throw new SignatureException (sigAlg + " IOException");
-
- } catch (NoSuchAlgorithmException e) {
- // "can't happen"
- throw new SignatureException (sigAlg + " unavailable?");
- }
- return req;
- }
-
- private SecureRandom prng;
- private String sigAlg;
- private KeyPairGenerator keyGen;
- private PublicKey publicKey;
- private PrivateKey privateKey;
-}
diff --git a/jdk/src/share/classes/sun/tools/jar/JarImageSource.java b/jdk/src/share/classes/sun/tools/jar/JarImageSource.java
deleted file mode 100644
index 254eebd..0000000
--- a/jdk/src/share/classes/sun/tools/jar/JarImageSource.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.tools.jar;
-
-import sun.awt.image.URLImageSource;
-import sun.awt.image.ImageDecoder;
-import java.net.URL;
-import java.net.JarURLConnection;
-import java.util.jar.JarFile;
-import java.util.jar.JarEntry;
-import java.io.InputStream;
-import java.io.IOException;
-
-
-public class JarImageSource extends URLImageSource {
- String mimeType;
- String entryName = null;
- URL url;
-
- /**
- * Create an image source from a Jar entry URL with the specified
- * mime type.
- */
- public JarImageSource(URL u, String type) {
- super(u);
- url = u;
- mimeType = type;
- }
-
- /**
- * Create an image source from a Jar file/entry URL
- * with the specified entry name and mime type.
- */
- public JarImageSource(URL u, String name, String type) {
- this(u, type);
- this.entryName = name;
- }
-
- protected ImageDecoder getDecoder() {
- InputStream is = null;
- try {
- JarURLConnection c = (JarURLConnection)url.openConnection();
- JarFile f = c.getJarFile();
- JarEntry e = c.getJarEntry();
-
- if (entryName != null && e == null) {
- e = f.getJarEntry(entryName);
- }
- if (e == null || (e != null && entryName != null
- && (!(entryName.equals(e.getName()))))) {
- return null;
- }
- is = f.getInputStream(e);
- } catch (IOException e) {
- return null;
- }
-
- ImageDecoder id = decoderForType(is, mimeType);
- if (id == null) {
- id = getDecoder(is);
- }
- return id;
- }
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/ChangeLog b/jdk/src/share/native/java/util/zip/zlib-1.2.3/ChangeLog
deleted file mode 100644
index 7f6869d..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/ChangeLog
+++ /dev/null
@@ -1,855 +0,0 @@
-
- ChangeLog file for zlib
-
-Changes in 1.2.3 (18 July 2005)
-- Apply security vulnerability fixes to contrib/infback9 as well
-- Clean up some text files (carriage returns, trailing space)
-- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
-
-Changes in 1.2.2.4 (11 July 2005)
-- Add inflatePrime() function for starting inflation at bit boundary
-- Avoid some Visual C warnings in deflate.c
-- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit
- compile
-- Fix some spelling errors in comments [Betts]
-- Correct inflateInit2() error return documentation in zlib.h
-- Added zran.c example of compressed data random access to examples
- directory, shows use of inflatePrime()
-- Fix cast for assignments to strm->state in inflate.c and infback.c
-- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
-- Move declarations of gf2 functions to right place in crc32.c [Oberhumer]
-- Add cast in trees.c t avoid a warning [Oberhumer]
-- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer]
-- Update make_vms.com [Zinser]
-- Initialize state->write in inflateReset() since copied in inflate_fast()
-- Be more strict on incomplete code sets in inflate_table() and increase
- ENOUGH and MAXD -- this repairs a possible security vulnerability for
- invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
- discovering the vulnerability and providing test cases.
-- Add ia64 support to configure for HP-UX [Smith]
-- Add error return to gzread() for format or i/o error [Levin]
-- Use malloc.h for OS/2 [Necasek]
-
-Changes in 1.2.2.3 (27 May 2005)
-- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile
-- Typecast fread() return values in gzio.c [Vollant]
-- Remove trailing space in minigzip.c outmode (VC++ can't deal with it)
-- Fix crc check bug in gzread() after gzungetc() [Heiner]
-- Add the deflateTune() function to adjust internal compression parameters
-- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack)
-- Remove an incorrect assertion in examples/zpipe.c
-- Add C++ wrapper in infback9.h [Donais]
-- Fix bug in inflateCopy() when decoding fixed codes
-- Note in zlib.h how much deflateSetDictionary() actually uses
-- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used)
-- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer]
-- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer]
-- Add gzdirect() function to indicate transparent reads
-- Update contrib/minizip [Vollant]
-- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer]
-- Add casts in crc32.c to avoid warnings [Oberhumer]
-- Add contrib/masmx64 [Vollant]
-- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant]
-
-Changes in 1.2.2.2 (30 December 2004)
-- Replace structure assignments in deflate.c and inflate.c with zmemcpy to
- avoid implicit memcpy calls (portability for no-library compilation)
-- Increase sprintf() buffer size in gzdopen() to allow for large numbers
-- Add INFLATE_STRICT to check distances against zlib header
-- Improve WinCE errno handling and comments [Chang]
-- Remove comment about no gzip header processing in FAQ
-- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
-- Add updated make_vms.com [Coghlan], update README
-- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
- fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html.
-- Add FAQ entry and comments in deflate.c on uninitialized memory access
-- Add Solaris 9 make options in configure [Gilbert]
-- Allow strerror() usage in gzio.c for STDC
-- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer]
-- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant]
-- Use z_off_t for adler32_combine() and crc32_combine() lengths
-- Make adler32() much faster for small len
-- Use OS_CODE in deflate() default gzip header
-
-Changes in 1.2.2.1 (31 October 2004)
-- Allow inflateSetDictionary() call for raw inflate
-- Fix inflate header crc check bug for file names and comments
-- Add deflateSetHeader() and gz_header structure for custom gzip headers
-- Add inflateGetheader() to retrieve gzip headers
-- Add crc32_combine() and adler32_combine() functions
-- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list
-- Use zstreamp consistently in zlib.h (inflate_back functions)
-- Remove GUNZIP condition from definition of inflate_mode in inflate.h
- and in contrib/inflate86/inffast.S [Truta, Anderson]
-- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson]
-- Update projects/README.projects and projects/visualc6 [Truta]
-- Update win32/DLL_FAQ.txt [Truta]
-- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta]
-- Deprecate Z_ASCII; use Z_TEXT instead [Truta]
-- Use a new algorithm for setting strm->data_type in trees.c [Truta]
-- Do not define an exit() prototype in zutil.c unless DEBUG defined
-- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta]
-- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate()
-- Fix Darwin build version identification [Peterson]
-
-Changes in 1.2.2 (3 October 2004)
-- Update zlib.h comments on gzip in-memory processing
-- Set adler to 1 in inflateReset() to support Java test suite [Walles]
-- Add contrib/dotzlib [Ravn]
-- Update win32/DLL_FAQ.txt [Truta]
-- Update contrib/minizip [Vollant]
-- Move contrib/visual-basic.txt to old/ [Truta]
-- Fix assembler builds in projects/visualc6/ [Truta]
-
-Changes in 1.2.1.2 (9 September 2004)
-- Update INDEX file
-- Fix trees.c to update strm->data_type (no one ever noticed!)
-- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
-- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
-- Add limited multitasking protection to DYNAMIC_CRC_TABLE
-- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
-- Don't declare strerror() under VMS [Mozilla]
-- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
-- Update contrib/ada [Anisimkov]
-- Update contrib/minizip [Vollant]
-- Fix configure to not hardcode directories for Darwin [Peterson]
-- Fix gzio.c to not return error on empty files [Brown]
-- Fix indentation; update version in contrib/delphi/ZLib.pas and
- contrib/pascal/zlibpas.pas [Truta]
-- Update mkasm.bat in contrib/masmx86 [Truta]
-- Update contrib/untgz [Truta]
-- Add projects/README.projects [Truta]
-- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
-- Update win32/DLL_FAQ.txt [Truta]
-- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
-- Remove an unnecessary assignment to curr in inftrees.c [Truta]
-- Add OS/2 to exe builds in configure [Poltorak]
-- Remove err dummy parameter in zlib.h [Kientzle]
-
-Changes in 1.2.1.1 (9 January 2004)
-- Update email address in README
-- Several FAQ updates
-- Fix a big fat bug in inftrees.c that prevented decoding valid
- dynamic blocks with only literals and no distance codes --
- Thanks to "Hot Emu" for the bug report and sample file
-- Add a note to puff.c on no distance codes case.
-
-Changes in 1.2.1 (17 November 2003)
-- Remove a tab in contrib/gzappend/gzappend.c
-- Update some interfaces in contrib for new zlib functions
-- Update zlib version number in some contrib entries
-- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta]
-- Support shared libraries on Hurd and KFreeBSD [Brown]
-- Fix error in NO_DIVIDE option of adler32.c
-
-Changes in 1.2.0.8 (4 November 2003)
-- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas
-- Add experimental NO_DIVIDE #define in adler32.c
- - Possibly faster on some processors (let me know if it is)
-- Correct Z_BLOCK to not return on first inflate call if no wrap
-- Fix strm->data_type on inflate() return to correctly indicate EOB
-- Add deflatePrime() function for appending in the middle of a byte
-- Add contrib/gzappend for an example of appending to a stream
-- Update win32/DLL_FAQ.txt [Truta]
-- Delete Turbo C comment in README [Truta]
-- Improve some indentation in zconf.h [Truta]
-- Fix infinite loop on bad input in configure script [Church]
-- Fix gzeof() for concatenated gzip files [Johnson]
-- Add example to contrib/visual-basic.txt [Michael B.]
-- Add -p to mkdir's in Makefile.in [vda]
-- Fix configure to properly detect presence or lack of printf functions
-- Add AS400 support [Monnerat]
-- Add a little Cygwin support [Wilson]
-
-Changes in 1.2.0.7 (21 September 2003)
-- Correct some debug formats in contrib/infback9
-- Cast a type in a debug statement in trees.c
-- Change search and replace delimiter in configure from % to # [Beebe]
-- Update contrib/untgz to 0.2 with various fixes [Truta]
-- Add build support for Amiga [Nikl]
-- Remove some directories in old that have been updated to 1.2
-- Add dylib building for Mac OS X in configure and Makefile.in
-- Remove old distribution stuff from Makefile
-- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X
-- Update links in README
-
-Changes in 1.2.0.6 (13 September 2003)
-- Minor FAQ updates
-- Update contrib/minizip to 1.00 [Vollant]
-- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
-- Update POSTINC comment for 68060 [Nikl]
-- Add contrib/infback9 with deflate64 decoding (unsupported)
-- For MVS define NO_vsnprintf and undefine FAR [van Burik]
-- Add pragma for fdopen on MVS [van Burik]
-
-Changes in 1.2.0.5 (8 September 2003)
-- Add OF to inflateBackEnd() declaration in zlib.h
-- Remember start when using gzdopen in the middle of a file
-- Use internal off_t counters in gz* functions to properly handle seeks
-- Perform more rigorous check for distance-too-far in inffast.c
-- Add Z_BLOCK flush option to return from inflate at block boundary
-- Set strm->data_type on return from inflate
- - Indicate bits unused, if at block boundary, and if in last block
-- Replace size_t with ptrdiff_t in crc32.c, and check for correct size
-- Add condition so old NO_DEFLATE define still works for compatibility
-- FAQ update regarding the Windows DLL [Truta]
-- INDEX update: add qnx entry, remove aix entry [Truta]
-- Install zlib.3 into mandir [Wilson]
-- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta]
-- Adapt the zlib interface to the new DLL convention guidelines [Truta]
-- Introduce ZLIB_WINAPI macro to allow the export of functions using
- the WINAPI calling convention, for Visual Basic [Vollant, Truta]
-- Update msdos and win32 scripts and makefiles [Truta]
-- Export symbols by name, not by ordinal, in win32/zlib.def [Truta]
-- Add contrib/ada [Anisimkov]
-- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta]
-- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant]
-- Add contrib/masm686 [Truta]
-- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm
- [Truta, Vollant]
-- Update contrib/delphi; rename to contrib/pascal; add example [Truta]
-- Remove contrib/delphi2; add a new contrib/delphi [Truta]
-- Avoid inclusion of the nonstandard <memory.h> in contrib/iostream,
- and fix some method prototypes [Truta]
-- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip
- [Truta]
-- Avoid the use of backslash (\) in contrib/minizip [Vollant]
-- Fix file time handling in contrib/untgz; update makefiles [Truta]
-- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines
- [Vollant]
-- Remove contrib/vstudio/vc15_16 [Vollant]
-- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta]
-- Update README.contrib [Truta]
-- Invert the assignment order of match_head and s->prev[...] in
- INSERT_STRING [Truta]
-- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings
- [Truta]
-- Compare function pointers with 0, not with NULL or Z_NULL [Truta]
-- Fix prototype of syncsearch in inflate.c [Truta]
-- Introduce ASMINF macro to be enabled when using an ASM implementation
- of inflate_fast [Truta]
-- Change NO_DEFLATE to NO_GZCOMPRESS [Truta]
-- Modify test_gzio in example.c to take a single file name as a
- parameter [Truta]
-- Exit the example.c program if gzopen fails [Truta]
-- Add type casts around strlen in example.c [Truta]
-- Remove casting to sizeof in minigzip.c; give a proper type
- to the variable compared with SUFFIX_LEN [Truta]
-- Update definitions of STDC and STDC99 in zconf.h [Truta]
-- Synchronize zconf.h with the new Windows DLL interface [Truta]
-- Use SYS16BIT instead of __32BIT__ to distinguish between
- 16- and 32-bit platforms [Truta]
-- Use far memory allocators in small 16-bit memory models for
- Turbo C [Truta]
-- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in
- zlibCompileFlags [Truta]
-- Cygwin has vsnprintf [Wilson]
-- In Windows16, OS_CODE is 0, as in MSDOS [Truta]
-- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson]
-
-Changes in 1.2.0.4 (10 August 2003)
-- Minor FAQ updates
-- Be more strict when checking inflateInit2's windowBits parameter
-- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
-- Add gzip wrapper option to deflateInit2 using windowBits
-- Add updated QNX rule in configure and qnx directory [Bonnefoy]
-- Make inflate distance-too-far checks more rigorous
-- Clean up FAR usage in inflate
-- Add casting to sizeof() in gzio.c and minigzip.c
-
-Changes in 1.2.0.3 (19 July 2003)
-- Fix silly error in gzungetc() implementation [Vollant]
-- Update contrib/minizip and contrib/vstudio [Vollant]
-- Fix printf format in example.c
-- Correct cdecl support in zconf.in.h [Anisimkov]
-- Minor FAQ updates
-
-Changes in 1.2.0.2 (13 July 2003)
-- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
-- Attempt to avoid warnings in crc32.c for pointer-int conversion
-- Add AIX to configure, remove aix directory [Bakker]
-- Add some casts to minigzip.c
-- Improve checking after insecure sprintf() or vsprintf() calls
-- Remove #elif's from crc32.c
-- Change leave label to inf_leave in inflate.c and infback.c to avoid
- library conflicts
-- Remove inflate gzip decoding by default--only enable gzip decoding by
- special request for stricter backward compatibility
-- Add zlibCompileFlags() function to return compilation information
-- More typecasting in deflate.c to avoid warnings
-- Remove leading underscore from _Capital #defines [Truta]
-- Fix configure to link shared library when testing
-- Add some Windows CE target adjustments [Mai]
-- Remove #define ZLIB_DLL in zconf.h [Vollant]
-- Add zlib.3 [Rodgers]
-- Update RFC URL in deflate.c and algorithm.txt [Mai]
-- Add zlib_dll_FAQ.txt to contrib [Truta]
-- Add UL to some constants [Truta]
-- Update minizip and vstudio [Vollant]
-- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h
-- Expand use of NO_DUMMY_DECL to avoid all dummy structures
-- Added iostream3 to contrib [Schwardt]
-- Replace rewind() with fseek() for WinCE [Truta]
-- Improve setting of zlib format compression level flags
- - Report 0 for huffman and rle strategies and for level == 0 or 1
- - Report 2 only for level == 6
-- Only deal with 64K limit when necessary at compile time [Truta]
-- Allow TOO_FAR check to be turned off at compile time [Truta]
-- Add gzclearerr() function [Souza]
-- Add gzungetc() function
-
-Changes in 1.2.0.1 (17 March 2003)
-- Add Z_RLE strategy for run-length encoding [Truta]
- - When Z_RLE requested, restrict matches to distance one
- - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE
-- Correct FASTEST compilation to allow level == 0
-- Clean up what gets compiled for FASTEST
-- Incorporate changes to zconf.in.h [Vollant]
- - Refine detection of Turbo C need for dummy returns
- - Refine ZLIB_DLL compilation
- - Include additional header file on VMS for off_t typedef
-- Try to use _vsnprintf where it supplants vsprintf [Vollant]
-- Add some casts in inffast.c
-- Enchance comments in zlib.h on what happens if gzprintf() tries to
- write more than 4095 bytes before compression
-- Remove unused state from inflateBackEnd()
-- Remove exit(0) from minigzip.c, example.c
-- Get rid of all those darn tabs
-- Add "check" target to Makefile.in that does the same thing as "test"
-- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in
-- Update contrib/inflate86 [Anderson]
-- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant]
-- Add msdos and win32 directories with makefiles [Truta]
-- More additions and improvements to the FAQ
-
-Changes in 1.2.0 (9 March 2003)
-- New and improved inflate code
- - About 20% faster
- - Does not allocate 32K window unless and until needed
- - Automatically detects and decompresses gzip streams
- - Raw inflate no longer needs an extra dummy byte at end
- - Added inflateBack functions using a callback interface--even faster
- than inflate, useful for file utilities (gzip, zip)
- - Added inflateCopy() function to record state for random access on
- externally generated deflate streams (e.g. in gzip files)
- - More readable code (I hope)
-- New and improved crc32()
- - About 50% faster, thanks to suggestions from Rodney Brown
-- Add deflateBound() and compressBound() functions
-- Fix memory leak in deflateInit2()
-- Permit setting dictionary for raw deflate (for parallel deflate)
-- Fix const declaration for gzwrite()
-- Check for some malloc() failures in gzio.c
-- Fix bug in gzopen() on single-byte file 0x1f
-- Fix bug in gzread() on concatenated file with 0x1f at end of buffer
- and next buffer doesn't start with 0x8b
-- Fix uncompress() to return Z_DATA_ERROR on truncated input
-- Free memory at end of example.c
-- Remove MAX #define in trees.c (conflicted with some libraries)
-- Fix static const's in deflate.c, gzio.c, and zutil.[ch]
-- Declare malloc() and free() in gzio.c if STDC not defined
-- Use malloc() instead of calloc() in zutil.c if int big enough
-- Define STDC for AIX
-- Add aix/ with approach for compiling shared library on AIX
-- Add HP-UX support for shared libraries in configure
-- Add OpenUNIX support for shared libraries in configure
-- Use $cc instead of gcc to build shared library
-- Make prefix directory if needed when installing
-- Correct Macintosh avoidance of typedef Byte in zconf.h
-- Correct Turbo C memory allocation when under Linux
-- Use libz.a instead of -lz in Makefile (assure use of compiled library)
-- Update configure to check for snprintf or vsnprintf functions and their
- return value, warn during make if using an insecure function
-- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that
- is lost when library is used--resolution is to build new zconf.h
-- Documentation improvements (in zlib.h):
- - Document raw deflate and inflate
- - Update RFCs URL
- - Point out that zlib and gzip formats are different
- - Note that Z_BUF_ERROR is not fatal
- - Document string limit for gzprintf() and possible buffer overflow
- - Note requirement on avail_out when flushing
- - Note permitted values of flush parameter of inflate()
-- Add some FAQs (and even answers) to the FAQ
-- Add contrib/inflate86/ for x86 faster inflate
-- Add contrib/blast/ for PKWare Data Compression Library decompression
-- Add contrib/puff/ simple inflate for deflate format description
-
-Changes in 1.1.4 (11 March 2002)
-- ZFREE was repeated on same allocation on some error conditions.
- This creates a security problem described in
- http://www.zlib.org/advisory-2002-03-11.txt
-- Returned incorrect error (Z_MEM_ERROR) on some invalid data
-- Avoid accesses before window for invalid distances with inflate window
- less than 32K.
-- force windowBits > 8 to avoid a bug in the encoder for a window size
- of 256 bytes. (A complete fix will be available in 1.1.5).
-
-Changes in 1.1.3 (9 July 1998)
-- fix "an inflate input buffer bug that shows up on rare but persistent
- occasions" (Mark)
-- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
-- fix gzseek(..., SEEK_SET) in write mode
-- fix crc check after a gzeek (Frank Faubert)
-- fix miniunzip when the last entry in a zip file is itself a zip file
- (J Lillge)
-- add contrib/asm586 and contrib/asm686 (Brian Raiter)
- See http://www.muppetlabs.com/~breadbox/software/assembly.html
-- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
-- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
-- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
-- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
-- added a FAQ file
-
-- Support gzdopen on Mac with Metrowerks (Jason Linhart)
-- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
-- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
-- avoid some warnings with Borland C (Tom Tanner)
-- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
-- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant)
-- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
-- use libdir and includedir in Makefile.in (Tim Mooney)
-- support shared libraries on OSF1 V4 (Tim Mooney)
-- remove so_locations in "make clean" (Tim Mooney)
-- fix maketree.c compilation error (Glenn, Mark)
-- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
-- new Makefile.riscos (Rich Walker)
-- initialize static descriptors in trees.c for embedded targets (Nick Smith)
-- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
-- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
-- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
-- fix maketree.c to allow clean compilation of inffixed.h (Mark)
-- fix parameter check in deflateCopy (Gunther Nikl)
-- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
-- Many portability patches by Christian Spieler:
- . zutil.c, zutil.h: added "const" for zmem*
- . Make_vms.com: fixed some typos
- . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
- . msdos/Makefile.msc: remove "default rtl link library" info from obj files
- . msdos/Makefile.*: use model-dependent name for the built zlib library
- . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
- new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
-- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
-- replace __far with _far for better portability (Christian Spieler, Tom Lane)
-- fix test for errno.h in configure (Tim Newsham)
-
-Changes in 1.1.2 (19 March 98)
-- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
- See http://www.winimage.com/zLibDll/unzip.html
-- preinitialize the inflate tables for fixed codes, to make the code
- completely thread safe (Mark)
-- some simplifications and slight speed-up to the inflate code (Mark)
-- fix gzeof on non-compressed files (Allan Schrum)
-- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
-- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
-- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
-- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
-- do not wrap extern "C" around system includes (Tom Lane)
-- mention zlib binding for TCL in README (Andreas Kupries)
-- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
-- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
-- allow "configure --prefix $HOME" (Tim Mooney)
-- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
-- move Makefile.sas to amiga/Makefile.sas
-
-Changes in 1.1.1 (27 Feb 98)
-- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson)
-- remove block truncation heuristic which had very marginal effect for zlib
- (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
- compression ratio on some files. This also allows inlining _tr_tally for
- matches in deflate_slow.
-- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
-
-Changes in 1.1.0 (24 Feb 98)
-- do not return STREAM_END prematurely in inflate (John Bowler)
-- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
-- compile with -DFASTEST to get compression code optimized for speed only
-- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
-- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
- on Sun but significant on HP)
-
-- add a pointer to experimental unzip library in README (Gilles Vollant)
-- initialize variable gcc in configure (Chris Herborth)
-
-Changes in 1.0.9 (17 Feb 1998)
-- added gzputs and gzgets functions
-- do not clear eof flag in gzseek (Mark Diekhans)
-- fix gzseek for files in transparent mode (Mark Diekhans)
-- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
-- replace EXPORT with ZEXPORT to avoid conflict with other programs
-- added compress2 in zconf.h, zlib.def, zlib.dnt
-- new asm code from Gilles Vollant in contrib/asm386
-- simplify the inflate code (Mark):
- . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
- . ZALLOC the length list in inflate_trees_fixed() instead of using stack
- . ZALLOC the value area for huft_build() instead of using stack
- . Simplify Z_FINISH check in inflate()
-
-- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
-- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
-- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
- the declaration of FAR (Gilles VOllant)
-- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
-- read_buf buf parameter of type Bytef* instead of charf*
-- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
-- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
-- fix check for presence of directories in "make install" (Ian Willis)
-
-Changes in 1.0.8 (27 Jan 1998)
-- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
-- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
-- added compress2() to allow setting the compression level
-- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
-- use constant arrays for the static trees in trees.c instead of computing
- them at run time (thanks to Ken Raeburn for this suggestion). To create
- trees.h, compile with GEN_TREES_H and run "make test".
-- check return code of example in "make test" and display result
-- pass minigzip command line options to file_compress
-- simplifying code of inflateSync to avoid gcc 2.8 bug
-
-- support CC="gcc -Wall" in configure -s (QingLong)
-- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
-- fix test for shared library support to avoid compiler warnings
-- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
-- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
-- do not use fdopen for Metrowerks on Mac (Brad Pettit))
-- add checks for gzputc and gzputc in example.c
-- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
-- use const for the CRC table (Ken Raeburn)
-- fixed "make uninstall" for shared libraries
-- use Tracev instead of Trace in infblock.c
-- in example.c use correct compressed length for test_sync
-- suppress +vnocompatwarnings in configure for HPUX (not always supported)
-
-Changes in 1.0.7 (20 Jan 1998)
-- fix gzseek which was broken in write mode
-- return error for gzseek to negative absolute position
-- fix configure for Linux (Chun-Chung Chen)
-- increase stack space for MSC (Tim Wegner)
-- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
-- define EXPORTVA for gzprintf (Gilles Vollant)
-- added man page zlib.3 (Rick Rodgers)
-- for contrib/untgz, fix makedir() and improve Makefile
-
-- check gzseek in write mode in example.c
-- allocate extra buffer for seeks only if gzseek is actually called
-- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
-- add inflateSyncPoint in zconf.h
-- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
-
-Changes in 1.0.6 (19 Jan 1998)
-- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
- gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
-- Fix a deflate bug occurring only with compression level 0 (thanks to
- Andy Buckler for finding this one).
-- In minigzip, pass transparently also the first byte for .Z files.
-- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
-- check Z_FINISH in inflate (thanks to Marc Schluper)
-- Implement deflateCopy (thanks to Adam Costello)
-- make static libraries by default in configure, add --shared option.
-- move MSDOS or Windows specific files to directory msdos
-- suppress the notion of partial flush to simplify the interface
- (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
-- suppress history buffer provided by application to simplify the interface
- (this feature was not implemented anyway in 1.0.4)
-- next_in and avail_in must be initialized before calling inflateInit or
- inflateInit2
-- add EXPORT in all exported functions (for Windows DLL)
-- added Makefile.nt (thanks to Stephen Williams)
-- added the unsupported "contrib" directory:
- contrib/asm386/ by Gilles Vollant <info at winimage.com>
- 386 asm code replacing longest_match().
- contrib/iostream/ by Kevin Ruland <kevin at rodin.wustl.edu>
- A C++ I/O streams interface to the zlib gz* functions
- contrib/iostream2/ by Tyge Løvset <Tyge.Lovset at cmr.no>
- Another C++ I/O streams interface
- contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag at tid.es>
- A very simple tar.gz file extractor using zlib
- contrib/visual-basic.txt by Carlos Rios <c_rios at sonda.cl>
- How to use compress(), uncompress() and the gz* functions from VB.
-- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
- level) in minigzip (thanks to Tom Lane)
-
-- use const for rommable constants in deflate
-- added test for gzseek and gztell in example.c
-- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
-- add undocumented function zError to convert error code to string
- (for Tim Smithers)
-- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
-- Use default memcpy for Symantec MSDOS compiler.
-- Add EXPORT keyword for check_func (needed for Windows DLL)
-- add current directory to LD_LIBRARY_PATH for "make test"
-- create also a link for libz.so.1
-- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
-- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
-- added -soname for Linux in configure (Chun-Chung Chen,
-- assign numbers to the exported functions in zlib.def (for Windows DLL)
-- add advice in zlib.h for best usage of deflateSetDictionary
-- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
-- allow compilation with ANSI keywords only enabled for TurboC in large model
-- avoid "versionString"[0] (Borland bug)
-- add NEED_DUMMY_RETURN for Borland
-- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
-- allow compilation with CC
-- defined STDC for OS/2 (David Charlap)
-- limit external names to 8 chars for MVS (Thomas Lund)
-- in minigzip.c, use static buffers only for 16-bit systems
-- fix suffix check for "minigzip -d foo.gz"
-- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
-- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
-- added makelcc.bat for lcc-win32 (Tom St Denis)
-- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
-- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
-- check for unistd.h in configure (for off_t)
-- remove useless check parameter in inflate_blocks_free
-- avoid useless assignment of s->check to itself in inflate_blocks_new
-- do not flush twice in gzclose (thanks to Ken Raeburn)
-- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
-- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
-- work around buggy fclose on pipes for HP/UX
-- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
-- fix configure if CC is already equal to gcc
-
-Changes in 1.0.5 (3 Jan 98)
-- Fix inflate to terminate gracefully when fed corrupted or invalid data
-- Use const for rommable constants in inflate
-- Eliminate memory leaks on error conditions in inflate
-- Removed some vestigial code in inflate
-- Update web address in README
-
-Changes in 1.0.4 (24 Jul 96)
-- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
- bit, so the decompressor could decompress all the correct data but went
- on to attempt decompressing extra garbage data. This affected minigzip too.
-- zlibVersion and gzerror return const char* (needed for DLL)
-- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
-- use z_error only for DEBUG (avoid problem with DLLs)
-
-Changes in 1.0.3 (2 Jul 96)
-- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
- small and medium models; this makes the library incompatible with previous
- versions for these models. (No effect in large model or on other systems.)
-- return OK instead of BUF_ERROR if previous deflate call returned with
- avail_out as zero but there is nothing to do
-- added memcmp for non STDC compilers
-- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
-- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
-- better check for 16-bit mode MSC (avoids problem with Symantec)
-
-Changes in 1.0.2 (23 May 96)
-- added Windows DLL support
-- added a function zlibVersion (for the DLL support)
-- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
-- Bytef is define's instead of typedef'd only for Borland C
-- avoid reading uninitialized memory in example.c
-- mention in README that the zlib format is now RFC1950
-- updated Makefile.dj2
-- added algorithm.doc
-
-Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
-- fix array overlay in deflate.c which sometimes caused bad compressed data
-- fix inflate bug with empty stored block
-- fix MSDOS medium model which was broken in 0.99
-- fix deflateParams() which could generated bad compressed data.
-- Bytef is define'd instead of typedef'ed (work around Borland bug)
-- added an INDEX file
-- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
- Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
-- speed up adler32 for modern machines without auto-increment
-- added -ansi for IRIX in configure
-- static_init_done in trees.c is an int
-- define unlink as delete for VMS
-- fix configure for QNX
-- add configure branch for SCO and HPUX
-- avoid many warnings (unused variables, dead assignments, etc...)
-- no fdopen for BeOS
-- fix the Watcom fix for 32 bit mode (define FAR as empty)
-- removed redefinition of Byte for MKWERKS
-- work around an MWKERKS bug (incorrect merge of all .h files)
-
-Changes in 0.99 (27 Jan 96)
-- allow preset dictionary shared between compressor and decompressor
-- allow compression level 0 (no compression)
-- add deflateParams in zlib.h: allow dynamic change of compression level
- and compression strategy.
-- test large buffers and deflateParams in example.c
-- add optional "configure" to build zlib as a shared library
-- suppress Makefile.qnx, use configure instead
-- fixed deflate for 64-bit systems (detected on Cray)
-- fixed inflate_blocks for 64-bit systems (detected on Alpha)
-- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
-- always return Z_BUF_ERROR when deflate() has nothing to do
-- deflateInit and inflateInit are now macros to allow version checking
-- prefix all global functions and types with z_ with -DZ_PREFIX
-- make falloc completely reentrant (inftrees.c)
-- fixed very unlikely race condition in ct_static_init
-- free in reverse order of allocation to help memory manager
-- use zlib-1.0/* instead of zlib/* inside the tar.gz
-- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
- -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
-- allow gzread on concatenated .gz files
-- deflateEnd now returns Z_DATA_ERROR if it was premature
-- deflate is finally (?) fully deterministic (no matches beyond end of input)
-- Document Z_SYNC_FLUSH
-- add uninstall in Makefile
-- Check for __cpluplus in zlib.h
-- Better test in ct_align for partial flush
-- avoid harmless warnings for Borland C++
-- initialize hash_head in deflate.c
-- avoid warning on fdopen (gzio.c) for HP cc -Aa
-- include stdlib.h for STDC compilers
-- include errno.h for Cray
-- ignore error if ranlib doesn't exist
-- call ranlib twice for NeXTSTEP
-- use exec_prefix instead of prefix for libz.a
-- renamed ct_* as _tr_* to avoid conflict with applications
-- clear z->msg in inflateInit2 before any error return
-- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
-- fixed typo in zconf.h (_GNUC__ => __GNUC__)
-- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
-- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
-- in fcalloc, normalize pointer if size > 65520 bytes
-- don't use special fcalloc for 32 bit Borland C++
-- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
-- use Z_BINARY instead of BINARY
-- document that gzclose after gzdopen will close the file
-- allow "a" as mode in gzopen.
-- fix error checking in gzread
-- allow skipping .gz extra-field on pipes
-- added reference to Perl interface in README
-- put the crc table in FAR data (I dislike more and more the medium model :)
-- added get_crc_table
-- added a dimension to all arrays (Borland C can't count).
-- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
-- guard against multiple inclusion of *.h (for precompiled header on Mac)
-- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
-- don't use unsized arrays to avoid silly warnings by Visual C++:
- warning C4746: 'inflate_mask' : unsized array treated as '__far'
- (what's wrong with far data in far model?).
-- define enum out of inflate_blocks_state to allow compilation with C++
-
-Changes in 0.95 (16 Aug 95)
-- fix MSDOS small and medium model (now easier to adapt to any compiler)
-- inlined send_bits
-- fix the final (:-) bug for deflate with flush (output was correct but
- not completely flushed in rare occasions).
-- default window size is same for compression and decompression
- (it's now sufficient to set MAX_WBITS in zconf.h).
-- voidp -> voidpf and voidnp -> voidp (for consistency with other
- typedefs and because voidnp was not near in large model).
-
-Changes in 0.94 (13 Aug 95)
-- support MSDOS medium model
-- fix deflate with flush (could sometimes generate bad output)
-- fix deflateReset (zlib header was incorrectly suppressed)
-- added support for VMS
-- allow a compression level in gzopen()
-- gzflush now calls fflush
-- For deflate with flush, flush even if no more input is provided.
-- rename libgz.a as libz.a
-- avoid complex expression in infcodes.c triggering Turbo C bug
-- work around a problem with gcc on Alpha (in INSERT_STRING)
-- don't use inline functions (problem with some gcc versions)
-- allow renaming of Byte, uInt, etc... with #define.
-- avoid warning about (unused) pointer before start of array in deflate.c
-- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
-- avoid reserved word 'new' in trees.c
-
-Changes in 0.93 (25 June 95)
-- temporarily disable inline functions
-- make deflate deterministic
-- give enough lookahead for PARTIAL_FLUSH
-- Set binary mode for stdin/stdout in minigzip.c for OS/2
-- don't even use signed char in inflate (not portable enough)
-- fix inflate memory leak for segmented architectures
-
-Changes in 0.92 (3 May 95)
-- don't assume that char is signed (problem on SGI)
-- Clear bit buffer when starting a stored block
-- no memcpy on Pyramid
-- suppressed inftest.c
-- optimized fill_window, put longest_match inline for gcc
-- optimized inflate on stored blocks.
-- untabify all sources to simplify patches
-
-Changes in 0.91 (2 May 95)
-- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
-- Document the memory requirements in zconf.h
-- added "make install"
-- fix sync search logic in inflateSync
-- deflate(Z_FULL_FLUSH) now works even if output buffer too short
-- after inflateSync, don't scare people with just "lo world"
-- added support for DJGPP
-
-Changes in 0.9 (1 May 95)
-- don't assume that zalloc clears the allocated memory (the TurboC bug
- was Mark's bug after all :)
-- let again gzread copy uncompressed data unchanged (was working in 0.71)
-- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
-- added a test of inflateSync in example.c
-- moved MAX_WBITS to zconf.h because users might want to change that.
-- document explicitly that zalloc(64K) on MSDOS must return a normalized
- pointer (zero offset)
-- added Makefiles for Microsoft C, Turbo C, Borland C++
-- faster crc32()
-
-Changes in 0.8 (29 April 95)
-- added fast inflate (inffast.c)
-- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
- is incompatible with previous versions of zlib which returned Z_OK.
-- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
- (actually that was not a compiler bug, see 0.81 above)
-- gzread no longer reads one extra byte in certain cases
-- In gzio destroy(), don't reference a freed structure
-- avoid many warnings for MSDOS
-- avoid the ERROR symbol which is used by MS Windows
-
-Changes in 0.71 (14 April 95)
-- Fixed more MSDOS compilation problems :( There is still a bug with
- TurboC large model.
-
-Changes in 0.7 (14 April 95)
-- Added full inflate support.
-- Simplified the crc32() interface. The pre- and post-conditioning
- (one's complement) is now done inside crc32(). WARNING: this is
- incompatible with previous versions; see zlib.h for the new usage.
-
-Changes in 0.61 (12 April 95)
-- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
-
-Changes in 0.6 (11 April 95)
-- added minigzip.c
-- added gzdopen to reopen a file descriptor as gzFile
-- added transparent reading of non-gziped files in gzread.
-- fixed bug in gzread (don't read crc as data)
-- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
-- don't allocate big arrays in the stack (for MSDOS)
-- fix some MSDOS compilation problems
-
-Changes in 0.5:
-- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
- not yet Z_FULL_FLUSH.
-- support decompression but only in a single step (forced Z_FINISH)
-- added opaque object for zalloc and zfree.
-- added deflateReset and inflateReset
-- added a variable zlib_version for consistency checking.
-- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
- Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
-
-Changes in 0.4:
-- avoid "zip" everywhere, use zlib instead of ziplib.
-- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
- if compression method == 8.
-- added adler32 and crc32
-- renamed deflateOptions as deflateInit2, call one or the other but not both
-- added the method parameter for deflateInit2.
-- added inflateInit2
-- simplied considerably deflateInit and inflateInit by not supporting
- user-provided history buffer. This is supported only in deflateInit2
- and inflateInit2.
-
-Changes in 0.3:
-- prefix all macro names with Z_
-- use Z_FINISH instead of deflateEnd to finish compression.
-- added Z_HUFFMAN_ONLY
-- added gzerror()
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/README b/jdk/src/share/native/java/util/zip/zlib-1.2.3/README
deleted file mode 100644
index 758cc50..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/README
+++ /dev/null
@@ -1,125 +0,0 @@
-ZLIB DATA COMPRESSION LIBRARY
-
-zlib 1.2.3 is a general purpose data compression library. All the code is
-thread safe. The data format used by the zlib library is described by RFCs
-(Request for Comments) 1950 to 1952 in the files
-http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
-and rfc1952.txt (gzip format). These documents are also available in other
-formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
-
-All functions of the compression library are documented in the file zlib.h
-(volunteer to write man pages welcome, contact zlib at gzip.org). A usage example
-of the library is given in the file example.c which also tests that the library
-is working correctly. Another example is given in the file minigzip.c. The
-compression library itself is composed of all source files except example.c and
-minigzip.c.
-
-To compile all files and run the test program, follow the instructions given at
-the top of Makefile. In short "make test; make install" should work for most
-machines. For Unix: "./configure; make test; make install". For MSDOS, use one
-of the special makefiles such as Makefile.msc. For VMS, use make_vms.com.
-
-Questions about zlib should be sent to <zlib at gzip.org>, or to Gilles Vollant
-<info at winimage.com> for the Windows DLL version. The zlib home page is
-http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem,
-please check this site to verify that you have the latest version of zlib;
-otherwise get the latest version and check whether the problem still exists or
-not.
-
-PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking
-for help.
-
-Mark Nelson <markn at ieee.org> wrote an article about zlib for the Jan. 1997
-issue of Dr. Dobb's Journal; a copy of the article is available in
-http://dogma.net/markn/articles/zlibtool/zlibtool.htm
-
-The changes made in version 1.2.3 are documented in the file ChangeLog.
-
-Unsupported third party contributions are provided in directory "contrib".
-
-A Java implementation of zlib is available in the Java Development Kit
-http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html
-See the zlib home page http://www.zlib.org for details.
-
-A Perl interface to zlib written by Paul Marquess <pmqs at cpan.org> is in the
-CPAN (Comprehensive Perl Archive Network) sites
-http://www.cpan.org/modules/by-module/Compress/
-
-A Python interface to zlib written by A.M. Kuchling <amk at amk.ca> is
-available in Python 1.5 and later versions, see
-http://www.python.org/doc/lib/module-zlib.html
-
-A zlib binding for TCL written by Andreas Kupries <a.kupries at westend.com> is
-availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
-
-An experimental package to read and write files in .zip format, written on top
-of zlib by Gilles Vollant <info at winimage.com>, is available in the
-contrib/minizip directory of zlib.
-
-
-Notes for some targets:
-
-- For Windows DLL versions, please see win32/DLL_FAQ.txt
-
-- For 64-bit Irix, deflate.c must be compiled without any optimization. With
- -O, one libpng test fails. The test works in 32 bit mode (with the -n32
- compiler flag). The compiler bug has been reported to SGI.
-
-- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
- when compiled with cc.
-
-- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
- necessary to get gzprintf working correctly. This is done by configure.
-
-- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
- other compilers. Use "make test" to check your compiler.
-
-- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
-
-- For PalmOs, see http://palmzlib.sourceforge.net/
-
-- When building a shared, i.e. dynamic library on Mac OS X, the library must be
- installed before testing (do "make install" before "make test"), since the
- library location is specified in the library.
-
-
-Acknowledgments:
-
- The deflate format used by zlib was defined by Phil Katz. The deflate
- and zlib specifications were written by L. Peter Deutsch. Thanks to all the
- people who reported problems and suggested various improvements in zlib;
- they are too numerous to cite here.
-
-Copyright notice:
-
- (C) 1995-2004 Jean-loup Gailly and Mark Adler
-
- 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.
-
- Jean-loup Gailly Mark Adler
- jloup at gzip.org madler at alumni.caltech.edu
-
-If you use the zlib library in a product, we would appreciate *not*
-receiving lengthy legal documents to sign. The sources are provided
-for free but without warranty of any kind. The library has been
-entirely written by Jean-loup Gailly and Mark Adler; it does not
-include third-party code.
-
-If you redistribute modified sources, we would appreciate that you include
-in the file ChangeLog history information documenting your changes. Please
-read the FAQ for more information on the distribution of modified source
-versions.
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/compress.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/compress.c
deleted file mode 100644
index 5866998..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/compress.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* compress.c -- compress a memory buffer
- * Copyright (C) 1995-2003 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-/* ===========================================================================
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least 0.1% larger than sourceLen plus
- 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
- int level;
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
-#ifdef MAXSEG_64K
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-#endif
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
- stream.opaque = (voidpf)0;
-
- err = deflateInit(&stream, level);
- if (err != Z_OK) return err;
-
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- deflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = (uLong)stream.total_out;
-
- err = deflateEnd(&stream);
- return err;
-}
-
-/* ===========================================================================
- */
-int ZEXPORT compress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
- return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
-}
-
-/* ===========================================================================
- If the default memLevel or windowBits for deflateInit() is changed, then
- this function needs to be updated.
- */
-uLong ZEXPORT compressBound (sourceLen)
- uLong sourceLen;
-{
- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/crc32.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/crc32.h
deleted file mode 100644
index 2383bdc..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/crc32.h
+++ /dev/null
@@ -1,465 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* crc32.h -- tables for rapid CRC calculation
- * Generated automatically by crc32.c
- */
-
-local const unsigned long FAR crc_table[TBLS][256] =
-{
- {
- 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
- 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
- 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
- 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
- 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
- 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
- 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
- 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
- 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
- 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
- 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
- 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
- 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
- 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
- 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
- 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
- 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
- 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
- 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
- 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
- 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
- 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
- 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
- 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
- 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
- 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
- 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
- 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
- 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
- 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
- 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
- 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
- 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
- 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
- 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
- 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
- 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
- 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
- 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
- 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
- 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
- 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
- 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
- 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
- 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
- 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
- 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
- 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
- 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
- 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
- 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
- 0x2d02ef8dUL
-#ifdef BYFOUR
- },
- {
- 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
- 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
- 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
- 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
- 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
- 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
- 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
- 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
- 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
- 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
- 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
- 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
- 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
- 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
- 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
- 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
- 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
- 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
- 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
- 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
- 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
- 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
- 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
- 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
- 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
- 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
- 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
- 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
- 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
- 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
- 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
- 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
- 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
- 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
- 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
- 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
- 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
- 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
- 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
- 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
- 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
- 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
- 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
- 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
- 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
- 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
- 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
- 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
- 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
- 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
- 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
- 0x9324fd72UL
- },
- {
- 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
- 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
- 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
- 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
- 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
- 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
- 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
- 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
- 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
- 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
- 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
- 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
- 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
- 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
- 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
- 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
- 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
- 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
- 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
- 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
- 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
- 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
- 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
- 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
- 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
- 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
- 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
- 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
- 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
- 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
- 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
- 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
- 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
- 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
- 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
- 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
- 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
- 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
- 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
- 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
- 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
- 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
- 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
- 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
- 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
- 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
- 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
- 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
- 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
- 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
- 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
- 0xbe9834edUL
- },
- {
- 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
- 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
- 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
- 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
- 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
- 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
- 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
- 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
- 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
- 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
- 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
- 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
- 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
- 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
- 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
- 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
- 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
- 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
- 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
- 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
- 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
- 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
- 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
- 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
- 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
- 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
- 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
- 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
- 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
- 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
- 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
- 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
- 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
- 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
- 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
- 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
- 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
- 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
- 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
- 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
- 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
- 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
- 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
- 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
- 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
- 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
- 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
- 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
- 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
- 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
- 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
- 0xde0506f1UL
- },
- {
- 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
- 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
- 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
- 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
- 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
- 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
- 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
- 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
- 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
- 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
- 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
- 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
- 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
- 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
- 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
- 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
- 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
- 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
- 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
- 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
- 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
- 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
- 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
- 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
- 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
- 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
- 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
- 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
- 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
- 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
- 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
- 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
- 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
- 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
- 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
- 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
- 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
- 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
- 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
- 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
- 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
- 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
- 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
- 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
- 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
- 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
- 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
- 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
- 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
- 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
- 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
- 0x8def022dUL
- },
- {
- 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
- 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
- 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
- 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
- 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
- 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
- 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
- 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
- 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
- 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
- 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
- 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
- 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
- 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
- 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
- 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
- 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
- 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
- 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
- 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
- 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
- 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
- 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
- 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
- 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
- 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
- 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
- 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
- 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
- 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
- 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
- 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
- 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
- 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
- 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
- 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
- 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
- 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
- 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
- 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
- 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
- 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
- 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
- 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
- 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
- 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
- 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
- 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
- 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
- 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
- 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
- 0x72fd2493UL
- },
- {
- 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
- 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
- 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
- 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
- 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
- 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
- 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
- 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
- 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
- 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
- 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
- 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
- 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
- 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
- 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
- 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
- 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
- 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
- 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
- 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
- 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
- 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
- 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
- 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
- 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
- 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
- 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
- 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
- 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
- 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
- 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
- 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
- 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
- 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
- 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
- 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
- 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
- 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
- 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
- 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
- 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
- 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
- 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
- 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
- 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
- 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
- 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
- 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
- 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
- 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
- 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
- 0xed3498beUL
- },
- {
- 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
- 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
- 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
- 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
- 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
- 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
- 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
- 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
- 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
- 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
- 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
- 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
- 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
- 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
- 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
- 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
- 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
- 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
- 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
- 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
- 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
- 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
- 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
- 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
- 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
- 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
- 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
- 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
- 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
- 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
- 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
- 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
- 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
- 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
- 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
- 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
- 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
- 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
- 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
- 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
- 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
- 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
- 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
- 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
- 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
- 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
- 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
- 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
- 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
- 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
- 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
- 0xf10605deUL
-#endif
- }
-};
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.c
deleted file mode 100644
index ba1661d..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.c
+++ /dev/null
@@ -1,1760 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * ALGORITHM
- *
- * The "deflation" process depends on being able to identify portions
- * of the input text which are identical to earlier input (within a
- * sliding window trailing behind the input currently being processed).
- *
- * The most straightforward technique turns out to be the fastest for
- * most input files: try all possible matches and select the longest.
- * The key feature of this algorithm is that insertions into the string
- * dictionary are very simple and thus fast, and deletions are avoided
- * completely. Insertions are performed at each input character, whereas
- * string matches are performed only when the previous match ends. So it
- * is preferable to spend more time in matches to allow very fast string
- * insertions and avoid deletions. The matching algorithm for small
- * strings is inspired from that of Rabin & Karp. A brute force approach
- * is used to find longer strings when a small match has been found.
- * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
- * (by Leonid Broukhis).
- * A previous version of this file used a more sophisticated algorithm
- * (by Fiala and Greene) which is guaranteed to run in linear amortized
- * time, but has a larger average cost, uses more memory and is patented.
- * However the F&G algorithm may be faster for some highly redundant
- * files if the parameter max_chain_length (described below) is too large.
- *
- * ACKNOWLEDGEMENTS
- *
- * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
- * I found it in 'freeze' written by Leonid Broukhis.
- * Thanks to many people for bug reports and testing.
- *
- * REFERENCES
- *
- * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
- * Available in http://www.ietf.org/rfc/rfc1951.txt
- *
- * A description of the Rabin and Karp algorithm is given in the book
- * "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
- *
- * Fiala,E.R., and Greene,D.H.
- * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
- *
- */
-
-/* @(#) $Id$ */
-
-#include "deflate.h"
-
-const char deflate_copyright[] =
- " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-/* ===========================================================================
- * Function prototypes.
- */
-typedef enum {
- need_more, /* block not completed, need more input or more output */
- block_done, /* block flush performed */
- finish_started, /* finish started, need only more output at next deflate */
- finish_done /* finish done, accept no more input or output */
-} block_state;
-
-typedef block_state (*compress_func) OF((deflate_state *s, int flush));
-/* Compression function. Returns the block state after the call. */
-
-local void fill_window OF((deflate_state *s));
-local block_state deflate_stored OF((deflate_state *s, int flush));
-local block_state deflate_fast OF((deflate_state *s, int flush));
-#ifndef FASTEST
-local block_state deflate_slow OF((deflate_state *s, int flush));
-#endif
-local void lm_init OF((deflate_state *s));
-local void putShortMSB OF((deflate_state *s, uInt b));
-local void flush_pending OF((z_streamp strm));
-local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
-#ifndef FASTEST
-#ifdef ASMV
- void match_init OF((void)); /* asm code initialization */
- uInt longest_match OF((deflate_state *s, IPos cur_match));
-#else
-local uInt longest_match OF((deflate_state *s, IPos cur_match));
-#endif
-#endif
-local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
-
-#ifdef DEBUG
-local void check_match OF((deflate_state *s, IPos start, IPos match,
- int length));
-#endif
-
-/* ===========================================================================
- * Local data
- */
-
-#define NIL 0
-/* Tail of hash chains */
-
-#ifndef TOO_FAR
-# define TOO_FAR 4096
-#endif
-/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
-
-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
-/* Minimum amount of lookahead, except at the end of the input file.
- * See deflate.c for comments about the MIN_MATCH+1.
- */
-
-/* Values for max_lazy_match, good_match and max_chain_length, depending on
- * the desired pack level (0..9). The values given below have been tuned to
- * exclude worst case performance for pathological files. Better values may be
- * found for specific files.
- */
-typedef struct config_s {
- ush good_length; /* reduce lazy search above this match length */
- ush max_lazy; /* do not perform lazy search above this match length */
- ush nice_length; /* quit search above this match length */
- ush max_chain;
- compress_func func;
-} config;
-
-#ifdef FASTEST
-local const config configuration_table[2] = {
-/* good lazy nice chain */
-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
-/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */
-#else
-local const config configuration_table[10] = {
-/* good lazy nice chain */
-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
-/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */
-/* 2 */ {4, 5, 16, 8, deflate_fast},
-/* 3 */ {4, 6, 32, 32, deflate_fast},
-
-/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
-/* 5 */ {8, 16, 32, 32, deflate_slow},
-/* 6 */ {8, 16, 128, 128, deflate_slow},
-/* 7 */ {8, 32, 128, 256, deflate_slow},
-/* 8 */ {32, 128, 258, 1024, deflate_slow},
-/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
-#endif
-
-/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
- * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
- * meaning.
- */
-
-#define EQUAL 0
-/* result of memcmp for equal strings */
-
-#ifndef NO_DUMMY_DECL
-struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
-#endif
-
-/* ===========================================================================
- * Update a hash value with the given input byte
- * IN assertion: all calls to to UPDATE_HASH are made with consecutive
- * input characters, so that a running hash key can be computed from the
- * previous key instead of complete recalculation each time.
- */
-#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
-
-
-/* ===========================================================================
- * Insert string str in the dictionary and set match_head to the previous head
- * of the hash chain (the most recent string with same hash key). Return
- * the previous length of the hash chain.
- * If this file is compiled with -DFASTEST, the compression level is forced
- * to 1, and no hash chains are maintained.
- * IN assertion: all calls to to INSERT_STRING are made with consecutive
- * input characters and the first MIN_MATCH bytes of str are valid
- * (except for the last MIN_MATCH-1 bytes of the input file).
- */
-#ifdef FASTEST
-#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
-#else
-#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
-#endif
-
-/* ===========================================================================
- * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
- * prev[] will be initialized on the fly.
- */
-#define CLEAR_HASH(s) \
- s->head[s->hash_size-1] = NIL; \
- zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
-
-/* ========================================================================= */
-int ZEXPORT deflateInit_(strm, level, version, stream_size)
- z_streamp strm;
- int level;
- const char *version;
- int stream_size;
-{
- return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
- Z_DEFAULT_STRATEGY, version, stream_size);
- /* To do: ignore strm->next_in if we use it as window */
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
- version, stream_size)
- z_streamp strm;
- int level;
- int method;
- int windowBits;
- int memLevel;
- int strategy;
- const char *version;
- int stream_size;
-{
- deflate_state *s;
- int wrap = 1;
- static const char my_version[] = ZLIB_VERSION;
-
- ushf *overlay;
- /* We overlay pending_buf and d_buf+l_buf. This works since the average
- * output size for (length,distance) codes is <= 24 bits.
- */
-
- if (version == Z_NULL || version[0] != my_version[0] ||
- stream_size != sizeof(z_stream)) {
- return Z_VERSION_ERROR;
- }
- if (strm == Z_NULL) return Z_STREAM_ERROR;
-
- strm->msg = Z_NULL;
- if (strm->zalloc == (alloc_func)0) {
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
- }
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
-
-#ifdef FASTEST
- if (level != 0) level = 1;
-#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
-#endif
-
- if (windowBits < 0) { /* suppress zlib wrapper */
- wrap = 0;
- windowBits = -windowBits;
- }
-#ifdef GZIP
- else if (windowBits > 15) {
- wrap = 2; /* write gzip wrapper instead */
- windowBits -= 16;
- }
-#endif
- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
- windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
- strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
- s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
- if (s == Z_NULL) return Z_MEM_ERROR;
- strm->state = (struct internal_state FAR *)s;
- s->strm = strm;
-
- s->wrap = wrap;
- s->gzhead = Z_NULL;
- s->w_bits = windowBits;
- s->w_size = 1 << s->w_bits;
- s->w_mask = s->w_size - 1;
-
- s->hash_bits = memLevel + 7;
- s->hash_size = 1 << s->hash_bits;
- s->hash_mask = s->hash_size - 1;
- s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
-
- s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
- s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
- s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
-
- s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
-
- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
- s->pending_buf = (uchf *) overlay;
- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
-
- if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
- s->pending_buf == Z_NULL) {
- s->status = FINISH_STATE;
- strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
- deflateEnd (strm);
- return Z_MEM_ERROR;
- }
- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
-
- s->level = level;
- s->strategy = strategy;
- s->method = (Byte)method;
-
- return deflateReset(strm);
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
- z_streamp strm;
- const Bytef *dictionary;
- uInt dictLength;
-{
- deflate_state *s;
- uInt length = dictLength;
- uInt n;
- IPos hash_head = 0;
-
- if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
- strm->state->wrap == 2 ||
- (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
- return Z_STREAM_ERROR;
-
- s = strm->state;
- if (s->wrap)
- strm->adler = adler32(strm->adler, dictionary, dictLength);
-
- if (length < MIN_MATCH) return Z_OK;
- if (length > MAX_DIST(s)) {
- length = MAX_DIST(s);
- dictionary += dictLength - length; /* use the tail of the dictionary */
- }
- zmemcpy(s->window, dictionary, length);
- s->strstart = length;
- s->block_start = (long)length;
-
- /* Insert all strings in the hash table (except for the last two bytes).
- * s->lookahead stays null, so s->ins_h will be recomputed at the next
- * call of fill_window.
- */
- s->ins_h = s->window[0];
- UPDATE_HASH(s, s->ins_h, s->window[1]);
- for (n = 0; n <= length - MIN_MATCH; n++) {
- INSERT_STRING(s, n, hash_head);
- }
- if (hash_head) hash_head = 0; /* to make compiler happy */
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateReset (strm)
- z_streamp strm;
-{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
- return Z_STREAM_ERROR;
- }
-
- strm->total_in = strm->total_out = 0;
- strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
- strm->data_type = Z_UNKNOWN;
-
- s = (deflate_state *)strm->state;
- s->pending = 0;
- s->pending_out = s->pending_buf;
-
- if (s->wrap < 0) {
- s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
- }
- s->status = s->wrap ? INIT_STATE : BUSY_STATE;
- strm->adler =
-#ifdef GZIP
- s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
-#endif
- adler32(0L, Z_NULL, 0);
- s->last_flush = Z_NO_FLUSH;
-
- _tr_init(s);
- lm_init(s);
-
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateSetHeader (strm, head)
- z_streamp strm;
- gz_headerp head;
-{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- if (strm->state->wrap != 2) return Z_STREAM_ERROR;
- strm->state->gzhead = head;
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflatePrime (strm, bits, value)
- z_streamp strm;
- int bits;
- int value;
-{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- strm->state->bi_valid = bits;
- strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateParams(strm, level, strategy)
- z_streamp strm;
- int level;
- int strategy;
-{
- deflate_state *s;
- compress_func func;
- int err = Z_OK;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
-
-#ifdef FASTEST
- if (level != 0) level = 1;
-#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
-#endif
- if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- func = configuration_table[s->level].func;
-
- if (func != configuration_table[level].func && strm->total_in != 0) {
- /* Flush the last buffer: */
- err = deflate(strm, Z_PARTIAL_FLUSH);
- }
- if (s->level != level) {
- s->level = level;
- s->max_lazy_match = configuration_table[level].max_lazy;
- s->good_match = configuration_table[level].good_length;
- s->nice_match = configuration_table[level].nice_length;
- s->max_chain_length = configuration_table[level].max_chain;
- }
- s->strategy = strategy;
- return err;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
- z_streamp strm;
- int good_length;
- int max_lazy;
- int nice_length;
- int max_chain;
-{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
- s->good_match = good_length;
- s->max_lazy_match = max_lazy;
- s->nice_match = nice_length;
- s->max_chain_length = max_chain;
- return Z_OK;
-}
-
-/* =========================================================================
- * For the default windowBits of 15 and memLevel of 8, this function returns
- * a close to exact, as well as small, upper bound on the compressed size.
- * They are coded as constants here for a reason--if the #define's are
- * changed, then this function needs to be changed as well. The return
- * value for 15 and 8 only works for those exact settings.
- *
- * For any setting other than those defaults for windowBits and memLevel,
- * the value returned is a conservative worst case for the maximum expansion
- * resulting from using fixed blocks instead of stored blocks, which deflate
- * can emit on compressed data for some combinations of the parameters.
- *
- * This function could be more sophisticated to provide closer upper bounds
- * for every combination of windowBits and memLevel, as well as wrap.
- * But even the conservative upper bound of about 14% expansion does not
- * seem onerous for output buffer allocation.
- */
-uLong ZEXPORT deflateBound(strm, sourceLen)
- z_streamp strm;
- uLong sourceLen;
-{
- deflate_state *s;
- uLong destLen;
-
- /* conservative upper bound */
- destLen = sourceLen +
- ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11;
-
- /* if can't get parameters, return conservative bound */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return destLen;
-
- /* if not default parameters, return conservative bound */
- s = strm->state;
- if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return destLen;
-
- /* default settings: return tight bound for that case */
- return compressBound(sourceLen);
-}
-
-/* =========================================================================
- * Put a short in the pending buffer. The 16-bit value is put in MSB order.
- * IN assertion: the stream state is correct and there is enough room in
- * pending_buf.
- */
-local void putShortMSB (s, b)
- deflate_state *s;
- uInt b;
-{
- put_byte(s, (Byte)(b >> 8));
- put_byte(s, (Byte)(b & 0xff));
-}
-
-/* =========================================================================
- * Flush as much pending output as possible. All deflate() output goes
- * through this function so some applications may wish to modify it
- * to avoid allocating a large strm->next_out buffer and copying into it.
- * (See also read_buf()).
- */
-local void flush_pending(strm)
- z_streamp strm;
-{
- unsigned len = strm->state->pending;
-
- if (len > strm->avail_out) len = strm->avail_out;
- if (len == 0) return;
-
- zmemcpy(strm->next_out, strm->state->pending_out, len);
- strm->next_out += len;
- strm->state->pending_out += len;
- strm->total_out += len;
- strm->avail_out -= len;
- strm->state->pending -= len;
- if (strm->state->pending == 0) {
- strm->state->pending_out = strm->state->pending_buf;
- }
-}
-
-/* ========================================================================= */
-int ZEXPORT deflate (strm, flush)
- z_streamp strm;
- int flush;
-{
- int old_flush; /* value of flush param for previous deflate call */
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- flush > Z_FINISH || flush < 0) {
- return Z_STREAM_ERROR;
- }
- s = strm->state;
-
- if (strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0) ||
- (s->status == FINISH_STATE && flush != Z_FINISH)) {
- ERR_RETURN(strm, Z_STREAM_ERROR);
- }
- if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
-
- s->strm = strm; /* just in case */
- old_flush = s->last_flush;
- s->last_flush = flush;
-
- /* Write the header */
- if (s->status == INIT_STATE) {
-#ifdef GZIP
- if (s->wrap == 2) {
- strm->adler = crc32(0L, Z_NULL, 0);
- put_byte(s, 31);
- put_byte(s, 139);
- put_byte(s, 8);
- if (s->gzhead == NULL) {
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, OS_CODE);
- s->status = BUSY_STATE;
- }
- else {
- put_byte(s, (s->gzhead->text ? 1 : 0) +
- (s->gzhead->hcrc ? 2 : 0) +
- (s->gzhead->extra == Z_NULL ? 0 : 4) +
- (s->gzhead->name == Z_NULL ? 0 : 8) +
- (s->gzhead->comment == Z_NULL ? 0 : 16)
- );
- put_byte(s, (Byte)(s->gzhead->time & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, s->gzhead->os & 0xff);
- if (s->gzhead->extra != NULL) {
- put_byte(s, s->gzhead->extra_len & 0xff);
- put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
- }
- if (s->gzhead->hcrc)
- strm->adler = crc32(strm->adler, s->pending_buf,
- s->pending);
- s->gzindex = 0;
- s->status = EXTRA_STATE;
- }
- }
- else
-#endif
- {
- uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
- uInt level_flags;
-
- if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
- level_flags = 0;
- else if (s->level < 6)
- level_flags = 1;
- else if (s->level == 6)
- level_flags = 2;
- else
- level_flags = 3;
- header |= (level_flags << 6);
- if (s->strstart != 0) header |= PRESET_DICT;
- header += 31 - (header % 31);
-
- s->status = BUSY_STATE;
- putShortMSB(s, header);
-
- /* Save the adler32 of the preset dictionary: */
- if (s->strstart != 0) {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- strm->adler = adler32(0L, Z_NULL, 0);
- }
- }
-#ifdef GZIP
- if (s->status == EXTRA_STATE) {
- if (s->gzhead->extra != NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
-
- while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size)
- break;
- }
- put_byte(s, s->gzhead->extra[s->gzindex]);
- s->gzindex++;
- }
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (s->gzindex == s->gzhead->extra_len) {
- s->gzindex = 0;
- s->status = NAME_STATE;
- }
- }
- else
- s->status = NAME_STATE;
- }
- if (s->status == NAME_STATE) {
- if (s->gzhead->name != NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->name[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0) {
- s->gzindex = 0;
- s->status = COMMENT_STATE;
- }
- }
- else
- s->status = COMMENT_STATE;
- }
- if (s->status == COMMENT_STATE) {
- if (s->gzhead->comment != NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->comment[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0)
- s->status = HCRC_STATE;
- }
- else
- s->status = HCRC_STATE;
- }
- if (s->status == HCRC_STATE) {
- if (s->gzhead->hcrc) {
- if (s->pending + 2 > s->pending_buf_size)
- flush_pending(strm);
- if (s->pending + 2 <= s->pending_buf_size) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- strm->adler = crc32(0L, Z_NULL, 0);
- s->status = BUSY_STATE;
- }
- }
- else
- s->status = BUSY_STATE;
- }
-#endif
-
- /* Flush as much pending output as possible */
- if (s->pending != 0) {
- flush_pending(strm);
- if (strm->avail_out == 0) {
- /* Since avail_out is 0, deflate will be called again with
- * more output space, but possibly with both pending and
- * avail_in equal to zero. There won't be anything to do,
- * but this is not an error situation so make sure we
- * return OK instead of BUF_ERROR at next call of deflate:
- */
- s->last_flush = -1;
- return Z_OK;
- }
-
- /* Make sure there is something to do and avoid duplicate consecutive
- * flushes. For repeated and useless calls with Z_FINISH, we keep
- * returning Z_STREAM_END instead of Z_BUF_ERROR.
- */
- } else if (strm->avail_in == 0 && flush <= old_flush &&
- flush != Z_FINISH) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* User must not provide more input after the first FINISH: */
- if (s->status == FINISH_STATE && strm->avail_in != 0) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* Start a new block or continue the current one.
- */
- if (strm->avail_in != 0 || s->lookahead != 0 ||
- (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
- block_state bstate;
-
- bstate = (*(configuration_table[s->level].func))(s, flush);
-
- if (bstate == finish_started || bstate == finish_done) {
- s->status = FINISH_STATE;
- }
- if (bstate == need_more || bstate == finish_started) {
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
- }
- return Z_OK;
- /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
- * of deflate should use the same flush parameter to make sure
- * that the flush is complete. So we don't have to output an
- * empty block here, this will be done at next call. This also
- * ensures that for a very small output buffer, we emit at most
- * one empty block.
- */
- }
- if (bstate == block_done) {
- if (flush == Z_PARTIAL_FLUSH) {
- _tr_align(s);
- } else { /* FULL_FLUSH or SYNC_FLUSH */
- _tr_stored_block(s, (char*)0, 0L, 0);
- /* For a full flush, this empty block will be recognized
- * as a special marker by inflate_sync().
- */
- if (flush == Z_FULL_FLUSH) {
- CLEAR_HASH(s); /* forget history */
- }
- }
- flush_pending(strm);
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
- return Z_OK;
- }
- }
- }
- Assert(strm->avail_out > 0, "bug2");
-
- if (flush != Z_FINISH) return Z_OK;
- if (s->wrap <= 0) return Z_STREAM_END;
-
- /* Write the trailer */
-#ifdef GZIP
- if (s->wrap == 2) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
- put_byte(s, (Byte)(strm->total_in & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
- }
- else
-#endif
- {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- flush_pending(strm);
- /* If avail_out is zero, the application will call deflate again
- * to flush the rest.
- */
- if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
- return s->pending != 0 ? Z_OK : Z_STREAM_END;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateEnd (strm)
- z_streamp strm;
-{
- int status;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
-
- status = strm->state->status;
- if (status != INIT_STATE &&
- status != EXTRA_STATE &&
- status != NAME_STATE &&
- status != COMMENT_STATE &&
- status != HCRC_STATE &&
- status != BUSY_STATE &&
- status != FINISH_STATE) {
- return Z_STREAM_ERROR;
- }
-
- /* Deallocate in reverse order of allocations: */
- TRY_FREE(strm, strm->state->pending_buf);
- TRY_FREE(strm, strm->state->head);
- TRY_FREE(strm, strm->state->prev);
- TRY_FREE(strm, strm->state->window);
-
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
-
- return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
-}
-
-/* =========================================================================
- * Copy the source state to the destination state.
- * To simplify the source, this is not supported for 16-bit MSDOS (which
- * doesn't have enough memory anyway to duplicate compression states).
- */
-int ZEXPORT deflateCopy (dest, source)
- z_streamp dest;
- z_streamp source;
-{
-#ifdef MAXSEG_64K
- return Z_STREAM_ERROR;
-#else
- deflate_state *ds;
- deflate_state *ss;
- ushf *overlay;
-
-
- if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
- return Z_STREAM_ERROR;
- }
-
- ss = source->state;
-
- zmemcpy(dest, source, sizeof(z_stream));
-
- ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
- if (ds == Z_NULL) return Z_MEM_ERROR;
- dest->state = (struct internal_state FAR *) ds;
- zmemcpy(ds, ss, sizeof(deflate_state));
- ds->strm = dest;
-
- ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
- ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
- ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
- ds->pending_buf = (uchf *) overlay;
-
- if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
- ds->pending_buf == Z_NULL) {
- deflateEnd (dest);
- return Z_MEM_ERROR;
- }
- /* following zmemcpy do not work for 16-bit MSDOS */
- zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
- zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
- zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
- zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
-
- ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
-
- ds->l_desc.dyn_tree = ds->dyn_ltree;
- ds->d_desc.dyn_tree = ds->dyn_dtree;
- ds->bl_desc.dyn_tree = ds->bl_tree;
-
- return Z_OK;
-#endif /* MAXSEG_64K */
-}
-
-/* ===========================================================================
- * Read a new buffer from the current input stream, update the adler32
- * and total number of bytes read. All deflate() input goes through
- * this function so some applications may wish to modify it to avoid
- * allocating a large strm->next_in buffer and copying from it.
- * (See also flush_pending()).
- */
-local int read_buf(strm, buf, size)
- z_streamp strm;
- Bytef *buf;
- unsigned size;
-{
- unsigned len = strm->avail_in;
-
- if (len > size) len = size;
- if (len == 0) return 0;
-
- strm->avail_in -= len;
-
- if (strm->state->wrap == 1) {
- strm->adler = adler32(strm->adler, strm->next_in, len);
- }
-#ifdef GZIP
- else if (strm->state->wrap == 2) {
- strm->adler = crc32(strm->adler, strm->next_in, len);
- }
-#endif
- zmemcpy(buf, strm->next_in, len);
- strm->next_in += len;
- strm->total_in += len;
-
- return (int)len;
-}
-
-/* ===========================================================================
- * Initialize the "longest match" routines for a new zlib stream
- */
-local void lm_init (s)
- deflate_state *s;
-{
- s->window_size = (ulg)2L*s->w_size;
-
- CLEAR_HASH(s);
-
- /* Set the default configuration parameters:
- */
- s->max_lazy_match = configuration_table[s->level].max_lazy;
- s->good_match = configuration_table[s->level].good_length;
- s->nice_match = configuration_table[s->level].nice_length;
- s->max_chain_length = configuration_table[s->level].max_chain;
-
- s->strstart = 0;
- s->block_start = 0L;
- s->lookahead = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- s->ins_h = 0;
-#ifndef FASTEST
-#ifdef ASMV
- match_init(); /* initialize the asm code */
-#endif
-#endif
-}
-
-#ifndef FASTEST
-/* ===========================================================================
- * Set match_start to the longest match starting at the given string and
- * return its length. Matches shorter or equal to prev_length are discarded,
- * in which case the result is equal to prev_length and match_start is
- * garbage.
- * IN assertions: cur_match is the head of the hash chain for the current
- * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
- * OUT assertion: the match length is not greater than s->lookahead.
- */
-#ifndef ASMV
-/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
- * match.S. The code will be functionally equivalent.
- */
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
- unsigned chain_length = s->max_chain_length;/* max hash chain length */
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- int best_len = s->prev_length; /* best match length so far */
- int nice_match = s->nice_match; /* stop if match long enough */
- IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
- s->strstart - (IPos)MAX_DIST(s) : NIL;
- /* Stop when cur_match becomes <= limit. To simplify the code,
- * we prevent matches with the string of window index 0.
- */
- Posf *prev = s->prev;
- uInt wmask = s->w_mask;
-
-#ifdef UNALIGNED_OK
- /* Compare two bytes at a time. Note: this is not always beneficial.
- * Try with and without -DUNALIGNED_OK to check.
- */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
- register ush scan_start = *(ushf*)scan;
- register ush scan_end = *(ushf*)(scan+best_len-1);
-#else
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- register Byte scan_end1 = scan[best_len-1];
- register Byte scan_end = scan[best_len];
-#endif
-
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
-
- /* Do not waste too much time if we already have a good match: */
- if (s->prev_length >= s->good_match) {
- chain_length >>= 2;
- }
- /* Do not look for matches beyond the end of the input. This is necessary
- * to make deflate deterministic.
- */
- if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
-
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
-
- do {
- Assert(cur_match < s->strstart, "no future");
- match = s->window + cur_match;
-
- /* Skip to next match if the match length cannot increase
- * or if the match length is less than 2. Note that the checks below
- * for insufficient lookahead only occur occasionally for performance
- * reasons. Therefore uninitialized memory will be accessed, and
- * conditional jumps will be made that depend on those values.
- * However the length of the match is limited to the lookahead, so
- * the output of deflate is not affected by the uninitialized values.
- */
-#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
- /* This code assumes sizeof(unsigned short) == 2. Do not use
- * UNALIGNED_OK if your compiler uses a different size.
- */
- if (*(ushf*)(match+best_len-1) != scan_end ||
- *(ushf*)match != scan_start) continue;
-
- /* It is not necessary to compare scan[2] and match[2] since they are
- * always equal when the other bytes match, given that the hash keys
- * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
- * strstart+3, +5, ... up to strstart+257. We check for insufficient
- * lookahead only every 4th comparison; the 128th check will be made
- * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
- * necessary to put more guard bytes at the end of the window, or
- * to check more often for insufficient lookahead.
- */
- Assert(scan[2] == match[2], "scan[2]?");
- scan++, match++;
- do {
- } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- scan < strend);
- /* The funny "do {}" generates better code on most compilers */
-
- /* Here, scan <= window+strstart+257 */
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
- if (*scan == *match) scan++;
-
- len = (MAX_MATCH - 1) - (int)(strend-scan);
- scan = strend - (MAX_MATCH-1);
-
-#else /* UNALIGNED_OK */
-
- if (match[best_len] != scan_end ||
- match[best_len-1] != scan_end1 ||
- *match != *scan ||
- *++match != scan[1]) continue;
-
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match++;
- Assert(*scan == *match, "match[2]?");
-
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
-
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-
- len = MAX_MATCH - (int)(strend - scan);
- scan = strend - MAX_MATCH;
-
-#endif /* UNALIGNED_OK */
-
- if (len > best_len) {
- s->match_start = cur_match;
- best_len = len;
- if (len >= nice_match) break;
-#ifdef UNALIGNED_OK
- scan_end = *(ushf*)(scan+best_len-1);
-#else
- scan_end1 = scan[best_len-1];
- scan_end = scan[best_len];
-#endif
- }
- } while ((cur_match = prev[cur_match & wmask]) > limit
- && --chain_length != 0);
-
- if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
- return s->lookahead;
-}
-#endif /* ASMV */
-#endif /* FASTEST */
-
-/* ---------------------------------------------------------------------------
- * Optimized version for level == 1 or strategy == Z_RLE only
- */
-local uInt longest_match_fast(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
-
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
-
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
-
- Assert(cur_match < s->strstart, "no future");
-
- match = s->window + cur_match;
-
- /* Return failure if the match length is less than 2:
- */
- if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
-
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match += 2;
- Assert(*scan == *match, "match[2]?");
-
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
-
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-
- len = MAX_MATCH - (int)(strend - scan);
-
- if (len < MIN_MATCH) return MIN_MATCH - 1;
-
- s->match_start = cur_match;
- return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
-}
-
-#ifdef DEBUG
-/* ===========================================================================
- * Check that the match at match_start is indeed a match.
- */
-local void check_match(s, start, match, length)
- deflate_state *s;
- IPos start, match;
- int length;
-{
- /* check that the match is indeed a match */
- if (zmemcmp(s->window + match,
- s->window + start, length) != EQUAL) {
- fprintf(stderr, " start %u, match %u, length %d\n",
- start, match, length);
- do {
- fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
- } while (--length != 0);
- z_error("invalid match");
- }
- if (z_verbose > 1) {
- fprintf(stderr,"\\[%d,%d]", start-match, length);
- do { putc(s->window[start++], stderr); } while (--length != 0);
- }
-}
-#else
-# define check_match(s, start, match, length)
-#endif /* DEBUG */
-
-/* ===========================================================================
- * Fill the window when the lookahead becomes insufficient.
- * Updates strstart and lookahead.
- *
- * IN assertion: lookahead < MIN_LOOKAHEAD
- * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
- * At least one byte has been read, or avail_in == 0; reads are
- * performed for at least two bytes (required for the zip translate_eol
- * option -- not supported here).
- */
-local void fill_window(s)
- deflate_state *s;
-{
- register unsigned n, m;
- register Posf *p;
- unsigned more; /* Amount of free space at the end of the window. */
- uInt wsize = s->w_size;
-
- do {
- more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
-
- /* Deal with !@#$% 64K limit: */
- if (sizeof(int) <= 2) {
- if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
- more = wsize;
-
- } else if (more == (unsigned)(-1)) {
- /* Very unlikely, but possible on 16 bit machine if
- * strstart == 0 && lookahead == 1 (input done a byte at time)
- */
- more--;
- }
- }
-
- /* If the window is almost full and there is insufficient lookahead,
- * move the upper half to the lower one to make room in the upper half.
- */
- if (s->strstart >= wsize+MAX_DIST(s)) {
-
- zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
- s->match_start -= wsize;
- s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
- s->block_start -= (long) wsize;
-
- /* Slide the hash table (could be avoided with 32 bit values
- at the expense of memory usage). We slide even when level == 0
- to keep the hash table consistent if we switch back to level > 0
- later. (Using level 0 permanently is not an optimal usage of
- zlib, so we don't care about this pathological case.)
- */
- /* %%% avoid this when Z_RLE */
- n = s->hash_size;
- p = &s->head[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- } while (--n);
-
- n = wsize;
-#ifndef FASTEST
- p = &s->prev[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- /* If n is not on any hash chain, prev[n] is garbage but
- * its value will never be used.
- */
- } while (--n);
-#endif
- more += wsize;
- }
- if (s->strm->avail_in == 0) return;
-
- /* If there was no sliding:
- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
- * more == window_size - lookahead - strstart
- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
- * => more >= window_size - 2*WSIZE + 2
- * In the BIG_MEM or MMAP case (not yet supported),
- * window_size == input_size + MIN_LOOKAHEAD &&
- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
- * Otherwise, window_size == 2*WSIZE so more >= 2.
- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
- */
- Assert(more >= 2, "more < 2");
-
- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
- s->lookahead += n;
-
- /* Initialize the hash value now that we have some input: */
- if (s->lookahead >= MIN_MATCH) {
- s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- }
- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
- * but this is not important since only literal bytes will be emitted.
- */
-
- } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
-}
-
-/* ===========================================================================
- * Flush the current block, with given end-of-file flag.
- * IN assertion: strstart is set to the end of the current match.
- */
-#define FLUSH_BLOCK_ONLY(s, eof) { \
- _tr_flush_block(s, (s->block_start >= 0L ? \
- (charf *)&s->window[(unsigned)s->block_start] : \
- (charf *)Z_NULL), \
- (ulg)((long)s->strstart - s->block_start), \
- (eof)); \
- s->block_start = s->strstart; \
- flush_pending(s->strm); \
- Tracev((stderr,"[FLUSH]")); \
-}
-
-/* Same but force premature exit if necessary. */
-#define FLUSH_BLOCK(s, eof) { \
- FLUSH_BLOCK_ONLY(s, eof); \
- if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
-}
-
-/* ===========================================================================
- * Copy without compression as much as possible from the input stream, return
- * the current block state.
- * This function does not insert new strings in the dictionary since
- * uncompressible data is probably not useful. This function is used
- * only for the level=0 compression option.
- * NOTE: this function should be optimized to avoid extra copying from
- * window to pending_buf.
- */
-local block_state deflate_stored(s, flush)
- deflate_state *s;
- int flush;
-{
- /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
- * to pending_buf_size, and each stored block has a 5 byte header:
- */
- ulg max_block_size = 0xffff;
- ulg max_start;
-
- if (max_block_size > s->pending_buf_size - 5) {
- max_block_size = s->pending_buf_size - 5;
- }
-
- /* Copy as much as possible from input to output: */
- for (;;) {
- /* Fill the window as much as possible: */
- if (s->lookahead <= 1) {
-
- Assert(s->strstart < s->w_size+MAX_DIST(s) ||
- s->block_start >= (long)s->w_size, "slide too late");
-
- fill_window(s);
- if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
-
- if (s->lookahead == 0) break; /* flush the current block */
- }
- Assert(s->block_start >= 0L, "block gone");
-
- s->strstart += s->lookahead;
- s->lookahead = 0;
-
- /* Emit a stored block if pending_buf will be full: */
- max_start = s->block_start + max_block_size;
- if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
- /* strstart == 0 is possible when wraparound on 16-bit machine */
- s->lookahead = (uInt)(s->strstart - max_start);
- s->strstart = (uInt)max_start;
- FLUSH_BLOCK(s, 0);
- }
- /* Flush if we may have to slide, otherwise block_start may become
- * negative and the data will be gone:
- */
- if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
- FLUSH_BLOCK(s, 0);
- }
- }
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
-}
-
-/* ===========================================================================
- * Compress as much as possible from the input stream, return the current
- * block state.
- * This function does not perform lazy evaluation of matches and inserts
- * new strings in the dictionary only for unmatched strings or for short
- * matches. It is used only for the fast compression options.
- */
-local block_state deflate_fast(s, flush)
- deflate_state *s;
- int flush;
-{
- IPos hash_head = NIL; /* head of the hash chain */
- int bflush; /* set if current block must be flushed */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- * At this point we have always match_length < MIN_MATCH
- */
- if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
-#ifdef FASTEST
- if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) ||
- (s->strategy == Z_RLE && s->strstart - hash_head == 1)) {
- s->match_length = longest_match_fast (s, hash_head);
- }
-#else
- if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
- s->match_length = longest_match (s, hash_head);
- } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
- s->match_length = longest_match_fast (s, hash_head);
- }
-#endif
- /* longest_match() or longest_match_fast() sets match_start */
- }
- if (s->match_length >= MIN_MATCH) {
- check_match(s, s->strstart, s->match_start, s->match_length);
-
- _tr_tally_dist(s, s->strstart - s->match_start,
- s->match_length - MIN_MATCH, bflush);
-
- s->lookahead -= s->match_length;
-
- /* Insert new strings in the hash table only if the match length
- * is not too large. This saves time but degrades compression.
- */
-#ifndef FASTEST
- if (s->match_length <= s->max_insert_length &&
- s->lookahead >= MIN_MATCH) {
- s->match_length--; /* string at strstart already in table */
- do {
- s->strstart++;
- INSERT_STRING(s, s->strstart, hash_head);
- /* strstart never exceeds WSIZE-MAX_MATCH, so there are
- * always MIN_MATCH bytes ahead.
- */
- } while (--s->match_length != 0);
- s->strstart++;
- } else
-#endif
- {
- s->strstart += s->match_length;
- s->match_length = 0;
- s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
- * matter since it will be recomputed at next deflate call.
- */
- }
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
-}
-
-#ifndef FASTEST
-/* ===========================================================================
- * Same as above, but achieves better compression. We use a lazy
- * evaluation for matches: a match is finally adopted only if there is
- * no better match at the next window position.
- */
-local block_state deflate_slow(s, flush)
- deflate_state *s;
- int flush;
-{
- IPos hash_head = NIL; /* head of hash chain */
- int bflush; /* set if current block must be flushed */
-
- /* Process the input block. */
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- */
- s->prev_length = s->match_length, s->prev_match = s->match_start;
- s->match_length = MIN_MATCH-1;
-
- if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
- s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
- if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
- s->match_length = longest_match (s, hash_head);
- } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
- s->match_length = longest_match_fast (s, hash_head);
- }
- /* longest_match() or longest_match_fast() sets match_start */
-
- if (s->match_length <= 5 && (s->strategy == Z_FILTERED
-#if TOO_FAR <= 32767
- || (s->match_length == MIN_MATCH &&
- s->strstart - s->match_start > TOO_FAR)
-#endif
- )) {
-
- /* If prev_match is also MIN_MATCH, match_start is garbage
- * but we will ignore the current match anyway.
- */
- s->match_length = MIN_MATCH-1;
- }
- }
- /* If there was a match at the previous step and the current
- * match is not better, output the previous match:
- */
- if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
- uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
- /* Do not insert strings in hash table beyond this. */
-
- check_match(s, s->strstart-1, s->prev_match, s->prev_length);
-
- _tr_tally_dist(s, s->strstart -1 - s->prev_match,
- s->prev_length - MIN_MATCH, bflush);
-
- /* Insert in hash table all strings up to the end of the match.
- * strstart-1 and strstart are already inserted. If there is not
- * enough lookahead, the last two strings are not inserted in
- * the hash table.
- */
- s->lookahead -= s->prev_length-1;
- s->prev_length -= 2;
- do {
- if (++s->strstart <= max_insert) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
- } while (--s->prev_length != 0);
- s->match_available = 0;
- s->match_length = MIN_MATCH-1;
- s->strstart++;
-
- if (bflush) FLUSH_BLOCK(s, 0);
-
- } else if (s->match_available) {
- /* If there was no match at the previous position, output a
- * single literal. If there was a match but the current match
- * is longer, truncate the previous match to a single literal.
- */
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- if (bflush) {
- FLUSH_BLOCK_ONLY(s, 0);
- }
- s->strstart++;
- s->lookahead--;
- if (s->strm->avail_out == 0) return need_more;
- } else {
- /* There is no previous match to compare with, wait for
- * the next step to decide.
- */
- s->match_available = 1;
- s->strstart++;
- s->lookahead--;
- }
- }
- Assert (flush != Z_NO_FLUSH, "no flush?");
- if (s->match_available) {
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- s->match_available = 0;
- }
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
-}
-#endif /* FASTEST */
-
-#if 0
-/* ===========================================================================
- * For Z_RLE, simply look for runs of bytes, generate matches only of distance
- * one. Do not maintain a hash table. (It will be regenerated if this run of
- * deflate switches away from Z_RLE.)
- */
-local block_state deflate_rle(s, flush)
- deflate_state *s;
- int flush;
-{
- int bflush; /* set if current block must be flushed */
- uInt run; /* length of run */
- uInt max; /* maximum length of run */
- uInt prev; /* byte at distance one to match */
- Bytef *scan; /* scan for end of run */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the longest encodable run.
- */
- if (s->lookahead < MAX_MATCH) {
- fill_window(s);
- if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* See how many times the previous byte repeats */
- run = 0;
- if (s->strstart > 0) { /* if there is a previous byte, that is */
- max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH;
- scan = s->window + s->strstart - 1;
- prev = *scan++;
- do {
- if (*scan++ != prev)
- break;
- } while (++run < max);
- }
-
- /* Emit match if have run of MIN_MATCH or longer, else emit literal */
- if (run >= MIN_MATCH) {
- check_match(s, s->strstart, s->strstart - 1, run);
- _tr_tally_dist(s, 1, run - MIN_MATCH, bflush);
- s->lookahead -= run;
- s->strstart += run;
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
-}
-#endif
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.h
deleted file mode 100644
index a5f4e64..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.h
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* deflate.h -- internal compression state
- * Copyright (C) 1995-2004 Jean-loup Gailly
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id$ */
-
-#ifndef DEFLATE_H
-#define DEFLATE_H
-
-#include "zutil.h"
-
-/* define NO_GZIP when compiling if you want to disable gzip header and
- trailer creation by deflate(). NO_GZIP would be used to avoid linking in
- the crc code when it is not needed. For shared libraries, gzip encoding
- should be left enabled. */
-#ifndef NO_GZIP
-# define GZIP
-#endif
-
-/* ===========================================================================
- * Internal compression state.
- */
-
-#define LENGTH_CODES 29
-/* number of length codes, not counting the special END_BLOCK code */
-
-#define LITERALS 256
-/* number of literal bytes 0..255 */
-
-#define L_CODES (LITERALS+1+LENGTH_CODES)
-/* number of Literal or Length codes, including the END_BLOCK code */
-
-#define D_CODES 30
-/* number of distance codes */
-
-#define BL_CODES 19
-/* number of codes used to transfer the bit lengths */
-
-#define HEAP_SIZE (2*L_CODES+1)
-/* maximum heap size */
-
-#define MAX_BITS 15
-/* All codes must not exceed MAX_BITS bits */
-
-#define INIT_STATE 42
-#define EXTRA_STATE 69
-#define NAME_STATE 73
-#define COMMENT_STATE 91
-#define HCRC_STATE 103
-#define BUSY_STATE 113
-#define FINISH_STATE 666
-/* Stream status */
-
-
-/* Data structure describing a single value and its code string. */
-typedef struct ct_data_s {
- union {
- ush freq; /* frequency count */
- ush code; /* bit string */
- } fc;
- union {
- ush dad; /* father node in Huffman tree */
- ush len; /* length of bit string */
- } dl;
-} FAR ct_data;
-
-#define Freq fc.freq
-#define Code fc.code
-#define Dad dl.dad
-#define Len dl.len
-
-typedef struct static_tree_desc_s static_tree_desc;
-
-typedef struct tree_desc_s {
- ct_data *dyn_tree; /* the dynamic tree */
- int max_code; /* largest code with non zero frequency */
- static_tree_desc *stat_desc; /* the corresponding static tree */
-} FAR tree_desc;
-
-typedef ush Pos;
-typedef Pos FAR Posf;
-typedef unsigned IPos;
-
-/* A Pos is an index in the character window. We use short instead of int to
- * save space in the various tables. IPos is used only for parameter passing.
- */
-
-typedef struct internal_state {
- z_streamp strm; /* pointer back to this zlib stream */
- int status; /* as the name implies */
- Bytef *pending_buf; /* output still pending */
- ulg pending_buf_size; /* size of pending_buf */
- Bytef *pending_out; /* next pending byte to output to the stream */
- uInt pending; /* nb of bytes in the pending buffer */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- gz_headerp gzhead; /* gzip header information to write */
- uInt gzindex; /* where in extra, name, or comment */
- Byte method; /* STORED (for zip only) or DEFLATED */
- int last_flush; /* value of flush param for previous deflate call */
-
- /* used by deflate.c: */
-
- uInt w_size; /* LZ77 window size (32K by default) */
- uInt w_bits; /* log2(w_size) (8..16) */
- uInt w_mask; /* w_size - 1 */
-
- Bytef *window;
- /* Sliding window. Input bytes are read into the second half of the window,
- * and move to the first half later to keep a dictionary of at least wSize
- * bytes. With this organization, matches are limited to a distance of
- * wSize-MAX_MATCH bytes, but this ensures that IO is always
- * performed with a length multiple of the block size. Also, it limits
- * the window size to 64K, which is quite useful on MSDOS.
- * To do: use the user input buffer as sliding window.
- */
-
- ulg window_size;
- /* Actual size of window: 2*wSize, except when the user input buffer
- * is directly used as sliding window.
- */
-
- Posf *prev;
- /* Link to older string with same hash index. To limit the size of this
- * array to 64K, this link is maintained only for the last 32K strings.
- * An index in this array is thus a window index modulo 32K.
- */
-
- Posf *head; /* Heads of the hash chains or NIL. */
-
- uInt ins_h; /* hash index of string to be inserted */
- uInt hash_size; /* number of elements in hash table */
- uInt hash_bits; /* log2(hash_size) */
- uInt hash_mask; /* hash_size-1 */
-
- uInt hash_shift;
- /* Number of bits by which ins_h must be shifted at each input
- * step. It must be such that after MIN_MATCH steps, the oldest
- * byte no longer takes part in the hash key, that is:
- * hash_shift * MIN_MATCH >= hash_bits
- */
-
- long block_start;
- /* Window position at the beginning of the current output block. Gets
- * negative when the window is moved backwards.
- */
-
- uInt match_length; /* length of best match */
- IPos prev_match; /* previous match */
- int match_available; /* set if previous match exists */
- uInt strstart; /* start of string to insert */
- uInt match_start; /* start of matching string */
- uInt lookahead; /* number of valid bytes ahead in window */
-
- uInt prev_length;
- /* Length of the best match at previous step. Matches not greater than this
- * are discarded. This is used in the lazy match evaluation.
- */
-
- uInt max_chain_length;
- /* To speed up deflation, hash chains are never searched beyond this
- * length. A higher limit improves compression ratio but degrades the
- * speed.
- */
-
- uInt max_lazy_match;
- /* Attempt to find a better match only when the current match is strictly
- * smaller than this value. This mechanism is used only for compression
- * levels >= 4.
- */
-# define max_insert_length max_lazy_match
- /* Insert new strings in the hash table only if the match length is not
- * greater than this length. This saves time but degrades compression.
- * max_insert_length is used only for compression levels <= 3.
- */
-
- int level; /* compression level (1..9) */
- int strategy; /* favor or force Huffman coding*/
-
- uInt good_match;
- /* Use a faster search when the previous match is longer than this */
-
- int nice_match; /* Stop searching when current match exceeds this */
-
- /* used by trees.c: */
- /* Didn't use ct_data typedef below to supress compiler warning */
- struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
- struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
- struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
-
- struct tree_desc_s l_desc; /* desc. for literal tree */
- struct tree_desc_s d_desc; /* desc. for distance tree */
- struct tree_desc_s bl_desc; /* desc. for bit length tree */
-
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
- int heap_len; /* number of elements in the heap */
- int heap_max; /* element of largest frequency */
- /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
- * The same heap array is used to build all trees.
- */
-
- uch depth[2*L_CODES+1];
- /* Depth of each subtree used as tie breaker for trees of equal frequency
- */
-
- uchf *l_buf; /* buffer for literals or lengths */
-
- uInt lit_bufsize;
- /* Size of match buffer for literals/lengths. There are 4 reasons for
- * limiting lit_bufsize to 64K:
- * - frequencies can be kept in 16 bit counters
- * - if compression is not successful for the first block, all input
- * data is still in the window so we can still emit a stored block even
- * when input comes from standard input. (This can also be done for
- * all blocks if lit_bufsize is not greater than 32K.)
- * - if compression is not successful for a file smaller than 64K, we can
- * even emit a stored file instead of a stored block (saving 5 bytes).
- * This is applicable only for zip (not gzip or zlib).
- * - creating new Huffman trees less frequently may not provide fast
- * adaptation to changes in the input data statistics. (Take for
- * example a binary file with poorly compressible code followed by
- * a highly compressible string table.) Smaller buffer sizes give
- * fast adaptation but have of course the overhead of transmitting
- * trees more frequently.
- * - I can't count above 4
- */
-
- uInt last_lit; /* running index in l_buf */
-
- ushf *d_buf;
- /* Buffer for distances. To simplify the code, d_buf and l_buf have
- * the same number of elements. To use different lengths, an extra flag
- * array would be necessary.
- */
-
- ulg opt_len; /* bit length of current block with optimal trees */
- ulg static_len; /* bit length of current block with static trees */
- uInt matches; /* number of string matches in current block */
- int last_eob_len; /* bit length of EOB code for last block */
-
-#ifdef DEBUG
- ulg compressed_len; /* total bit length of compressed file mod 2^32 */
- ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
-#endif
-
- ush bi_buf;
- /* Output buffer. bits are inserted starting at the bottom (least
- * significant bits).
- */
- int bi_valid;
- /* Number of valid bits in bi_buf. All bits above the last valid bit
- * are always zero.
- */
-
-} FAR deflate_state;
-
-/* Output a byte on the stream.
- * IN assertion: there is enough room in pending_buf.
- */
-#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
-
-
-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
-/* Minimum amount of lookahead, except at the end of the input file.
- * See deflate.c for comments about the MIN_MATCH+1.
- */
-
-#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
-/* In order to simplify the code, particularly on 16 bit machines, match
- * distances are limited to MAX_DIST instead of WSIZE.
- */
-
- /* in trees.c */
-void _tr_init OF((deflate_state *s));
-int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
-void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
- int eof));
-void _tr_align OF((deflate_state *s));
-void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
- int eof));
-
-#define d_code(dist) \
- ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
-/* Mapping from a distance to a distance code. dist is the distance - 1 and
- * must not have side effects. _dist_code[256] and _dist_code[257] are never
- * used.
- */
-
-#ifndef DEBUG
-/* Inline versions of _tr_tally for speed: */
-
-#if defined(GEN_TREES_H) || !defined(STDC)
- extern uch _length_code[];
- extern uch _dist_code[];
-#else
- extern const uch _length_code[];
- extern const uch _dist_code[];
-#endif
-
-# define _tr_tally_lit(s, c, flush) \
- { uch cc = (c); \
- s->d_buf[s->last_lit] = 0; \
- s->l_buf[s->last_lit++] = cc; \
- s->dyn_ltree[cc].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
-# define _tr_tally_dist(s, distance, length, flush) \
- { uch len = (length); \
- ush dist = (distance); \
- s->d_buf[s->last_lit] = dist; \
- s->l_buf[s->last_lit++] = len; \
- dist--; \
- s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
- s->dyn_dtree[d_code(dist)].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
-#else
-# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
-# define _tr_tally_dist(s, distance, length, flush) \
- flush = _tr_tally(s, distance, length)
-#endif
-
-#endif /* DEFLATE_H */
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/gzio.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/gzio.c
deleted file mode 100644
index 2926d93..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/gzio.c
+++ /dev/null
@@ -1,1050 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* gzio.c -- IO on .gz files
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Compile this file with -DNO_GZCOMPRESS to avoid the compression code.
- */
-
-/* @(#) $Id$ */
-
-#include <stdio.h>
-
-#include "zutil.h"
-
-#ifdef NO_DEFLATE /* for compatibility with old definition */
-# define NO_GZCOMPRESS
-#endif
-
-#ifndef NO_DUMMY_DECL
-struct internal_state {int dummy;}; /* for buggy compilers */
-#endif
-
-#ifndef Z_BUFSIZE
-# ifdef MAXSEG_64K
-# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
-# else
-# define Z_BUFSIZE 16384
-# endif
-#endif
-#ifndef Z_PRINTF_BUFSIZE
-# define Z_PRINTF_BUFSIZE 4096
-#endif
-
-#ifdef __MVS__
-# pragma map (fdopen , "\174\174FDOPEN")
- FILE *fdopen(int, const char *);
-#endif
-
-#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern void free OF((voidpf ptr));
-#endif
-
-#define ALLOC(size) malloc(size)
-#define TRYFREE(p) {if (p) free(p);}
-
-static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
-
-/* gzip flag byte */
-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
-#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
-#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
-#define COMMENT 0x10 /* bit 4 set: file comment present */
-#define RESERVED 0xE0 /* bits 5..7: reserved */
-
-typedef struct gz_stream {
- z_stream stream;
- int z_err; /* error code for last stream operation */
- int z_eof; /* set if end of input file */
- FILE *file; /* .gz file */
- Byte *inbuf; /* input buffer */
- Byte *outbuf; /* output buffer */
- uLong crc; /* crc32 of uncompressed data */
- char *msg; /* error message */
- char *path; /* path name for debugging only */
- int transparent; /* 1 if input file is not a .gz file */
- char mode; /* 'w' or 'r' */
- z_off_t start; /* start of compressed data in file (header skipped) */
- z_off_t in; /* bytes into deflate or inflate */
- z_off_t out; /* bytes out of deflate or inflate */
- int back; /* one character push-back */
- int last; /* true if push-back is last character */
-} gz_stream;
-
-
-local gzFile gz_open OF((const char *path, const char *mode, int fd));
-local int do_flush OF((gzFile file, int flush));
-local int get_byte OF((gz_stream *s));
-local void check_header OF((gz_stream *s));
-local int destroy OF((gz_stream *s));
-local void putLong OF((FILE *file, uLong x));
-local uLong getLong OF((gz_stream *s));
-
-/* ===========================================================================
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb"). The file is given either by file descriptor
- or path name (if fd == -1).
- gz_open returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR).
-*/
-local gzFile gz_open (path, mode, fd)
- const char *path;
- const char *mode;
- int fd;
-{
- int err;
- int level = Z_DEFAULT_COMPRESSION; /* compression level */
- int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
- char *p = (char*)mode;
- gz_stream *s;
- char fmode[80]; /* copy of mode, without the compression level */
- char *m = fmode;
-
- if (!path || !mode) return Z_NULL;
-
- s = (gz_stream *)ALLOC(sizeof(gz_stream));
- if (!s) return Z_NULL;
-
- s->stream.zalloc = (alloc_func)0;
- s->stream.zfree = (free_func)0;
- s->stream.opaque = (voidpf)0;
- s->stream.next_in = s->inbuf = Z_NULL;
- s->stream.next_out = s->outbuf = Z_NULL;
- s->stream.avail_in = s->stream.avail_out = 0;
- s->file = NULL;
- s->z_err = Z_OK;
- s->z_eof = 0;
- s->in = 0;
- s->out = 0;
- s->back = EOF;
- s->crc = crc32(0L, Z_NULL, 0);
- s->msg = NULL;
- s->transparent = 0;
-
- s->path = (char*)ALLOC(strlen(path)+1);
- if (s->path == NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- strcpy(s->path, path); /* do this early for debugging */
-
- s->mode = '\0';
- do {
- if (*p == 'r') s->mode = 'r';
- if (*p == 'w' || *p == 'a') s->mode = 'w';
- if (*p >= '0' && *p <= '9') {
- level = *p - '0';
- } else if (*p == 'f') {
- strategy = Z_FILTERED;
- } else if (*p == 'h') {
- strategy = Z_HUFFMAN_ONLY;
- } else if (*p == 'R') {
- strategy = Z_RLE;
- } else {
- *m++ = *p; /* copy the mode */
- }
- } while (*p++ && m != fmode + sizeof(fmode));
- if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
-
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- err = Z_STREAM_ERROR;
-#else
- err = deflateInit2(&(s->stream), level,
- Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
- /* windowBits is passed < 0 to suppress zlib header */
-
- s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
-#endif
- if (err != Z_OK || s->outbuf == Z_NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- } else {
- s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
-
- err = inflateInit2(&(s->stream), -MAX_WBITS);
- /* windowBits is passed < 0 to tell that there is no zlib header.
- * Note that in this case inflate *requires* an extra "dummy" byte
- * after the compressed stream in order to complete decompression and
- * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
- * present after the compressed stream.
- */
- if (err != Z_OK || s->inbuf == Z_NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- }
- s->stream.avail_out = Z_BUFSIZE;
-
- errno = 0;
- s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
-
- if (s->file == NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- if (s->mode == 'w') {
- /* Write a very simple .gz header:
- */
- fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
- Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
- s->start = 10L;
- /* We use 10L instead of ftell(s->file) to because ftell causes an
- * fflush on some systems. This version of the library doesn't use
- * start anyway in write mode, so this initialization is not
- * necessary.
- */
- } else {
- check_header(s); /* skip the .gz header */
- s->start = ftell(s->file) - s->stream.avail_in;
- }
-
- return (gzFile)s;
-}
-
-/* ===========================================================================
- Opens a gzip (.gz) file for reading or writing.
-*/
-gzFile ZEXPORT gzopen (path, mode)
- const char *path;
- const char *mode;
-{
- return gz_open (path, mode, -1);
-}
-
-/* ===========================================================================
- Associate a gzFile with the file descriptor fd. fd is not dup'ed here
- to mimic the behavio(u)r of fdopen.
-*/
-gzFile ZEXPORT gzdopen (fd, mode)
- int fd;
- const char *mode;
-{
- char name[46]; /* allow for up to 128-bit integers */
-
- if (fd < 0) return (gzFile)Z_NULL;
- sprintf(name, "<fd:%d>", fd); /* for debugging */
-
- return gz_open (name, mode, fd);
-}
-
-/* ===========================================================================
- * Update the compression level and strategy
- */
-int ZEXPORT gzsetparams (file, level, strategy)
- gzFile file;
- int level;
- int strategy;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
-
- /* Make room to allow flushing */
- if (s->stream.avail_out == 0) {
-
- s->stream.next_out = s->outbuf;
- if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
- s->z_err = Z_ERRNO;
- }
- s->stream.avail_out = Z_BUFSIZE;
- }
-
- return deflateParams (&(s->stream), level, strategy);
-}
-
-/* ===========================================================================
- Read a byte from a gz_stream; update next_in and avail_in. Return EOF
- for end of file.
- IN assertion: the stream s has been sucessfully opened for reading.
-*/
-local int get_byte(s)
- gz_stream *s;
-{
- if (s->z_eof) return EOF;
- if (s->stream.avail_in == 0) {
- errno = 0;
- s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
- if (s->stream.avail_in == 0) {
- s->z_eof = 1;
- if (ferror(s->file)) s->z_err = Z_ERRNO;
- return EOF;
- }
- s->stream.next_in = s->inbuf;
- }
- s->stream.avail_in--;
- return *(s->stream.next_in)++;
-}
-
-/* ===========================================================================
- Check the gzip header of a gz_stream opened for reading. Set the stream
- mode to transparent if the gzip magic header is not present; set s->err
- to Z_DATA_ERROR if the magic header is present but the rest of the header
- is incorrect.
- IN assertion: the stream s has already been created sucessfully;
- s->stream.avail_in is zero for the first time, but may be non-zero
- for concatenated .gz files.
-*/
-local void check_header(s)
- gz_stream *s;
-{
- int method; /* method byte */
- int flags; /* flags byte */
- uInt len;
- int c;
-
- /* Assure two bytes in the buffer so we can peek ahead -- handle case
- where first byte of header is at the end of the buffer after the last
- gzip segment */
- len = s->stream.avail_in;
- if (len < 2) {
- if (len) s->inbuf[0] = s->stream.next_in[0];
- errno = 0;
- len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file);
- if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO;
- s->stream.avail_in += len;
- s->stream.next_in = s->inbuf;
- if (s->stream.avail_in < 2) {
- s->transparent = s->stream.avail_in;
- return;
- }
- }
-
- /* Peek ahead to check the gzip magic header */
- if (s->stream.next_in[0] != gz_magic[0] ||
- s->stream.next_in[1] != gz_magic[1]) {
- s->transparent = 1;
- return;
- }
- s->stream.avail_in -= 2;
- s->stream.next_in += 2;
-
- /* Check the rest of the gzip header */
- method = get_byte(s);
- flags = get_byte(s);
- if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
- s->z_err = Z_DATA_ERROR;
- return;
- }
-
- /* Discard time, xflags and OS code: */
- for (len = 0; len < 6; len++) (void)get_byte(s);
-
- if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
- len = (uInt)get_byte(s);
- len += ((uInt)get_byte(s))<<8;
- /* len is garbage if EOF but the loop below will quit anyway */
- while (len-- != 0 && get_byte(s) != EOF) ;
- }
- if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
- while ((c = get_byte(s)) != 0 && c != EOF) ;
- }
- if ((flags & COMMENT) != 0) { /* skip the .gz file comment */
- while ((c = get_byte(s)) != 0 && c != EOF) ;
- }
- if ((flags & HEAD_CRC) != 0) { /* skip the header crc */
- for (len = 0; len < 2; len++) (void)get_byte(s);
- }
- s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
-}
-
- /* ===========================================================================
- * Cleanup then free the given gz_stream. Return a zlib error code.
- Try freeing in the reverse order of allocations.
- */
-local int destroy (s)
- gz_stream *s;
-{
- int err = Z_OK;
-
- if (!s) return Z_STREAM_ERROR;
-
- TRYFREE(s->msg);
-
- if (s->stream.state != NULL) {
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- err = Z_STREAM_ERROR;
-#else
- err = deflateEnd(&(s->stream));
-#endif
- } else if (s->mode == 'r') {
- err = inflateEnd(&(s->stream));
- }
- }
- if (s->file != NULL && fclose(s->file)) {
-#ifdef ESPIPE
- if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
-#endif
- err = Z_ERRNO;
- }
- if (s->z_err < 0) err = s->z_err;
-
- TRYFREE(s->inbuf);
- TRYFREE(s->outbuf);
- TRYFREE(s->path);
- TRYFREE(s);
- return err;
-}
-
-/* ===========================================================================
- Reads the given number of uncompressed bytes from the compressed file.
- gzread returns the number of bytes actually read (0 for end of file).
-*/
-int ZEXPORT gzread (file, buf, len)
- gzFile file;
- voidp buf;
- unsigned len;
-{
- gz_stream *s = (gz_stream*)file;
- Bytef *start = (Bytef*)buf; /* starting point for crc computation */
- Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
-
- if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
-
- if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
- if (s->z_err == Z_STREAM_END) return 0; /* EOF */
-
- next_out = (Byte*)buf;
- s->stream.next_out = (Bytef*)buf;
- s->stream.avail_out = len;
-
- if (s->stream.avail_out && s->back != EOF) {
- *next_out++ = s->back;
- s->stream.next_out++;
- s->stream.avail_out--;
- s->back = EOF;
- s->out++;
- start++;
- if (s->last) {
- s->z_err = Z_STREAM_END;
- return 1;
- }
- }
-
- while (s->stream.avail_out != 0) {
-
- if (s->transparent) {
- /* Copy first the lookahead bytes: */
- uInt n = s->stream.avail_in;
- if (n > s->stream.avail_out) n = s->stream.avail_out;
- if (n > 0) {
- zmemcpy(s->stream.next_out, s->stream.next_in, n);
- next_out += n;
- s->stream.next_out = next_out;
- s->stream.next_in += n;
- s->stream.avail_out -= n;
- s->stream.avail_in -= n;
- }
- if (s->stream.avail_out > 0) {
- s->stream.avail_out -=
- (uInt)fread(next_out, 1, s->stream.avail_out, s->file);
- }
- len -= s->stream.avail_out;
- s->in += len;
- s->out += len;
- if (len == 0) s->z_eof = 1;
- return (int)len;
- }
- if (s->stream.avail_in == 0 && !s->z_eof) {
-
- errno = 0;
- s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
- if (s->stream.avail_in == 0) {
- s->z_eof = 1;
- if (ferror(s->file)) {
- s->z_err = Z_ERRNO;
- break;
- }
- }
- s->stream.next_in = s->inbuf;
- }
- s->in += s->stream.avail_in;
- s->out += s->stream.avail_out;
- s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
- s->in -= s->stream.avail_in;
- s->out -= s->stream.avail_out;
-
- if (s->z_err == Z_STREAM_END) {
- /* Check CRC and original size */
- s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
- start = s->stream.next_out;
-
- if (getLong(s) != s->crc) {
- s->z_err = Z_DATA_ERROR;
- } else {
- (void)getLong(s);
- /* The uncompressed length returned by above getlong() may be
- * different from s->out in case of concatenated .gz files.
- * Check for such files:
- */
- check_header(s);
- if (s->z_err == Z_OK) {
- inflateReset(&(s->stream));
- s->crc = crc32(0L, Z_NULL, 0);
- }
- }
- }
- if (s->z_err != Z_OK || s->z_eof) break;
- }
- s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
-
- if (len == s->stream.avail_out &&
- (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO))
- return -1;
- return (int)(len - s->stream.avail_out);
-}
-
-
-/* ===========================================================================
- Reads one byte from the compressed file. gzgetc returns this byte
- or -1 in case of end of file or error.
-*/
-int ZEXPORT gzgetc(file)
- gzFile file;
-{
- unsigned char c;
-
- return gzread(file, &c, 1) == 1 ? c : -1;
-}
-
-
-/* ===========================================================================
- Push one byte back onto the stream.
-*/
-int ZEXPORT gzungetc(c, file)
- int c;
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF;
- s->back = c;
- s->out--;
- s->last = (s->z_err == Z_STREAM_END);
- if (s->last) s->z_err = Z_OK;
- s->z_eof = 0;
- return c;
-}
-
-
-/* ===========================================================================
- Reads bytes from the compressed file until len-1 characters are
- read, or a newline character is read and transferred to buf, or an
- end-of-file condition is encountered. The string is then terminated
- with a null character.
- gzgets returns buf, or Z_NULL in case of error.
-
- The current implementation is not optimized at all.
-*/
-char * ZEXPORT gzgets(file, buf, len)
- gzFile file;
- char *buf;
- int len;
-{
- char *b = buf;
- if (buf == Z_NULL || len <= 0) return Z_NULL;
-
- while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
- *buf = '\0';
- return b == buf && len > 0 ? Z_NULL : b;
-}
-
-
-#ifndef NO_GZCOMPRESS
-/* ===========================================================================
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of bytes actually written (0 in case of error).
-*/
-int ZEXPORT gzwrite (file, buf, len)
- gzFile file;
- voidpc buf;
- unsigned len;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
-
- s->stream.next_in = (Bytef*)buf;
- s->stream.avail_in = len;
-
- while (s->stream.avail_in != 0) {
-
- if (s->stream.avail_out == 0) {
-
- s->stream.next_out = s->outbuf;
- if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
- s->z_err = Z_ERRNO;
- break;
- }
- s->stream.avail_out = Z_BUFSIZE;
- }
- s->in += s->stream.avail_in;
- s->out += s->stream.avail_out;
- s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
- s->in -= s->stream.avail_in;
- s->out -= s->stream.avail_out;
- if (s->z_err != Z_OK) break;
- }
- s->crc = crc32(s->crc, (const Bytef *)buf, len);
-
- return (int)(len - s->stream.avail_in);
-}
-
-
-/* ===========================================================================
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written (0 in case of error).
-*/
-#ifdef STDC
-#include <stdarg.h>
-
-int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
-{
- char buf[Z_PRINTF_BUFSIZE];
- va_list va;
- int len;
-
- buf[sizeof(buf) - 1] = 0;
- va_start(va, format);
-#ifdef NO_vsnprintf
-# ifdef HAS_vsprintf_void
- (void)vsprintf(buf, format, va);
- va_end(va);
- for (len = 0; len < sizeof(buf); len++)
- if (buf[len] == 0) break;
-# else
- len = vsprintf(buf, format, va);
- va_end(va);
-# endif
-#else
-# ifdef HAS_vsnprintf_void
- (void)vsnprintf(buf, sizeof(buf), format, va);
- va_end(va);
- len = strlen(buf);
-# else
- len = vsnprintf(buf, sizeof(buf), format, va);
- va_end(va);
-# endif
-#endif
- if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0)
- return 0;
- return gzwrite(file, buf, (unsigned)len);
-}
-#else /* not ANSI C */
-
-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
- gzFile file;
- const char *format;
- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
-{
- char buf[Z_PRINTF_BUFSIZE];
- int len;
-
- buf[sizeof(buf) - 1] = 0;
-#ifdef NO_snprintf
-# ifdef HAS_sprintf_void
- sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- for (len = 0; len < sizeof(buf); len++)
- if (buf[len] == 0) break;
-# else
- len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#else
-# ifdef HAS_snprintf_void
- snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- len = strlen(buf);
-# else
- len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#endif
- if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0)
- return 0;
- return gzwrite(file, buf, len);
-}
-#endif
-
-/* ===========================================================================
- Writes c, converted to an unsigned char, into the compressed file.
- gzputc returns the value that was written, or -1 in case of error.
-*/
-int ZEXPORT gzputc(file, c)
- gzFile file;
- int c;
-{
- unsigned char cc = (unsigned char) c; /* required for big endian systems */
-
- return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
-}
-
-
-/* ===========================================================================
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-int ZEXPORT gzputs(file, s)
- gzFile file;
- const char *s;
-{
- return gzwrite(file, (char*)s, (unsigned)strlen(s));
-}
-
-
-/* ===========================================================================
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function.
-*/
-local int do_flush (file, flush)
- gzFile file;
- int flush;
-{
- uInt len;
- int done = 0;
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
-
- s->stream.avail_in = 0; /* should be zero already anyway */
-
- for (;;) {
- len = Z_BUFSIZE - s->stream.avail_out;
-
- if (len != 0) {
- if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
- s->z_err = Z_ERRNO;
- return Z_ERRNO;
- }
- s->stream.next_out = s->outbuf;
- s->stream.avail_out = Z_BUFSIZE;
- }
- if (done) break;
- s->out += s->stream.avail_out;
- s->z_err = deflate(&(s->stream), flush);
- s->out -= s->stream.avail_out;
-
- /* Ignore the second of two consecutive flushes: */
- if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
-
- /* deflate has finished flushing only when it hasn't used up
- * all the available space in the output buffer:
- */
- done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
-
- if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
- }
- return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
-}
-
-int ZEXPORT gzflush (file, flush)
- gzFile file;
- int flush;
-{
- gz_stream *s = (gz_stream*)file;
- int err = do_flush (file, flush);
-
- if (err) return err;
- fflush(s->file);
- return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
-}
-#endif /* NO_GZCOMPRESS */
-
-/* ===========================================================================
- Sets the starting position for the next gzread or gzwrite on the given
- compressed file. The offset represents a number of bytes in the
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error.
- SEEK_END is not implemented, returns error.
- In this version of the library, gzseek can be extremely slow.
-*/
-z_off_t ZEXPORT gzseek (file, offset, whence)
- gzFile file;
- z_off_t offset;
- int whence;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || whence == SEEK_END ||
- s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
- return -1L;
- }
-
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- return -1L;
-#else
- if (whence == SEEK_SET) {
- offset -= s->in;
- }
- if (offset < 0) return -1L;
-
- /* At this point, offset is the number of zero bytes to write. */
- if (s->inbuf == Z_NULL) {
- s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
- if (s->inbuf == Z_NULL) return -1L;
- zmemzero(s->inbuf, Z_BUFSIZE);
- }
- while (offset > 0) {
- uInt size = Z_BUFSIZE;
- if (offset < Z_BUFSIZE) size = (uInt)offset;
-
- size = gzwrite(file, s->inbuf, size);
- if (size == 0) return -1L;
-
- offset -= size;
- }
- return s->in;
-#endif
- }
- /* Rest of function is for reading only */
-
- /* compute absolute position */
- if (whence == SEEK_CUR) {
- offset += s->out;
- }
- if (offset < 0) return -1L;
-
- if (s->transparent) {
- /* map to fseek */
- s->back = EOF;
- s->stream.avail_in = 0;
- s->stream.next_in = s->inbuf;
- if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
-
- s->in = s->out = offset;
- return offset;
- }
-
- /* For a negative seek, rewind and use positive seek */
- if (offset >= s->out) {
- offset -= s->out;
- } else if (gzrewind(file) < 0) {
- return -1L;
- }
- /* offset is now the number of bytes to skip. */
-
- if (offset != 0 && s->outbuf == Z_NULL) {
- s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
- if (s->outbuf == Z_NULL) return -1L;
- }
- if (offset && s->back != EOF) {
- s->back = EOF;
- s->out++;
- offset--;
- if (s->last) s->z_err = Z_STREAM_END;
- }
- while (offset > 0) {
- int size = Z_BUFSIZE;
- if (offset < Z_BUFSIZE) size = (int)offset;
-
- size = gzread(file, s->outbuf, (uInt)size);
- if (size <= 0) return -1L;
- offset -= size;
- }
- return s->out;
-}
-
-/* ===========================================================================
- Rewinds input file.
-*/
-int ZEXPORT gzrewind (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'r') return -1;
-
- s->z_err = Z_OK;
- s->z_eof = 0;
- s->back = EOF;
- s->stream.avail_in = 0;
- s->stream.next_in = s->inbuf;
- s->crc = crc32(0L, Z_NULL, 0);
- if (!s->transparent) (void)inflateReset(&s->stream);
- s->in = 0;
- s->out = 0;
- return fseek(s->file, s->start, SEEK_SET);
-}
-
-/* ===========================================================================
- Returns the starting position for the next gzread or gzwrite on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
-*/
-z_off_t ZEXPORT gztell (file)
- gzFile file;
-{
- return gzseek(file, 0L, SEEK_CUR);
-}
-
-/* ===========================================================================
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
-*/
-int ZEXPORT gzeof (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- /* With concatenated compressed files that can have embedded
- * crc trailers, z_eof is no longer the only/best indicator of EOF
- * on a gz_stream. Handle end-of-stream error explicitly here.
- */
- if (s == NULL || s->mode != 'r') return 0;
- if (s->z_eof) return 1;
- return s->z_err == Z_STREAM_END;
-}
-
-/* ===========================================================================
- Returns 1 if reading and doing so transparently, otherwise zero.
-*/
-int ZEXPORT gzdirect (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'r') return 0;
- return s->transparent;
-}
-
-/* ===========================================================================
- Outputs a long in LSB order to the given file
-*/
-local void putLong (file, x)
- FILE *file;
- uLong x;
-{
- int n;
- for (n = 0; n < 4; n++) {
- fputc((int)(x & 0xff), file);
- x >>= 8;
- }
-}
-
-/* ===========================================================================
- Reads a long in LSB order from the given gz_stream. Sets z_err in case
- of error.
-*/
-local uLong getLong (s)
- gz_stream *s;
-{
- uLong x = (uLong)get_byte(s);
- int c;
-
- x += ((uLong)get_byte(s))<<8;
- x += ((uLong)get_byte(s))<<16;
- c = get_byte(s);
- if (c == EOF) s->z_err = Z_DATA_ERROR;
- x += ((uLong)c)<<24;
- return x;
-}
-
-/* ===========================================================================
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state.
-*/
-int ZEXPORT gzclose (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL) return Z_STREAM_ERROR;
-
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- return Z_STREAM_ERROR;
-#else
- if (do_flush (file, Z_FINISH) != Z_OK)
- return destroy((gz_stream*)file);
-
- putLong (s->file, s->crc);
- putLong (s->file, (uLong)(s->in & 0xffffffff));
-#endif
- }
- return destroy((gz_stream*)file);
-}
-
-#ifdef STDC
-# define zstrerror(errnum) strerror(errnum)
-#else
-# define zstrerror(errnum) ""
-#endif
-
-/* ===========================================================================
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
-*/
-const char * ZEXPORT gzerror (file, errnum)
- gzFile file;
- int *errnum;
-{
- char *m;
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL) {
- *errnum = Z_STREAM_ERROR;
- return (const char*)ERR_MSG(Z_STREAM_ERROR);
- }
- *errnum = s->z_err;
- if (*errnum == Z_OK) return (const char*)"";
-
- m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
-
- if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
-
- TRYFREE(s->msg);
- s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
- if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR);
- strcpy(s->msg, s->path);
- strcat(s->msg, ": ");
- strcat(s->msg, m);
- return (const char*)s->msg;
-}
-
-/* ===========================================================================
- Clear the error and end-of-file flags, and do the same for the real file.
-*/
-void ZEXPORT gzclearerr (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL) return;
- if (s->z_err != Z_STREAM_END) s->z_err = Z_OK;
- s->z_eof = 0;
- clearerr(s->file);
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/infback.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/infback.c
deleted file mode 100644
index 3fc03f8..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/infback.c
+++ /dev/null
@@ -1,647 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* infback.c -- inflate using a call-back interface
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- This code is largely copied from inflate.c. Normally either infback.o or
- inflate.o would be linked into an application--not both. The interface
- with inffast.c is retained so that optimized assembler-coded versions of
- inflate_fast() can be used with either inflate.c or infback.c.
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-/* function prototypes */
-local void fixedtables OF((struct inflate_state FAR *state));
-
-/*
- strm provides memory allocation functions in zalloc and zfree, or
- Z_NULL to use the library memory allocation functions.
-
- windowBits is in the range 8..15, and window is a user-supplied
- window and output buffer that is 2**windowBits bytes.
- */
-int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
-z_streamp strm;
-int windowBits;
-unsigned char FAR *window;
-const char *version;
-int stream_size;
-{
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL || window == Z_NULL ||
- windowBits < 8 || windowBits > 15)
- return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
- }
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
- state = (struct inflate_state FAR *)ZALLOC(strm, 1,
- sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- state->dmax = 32768U;
- state->wbits = windowBits;
- state->wsize = 1U << windowBits;
- state->window = window;
- state->write = 0;
- state->whave = 0;
- return Z_OK;
-}
-
-/*
- Return state with length and distance decoding tables and index sizes set to
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
- If BUILDFIXED is defined, then instead this routine builds the tables the
- first time it's called, and returns those tables the first time and
- thereafter. This reduces the size of the code by about 2K bytes, in
- exchange for a little execution time. However, BUILDFIXED should not be
- used for threaded applications, since the rewriting of the tables and virgin
- may not be thread-safe.
- */
-local void fixedtables(state)
-struct inflate_state FAR *state;
-{
-#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
-#else /* !BUILDFIXED */
-# include "inffixed.h"
-#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
-}
-
-/* Macros for inflateBack(): */
-
-/* Load returned state from inflate_fast() */
-#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
-
-/* Set state from registers for inflate_fast() */
-#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
-
-/* Clear the input bit accumulator */
-#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
-
-/* Assure that some input is available. If input is requested, but denied,
- then return a Z_BUF_ERROR from inflateBack(). */
-#define PULL() \
- do { \
- if (have == 0) { \
- have = in(in_desc, &next); \
- if (have == 0) { \
- next = Z_NULL; \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/* Get a byte of input into the bit accumulator, or return from inflateBack()
- with an error if there is no input available. */
-#define PULLBYTE() \
- do { \
- PULL(); \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
-
-/* Assure that there are at least n bits in the bit accumulator. If there is
- not enough available input to do that, then return from inflateBack() with
- an error. */
-#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
-
-/* Return the low n bits of the bit accumulator (n < 16) */
-#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
-
-/* Remove n bits from the bit accumulator */
-#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
-
-/* Remove zero to seven bits as needed to go to a byte boundary */
-#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
-
-/* Assure that some output space is available, by writing out the window
- if it's full. If the write fails, return from inflateBack() with a
- Z_BUF_ERROR. */
-#define ROOM() \
- do { \
- if (left == 0) { \
- put = state->window; \
- left = state->wsize; \
- state->whave = left; \
- if (out(out_desc, put, left)) { \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/*
- strm provides the memory allocation functions and window buffer on input,
- and provides information on the unused input on return. For Z_DATA_ERROR
- returns, strm will also provide an error message.
-
- in() and out() are the call-back input and output functions. When
- inflateBack() needs more input, it calls in(). When inflateBack() has
- filled the window with output, or when it completes with data in the
- window, it calls out() to write out the data. The application must not
- change the provided input until in() is called again or inflateBack()
- returns. The application must not change the window/output buffer until
- inflateBack() returns.
-
- in() and out() are called with a descriptor parameter provided in the
- inflateBack() call. This parameter can be a structure that provides the
- information required to do the read or write, as well as accumulated
- information on the input and output such as totals and check values.
-
- in() should return zero on failure. out() should return non-zero on
- failure. If either in() or out() fails, than inflateBack() returns a
- Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
- was in() or out() that caused in the error. Otherwise, inflateBack()
- returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
- error, or Z_MEM_ERROR if it could not allocate memory for the state.
- inflateBack() can also return Z_STREAM_ERROR if the input parameters
- are not correct, i.e. strm is Z_NULL or the state was not initialized.
- */
-int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
-z_streamp strm;
-in_func in;
-void FAR *in_desc;
-out_func out;
-void FAR *out_desc;
-{
- struct inflate_state FAR *state;
- unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code this; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- /* Check that the strm exists and that the state was initialized */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* Reset the state */
- strm->msg = Z_NULL;
- state->mode = TYPE;
- state->last = 0;
- state->whave = 0;
- next = strm->next_in;
- have = next != Z_NULL ? strm->avail_in : 0;
- hold = 0;
- bits = 0;
- put = state->window;
- left = state->wsize;
-
- /* Inflate until end of block marked as last */
- for (;;)
- switch (state->mode) {
- case TYPE:
- /* determine and dispatch block type */
- if (state->last) {
- BYTEBITS();
- state->mode = DONE;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN; /* decode codes */
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
-
- case STORED:
- /* get and verify stored block length */
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
-
- /* copy stored block from input to output */
- while (state->length != 0) {
- copy = state->length;
- PULL();
- ROOM();
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
-
- case TABLE:
- /* get dynamic table entries descriptor */
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
-#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
-#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
-
- /* get code length code lengths (not a typo) */
- state->have = 0;
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
-
- /* get length and distance code code lengths */
- state->have = 0;
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- this = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.val < 16) {
- NEEDBITS(this.bits);
- DROPBITS(this.bits);
- state->lens[state->have++] = this.val;
- }
- else {
- if (this.val == 16) {
- NEEDBITS(this.bits + 2);
- DROPBITS(this.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = (unsigned)(state->lens[state->have - 1]);
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (this.val == 17) {
- NEEDBITS(this.bits + 3);
- DROPBITS(this.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(this.bits + 7);
- DROPBITS(this.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* build code tables */
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (code const FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN;
-
- case LEN:
- /* use inflate_fast() if we have enough input and output */
- if (have >= 6 && left >= 258) {
- RESTORE();
- if (state->whave < state->wsize)
- state->whave = state->wsize - left;
- inflate_fast(strm, state->wsize);
- LOAD();
- break;
- }
-
- /* get a literal, length, or end-of-block code */
- for (;;) {
- this = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.op && (this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- state->length = (unsigned)this.val;
-
- /* process literal */
- if (this.op == 0) {
- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", this.val));
- ROOM();
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- }
-
- /* process end of block */
- if (this.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
-
- /* invalid code */
- if (this.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
-
- /* length code -- get extra bits, if any */
- state->extra = (unsigned)(this.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
-
- /* get distance code */
- for (;;) {
- this = state->distcode[BITS(state->distbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if ((this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- if (this.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)this.val;
-
- /* get distance extra bits, if any */
- state->extra = (unsigned)(this.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- }
- if (state->offset > state->wsize - (state->whave < state->wsize ?
- left : 0)) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
-
- /* copy match from window to output */
- do {
- ROOM();
- copy = state->wsize - state->offset;
- if (copy < left) {
- from = put + copy;
- copy = left - copy;
- }
- else {
- from = put - state->offset;
- copy = left;
- }
- if (copy > state->length) copy = state->length;
- state->length -= copy;
- left -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- } while (state->length != 0);
- break;
-
- case DONE:
- /* inflate stream terminated properly -- write leftover output */
- ret = Z_STREAM_END;
- if (left < state->wsize) {
- if (out(out_desc, state->window, state->wsize - left))
- ret = Z_BUF_ERROR;
- }
- goto inf_leave;
-
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
-
- default: /* can't happen, but makes compilers happy */
- ret = Z_STREAM_ERROR;
- goto inf_leave;
- }
-
- /* Return unused input */
- inf_leave:
- strm->next_in = next;
- strm->avail_in = have;
- return ret;
-}
-
-int ZEXPORT inflateBackEnd(strm)
-z_streamp strm;
-{
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.c
deleted file mode 100644
index eaffa05..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* inffast.c -- fast decoding
- * Copyright (C) 1995-2004 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-#ifndef ASMINF
-
-/* Allow machine dependent optimization for post-increment or pre-increment.
- Based on testing to date,
- Pre-increment preferred for:
- - PowerPC G3 (Adler)
- - MIPS R5000 (Randers-Pehrson)
- Post-increment preferred for:
- - none
- No measurable difference:
- - Pentium III (Anderson)
- - M68060 (Nikl)
- */
-#ifdef POSTINC
-# define OFF 0
-# define PUP(a) *(a)++
-#else
-# define OFF 1
-# define PUP(a) *++(a)
-#endif
-
-/*
- Decode literal, length, and distance codes and write out the resulting
- literal and match bytes until either not enough input or output is
- available, an end-of-block is encountered, or a data error is encountered.
- When large enough input and output buffers are supplied to inflate(), for
- example, a 16K input buffer and a 64K output buffer, more than 95% of the
- inflate execution time is spent in this routine.
-
- Entry assumptions:
-
- state->mode == LEN
- strm->avail_in >= 6
- strm->avail_out >= 258
- start >= strm->avail_out
- state->bits < 8
-
- On return, state->mode is one of:
-
- LEN -- ran out of enough output space or enough available input
- TYPE -- reached end of block code, inflate() to interpret next block
- BAD -- error in block data
-
- Notes:
-
- - The maximum input bits used by a length/distance pair is 15 bits for the
- length code, 5 bits for the length extra, 15 bits for the distance code,
- and 13 bits for the distance extra. This totals 48 bits, or six bytes.
- Therefore if strm->avail_in >= 6, then there is enough input to avoid
- checking for available input while decoding.
-
- - The maximum bytes that a single length/distance pair can output is 258
- bytes, which is the maximum length that can be coded. inflate_fast()
- requires strm->avail_out >= 258 for each loop to avoid checking for
- output space.
- */
-void inflate_fast(strm, start)
-z_streamp strm;
-unsigned start; /* inflate()'s starting value for strm->avail_out */
-{
- struct inflate_state FAR *state;
- unsigned char FAR *in; /* local strm->next_in */
- unsigned char FAR *last; /* while in < last, enough input available */
- unsigned char FAR *out; /* local strm->next_out */
- unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
- unsigned char FAR *end; /* while out < end, enough space available */
-#ifdef INFLATE_STRICT
- unsigned dmax; /* maximum distance from zlib header */
-#endif
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned write; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
- unsigned long hold; /* local strm->hold */
- unsigned bits; /* local strm->bits */
- code const FAR *lcode; /* local strm->lencode */
- code const FAR *dcode; /* local strm->distcode */
- unsigned lmask; /* mask for first level of length codes */
- unsigned dmask; /* mask for first level of distance codes */
- code this; /* retrieved table entry */
- unsigned op; /* code bits, operation, extra bits, or */
- /* window position, window bytes to copy */
- unsigned len; /* match length, unused bytes */
- unsigned dist; /* match distance */
- unsigned char FAR *from; /* where to copy match from */
-
- /* copy state to local variables */
- state = (struct inflate_state FAR *)strm->state;
- in = strm->next_in - OFF;
- last = in + (strm->avail_in - 5);
- out = strm->next_out - OFF;
- beg = out - (start - strm->avail_out);
- end = out + (strm->avail_out - 257);
-#ifdef INFLATE_STRICT
- dmax = state->dmax;
-#endif
- wsize = state->wsize;
- whave = state->whave;
- write = state->write;
- window = state->window;
- hold = state->hold;
- bits = state->bits;
- lcode = state->lencode;
- dcode = state->distcode;
- lmask = (1U << state->lenbits) - 1;
- dmask = (1U << state->distbits) - 1;
-
- /* decode literals and length/distances until end-of-block or not enough
- input data or output space */
- do {
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- this = lcode[hold & lmask];
- dolen:
- op = (unsigned)(this.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(this.op);
- if (op == 0) { /* literal */
- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", this.val));
- PUP(out) = (unsigned char)(this.val);
- }
- else if (op & 16) { /* length base */
- len = (unsigned)(this.val);
- op &= 15; /* number of extra bits */
- if (op) {
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- len += (unsigned)hold & ((1U << op) - 1);
- hold >>= op;
- bits -= op;
- }
- Tracevv((stderr, "inflate: length %u\n", len));
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- this = dcode[hold & dmask];
- dodist:
- op = (unsigned)(this.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(this.op);
- if (op & 16) { /* distance base */
- dist = (unsigned)(this.val);
- op &= 15; /* number of extra bits */
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- }
- dist += (unsigned)hold & ((1U << op) - 1);
-#ifdef INFLATE_STRICT
- if (dist > dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#endif
- hold >>= op;
- bits -= op;
- Tracevv((stderr, "inflate: distance %u\n", dist));
- op = (unsigned)(out - beg); /* max distance in output */
- if (dist > op) { /* see if copy from window */
- op = dist - op; /* distance back in window */
- if (op > whave) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
- from = window - OFF;
- if (write == 0) { /* very common case */
- from += wsize - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- else if (write < op) { /* wrap around window */
- from += wsize + write - op;
- op -= write;
- if (op < len) { /* some from end of window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = window - OFF;
- if (write < len) { /* some from start of window */
- op = write;
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- }
- else { /* contiguous in window */
- from += write - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- while (len > 2) {
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- }
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- else {
- from = out - dist; /* copy direct from output */
- do { /* minimum length is three */
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- } while (len > 2);
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- }
- else if ((op & 64) == 0) { /* 2nd level distance code */
- this = dcode[this.val + (hold & ((1U << op) - 1))];
- goto dodist;
- }
- else {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- }
- else if ((op & 64) == 0) { /* 2nd level length code */
- this = lcode[this.val + (hold & ((1U << op) - 1))];
- goto dolen;
- }
- else if (op & 32) { /* end-of-block */
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
- else {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- } while (in < last && out < end);
-
- /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
- len = bits >> 3;
- in -= len;
- bits -= len << 3;
- hold &= (1U << bits) - 1;
-
- /* update state and return */
- strm->next_in = in + OFF;
- strm->next_out = out + OFF;
- strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
- strm->avail_out = (unsigned)(out < end ?
- 257 + (end - out) : 257 - (out - end));
- state->hold = hold;
- state->bits = bits;
- return;
-}
-
-/*
- inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
- - Using bit fields for code structure
- - Different op definition to avoid & for extra bits (do & for table bits)
- - Three separate decoding do-loops for direct, window, and write == 0
- - Special case for distance > 1 copies to do overlapped load and store copy
- - Explicit branch predictions (based on measured branch probabilities)
- - Deferring match copy and interspersed it with decoding subsequent codes
- - Swapping literal/length else
- - Swapping window/direct else
- - Larger unrolled copy loops (three is about right)
- - Moving len -= 3 statement into middle of loop
- */
-
-#endif /* !ASMINF */
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.h
deleted file mode 100644
index c45d087..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* inffast.h -- header to use inffast.c
- * Copyright (C) 1995-2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-void inflate_fast OF((z_streamp strm, unsigned start));
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffixed.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffixed.h
deleted file mode 100644
index f44fee2..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inffixed.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /* inffixed.h -- table for decoding fixed codes
- * Generated automatically by makefixed().
- */
-
- /* WARNING: this file should *not* be used by applications. It
- is part of the implementation of the compression library and
- is subject to change. Applications should only use zlib.h.
- */
-
- static const code lenfix[512] = {
- {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
- {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
- {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
- {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
- {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
- {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
- {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
- {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
- {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
- {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
- {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
- {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
- {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
- {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
- {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
- {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
- {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
- {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
- {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
- {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
- {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
- {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
- {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
- {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
- {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
- {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
- {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
- {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
- {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
- {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
- {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
- {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
- {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
- {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
- {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
- {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
- {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
- {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
- {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
- {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
- {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
- {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
- {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
- {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
- {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
- {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
- {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
- {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
- {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
- {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
- {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
- {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
- {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
- {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
- {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
- {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
- {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
- {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
- {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
- {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
- {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
- {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
- {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
- {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
- {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
- {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
- {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
- {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
- {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
- {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
- {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
- {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
- {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
- {0,9,255}
- };
-
- static const code distfix[32] = {
- {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
- {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
- {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
- {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
- {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
- {22,5,193},{64,5,0}
- };
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.c
deleted file mode 100644
index caf1ad0..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.c
+++ /dev/null
@@ -1,1392 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* inflate.c -- zlib decompression
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * Change history:
- *
- * 1.2.beta0 24 Nov 2002
- * - First version -- complete rewrite of inflate to simplify code, avoid
- * creation of window when not needed, minimize use of window when it is
- * needed, make inffast.c even faster, implement gzip decoding, and to
- * improve code readability and style over the previous zlib inflate code
- *
- * 1.2.beta1 25 Nov 2002
- * - Use pointers for available input and output checking in inffast.c
- * - Remove input and output counters in inffast.c
- * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
- * - Remove unnecessary second byte pull from length extra in inffast.c
- * - Unroll direct copy to three copies per loop in inffast.c
- *
- * 1.2.beta2 4 Dec 2002
- * - Change external routine names to reduce potential conflicts
- * - Correct filename to inffixed.h for fixed tables in inflate.c
- * - Make hbuf[] unsigned char to match parameter type in inflate.c
- * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
- * to avoid negation problem on Alphas (64 bit) in inflate.c
- *
- * 1.2.beta3 22 Dec 2002
- * - Add comments on state->bits assertion in inffast.c
- * - Add comments on op field in inftrees.h
- * - Fix bug in reuse of allocated window after inflateReset()
- * - Remove bit fields--back to byte structure for speed
- * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
- * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
- * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
- * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
- * - Use local copies of stream next and avail values, as well as local bit
- * buffer and bit count in inflate()--for speed when inflate_fast() not used
- *
- * 1.2.beta4 1 Jan 2003
- * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
- * - Move a comment on output buffer sizes from inffast.c to inflate.c
- * - Add comments in inffast.c to introduce the inflate_fast() routine
- * - Rearrange window copies in inflate_fast() for speed and simplification
- * - Unroll last copy for window match in inflate_fast()
- * - Use local copies of window variables in inflate_fast() for speed
- * - Pull out common write == 0 case for speed in inflate_fast()
- * - Make op and len in inflate_fast() unsigned for consistency
- * - Add FAR to lcode and dcode declarations in inflate_fast()
- * - Simplified bad distance check in inflate_fast()
- * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
- * source file infback.c to provide a call-back interface to inflate for
- * programs like gzip and unzip -- uses window as output buffer to avoid
- * window copying
- *
- * 1.2.beta5 1 Jan 2003
- * - Improved inflateBack() interface to allow the caller to provide initial
- * input in strm.
- * - Fixed stored blocks bug in inflateBack()
- *
- * 1.2.beta6 4 Jan 2003
- * - Added comments in inffast.c on effectiveness of POSTINC
- * - Typecasting all around to reduce compiler warnings
- * - Changed loops from while (1) or do {} while (1) to for (;;), again to
- * make compilers happy
- * - Changed type of window in inflateBackInit() to unsigned char *
- *
- * 1.2.beta7 27 Jan 2003
- * - Changed many types to unsigned or unsigned short to avoid warnings
- * - Added inflateCopy() function
- *
- * 1.2.0 9 Mar 2003
- * - Changed inflateBack() interface to provide separate opaque descriptors
- * for the in() and out() functions
- * - Changed inflateBack() argument and in_func typedef to swap the length
- * and buffer address return values for the input function
- * - Check next_in and next_out for Z_NULL on entry to inflate()
- *
- * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-#ifdef MAKEFIXED
-# ifndef BUILDFIXED
-# define BUILDFIXED
-# endif
-#endif
-
-/* function prototypes */
-local void fixedtables OF((struct inflate_state FAR *state));
-local int updatewindow OF((z_streamp strm, unsigned out));
-#ifdef BUILDFIXED
- void makefixed OF((void));
-#endif
-local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
- unsigned len));
-
-int ZEXPORT inflateReset(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- strm->total_in = strm->total_out = state->total = 0;
- strm->msg = Z_NULL;
- strm->adler = 1; /* to support ill-conceived Java test suite */
- state->mode = HEAD;
- state->last = 0;
- state->havedict = 0;
- state->dmax = 32768U;
- state->head = Z_NULL;
- state->wsize = 0;
- state->whave = 0;
- state->write = 0;
- state->hold = 0;
- state->bits = 0;
- state->lencode = state->distcode = state->next = state->codes;
- Tracev((stderr, "inflate: reset\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflatePrime(strm, bits, value)
-z_streamp strm;
-int bits;
-int value;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
- value &= (1L << bits) - 1;
- state->hold += value << state->bits;
- state->bits += bits;
- return Z_OK;
-}
-
-int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
-z_streamp strm;
-int windowBits;
-const char *version;
-int stream_size;
-{
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL) return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
- }
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
- state = (struct inflate_state FAR *)
- ZALLOC(strm, 1, sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- if (windowBits < 0) {
- state->wrap = 0;
- windowBits = -windowBits;
- }
- else {
- state->wrap = (windowBits >> 4) + 1;
-#ifdef GUNZIP
- if (windowBits < 48) windowBits &= 15;
-#endif
- }
- if (windowBits < 8 || windowBits > 15) {
- ZFREE(strm, state);
- strm->state = Z_NULL;
- return Z_STREAM_ERROR;
- }
- state->wbits = (unsigned)windowBits;
- state->window = Z_NULL;
- return inflateReset(strm);
-}
-
-int ZEXPORT inflateInit_(strm, version, stream_size)
-z_streamp strm;
-const char *version;
-int stream_size;
-{
- return inflateInit2_(strm, DEF_WBITS, version, stream_size);
-}
-
-/*
- Return state with length and distance decoding tables and index sizes set to
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
- If BUILDFIXED is defined, then instead this routine builds the tables the
- first time it's called, and returns those tables the first time and
- thereafter. This reduces the size of the code by about 2K bytes, in
- exchange for a little execution time. However, BUILDFIXED should not be
- used for threaded applications, since the rewriting of the tables and virgin
- may not be thread-safe.
- */
-local void fixedtables(state)
-struct inflate_state FAR *state;
-{
-#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
-#else /* !BUILDFIXED */
-# include "inffixed.h"
-#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
-}
-
-#ifdef MAKEFIXED
-#include <stdio.h>
-
-/*
- Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also
- defines BUILDFIXED, so the tables are built on the fly. makefixed() writes
- those tables to stdout, which would be piped to inffixed.h. A small program
- can simply call makefixed to do this:
-
- void makefixed(void);
-
- int main(void)
- {
- makefixed();
- return 0;
- }
-
- Then that can be linked with zlib built with MAKEFIXED defined and run:
-
- a.out > inffixed.h
- */
-void makefixed()
-{
- unsigned low, size;
- struct inflate_state state;
-
- fixedtables(&state);
- puts(" /* inffixed.h -- table for decoding fixed codes");
- puts(" * Generated automatically by makefixed().");
- puts(" */");
- puts("");
- puts(" /* WARNING: this file should *not* be used by applications.");
- puts(" It is part of the implementation of this library and is");
- puts(" subject to change. Applications should only use zlib.h.");
- puts(" */");
- puts("");
- size = 1U << 9;
- printf(" static const code lenfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 7) == 0) printf("\n ");
- printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
- state.lencode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
- size = 1U << 5;
- printf("\n static const code distfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 6) == 0) printf("\n ");
- printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
- state.distcode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
-}
-#endif /* MAKEFIXED */
-
-/*
- Update the window with the last wsize (normally 32K) bytes written before
- returning. If window does not exist yet, create it. This is only called
- when a window is already in use, or when output has been written during this
- inflate call, but the end of the deflate stream has not been reached yet.
- It is also called to create a window for dictionary data when a dictionary
- is loaded.
-
- Providing output buffers larger than 32K to inflate() should provide a speed
- advantage, since only the last 32K of output is copied to the sliding window
- upon return from inflate(), and since all distances after the first 32K of
- output will fall in the output data, making match copies simpler and faster.
- The advantage may be dependent on the size of the processor's data caches.
- */
-local int updatewindow(strm, out)
-z_streamp strm;
-unsigned out;
-{
- struct inflate_state FAR *state;
- unsigned copy, dist;
-
- state = (struct inflate_state FAR *)strm->state;
-
- /* if it hasn't been done already, allocate space for the window */
- if (state->window == Z_NULL) {
- state->window = (unsigned char FAR *)
- ZALLOC(strm, 1U << state->wbits,
- sizeof(unsigned char));
- if (state->window == Z_NULL) return 1;
- }
-
- /* if window not in use yet, initialize */
- if (state->wsize == 0) {
- state->wsize = 1U << state->wbits;
- state->write = 0;
- state->whave = 0;
- }
-
- /* copy state->wsize or less output bytes into the circular window */
- copy = out - strm->avail_out;
- if (copy >= state->wsize) {
- zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
- state->write = 0;
- state->whave = state->wsize;
- }
- else {
- dist = state->wsize - state->write;
- if (dist > copy) dist = copy;
- zmemcpy(state->window + state->write, strm->next_out - copy, dist);
- copy -= dist;
- if (copy) {
- zmemcpy(state->window, strm->next_out - copy, copy);
- state->write = copy;
- state->whave = state->wsize;
- }
- else {
- state->write += dist;
- if (state->write == state->wsize) state->write = 0;
- if (state->whave < state->wsize) state->whave += dist;
- }
- }
- return 0;
-}
-
-/* Macros for inflate(): */
-
-/* check function to use adler32() for zlib or crc32() for gzip */
-#ifdef GUNZIP
-# define UPDATE(check, buf, len) \
- (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
-#else
-# define UPDATE(check, buf, len) adler32(check, buf, len)
-#endif
-
-/* check macros for header crc */
-#ifdef GUNZIP
-# define CRC2(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- check = crc32(check, hbuf, 2); \
- } while (0)
-
-# define CRC4(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- hbuf[2] = (unsigned char)((word) >> 16); \
- hbuf[3] = (unsigned char)((word) >> 24); \
- check = crc32(check, hbuf, 4); \
- } while (0)
-#endif
-
-/* Load registers with state in inflate() for speed */
-#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
-
-/* Restore state from registers in inflate() */
-#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
-
-/* Clear the input bit accumulator */
-#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
-
-/* Get a byte of input into the bit accumulator, or return from inflate()
- if there is no input available. */
-#define PULLBYTE() \
- do { \
- if (have == 0) goto inf_leave; \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
-
-/* Assure that there are at least n bits in the bit accumulator. If there is
- not enough available input to do that, then return from inflate(). */
-#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
-
-/* Return the low n bits of the bit accumulator (n < 16) */
-#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
-
-/* Remove n bits from the bit accumulator */
-#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
-
-/* Remove zero to seven bits as needed to go to a byte boundary */
-#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
-
-/* Reverse the bytes in a 32-bit value */
-#define REVERSE(q) \
- ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
-
-/*
- inflate() uses a state machine to process as much input data and generate as
- much output data as possible before returning. The state machine is
- structured roughly as follows:
-
- for (;;) switch (state) {
- ...
- case STATEn:
- if (not enough input data or output space to make progress)
- return;
- ... make progress ...
- state = STATEm;
- break;
- ...
- }
-
- so when inflate() is called again, the same case is attempted again, and
- if the appropriate resources are provided, the machine proceeds to the
- next state. The NEEDBITS() macro is usually the way the state evaluates
- whether it can proceed or should return. NEEDBITS() does the return if
- the requested bits are not available. The typical use of the BITS macros
- is:
-
- NEEDBITS(n);
- ... do something with BITS(n) ...
- DROPBITS(n);
-
- where NEEDBITS(n) either returns from inflate() if there isn't enough
- input left to load n bits into the accumulator, or it continues. BITS(n)
- gives the low n bits in the accumulator. When done, DROPBITS(n) drops
- the low n bits off the accumulator. INITBITS() clears the accumulator
- and sets the number of available bits to zero. BYTEBITS() discards just
- enough bits to put the accumulator on a byte boundary. After BYTEBITS()
- and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
-
- NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
- if there is no input available. The decoding of variable length codes uses
- PULLBYTE() directly in order to pull just enough bytes to decode the next
- code, and no more.
-
- Some states loop until they get enough input, making sure that enough
- state information is maintained to continue the loop where it left off
- if NEEDBITS() returns in the loop. For example, want, need, and keep
- would all have to actually be part of the saved state in case NEEDBITS()
- returns:
-
- case STATEw:
- while (want < need) {
- NEEDBITS(n);
- keep[want++] = BITS(n);
- DROPBITS(n);
- }
- state = STATEx;
- case STATEx:
-
- As shown above, if the next state is also the next case, then the break
- is omitted.
-
- A state may also return if there is not enough output space available to
- complete that state. Those states are copying stored data, writing a
- literal byte, and copying a matching string.
-
- When returning, a "goto inf_leave" is used to update the total counters,
- update the check value, and determine whether any progress has been made
- during that inflate() call in order to return the proper return code.
- Progress is defined as a change in either strm->avail_in or strm->avail_out.
- When there is a window, goto inf_leave will update the window with the last
- output written. If a goto inf_leave occurs in the middle of decompression
- and there is no window currently, goto inf_leave will create one and copy
- output to the window for the next call of inflate().
-
- In this implementation, the flush parameter of inflate() only affects the
- return code (per zlib.h). inflate() always writes as much as possible to
- strm->next_out, given the space available and the provided input--the effect
- documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
- the allocation of and copying into a sliding window until necessary, which
- provides the effect documented in zlib.h for Z_FINISH when the entire input
- stream available. So the only thing the flush parameter actually does is:
- when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
- will return Z_BUF_ERROR if it has not reached the end of the stream.
- */
-
-int ZEXPORT inflate(strm, flush)
-z_streamp strm;
-int flush;
-{
- struct inflate_state FAR *state;
- unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned in, out; /* save starting available input and output */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code this; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
-#ifdef GUNZIP
- unsigned char hbuf[4]; /* buffer for gzip header crc calculation */
-#endif
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0))
- return Z_STREAM_ERROR;
-
- state = (struct inflate_state FAR *)strm->state;
- if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
- LOAD();
- in = have;
- out = left;
- ret = Z_OK;
- for (;;)
- switch (state->mode) {
- case HEAD:
- if (state->wrap == 0) {
- state->mode = TYPEDO;
- break;
- }
- NEEDBITS(16);
-#ifdef GUNZIP
- if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
- state->check = crc32(0L, Z_NULL, 0);
- CRC2(state->check, hold);
- INITBITS();
- state->mode = FLAGS;
- break;
- }
- state->flags = 0; /* expect zlib header */
- if (state->head != Z_NULL)
- state->head->done = -1;
- if (!(state->wrap & 1) || /* check if zlib header allowed */
-#else
- if (
-#endif
- ((BITS(8) << 8) + (hold >> 8)) % 31) {
- strm->msg = (char *)"incorrect header check";
- state->mode = BAD;
- break;
- }
- if (BITS(4) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- DROPBITS(4);
- len = BITS(4) + 8;
- if (len > state->wbits) {
- strm->msg = (char *)"invalid window size";
- state->mode = BAD;
- break;
- }
- state->dmax = 1U << len;
- Tracev((stderr, "inflate: zlib header ok\n"));
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = hold & 0x200 ? DICTID : TYPE;
- INITBITS();
- break;
-#ifdef GUNZIP
- case FLAGS:
- NEEDBITS(16);
- state->flags = (int)(hold);
- if ((state->flags & 0xff) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- if (state->flags & 0xe000) {
- strm->msg = (char *)"unknown header flags set";
- state->mode = BAD;
- break;
- }
- if (state->head != Z_NULL)
- state->head->text = (int)((hold >> 8) & 1);
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = TIME;
- case TIME:
- NEEDBITS(32);
- if (state->head != Z_NULL)
- state->head->time = hold;
- if (state->flags & 0x0200) CRC4(state->check, hold);
- INITBITS();
- state->mode = OS;
- case OS:
- NEEDBITS(16);
- if (state->head != Z_NULL) {
- state->head->xflags = (int)(hold & 0xff);
- state->head->os = (int)(hold >> 8);
- }
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = EXLEN;
- case EXLEN:
- if (state->flags & 0x0400) {
- NEEDBITS(16);
- state->length = (unsigned)(hold);
- if (state->head != Z_NULL)
- state->head->extra_len = (unsigned)hold;
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- }
- else if (state->head != Z_NULL)
- state->head->extra = Z_NULL;
- state->mode = EXTRA;
- case EXTRA:
- if (state->flags & 0x0400) {
- copy = state->length;
- if (copy > have) copy = have;
- if (copy) {
- if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
- zmemcpy(state->head->extra + len, next,
- len + copy > state->head->extra_max ?
- state->head->extra_max - len : copy);
- }
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- state->length -= copy;
- }
- if (state->length) goto inf_leave;
- }
- state->length = 0;
- state->mode = NAME;
- case NAME:
- if (state->flags & 0x0800) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->name != Z_NULL &&
- state->length < state->head->name_max)
- state->head->name[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->name = Z_NULL;
- state->length = 0;
- state->mode = COMMENT;
- case COMMENT:
- if (state->flags & 0x1000) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->comment != Z_NULL &&
- state->length < state->head->comm_max)
- state->head->comment[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->comment = Z_NULL;
- state->mode = HCRC;
- case HCRC:
- if (state->flags & 0x0200) {
- NEEDBITS(16);
- if (hold != (state->check & 0xffff)) {
- strm->msg = (char *)"header crc mismatch";
- state->mode = BAD;
- break;
- }
- INITBITS();
- }
- if (state->head != Z_NULL) {
- state->head->hcrc = (int)((state->flags >> 9) & 1);
- state->head->done = 1;
- }
- strm->adler = state->check = crc32(0L, Z_NULL, 0);
- state->mode = TYPE;
- break;
-#endif
- case DICTID:
- NEEDBITS(32);
- strm->adler = state->check = REVERSE(hold);
- INITBITS();
- state->mode = DICT;
- case DICT:
- if (state->havedict == 0) {
- RESTORE();
- return Z_NEED_DICT;
- }
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = TYPE;
- case TYPE:
- if (flush == Z_BLOCK) goto inf_leave;
- case TYPEDO:
- if (state->last) {
- BYTEBITS();
- state->mode = CHECK;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN; /* decode codes */
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
- case STORED:
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
- state->mode = COPY;
- case COPY:
- copy = state->length;
- if (copy) {
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- if (copy == 0) goto inf_leave;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- break;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
- case TABLE:
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
-#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
-#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
- state->have = 0;
- state->mode = LENLENS;
- case LENLENS:
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
- state->have = 0;
- state->mode = CODELENS;
- case CODELENS:
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- this = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.val < 16) {
- NEEDBITS(this.bits);
- DROPBITS(this.bits);
- state->lens[state->have++] = this.val;
- }
- else {
- if (this.val == 16) {
- NEEDBITS(this.bits + 2);
- DROPBITS(this.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = state->lens[state->have - 1];
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (this.val == 17) {
- NEEDBITS(this.bits + 3);
- DROPBITS(this.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(this.bits + 7);
- DROPBITS(this.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* build code tables */
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (code const FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN;
- case LEN:
- if (have >= 6 && left >= 258) {
- RESTORE();
- inflate_fast(strm, out);
- LOAD();
- break;
- }
- for (;;) {
- this = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.op && (this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- state->length = (unsigned)this.val;
- if ((int)(this.op) == 0) {
- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", this.val));
- state->mode = LIT;
- break;
- }
- if (this.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
- if (this.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- state->extra = (unsigned)(this.op) & 15;
- state->mode = LENEXT;
- case LENEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
- state->mode = DIST;
- case DIST:
- for (;;) {
- this = state->distcode[BITS(state->distbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if ((this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- if (this.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)this.val;
- state->extra = (unsigned)(this.op) & 15;
- state->mode = DISTEXT;
- case DISTEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- }
-#ifdef INFLATE_STRICT
- if (state->offset > state->dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#endif
- if (state->offset > state->whave + out - left) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
- state->mode = MATCH;
- case MATCH:
- if (left == 0) goto inf_leave;
- copy = out - left;
- if (state->offset > copy) { /* copy from window */
- copy = state->offset - copy;
- if (copy > state->write) {
- copy -= state->write;
- from = state->window + (state->wsize - copy);
- }
- else
- from = state->window + (state->write - copy);
- if (copy > state->length) copy = state->length;
- }
- else { /* copy from output */
- from = put - state->offset;
- copy = state->length;
- }
- if (copy > left) copy = left;
- left -= copy;
- state->length -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- if (state->length == 0) state->mode = LEN;
- break;
- case LIT:
- if (left == 0) goto inf_leave;
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- case CHECK:
- if (state->wrap) {
- NEEDBITS(32);
- out -= left;
- strm->total_out += out;
- state->total += out;
- if (out)
- strm->adler = state->check =
- UPDATE(state->check, put - out, out);
- out = left;
- if ((
-#ifdef GUNZIP
- state->flags ? hold :
-#endif
- REVERSE(hold)) != state->check) {
- strm->msg = (char *)"incorrect data check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: check matches trailer\n"));
- }
-#ifdef GUNZIP
- state->mode = LENGTH;
- case LENGTH:
- if (state->wrap && state->flags) {
- NEEDBITS(32);
- if (hold != (state->total & 0xffffffffUL)) {
- strm->msg = (char *)"incorrect length check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: length matches trailer\n"));
- }
-#endif
- state->mode = DONE;
- case DONE:
- ret = Z_STREAM_END;
- goto inf_leave;
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
- case MEM:
- return Z_MEM_ERROR;
- case SYNC:
- default:
- return Z_STREAM_ERROR;
- }
-
- /*
- Return from inflate(), updating the total counts and the check value.
- If there was no progress during the inflate() call, return a buffer
- error. Call updatewindow() to create and/or update the window state.
- Note: a memory error from inflate() is non-recoverable.
- */
- inf_leave:
- RESTORE();
- if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
- if (updatewindow(strm, out)) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- in -= strm->avail_in;
- out -= strm->avail_out;
- strm->total_in += in;
- strm->total_out += out;
- state->total += out;
- if (state->wrap && out)
- strm->adler = state->check =
- UPDATE(state->check, strm->next_out - out, out);
- strm->data_type = state->bits + (state->last ? 64 : 0) +
- (state->mode == TYPE ? 128 : 0);
- if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
- ret = Z_BUF_ERROR;
- return ret;
-}
-
-int ZEXPORT inflateEnd(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->window != Z_NULL) ZFREE(strm, state->window);
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
-z_streamp strm;
-const Bytef *dictionary;
-uInt dictLength;
-{
- struct inflate_state FAR *state;
- unsigned long id;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->wrap != 0 && state->mode != DICT)
- return Z_STREAM_ERROR;
-
- /* check for correct dictionary id */
- if (state->mode == DICT) {
- id = adler32(0L, Z_NULL, 0);
- id = adler32(id, dictionary, dictLength);
- if (id != state->check)
- return Z_DATA_ERROR;
- }
-
- /* copy dictionary to window */
- if (updatewindow(strm, strm->avail_out)) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- if (dictLength > state->wsize) {
- zmemcpy(state->window, dictionary + dictLength - state->wsize,
- state->wsize);
- state->whave = state->wsize;
- }
- else {
- zmemcpy(state->window + state->wsize - dictLength, dictionary,
- dictLength);
- state->whave = dictLength;
- }
- state->havedict = 1;
- Tracev((stderr, "inflate: dictionary set\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateGetHeader(strm, head)
-z_streamp strm;
-gz_headerp head;
-{
- struct inflate_state FAR *state;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
-
- /* save header structure */
- state->head = head;
- head->done = 0;
- return Z_OK;
-}
-
-/*
- Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
- or when out of input. When called, *have is the number of pattern bytes
- found in order so far, in 0..3. On return *have is updated to the new
- state. If on return *have equals four, then the pattern was found and the
- return value is how many bytes were read including the last byte of the
- pattern. If *have is less than four, then the pattern has not been found
- yet and the return value is len. In the latter case, syncsearch() can be
- called again with more data and the *have state. *have is initialized to
- zero for the first call.
- */
-local unsigned syncsearch(have, buf, len)
-unsigned FAR *have;
-unsigned char FAR *buf;
-unsigned len;
-{
- unsigned got;
- unsigned next;
-
- got = *have;
- next = 0;
- while (next < len && got < 4) {
- if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
- got++;
- else if (buf[next])
- got = 0;
- else
- got = 4 - got;
- next++;
- }
- *have = got;
- return next;
-}
-
-int ZEXPORT inflateSync(strm)
-z_streamp strm;
-{
- unsigned len; /* number of bytes to look at or looked at */
- long long in, out; /* temporary to save total_in and total_out */
- unsigned char buf[4]; /* to restore bit buffer to byte string */
- struct inflate_state FAR *state;
-
- /* check parameters */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
-
- /* if first time, start search in bit buffer */
- if (state->mode != SYNC) {
- state->mode = SYNC;
- state->hold <<= state->bits & 7;
- state->bits -= state->bits & 7;
- len = 0;
- while (state->bits >= 8) {
- buf[len++] = (unsigned char)(state->hold);
- state->hold >>= 8;
- state->bits -= 8;
- }
- state->have = 0;
- syncsearch(&(state->have), buf, len);
- }
-
- /* search available input */
- len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
- strm->avail_in -= len;
- strm->next_in += len;
- strm->total_in += len;
-
- /* return no joy or set up to restart inflate() on a new block */
- if (state->have != 4) return Z_DATA_ERROR;
- in = strm->total_in; out = strm->total_out;
- inflateReset(strm);
- strm->total_in = in; strm->total_out = out;
- state->mode = TYPE;
- return Z_OK;
-}
-
-/*
- Returns true if inflate is currently at the end of a block generated by
- Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
- implementation to provide an additional safety check. PPP uses
- Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
- block. When decompressing, PPP checks that at the end of input packet,
- inflate is waiting for these length bytes.
- */
-int ZEXPORT inflateSyncPoint(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- return state->mode == STORED && state->bits == 0;
-}
-
-int ZEXPORT inflateCopy(dest, source)
-z_streamp dest;
-z_streamp source;
-{
- struct inflate_state FAR *state;
- struct inflate_state FAR *copy;
- unsigned char FAR *window;
- unsigned wsize;
-
- /* check input */
- if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
- source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)source->state;
-
- /* allocate space */
- copy = (struct inflate_state FAR *)
- ZALLOC(source, 1, sizeof(struct inflate_state));
- if (copy == Z_NULL) return Z_MEM_ERROR;
- window = Z_NULL;
- if (state->window != Z_NULL) {
- window = (unsigned char FAR *)
- ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
- if (window == Z_NULL) {
- ZFREE(source, copy);
- return Z_MEM_ERROR;
- }
- }
-
- /* copy state */
- zmemcpy(dest, source, sizeof(z_stream));
- zmemcpy(copy, state, sizeof(struct inflate_state));
- if (state->lencode >= state->codes &&
- state->lencode <= state->codes + ENOUGH - 1) {
- copy->lencode = copy->codes + (state->lencode - state->codes);
- copy->distcode = copy->codes + (state->distcode - state->codes);
- }
- copy->next = copy->codes + (state->next - state->codes);
- if (window != Z_NULL) {
- wsize = 1U << state->wbits;
- zmemcpy(window, state->window, wsize);
- }
- copy->window = window;
- dest->state = (struct internal_state FAR *)copy;
- return Z_OK;
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.h
deleted file mode 100644
index 11a5b08..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* inflate.h -- internal inflate state definition
- * Copyright (C) 1995-2004 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* define NO_GZIP when compiling if you want to disable gzip header and
- trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
- the crc code when it is not needed. For shared libraries, gzip decoding
- should be left enabled. */
-#ifndef NO_GZIP
-# define GUNZIP
-#endif
-
-/* Possible inflate modes between inflate() calls */
-typedef enum {
- HEAD, /* i: waiting for magic header */
- FLAGS, /* i: waiting for method and flags (gzip) */
- TIME, /* i: waiting for modification time (gzip) */
- OS, /* i: waiting for extra flags and operating system (gzip) */
- EXLEN, /* i: waiting for extra length (gzip) */
- EXTRA, /* i: waiting for extra bytes (gzip) */
- NAME, /* i: waiting for end of file name (gzip) */
- COMMENT, /* i: waiting for end of comment (gzip) */
- HCRC, /* i: waiting for header crc (gzip) */
- DICTID, /* i: waiting for dictionary check value */
- DICT, /* waiting for inflateSetDictionary() call */
- TYPE, /* i: waiting for type bits, including last-flag bit */
- TYPEDO, /* i: same, but skip check to exit inflate on new block */
- STORED, /* i: waiting for stored size (length and complement) */
- COPY, /* i/o: waiting for input or output to copy stored block */
- TABLE, /* i: waiting for dynamic block table lengths */
- LENLENS, /* i: waiting for code length code lengths */
- CODELENS, /* i: waiting for length/lit and distance code lengths */
- LEN, /* i: waiting for length/lit code */
- LENEXT, /* i: waiting for length extra bits */
- DIST, /* i: waiting for distance code */
- DISTEXT, /* i: waiting for distance extra bits */
- MATCH, /* o: waiting for output space to copy string */
- LIT, /* o: waiting for output space to write literal */
- CHECK, /* i: waiting for 32-bit check value */
- LENGTH, /* i: waiting for 32-bit length (gzip) */
- DONE, /* finished check, done -- remain here until reset */
- BAD, /* got a data error -- remain here until reset */
- MEM, /* got an inflate() memory error -- remain here until reset */
- SYNC /* looking for synchronization bytes to restart inflate() */
-} inflate_mode;
-
-/*
- State transitions between above modes -
-
- (most modes can go to the BAD or MEM mode -- not shown for clarity)
-
- Process header:
- HEAD -> (gzip) or (zlib)
- (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
- NAME -> COMMENT -> HCRC -> TYPE
- (zlib) -> DICTID or TYPE
- DICTID -> DICT -> TYPE
- Read deflate blocks:
- TYPE -> STORED or TABLE or LEN or CHECK
- STORED -> COPY -> TYPE
- TABLE -> LENLENS -> CODELENS -> LEN
- Read deflate codes:
- LEN -> LENEXT or LIT or TYPE
- LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
- LIT -> LEN
- Process trailer:
- CHECK -> LENGTH -> DONE
- */
-
-/* state maintained between inflate() calls. Approximately 7K bytes. */
-struct inflate_state {
- inflate_mode mode; /* current inflate mode */
- int last; /* true if processing last block */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- int havedict; /* true if dictionary provided */
- int flags; /* gzip header method and flags (0 if zlib) */
- unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
- unsigned long check; /* protected copy of check value */
- unsigned long total; /* protected copy of output count */
- gz_headerp head; /* where to save gzip header information */
- /* sliding window */
- unsigned wbits; /* log base 2 of requested window size */
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned write; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if needed */
- /* bit accumulator */
- unsigned long hold; /* input bit accumulator */
- unsigned bits; /* number of bits in "in" */
- /* for string and stored block copying */
- unsigned length; /* literal or length of data to copy */
- unsigned offset; /* distance back to copy string from */
- /* for table and code decoding */
- unsigned extra; /* extra bits needed */
- /* fixed and dynamic code tables */
- code const FAR *lencode; /* starting table for length/literal codes */
- code const FAR *distcode; /* starting table for distance codes */
- unsigned lenbits; /* index bits for lencode */
- unsigned distbits; /* index bits for distcode */
- /* dynamic table building */
- unsigned ncode; /* number of code length code lengths */
- unsigned nlen; /* number of length code lengths */
- unsigned ndist; /* number of distance code lengths */
- unsigned have; /* number of code lengths in lens[] */
- code FAR *next; /* next available space in codes[] */
- unsigned short lens[320]; /* temporary storage for code lengths */
- unsigned short work[288]; /* work area for code table building */
- code codes[ENOUGH]; /* space for code tables */
-};
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.c
deleted file mode 100644
index 0abd610..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-
-#define MAXBITS 15
-
-const char inflate_copyright[] =
- " inflate 1.2.3 Copyright 1995-2005 Mark Adler ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-/*
- Build a set of tables to decode the provided canonical Huffman code.
- The code lengths are lens[0..codes-1]. The result starts at *table,
- whose indices are 0..2^bits-1. work is a writable array of at least
- lens shorts, which is used as a work area. type is the type of code
- to be generated, CODES, LENS, or DISTS. On return, zero is success,
- -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
- on return points to the next available entry's address. bits is the
- requested root table index bits, and on return it is the actual root
- table index bits. It will differ if the request is greater than the
- longest code or if it is less than the shortest code.
- */
-int inflate_table(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short FAR *lens;
-unsigned codes;
-code FAR * FAR *table;
-unsigned FAR *bits;
-unsigned short FAR *work;
-{
- unsigned len; /* a code's length in bits */
- unsigned sym; /* index of code symbols */
- unsigned min, max; /* minimum and maximum code lengths */
- unsigned root; /* number of index bits for root table */
- unsigned curr; /* number of index bits for current table */
- unsigned drop; /* code bits to drop for sub-table */
- int left; /* number of prefix codes available */
- unsigned used; /* code entries in table used */
- unsigned huff; /* Huffman code */
- unsigned incr; /* for incrementing code, index */
- unsigned fill; /* index for replicating entries */
- unsigned low; /* low bits for current root entry */
- unsigned mask; /* mask for low root bits */
- code this; /* table entry for duplication */
- code FAR *next; /* next available space in table */
- const unsigned short FAR *base; /* base value table to use */
- const unsigned short FAR *extra; /* extra bits table to use */
- int end; /* use base and extra for symbol > end */
- unsigned short count[MAXBITS+1]; /* number of codes of each length */
- unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
- static const unsigned short lbase[31] = { /* Length codes 257..285 base */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
- static const unsigned short lext[31] = { /* Length codes 257..285 extra */
- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
- static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577, 0, 0};
- static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
- 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
- 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
- 28, 28, 29, 29, 64, 64};
-
- /*
- Process a set of code lengths to create a canonical Huffman code. The
- code lengths are lens[0..codes-1]. Each length corresponds to the
- symbols 0..codes-1. The Huffman code is generated by first sorting the
- symbols by length from short to long, and retaining the symbol order
- for codes with equal lengths. Then the code starts with all zero bits
- for the first code of the shortest length, and the codes are integer
- increments for the same length, and zeros are appended as the length
- increases. For the deflate format, these bits are stored backwards
- from their more natural integer increment ordering, and so when the
- decoding tables are built in the large loop below, the integer codes
- are incremented backwards.
-
- This routine assumes, but does not check, that all of the entries in
- lens[] are in the range 0..MAXBITS. The caller must assure this.
- 1..MAXBITS is interpreted as that code length. zero means that that
- symbol does not occur in this code.
-
- The codes are sorted by computing a count of codes for each length,
- creating from that a table of starting indices for each length in the
- sorted table, and then entering the symbols in order in the sorted
- table. The sorted table is work[], with that space being provided by
- the caller.
-
- The length counts are used for other purposes as well, i.e. finding
- the minimum and maximum length codes, determining if there are any
- codes at all, checking for a valid set of lengths, and looking ahead
- at length counts to determine sub-table sizes when building the
- decoding tables.
- */
-
- /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
- for (len = 0; len <= MAXBITS; len++)
- count[len] = 0;
- for (sym = 0; sym < codes; sym++)
- count[lens[sym]]++;
-
- /* bound code lengths, force root to be within code lengths */
- root = *bits;
- for (max = MAXBITS; max >= 1; max--)
- if (count[max] != 0) break;
- if (root > max) root = max;
- if (max == 0) { /* no symbols to code at all */
- this.op = (unsigned char)64; /* invalid code marker */
- this.bits = (unsigned char)1;
- this.val = (unsigned short)0;
- *(*table)++ = this; /* make a table to force an error */
- *(*table)++ = this;
- *bits = 1;
- return 0; /* no symbols, but wait for decoding to report error */
- }
- for (min = 1; min <= MAXBITS; min++)
- if (count[min] != 0) break;
- if (root < min) root = min;
-
- /* check for an over-subscribed or incomplete set of lengths */
- left = 1;
- for (len = 1; len <= MAXBITS; len++) {
- left <<= 1;
- left -= count[len];
- if (left < 0) return -1; /* over-subscribed */
- }
- if (left > 0 && (type == CODES || max != 1))
- return -1; /* incomplete set */
-
- /* generate offsets into symbol table for each length for sorting */
- offs[1] = 0;
- for (len = 1; len < MAXBITS; len++)
- offs[len + 1] = offs[len] + count[len];
-
- /* sort symbols by length, by symbol order within each length */
- for (sym = 0; sym < codes; sym++)
- if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
-
- /*
- Create and fill in decoding tables. In this loop, the table being
- filled is at next and has curr index bits. The code being used is huff
- with length len. That code is converted to an index by dropping drop
- bits off of the bottom. For codes where len is less than drop + curr,
- those top drop + curr - len bits are incremented through all values to
- fill the table with replicated entries.
-
- root is the number of index bits for the root table. When len exceeds
- root, sub-tables are created pointed to by the root entry with an index
- of the low root bits of huff. This is saved in low to check for when a
- new sub-table should be started. drop is zero when the root table is
- being filled, and drop is root when sub-tables are being filled.
-
- When a new sub-table is needed, it is necessary to look ahead in the
- code lengths to determine what size sub-table is needed. The length
- counts are used for this, and so count[] is decremented as codes are
- entered in the tables.
-
- used keeps track of how many table entries have been allocated from the
- provided *table space. It is checked when a LENS table is being made
- against the space in *table, ENOUGH, minus the maximum space needed by
- the worst case distance code, MAXD. This should never happen, but the
- sufficiency of ENOUGH has not been proven exhaustively, hence the check.
- This assumes that when type == LENS, bits == 9.
-
- sym increments through all symbols, and the loop terminates when
- all codes of length max, i.e. all codes, have been processed. This
- routine permits incomplete codes, so another loop after this one fills
- in the rest of the decoding tables with invalid code markers.
- */
-
- /* set up for code type */
- switch (type) {
- case CODES:
- base = extra = work; /* dummy value--not used */
- end = 19;
- break;
- case LENS:
- base = lbase;
- base -= 257;
- extra = lext;
- extra -= 257;
- end = 256;
- break;
- default: /* DISTS */
- base = dbase;
- extra = dext;
- end = -1;
- }
-
- /* initialize state for loop */
- huff = 0; /* starting code */
- sym = 0; /* starting code symbol */
- len = min; /* starting code length */
- next = *table; /* current table to fill in */
- curr = root; /* current table index bits */
- drop = 0; /* current bits to drop from code for index */
- low = (unsigned)(-1); /* trigger new sub-table when len > root */
- used = 1U << root; /* use root table entries */
- mask = used - 1; /* mask for comparing low */
-
- /* check available table space */
- if (type == LENS && used >= ENOUGH - MAXD)
- return 1;
-
- /* process all codes and make table entries */
- for (;;) {
- /* create table entry */
- this.bits = (unsigned char)(len - drop);
- if ((int)(work[sym]) < end) {
- this.op = (unsigned char)0;
- this.val = work[sym];
- }
- else if ((int)(work[sym]) > end) {
- this.op = (unsigned char)(extra[work[sym]]);
- this.val = base[work[sym]];
- }
- else {
- this.op = (unsigned char)(32 + 64); /* end of block */
- this.val = 0;
- }
-
- /* replicate for those indices with low len bits equal to huff */
- incr = 1U << (len - drop);
- fill = 1U << curr;
- min = fill; /* save offset to next table */
- do {
- fill -= incr;
- next[(huff >> drop) + fill] = this;
- } while (fill != 0);
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
-
- /* go to next symbol, update count, len */
- sym++;
- if (--(count[len]) == 0) {
- if (len == max) break;
- len = lens[work[sym]];
- }
-
- /* create new sub-table if needed */
- if (len > root && (huff & mask) != low) {
- /* if first time, transition to sub-tables */
- if (drop == 0)
- drop = root;
-
- /* increment past last table */
- next += min; /* here min is 1 << curr */
-
- /* determine length of next table */
- curr = len - drop;
- left = (int)(1 << curr);
- while (curr + drop < max) {
- left -= count[curr + drop];
- if (left <= 0) break;
- curr++;
- left <<= 1;
- }
-
- /* check for enough space */
- used += 1U << curr;
- if (type == LENS && used >= ENOUGH - MAXD)
- return 1;
-
- /* point entry in root table to sub-table */
- low = huff & mask;
- (*table)[low].op = (unsigned char)curr;
- (*table)[low].bits = (unsigned char)root;
- (*table)[low].val = (unsigned short)(next - *table);
- }
- }
-
- /*
- Fill in rest of table for incomplete codes. This loop is similar to the
- loop above in incrementing huff for table indices. It is assumed that
- len is equal to curr + drop, so there is no loop needed to increment
- through high index bits. When the current sub-table is filled, the loop
- drops back to the root table to fill in any remaining entries there.
- */
- this.op = (unsigned char)64; /* invalid code marker */
- this.bits = (unsigned char)(len - drop);
- this.val = (unsigned short)0;
- while (huff != 0) {
- /* when done with sub-table, drop back to root table */
- if (drop != 0 && (huff & mask) != low) {
- drop = 0;
- len = root;
- next = *table;
- this.bits = (unsigned char)len;
- }
-
- /* put invalid code marker in table */
- next[huff >> drop] = this;
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
- }
-
- /* set return parameters */
- *table += used;
- *bits = root;
- return 0;
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.h
deleted file mode 100644
index 8642e0d..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* inftrees.h -- header to use inftrees.c
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* Structure for decoding tables. Each entry provides either the
- information needed to do the operation requested by the code that
- indexed that table entry, or it provides a pointer to another
- table that indexes more bits of the code. op indicates whether
- the entry is a pointer to another table, a literal, a length or
- distance, an end-of-block, or an invalid code. For a table
- pointer, the low four bits of op is the number of index bits of
- that table. For a length or distance, the low four bits of op
- is the number of extra bits to get after the code. bits is
- the number of bits in this code or part of the code to drop off
- of the bit buffer. val is the actual byte to output in the case
- of a literal, the base length or distance, or the offset from
- the current table to the next table. Each entry is four bytes. */
-typedef struct {
- unsigned char op; /* operation, extra bits, table bits */
- unsigned char bits; /* bits in this part of the code */
- unsigned short val; /* offset in table or code value */
-} code;
-
-/* op values as set by inflate_table():
- 00000000 - literal
- 0000tttt - table link, tttt != 0 is the number of table index bits
- 0001eeee - length or distance, eeee is the number of extra bits
- 01100000 - end of block
- 01000000 - invalid code
- */
-
-/* Maximum size of dynamic tree. The maximum found in a long but non-
- exhaustive search was 1444 code structures (852 for length/literals
- and 592 for distances, the latter actually the result of an
- exhaustive search). The true maximum is not known, but the value
- below is more than safe. */
-#define ENOUGH 2048
-#define MAXD 592
-
-/* Type of code to build for inftable() */
-typedef enum {
- CODES,
- LENS,
- DISTS
-} codetype;
-
-extern int inflate_table OF((codetype type, unsigned short FAR *lens,
- unsigned codes, code FAR * FAR *table,
- unsigned FAR *bits, unsigned short FAR *work));
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java
deleted file mode 100644
index 068a0aa..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java
+++ /dev/null
@@ -1,16 +0,0 @@
-(1)renamed
- adler32.c -> zadler32.c
- zcrc32c -> zcrc32.c
-
-(2)added _LP64 to make uLong a 32-bit int on 64-bit platform
- zconf.h:
- uLong -> 32-bit int
-
-(3)updated crc32.c/crc32()
- unsigned long -> uLong
-
-(4)updated zlib.h (to support > 4G zipfile):
- total_in/out: uLong -> long long
-
-(5)updated upinflate.c/inflateSync()
- unsigned long in, out; --> long long in, out;
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff
deleted file mode 100644
index 6bd57b9..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff
+++ /dev/null
@@ -1,25 +0,0 @@
---- /home/sherman/TL/zlib-1.2.3_ORG/crc32.c Sun Jun 12 16:56:07 2005
-+++ zcrc32.c Tue Aug 25 14:22:41 2009
-@@ -216,8 +216,8 @@
- #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
-
- /* ========================================================================= */
--unsigned long ZEXPORT crc32(crc, buf, len)
-- unsigned long crc;
-+uLong ZEXPORT crc32(crc, buf, len)
-+ uLong crc;
- const unsigned char FAR *buf;
- unsigned len;
- {
-@@ -234,9 +234,9 @@
-
- endian = 1;
- if (*((unsigned char *)(&endian)))
-- return crc32_little(crc, buf, len);
-+ return (uLong)crc32_little(crc, buf, len);
- else
-- return crc32_big(crc, buf, len);
-+ return (uLong)crc32_big(crc, buf, len);
- }
- #endif /* BYFOUR */
- crc = crc ^ 0xffffffffUL;
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff
deleted file mode 100644
index 1280ac8..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- /home/sherman/TL/zlib-1.2.3_ORG/inflate.c Tue Jun 14 14:50:12 2005
-+++ inflate.c Tue Aug 25 14:22:09 2009
-@@ -1263,7 +1263,7 @@
- z_streamp strm;
- {
- unsigned len; /* number of bytes to look at or looked at */
-- unsigned long in, out; /* temporary to save total_in and total_out */
-+ long long in, out; /* temporary to save total_in and total_out */
- unsigned char buf[4]; /* to restore bit buffer to byte string */
- struct inflate_state FAR *state;
-
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff
deleted file mode 100644
index 04edcb2..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff
+++ /dev/null
@@ -1,24 +0,0 @@
---- /home/sherman/TL/zlib-1.2.3_ORG/zconf.h Fri May 27 23:40:35 2005
-+++ zconf.h Tue Aug 25 14:22:28 2009
-@@ -8,6 +8,9 @@
- #ifndef ZCONF_H
- #define ZCONF_H
-
-+/* for _LP64 */
-+#include <sys/types.h>
-+
- /*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
-@@ -261,7 +264,11 @@
- typedef unsigned char Byte; /* 8 bits */
- #endif
- typedef unsigned int uInt; /* 16 bits or more */
-+#ifdef _LP64
-+typedef unsigned int uLong; /* 32 bits or more */
-+#else
- typedef unsigned long uLong; /* 32 bits or more */
-+#endif
-
- #ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff b/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff
deleted file mode 100644
index 043f4ed..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff
+++ /dev/null
@@ -1,25 +0,0 @@
---- /home/sherman/TL/zlib-1.2.3_ORG/zlib.h Sun Jul 17 19:26:49 2005
-+++ zlib.h Tue Aug 25 14:22:50 2009
-@@ -82,11 +82,11 @@
- typedef struct z_stream_s {
- Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
-- uLong total_in; /* total nb of input bytes read so far */
-+ long long total_in; /* total nb of input bytes read so far */
-
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
-- uLong total_out; /* total nb of bytes output so far */
-+ long long total_out;/* total nb of bytes output so far */
-
- char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
-@@ -1348,7 +1348,7 @@
-
- ZEXTERN const char * ZEXPORT zError OF((int));
- ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
--ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
-+ZEXTERN const unsigned long FAR * ZEXPORT get_crc_table OF((void));
-
- #ifdef __cplusplus
- }
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.c
deleted file mode 100644
index 7d09e2e..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.c
+++ /dev/null
@@ -1,1243 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* trees.c -- output deflated data using Huffman coding
- * Copyright (C) 1995-2005 Jean-loup Gailly
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * ALGORITHM
- *
- * The "deflation" process uses several Huffman trees. The more
- * common source values are represented by shorter bit sequences.
- *
- * Each code tree is stored in a compressed form which is itself
- * a Huffman encoding of the lengths of all the code strings (in
- * ascending order by source values). The actual code strings are
- * reconstructed from the lengths in the inflate process, as described
- * in the deflate specification.
- *
- * REFERENCES
- *
- * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
- * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
- *
- * Storer, James A.
- * Data Compression: Methods and Theory, pp. 49-50.
- * Computer Science Press, 1988. ISBN 0-7167-8156-5.
- *
- * Sedgewick, R.
- * Algorithms, p290.
- * Addison-Wesley, 1983. ISBN 0-201-06672-6.
- */
-
-/* @(#) $Id$ */
-
-/* #define GEN_TREES_H */
-
-#include "deflate.h"
-
-#ifdef DEBUG
-# include <ctype.h>
-#endif
-
-/* ===========================================================================
- * Constants
- */
-
-#define MAX_BL_BITS 7
-/* Bit length codes must not exceed MAX_BL_BITS bits */
-
-#define END_BLOCK 256
-/* end of block literal code */
-
-#define REP_3_6 16
-/* repeat previous bit length 3-6 times (2 bits of repeat count) */
-
-#define REPZ_3_10 17
-/* repeat a zero length 3-10 times (3 bits of repeat count) */
-
-#define REPZ_11_138 18
-/* repeat a zero length 11-138 times (7 bits of repeat count) */
-
-local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
- = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
-
-local const int extra_dbits[D_CODES] /* extra bits for each distance code */
- = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
-
-local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
- = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
-
-local const uch bl_order[BL_CODES]
- = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
-/* The lengths of the bit length codes are sent in order of decreasing
- * probability, to avoid transmitting the lengths for unused bit length codes.
- */
-
-#define Buf_size (8 * 2*sizeof(char))
-/* Number of bits used within bi_buf. (bi_buf might be implemented on
- * more than 16 bits on some systems.)
- */
-
-/* ===========================================================================
- * Local data. These are initialized only once.
- */
-
-#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
-
-#if defined(GEN_TREES_H) || !defined(STDC)
-/* non ANSI compilers may not accept trees.h */
-
-local ct_data static_ltree[L_CODES+2];
-/* The static literal tree. Since the bit lengths are imposed, there is no
- * need for the L_CODES extra codes used during heap construction. However
- * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
- * below).
- */
-
-local ct_data static_dtree[D_CODES];
-/* The static distance tree. (Actually a trivial tree since all codes use
- * 5 bits.)
- */
-
-uch _dist_code[DIST_CODE_LEN];
-/* Distance codes. The first 256 values correspond to the distances
- * 3 .. 258, the last 256 values correspond to the top 8 bits of
- * the 15 bit distances.
- */
-
-uch _length_code[MAX_MATCH-MIN_MATCH+1];
-/* length code for each normalized match length (0 == MIN_MATCH) */
-
-local int base_length[LENGTH_CODES];
-/* First normalized length for each code (0 = MIN_MATCH) */
-
-local int base_dist[D_CODES];
-/* First normalized distance for each code (0 = distance of 1) */
-
-#else
-# include "trees.h"
-#endif /* GEN_TREES_H */
-
-struct static_tree_desc_s {
- const ct_data *static_tree; /* static tree or NULL */
- const intf *extra_bits; /* extra bits for each code or NULL */
- int extra_base; /* base index for extra_bits */
- int elems; /* max number of elements in the tree */
- int max_length; /* max bit length for the codes */
-};
-
-local static_tree_desc static_l_desc =
-{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
-
-local static_tree_desc static_d_desc =
-{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
-
-local static_tree_desc static_bl_desc =
-{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
-
-/* ===========================================================================
- * Local (static) routines in this file.
- */
-
-local void tr_static_init OF((void));
-local void init_block OF((deflate_state *s));
-local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
-local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
-local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
-local void build_tree OF((deflate_state *s, tree_desc *desc));
-local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local int build_bl_tree OF((deflate_state *s));
-local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
- int blcodes));
-local void compress_block OF((deflate_state *s, ct_data *ltree,
- ct_data *dtree));
-local void set_data_type OF((deflate_state *s));
-local unsigned bi_reverse OF((unsigned value, int length));
-local void bi_windup OF((deflate_state *s));
-local void bi_flush OF((deflate_state *s));
-local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
- int header));
-
-#ifdef GEN_TREES_H
-local void gen_trees_header OF((void));
-#endif
-
-#ifndef DEBUG
-# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
- /* Send a code of the given tree. c and tree must not have side effects */
-
-#else /* DEBUG */
-# define send_code(s, c, tree) \
- { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
- send_bits(s, tree[c].Code, tree[c].Len); }
-#endif
-
-/* ===========================================================================
- * Output a short LSB first on the stream.
- * IN assertion: there is enough room in pendingBuf.
- */
-#define put_short(s, w) { \
- put_byte(s, (uch)((w) & 0xff)); \
- put_byte(s, (uch)((ush)(w) >> 8)); \
-}
-
-/* ===========================================================================
- * Send a value on a given number of bits.
- * IN assertion: length <= 16 and value fits in length bits.
- */
-#ifdef DEBUG
-local void send_bits OF((deflate_state *s, int value, int length));
-
-local void send_bits(s, value, length)
- deflate_state *s;
- int value; /* value to send */
- int length; /* number of bits */
-{
- Tracevv((stderr," l %2d v %4x ", length, value));
- Assert(length > 0 && length <= 15, "invalid length");
- s->bits_sent += (ulg)length;
-
- /* If not enough room in bi_buf, use (valid) bits from bi_buf and
- * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
- * unused bits in value.
- */
- if (s->bi_valid > (int)Buf_size - length) {
- s->bi_buf |= (value << s->bi_valid);
- put_short(s, s->bi_buf);
- s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
- s->bi_valid += length - Buf_size;
- } else {
- s->bi_buf |= value << s->bi_valid;
- s->bi_valid += length;
- }
-}
-#else /* !DEBUG */
-
-#define send_bits(s, value, length) \
-{ int len = length;\
- if (s->bi_valid > (int)Buf_size - len) {\
- int val = value;\
- s->bi_buf |= (val << s->bi_valid);\
- put_short(s, s->bi_buf);\
- s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
- s->bi_valid += len - Buf_size;\
- } else {\
- s->bi_buf |= (value) << s->bi_valid;\
- s->bi_valid += len;\
- }\
-}
-#endif /* DEBUG */
-
-
-/* the arguments must not have side effects */
-
-/* ===========================================================================
- * Initialize the various 'constant' tables.
- */
-local void tr_static_init()
-{
-#if defined(GEN_TREES_H) || !defined(STDC)
- static int static_init_done = 0;
- int n; /* iterates over tree elements */
- int bits; /* bit counter */
- int length; /* length value */
- int code; /* code value */
- int dist; /* distance index */
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- if (static_init_done) return;
-
- /* For some embedded targets, global variables are not initialized: */
- static_l_desc.static_tree = static_ltree;
- static_l_desc.extra_bits = extra_lbits;
- static_d_desc.static_tree = static_dtree;
- static_d_desc.extra_bits = extra_dbits;
- static_bl_desc.extra_bits = extra_blbits;
-
- /* Initialize the mapping length (0..255) -> length code (0..28) */
- length = 0;
- for (code = 0; code < LENGTH_CODES-1; code++) {
- base_length[code] = length;
- for (n = 0; n < (1<<extra_lbits[code]); n++) {
- _length_code[length++] = (uch)code;
- }
- }
- Assert (length == 256, "tr_static_init: length != 256");
- /* Note that the length 255 (match length 258) can be represented
- * in two different ways: code 284 + 5 bits or code 285, so we
- * overwrite length_code[255] to use the best encoding:
- */
- _length_code[length-1] = (uch)code;
-
- /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
- dist = 0;
- for (code = 0 ; code < 16; code++) {
- base_dist[code] = dist;
- for (n = 0; n < (1<<extra_dbits[code]); n++) {
- _dist_code[dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: dist != 256");
- dist >>= 7; /* from now on, all distances are divided by 128 */
- for ( ; code < D_CODES; code++) {
- base_dist[code] = dist << 7;
- for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
- _dist_code[256 + dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: 256+dist != 512");
-
- /* Construct the codes of the static literal tree */
- for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
- n = 0;
- while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
- while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
- while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
- while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
- /* Codes 286 and 287 do not exist, but we must include them in the
- * tree construction to get a canonical Huffman tree (longest code
- * all ones)
- */
- gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
-
- /* The static distance tree is trivial: */
- for (n = 0; n < D_CODES; n++) {
- static_dtree[n].Len = 5;
- static_dtree[n].Code = bi_reverse((unsigned)n, 5);
- }
- static_init_done = 1;
-
-# ifdef GEN_TREES_H
- gen_trees_header();
-# endif
-#endif /* defined(GEN_TREES_H) || !defined(STDC) */
-}
-
-/* ===========================================================================
- * Genererate the file trees.h describing the static trees.
- */
-#ifdef GEN_TREES_H
-# ifndef DEBUG
-# include <stdio.h>
-# endif
-
-# define SEPARATOR(i, last, width) \
- ((i) == (last)? "\n};\n\n" : \
- ((i) % (width) == (width)-1 ? ",\n" : ", "))
-
-void gen_trees_header()
-{
- FILE *header = fopen("trees.h", "w");
- int i;
-
- Assert (header != NULL, "Can't open trees.h");
- fprintf(header,
- "/* header created automatically with -DGEN_TREES_H */\n\n");
-
- fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
- for (i = 0; i < L_CODES+2; i++) {
- fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
- static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
- }
-
- fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
- static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
- }
-
- fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
- for (i = 0; i < DIST_CODE_LEN; i++) {
- fprintf(header, "%2u%s", _dist_code[i],
- SEPARATOR(i, DIST_CODE_LEN-1, 20));
- }
-
- fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
- for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
- fprintf(header, "%2u%s", _length_code[i],
- SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
- }
-
- fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
- for (i = 0; i < LENGTH_CODES; i++) {
- fprintf(header, "%1u%s", base_length[i],
- SEPARATOR(i, LENGTH_CODES-1, 20));
- }
-
- fprintf(header, "local const int base_dist[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "%5u%s", base_dist[i],
- SEPARATOR(i, D_CODES-1, 10));
- }
-
- fclose(header);
-}
-#endif /* GEN_TREES_H */
-
-/* ===========================================================================
- * Initialize the tree data structures for a new zlib stream.
- */
-void _tr_init(s)
- deflate_state *s;
-{
- tr_static_init();
-
- s->l_desc.dyn_tree = s->dyn_ltree;
- s->l_desc.stat_desc = &static_l_desc;
-
- s->d_desc.dyn_tree = s->dyn_dtree;
- s->d_desc.stat_desc = &static_d_desc;
-
- s->bl_desc.dyn_tree = s->bl_tree;
- s->bl_desc.stat_desc = &static_bl_desc;
-
- s->bi_buf = 0;
- s->bi_valid = 0;
- s->last_eob_len = 8; /* enough lookahead for inflate */
-#ifdef DEBUG
- s->compressed_len = 0L;
- s->bits_sent = 0L;
-#endif
-
- /* Initialize the first block of the first file: */
- init_block(s);
-}
-
-/* ===========================================================================
- * Initialize a new block.
- */
-local void init_block(s)
- deflate_state *s;
-{
- int n; /* iterates over tree elements */
-
- /* Initialize the trees. */
- for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
- for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
- for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
-
- s->dyn_ltree[END_BLOCK].Freq = 1;
- s->opt_len = s->static_len = 0L;
- s->last_lit = s->matches = 0;
-}
-
-#define SMALLEST 1
-/* Index within the heap array of least frequent node in the Huffman tree */
-
-
-/* ===========================================================================
- * Remove the smallest element from the heap and recreate the heap with
- * one less element. Updates heap and heap_len.
- */
-#define pqremove(s, tree, top) \
-{\
- top = s->heap[SMALLEST]; \
- s->heap[SMALLEST] = s->heap[s->heap_len--]; \
- pqdownheap(s, tree, SMALLEST); \
-}
-
-/* ===========================================================================
- * Compares to subtrees, using the tree depth as tie breaker when
- * the subtrees have equal frequency. This minimizes the worst case length.
- */
-#define smaller(tree, n, m, depth) \
- (tree[n].Freq < tree[m].Freq || \
- (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
-
-/* ===========================================================================
- * Restore the heap property by moving down the tree starting at node k,
- * exchanging a node with the smallest of its two sons if necessary, stopping
- * when the heap property is re-established (each father smaller than its
- * two sons).
- */
-local void pqdownheap(s, tree, k)
- deflate_state *s;
- ct_data *tree; /* the tree to restore */
- int k; /* node to move down */
-{
- int v = s->heap[k];
- int j = k << 1; /* left son of k */
- while (j <= s->heap_len) {
- /* Set j to the smallest of the two sons: */
- if (j < s->heap_len &&
- smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
- j++;
- }
- /* Exit if v is smaller than both sons */
- if (smaller(tree, v, s->heap[j], s->depth)) break;
-
- /* Exchange v with the smallest son */
- s->heap[k] = s->heap[j]; k = j;
-
- /* And continue down the tree, setting j to the left son of k */
- j <<= 1;
- }
- s->heap[k] = v;
-}
-
-/* ===========================================================================
- * Compute the optimal bit lengths for a tree and update the total bit length
- * for the current block.
- * IN assertion: the fields freq and dad are set, heap[heap_max] and
- * above are the tree nodes sorted by increasing frequency.
- * OUT assertions: the field len is set to the optimal bit length, the
- * array bl_count contains the frequencies for each bit length.
- * The length opt_len is updated; static_len is also updated if stree is
- * not null.
- */
-local void gen_bitlen(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
- ct_data *tree = desc->dyn_tree;
- int max_code = desc->max_code;
- const ct_data *stree = desc->stat_desc->static_tree;
- const intf *extra = desc->stat_desc->extra_bits;
- int base = desc->stat_desc->extra_base;
- int max_length = desc->stat_desc->max_length;
- int h; /* heap index */
- int n, m; /* iterate over the tree elements */
- int bits; /* bit length */
- int xbits; /* extra bits */
- ush f; /* frequency */
- int overflow = 0; /* number of elements with bit length too large */
-
- for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
-
- /* In a first pass, compute the optimal bit lengths (which may
- * overflow in the case of the bit length tree).
- */
- tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
-
- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
- n = s->heap[h];
- bits = tree[tree[n].Dad].Len + 1;
- if (bits > max_length) bits = max_length, overflow++;
- tree[n].Len = (ush)bits;
- /* We overwrite tree[n].Dad which is no longer needed */
-
- if (n > max_code) continue; /* not a leaf node */
-
- s->bl_count[bits]++;
- xbits = 0;
- if (n >= base) xbits = extra[n-base];
- f = tree[n].Freq;
- s->opt_len += (ulg)f * (bits + xbits);
- if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
- }
- if (overflow == 0) return;
-
- Trace((stderr,"\nbit length overflow\n"));
- /* This happens for example on obj2 and pic of the Calgary corpus */
-
- /* Find the first bit length which could increase: */
- do {
- bits = max_length-1;
- while (s->bl_count[bits] == 0) bits--;
- s->bl_count[bits]--; /* move one leaf down the tree */
- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
- s->bl_count[max_length]--;
- /* The brother of the overflow item also moves one step up,
- * but this does not affect bl_count[max_length]
- */
- overflow -= 2;
- } while (overflow > 0);
-
- /* Now recompute all bit lengths, scanning in increasing frequency.
- * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
- * lengths instead of fixing only the wrong ones. This idea is taken
- * from 'ar' written by Haruhiko Okumura.)
- */
- for (bits = max_length; bits != 0; bits--) {
- n = s->bl_count[bits];
- while (n != 0) {
- m = s->heap[--h];
- if (m > max_code) continue;
- if ((unsigned) tree[m].Len != (unsigned) bits) {
- Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
- s->opt_len += ((long)bits - (long)tree[m].Len)
- *(long)tree[m].Freq;
- tree[m].Len = (ush)bits;
- }
- n--;
- }
- }
-}
-
-/* ===========================================================================
- * Generate the codes for a given tree and bit counts (which need not be
- * optimal).
- * IN assertion: the array bl_count contains the bit length statistics for
- * the given tree and the field len is set for all tree elements.
- * OUT assertion: the field code is set for all tree elements of non
- * zero code length.
- */
-local void gen_codes (tree, max_code, bl_count)
- ct_data *tree; /* the tree to decorate */
- int max_code; /* largest code with non zero frequency */
- ushf *bl_count; /* number of codes at each bit length */
-{
- ush next_code[MAX_BITS+1]; /* next code value for each bit length */
- ush code = 0; /* running code value */
- int bits; /* bit index */
- int n; /* code index */
-
- /* The distribution counts are first used to generate the code values
- * without bit reversal.
- */
- for (bits = 1; bits <= MAX_BITS; bits++) {
- next_code[bits] = code = (code + bl_count[bits-1]) << 1;
- }
- /* Check that the bit counts in bl_count are consistent. The last code
- * must be all ones.
- */
- Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
- "inconsistent bit counts");
- Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
-
- for (n = 0; n <= max_code; n++) {
- int len = tree[n].Len;
- if (len == 0) continue;
- /* Now reverse the bits */
- tree[n].Code = bi_reverse(next_code[len]++, len);
-
- Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
- }
-}
-
-/* ===========================================================================
- * Construct one Huffman tree and assigns the code bit strings and lengths.
- * Update the total bit length for the current block.
- * IN assertion: the field freq is set for all tree elements.
- * OUT assertions: the fields len and code are set to the optimal bit length
- * and corresponding code. The length opt_len is updated; static_len is
- * also updated if stree is not null. The field max_code is set.
- */
-local void build_tree(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
- ct_data *tree = desc->dyn_tree;
- const ct_data *stree = desc->stat_desc->static_tree;
- int elems = desc->stat_desc->elems;
- int n, m; /* iterate over heap elements */
- int max_code = -1; /* largest code with non zero frequency */
- int node; /* new node being created */
-
- /* Construct the initial heap, with least frequent element in
- * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
- * heap[0] is not used.
- */
- s->heap_len = 0, s->heap_max = HEAP_SIZE;
-
- for (n = 0; n < elems; n++) {
- if (tree[n].Freq != 0) {
- s->heap[++(s->heap_len)] = max_code = n;
- s->depth[n] = 0;
- } else {
- tree[n].Len = 0;
- }
- }
-
- /* The pkzip format requires that at least one distance code exists,
- * and that at least one bit should be sent even if there is only one
- * possible code. So to avoid special checks later on we force at least
- * two codes of non zero frequency.
- */
- while (s->heap_len < 2) {
- node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
- tree[node].Freq = 1;
- s->depth[node] = 0;
- s->opt_len--; if (stree) s->static_len -= stree[node].Len;
- /* node is 0 or 1 so it does not have extra bits */
- }
- desc->max_code = max_code;
-
- /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
- * establish sub-heaps of increasing lengths:
- */
- for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
-
- /* Construct the Huffman tree by repeatedly combining the least two
- * frequent nodes.
- */
- node = elems; /* next internal node of the tree */
- do {
- pqremove(s, tree, n); /* n = node of least frequency */
- m = s->heap[SMALLEST]; /* m = node of next least frequency */
-
- s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
- s->heap[--(s->heap_max)] = m;
-
- /* Create a new node father of n and m */
- tree[node].Freq = tree[n].Freq + tree[m].Freq;
- s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
- s->depth[n] : s->depth[m]) + 1);
- tree[n].Dad = tree[m].Dad = (ush)node;
-#ifdef DUMP_BL_TREE
- if (tree == s->bl_tree) {
- fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
- node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
- }
-#endif
- /* and insert the new node in the heap */
- s->heap[SMALLEST] = node++;
- pqdownheap(s, tree, SMALLEST);
-
- } while (s->heap_len >= 2);
-
- s->heap[--(s->heap_max)] = s->heap[SMALLEST];
-
- /* At this point, the fields freq and dad are set. We can now
- * generate the bit lengths.
- */
- gen_bitlen(s, (tree_desc *)desc);
-
- /* The field len is now set, we can generate the bit codes */
- gen_codes ((ct_data *)tree, max_code, s->bl_count);
-}
-
-/* ===========================================================================
- * Scan a literal or distance tree to determine the frequencies of the codes
- * in the bit length tree.
- */
-local void scan_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- if (nextlen == 0) max_count = 138, min_count = 3;
- tree[max_code+1].Len = (ush)0xffff; /* guard */
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- s->bl_tree[curlen].Freq += count;
- } else if (curlen != 0) {
- if (curlen != prevlen) s->bl_tree[curlen].Freq++;
- s->bl_tree[REP_3_6].Freq++;
- } else if (count <= 10) {
- s->bl_tree[REPZ_3_10].Freq++;
- } else {
- s->bl_tree[REPZ_11_138].Freq++;
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
-}
-
-/* ===========================================================================
- * Send a literal or distance tree in compressed form, using the codes in
- * bl_tree.
- */
-local void send_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- /* tree[max_code+1].Len = -1; */ /* guard already set */
- if (nextlen == 0) max_count = 138, min_count = 3;
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
-
- } else if (curlen != 0) {
- if (curlen != prevlen) {
- send_code(s, curlen, s->bl_tree); count--;
- }
- Assert(count >= 3 && count <= 6, " 3_6?");
- send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
-
- } else if (count <= 10) {
- send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
-
- } else {
- send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
-}
-
-/* ===========================================================================
- * Construct the Huffman tree for the bit lengths and return the index in
- * bl_order of the last bit length code to send.
- */
-local int build_bl_tree(s)
- deflate_state *s;
-{
- int max_blindex; /* index of last bit length code of non zero freq */
-
- /* Determine the bit length frequencies for literal and distance trees */
- scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
- scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
-
- /* Build the bit length tree: */
- build_tree(s, (tree_desc *)(&(s->bl_desc)));
- /* opt_len now includes the length of the tree representations, except
- * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
- */
-
- /* Determine the number of bit length codes to send. The pkzip format
- * requires that at least 4 bit length codes be sent. (appnote.txt says
- * 3 but the actual value used is 4.)
- */
- for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
- if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
- }
- /* Update opt_len to include the bit length tree and counts */
- s->opt_len += 3*(max_blindex+1) + 5+5+4;
- Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
- s->opt_len, s->static_len));
-
- return max_blindex;
-}
-
-/* ===========================================================================
- * Send the header for a block using dynamic Huffman trees: the counts, the
- * lengths of the bit length codes, the literal tree and the distance tree.
- * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
- */
-local void send_all_trees(s, lcodes, dcodes, blcodes)
- deflate_state *s;
- int lcodes, dcodes, blcodes; /* number of codes for each tree */
-{
- int rank; /* index in bl_order */
-
- Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
- Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
- "too many codes");
- Tracev((stderr, "\nbl counts: "));
- send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
- send_bits(s, dcodes-1, 5);
- send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
- for (rank = 0; rank < blcodes; rank++) {
- Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
- send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
- }
- Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
- Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
- Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
-}
-
-/* ===========================================================================
- * Send a stored block
- */
-void _tr_stored_block(s, buf, stored_len, eof)
- deflate_state *s;
- charf *buf; /* input block */
- ulg stored_len; /* length of input block */
- int eof; /* true if this is the last block for a file */
-{
- send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
-#ifdef DEBUG
- s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
- s->compressed_len += (stored_len + 4) << 3;
-#endif
- copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
-}
-
-/* ===========================================================================
- * Send one empty static block to give enough lookahead for inflate.
- * This takes 10 bits, of which 7 may remain in the bit buffer.
- * The current inflate code requires 9 bits of lookahead. If the
- * last two codes for the previous block (real code plus EOB) were coded
- * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
- * the last real code. In this case we send two empty static blocks instead
- * of one. (There are no problems if the previous block is stored or fixed.)
- * To simplify the code, we assume the worst case of last real code encoded
- * on one bit only.
- */
-void _tr_align(s)
- deflate_state *s;
-{
- send_bits(s, STATIC_TREES<<1, 3);
- send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
- s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
-#endif
- bi_flush(s);
- /* Of the 10 bits for the empty block, we have already sent
- * (10 - bi_valid) bits. The lookahead for the last real code (before
- * the EOB of the previous block) was thus at least one plus the length
- * of the EOB plus what we have just sent of the empty static block.
- */
- if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
- send_bits(s, STATIC_TREES<<1, 3);
- send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
- s->compressed_len += 10L;
-#endif
- bi_flush(s);
- }
- s->last_eob_len = 7;
-}
-
-/* ===========================================================================
- * Determine the best encoding for the current block: dynamic trees, static
- * trees or store, and output the encoded block to the zip file.
- */
-void _tr_flush_block(s, buf, stored_len, eof)
- deflate_state *s;
- charf *buf; /* input block, or NULL if too old */
- ulg stored_len; /* length of input block */
- int eof; /* true if this is the last block for a file */
-{
- ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
- int max_blindex = 0; /* index of last bit length code of non zero freq */
-
- /* Build the Huffman trees unless a stored block is forced */
- if (s->level > 0) {
-
- /* Check if the file is binary or text */
- if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN)
- set_data_type(s);
-
- /* Construct the literal and distance trees */
- build_tree(s, (tree_desc *)(&(s->l_desc)));
- Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
-
- build_tree(s, (tree_desc *)(&(s->d_desc)));
- Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
- /* At this point, opt_len and static_len are the total bit lengths of
- * the compressed block data, excluding the tree representations.
- */
-
- /* Build the bit length tree for the above two trees, and get the index
- * in bl_order of the last bit length code to send.
- */
- max_blindex = build_bl_tree(s);
-
- /* Determine the best encoding. Compute the block lengths in bytes. */
- opt_lenb = (s->opt_len+3+7)>>3;
- static_lenb = (s->static_len+3+7)>>3;
-
- Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
- opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
- s->last_lit));
-
- if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
-
- } else {
- Assert(buf != (char*)0, "lost buf");
- opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
- }
-
-#ifdef FORCE_STORED
- if (buf != (char*)0) { /* force stored block */
-#else
- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
- /* 4: two words for the lengths */
-#endif
- /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
- * Otherwise we can't have processed more than WSIZE input bytes since
- * the last block flush, because compression would have been
- * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
- * transform a block into a stored block.
- */
- _tr_stored_block(s, buf, stored_len, eof);
-
-#ifdef FORCE_STATIC
- } else if (static_lenb >= 0) { /* force static trees */
-#else
- } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
-#endif
- send_bits(s, (STATIC_TREES<<1)+eof, 3);
- compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
-#ifdef DEBUG
- s->compressed_len += 3 + s->static_len;
-#endif
- } else {
- send_bits(s, (DYN_TREES<<1)+eof, 3);
- send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
- max_blindex+1);
- compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
-#ifdef DEBUG
- s->compressed_len += 3 + s->opt_len;
-#endif
- }
- Assert (s->compressed_len == s->bits_sent, "bad compressed size");
- /* The above check is made mod 2^32, for files larger than 512 MB
- * and uLong implemented on 32 bits.
- */
- init_block(s);
-
- if (eof) {
- bi_windup(s);
-#ifdef DEBUG
- s->compressed_len += 7; /* align on byte boundary */
-#endif
- }
- Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
- s->compressed_len-7*eof));
-}
-
-/* ===========================================================================
- * Save the match info and tally the frequency counts. Return true if
- * the current block must be flushed.
- */
-int _tr_tally (s, dist, lc)
- deflate_state *s;
- unsigned dist; /* distance of matched string */
- unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
-{
- s->d_buf[s->last_lit] = (ush)dist;
- s->l_buf[s->last_lit++] = (uch)lc;
- if (dist == 0) {
- /* lc is the unmatched char */
- s->dyn_ltree[lc].Freq++;
- } else {
- s->matches++;
- /* Here, lc is the match length - MIN_MATCH */
- dist--; /* dist = match distance - 1 */
- Assert((ush)dist < (ush)MAX_DIST(s) &&
- (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
- (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
-
- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
- s->dyn_dtree[d_code(dist)].Freq++;
- }
-
-#ifdef TRUNCATE_BLOCK
- /* Try to guess if it is profitable to stop the current block here */
- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
- /* Compute an upper bound for the compressed length */
- ulg out_length = (ulg)s->last_lit*8L;
- ulg in_length = (ulg)((long)s->strstart - s->block_start);
- int dcode;
- for (dcode = 0; dcode < D_CODES; dcode++) {
- out_length += (ulg)s->dyn_dtree[dcode].Freq *
- (5L+extra_dbits[dcode]);
- }
- out_length >>= 3;
- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
- s->last_lit, in_length, out_length,
- 100L - out_length*100L/in_length));
- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
- }
-#endif
- return (s->last_lit == s->lit_bufsize-1);
- /* We avoid equality with lit_bufsize because of wraparound at 64K
- * on 16 bit machines and because stored blocks are restricted to
- * 64K-1 bytes.
- */
-}
-
-/* ===========================================================================
- * Send the block data compressed using the given Huffman trees
- */
-local void compress_block(s, ltree, dtree)
- deflate_state *s;
- ct_data *ltree; /* literal tree */
- ct_data *dtree; /* distance tree */
-{
- unsigned dist; /* distance of matched string */
- int lc; /* match length or unmatched char (if dist == 0) */
- unsigned lx = 0; /* running index in l_buf */
- unsigned code; /* the code to send */
- int extra; /* number of extra bits to send */
-
- if (s->last_lit != 0) do {
- dist = s->d_buf[lx];
- lc = s->l_buf[lx++];
- if (dist == 0) {
- send_code(s, lc, ltree); /* send a literal byte */
- Tracecv(isgraph(lc), (stderr," '%c' ", lc));
- } else {
- /* Here, lc is the match length - MIN_MATCH */
- code = _length_code[lc];
- send_code(s, code+LITERALS+1, ltree); /* send the length code */
- extra = extra_lbits[code];
- if (extra != 0) {
- lc -= base_length[code];
- send_bits(s, lc, extra); /* send the extra length bits */
- }
- dist--; /* dist is now the match distance - 1 */
- code = d_code(dist);
- Assert (code < D_CODES, "bad d_code");
-
- send_code(s, code, dtree); /* send the distance code */
- extra = extra_dbits[code];
- if (extra != 0) {
- dist -= base_dist[code];
- send_bits(s, dist, extra); /* send the extra distance bits */
- }
- } /* literal or match pair ? */
-
- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
- "pendingBuf overflow");
-
- } while (lx < s->last_lit);
-
- send_code(s, END_BLOCK, ltree);
- s->last_eob_len = ltree[END_BLOCK].Len;
-}
-
-/* ===========================================================================
- * Set the data type to BINARY or TEXT, using a crude approximation:
- * set it to Z_TEXT if all symbols are either printable characters (33 to 255)
- * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise.
- * IN assertion: the fields Freq of dyn_ltree are set.
- */
-local void set_data_type(s)
- deflate_state *s;
-{
- int n;
-
- for (n = 0; n < 9; n++)
- if (s->dyn_ltree[n].Freq != 0)
- break;
- if (n == 9)
- for (n = 14; n < 32; n++)
- if (s->dyn_ltree[n].Freq != 0)
- break;
- s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY;
-}
-
-/* ===========================================================================
- * Reverse the first len bits of a code, using straightforward code (a faster
- * method would use a table)
- * IN assertion: 1 <= len <= 15
- */
-local unsigned bi_reverse(code, len)
- unsigned code; /* the value to invert */
- int len; /* its bit length */
-{
- register unsigned res = 0;
- do {
- res |= code & 1;
- code >>= 1, res <<= 1;
- } while (--len > 0);
- return res >> 1;
-}
-
-/* ===========================================================================
- * Flush the bit buffer, keeping at most 7 bits in it.
- */
-local void bi_flush(s)
- deflate_state *s;
-{
- if (s->bi_valid == 16) {
- put_short(s, s->bi_buf);
- s->bi_buf = 0;
- s->bi_valid = 0;
- } else if (s->bi_valid >= 8) {
- put_byte(s, (Byte)s->bi_buf);
- s->bi_buf >>= 8;
- s->bi_valid -= 8;
- }
-}
-
-/* ===========================================================================
- * Flush the bit buffer and align the output on a byte boundary
- */
-local void bi_windup(s)
- deflate_state *s;
-{
- if (s->bi_valid > 8) {
- put_short(s, s->bi_buf);
- } else if (s->bi_valid > 0) {
- put_byte(s, (Byte)s->bi_buf);
- }
- s->bi_buf = 0;
- s->bi_valid = 0;
-#ifdef DEBUG
- s->bits_sent = (s->bits_sent+7) & ~7;
-#endif
-}
-
-/* ===========================================================================
- * Copy a stored block, storing first the length and its
- * one's complement if requested.
- */
-local void copy_block(s, buf, len, header)
- deflate_state *s;
- charf *buf; /* the input data */
- unsigned len; /* its length */
- int header; /* true if block header must be written */
-{
- bi_windup(s); /* align on byte boundary */
- s->last_eob_len = 8; /* enough lookahead for inflate */
-
- if (header) {
- put_short(s, (ush)len);
- put_short(s, (ush)~len);
-#ifdef DEBUG
- s->bits_sent += 2*16;
-#endif
- }
-#ifdef DEBUG
- s->bits_sent += (ulg)len<<3;
-#endif
- while (len--) {
- put_byte(s, *buf++);
- }
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.h
deleted file mode 100644
index 35de4b0..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* header created automatically with -DGEN_TREES_H */
-
-local const ct_data static_ltree[L_CODES+2] = {
-{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
-{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
-{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
-{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
-{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
-{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
-{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
-{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
-{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
-{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
-{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
-{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
-{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
-{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
-{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
-{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
-{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
-{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
-{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
-{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
-{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
-{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
-{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
-{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
-{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
-{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
-{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
-{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
-{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
-{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
-{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
-{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
-{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
-{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
-{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
-{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
-{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
-{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
-{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
-{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
-{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
-{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
-{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
-{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
-{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
-{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
-{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
-{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
-{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
-{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
-{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
-{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
-{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
-{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
-{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
-{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
-{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
-{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
-};
-
-local const ct_data static_dtree[D_CODES] = {
-{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
-{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
-{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
-{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
-{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
-{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
-};
-
-const uch _dist_code[DIST_CODE_LEN] = {
- 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
- 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
-10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
-13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
-18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
-};
-
-const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
-13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
-17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
-19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
-22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
-};
-
-local const int base_length[LENGTH_CODES] = {
-0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
-64, 80, 96, 112, 128, 160, 192, 224, 0
-};
-
-local const int base_dist[D_CODES] = {
- 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
- 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
- 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
-};
-
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c
deleted file mode 100644
index d2e4ef4..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* uncompr.c -- decompress a memory buffer
- * Copyright (C) 1995-2003 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-/* ===========================================================================
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted.
-*/
-int ZEXPORT uncompress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = inflateInit(&stream);
- if (err != Z_OK) return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
- return Z_DATA_ERROR;
- return err;
- }
- *destLen = (uLong)stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zadler32.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zadler32.c
deleted file mode 100644
index 6bb56f3..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zadler32.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2004 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-#define BASE 65521UL /* largest prime smaller than 65536 */
-#define NMAX 5552
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
-
-#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
-#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
-#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
-#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
-#define DO16(buf) DO8(buf,0); DO8(buf,8);
-
-/* use NO_DIVIDE if your processor does not do division in hardware */
-#ifdef NO_DIVIDE
-# define MOD(a) \
- do { \
- if (a >= (BASE << 16)) a -= (BASE << 16); \
- if (a >= (BASE << 15)) a -= (BASE << 15); \
- if (a >= (BASE << 14)) a -= (BASE << 14); \
- if (a >= (BASE << 13)) a -= (BASE << 13); \
- if (a >= (BASE << 12)) a -= (BASE << 12); \
- if (a >= (BASE << 11)) a -= (BASE << 11); \
- if (a >= (BASE << 10)) a -= (BASE << 10); \
- if (a >= (BASE << 9)) a -= (BASE << 9); \
- if (a >= (BASE << 8)) a -= (BASE << 8); \
- if (a >= (BASE << 7)) a -= (BASE << 7); \
- if (a >= (BASE << 6)) a -= (BASE << 6); \
- if (a >= (BASE << 5)) a -= (BASE << 5); \
- if (a >= (BASE << 4)) a -= (BASE << 4); \
- if (a >= (BASE << 3)) a -= (BASE << 3); \
- if (a >= (BASE << 2)) a -= (BASE << 2); \
- if (a >= (BASE << 1)) a -= (BASE << 1); \
- if (a >= BASE) a -= BASE; \
- } while (0)
-# define MOD4(a) \
- do { \
- if (a >= (BASE << 4)) a -= (BASE << 4); \
- if (a >= (BASE << 3)) a -= (BASE << 3); \
- if (a >= (BASE << 2)) a -= (BASE << 2); \
- if (a >= (BASE << 1)) a -= (BASE << 1); \
- if (a >= BASE) a -= BASE; \
- } while (0)
-#else
-# define MOD(a) a %= BASE
-# define MOD4(a) a %= BASE
-#endif
-
-/* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- uInt len;
-{
- unsigned long sum2;
- unsigned n;
-
- /* split Adler-32 into component sums */
- sum2 = (adler >> 16) & 0xffff;
- adler &= 0xffff;
-
- /* in case user likes doing a byte at a time, keep it fast */
- if (len == 1) {
- adler += buf[0];
- if (adler >= BASE)
- adler -= BASE;
- sum2 += adler;
- if (sum2 >= BASE)
- sum2 -= BASE;
- return adler | (sum2 << 16);
- }
-
- /* initial Adler-32 value (deferred check for len == 1 speed) */
- if (buf == Z_NULL)
- return 1L;
-
- /* in case short lengths are provided, keep it somewhat fast */
- if (len < 16) {
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- if (adler >= BASE)
- adler -= BASE;
- MOD4(sum2); /* only added so many BASE's */
- return adler | (sum2 << 16);
- }
-
- /* do length NMAX blocks -- requires just one modulo operation */
- while (len >= NMAX) {
- len -= NMAX;
- n = NMAX / 16; /* NMAX is divisible by 16 */
- do {
- DO16(buf); /* 16 sums unrolled */
- buf += 16;
- } while (--n);
- MOD(adler);
- MOD(sum2);
- }
-
- /* do remaining bytes (less than NMAX, still just one modulo) */
- if (len) { /* avoid modulos if none remaining */
- while (len >= 16) {
- len -= 16;
- DO16(buf);
- buf += 16;
- }
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- MOD(adler);
- MOD(sum2);
- }
-
- /* return recombined sums */
- return adler | (sum2 << 16);
-}
-
-/* ========================================================================= */
-uLong ZEXPORT adler32_combine(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off_t len2;
-{
- unsigned long sum1;
- unsigned long sum2;
- unsigned rem;
-
- /* the derivation of this formula is left as an exercise for the reader */
- rem = (unsigned)(len2 % BASE);
- sum1 = adler1 & 0xffff;
- sum2 = rem * sum1;
- MOD(sum2);
- sum1 += (adler2 & 0xffff) + BASE - 1;
- sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
- if (sum1 > BASE) sum1 -= BASE;
- if (sum1 > BASE) sum1 -= BASE;
- if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
- if (sum2 > BASE) sum2 -= BASE;
- return sum1 | (sum2 << 16);
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zconf.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zconf.h
deleted file mode 100644
index e7c3f51..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zconf.h
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-/* for _LP64 */
-#include <sys/types.h>
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-# define deflateInit_ z_deflateInit_
-# define deflate z_deflate
-# define deflateEnd z_deflateEnd
-# define inflateInit_ z_inflateInit_
-# define inflate z_inflate
-# define inflateEnd z_inflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateCopy z_deflateCopy
-# define deflateReset z_deflateReset
-# define deflateParams z_deflateParams
-# define deflateBound z_deflateBound
-# define deflatePrime z_deflatePrime
-# define inflateInit2_ z_inflateInit2_
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateCopy z_inflateCopy
-# define inflateReset z_inflateReset
-# define inflateBack z_inflateBack
-# define inflateBackEnd z_inflateBackEnd
-# define compress z_compress
-# define compress2 z_compress2
-# define compressBound z_compressBound
-# define uncompress z_uncompress
-# define adler32 z_adler32
-# define crc32 z_crc32
-# define get_crc_table z_get_crc_table
-# define zError z_zError
-
-# define alloc_func z_alloc_func
-# define free_func z_free_func
-# define in_func z_in_func
-# define out_func z_out_func
-# define Byte z_Byte
-# define uInt z_uInt
-# define uLong z_uLong
-# define Bytef z_Bytef
-# define charf z_charf
-# define intf z_intf
-# define uIntf z_uIntf
-# define uLongf z_uLongf
-# define voidpf z_voidpf
-# define voidp z_voidp
-#endif
-
-#if defined(__MSDOS__) && !defined(MSDOS)
-# define MSDOS
-#endif
-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
-# define OS2
-#endif
-#if defined(_WINDOWS) && !defined(WINDOWS)
-# define WINDOWS
-#endif
-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
-# ifndef WIN32
-# define WIN32
-# endif
-#endif
-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
-# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
-# ifndef SYS16BIT
-# define SYS16BIT
-# endif
-# endif
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#ifdef SYS16BIT
-# define MAXSEG_64K
-#endif
-#ifdef MSDOS
-# define UNALIGNED_OK
-#endif
-
-#ifdef __STDC_VERSION__
-# ifndef STDC
-# define STDC
-# endif
-# if __STDC_VERSION__ >= 199901L
-# ifndef STDC99
-# define STDC99
-# endif
-# endif
-#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
-# define STDC
-#endif
-
-#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const /* note: need a more gentle solution here */
-# endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-# define NO_DUMMY_DECL
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-# ifdef MAXSEG_64K
-# define MAX_MEM_LEVEL 8
-# else
-# define MAX_MEM_LEVEL 9
-# endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
- (1 << (windowBits+2)) + (1 << (memLevel+9))
- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
- The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
- /* Type declarations */
-
-#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#ifdef SYS16BIT
-# if defined(M_I86SM) || defined(M_I86MM)
- /* MSC small or medium model */
-# define SMALL_MEDIUM
-# ifdef _MSC_VER
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-# if (defined(__SMALL__) || defined(__MEDIUM__))
- /* Turbo C small or medium model */
-# define SMALL_MEDIUM
-# ifdef __BORLANDC__
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-#endif
-
-#if defined(WINDOWS) || defined(WIN32)
- /* If building or using zlib as a DLL, define ZLIB_DLL.
- * This is not mandatory, but it offers a little performance increase.
- */
-# ifdef ZLIB_DLL
-# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
-# ifdef ZLIB_INTERNAL
-# define ZEXTERN extern __declspec(dllexport)
-# else
-# define ZEXTERN extern __declspec(dllimport)
-# endif
-# endif
-# endif /* ZLIB_DLL */
- /* If building or using zlib with the WINAPI/WINAPIV calling convention,
- * define ZLIB_WINAPI.
- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
- */
-# ifdef ZLIB_WINAPI
-# ifdef FAR
-# undef FAR
-# endif
-# include <windows.h>
- /* No need for _export, use ZLIB.DEF instead. */
- /* For complete Windows compatibility, use WINAPI, not __stdcall. */
-# define ZEXPORT WINAPI
-# ifdef WIN32
-# define ZEXPORTVA WINAPIV
-# else
-# define ZEXPORTVA FAR CDECL
-# endif
-# endif
-#endif
-
-#if defined (__BEOS__)
-# ifdef ZLIB_DLL
-# ifdef ZLIB_INTERNAL
-# define ZEXPORT __declspec(dllexport)
-# define ZEXPORTVA __declspec(dllexport)
-# else
-# define ZEXPORT __declspec(dllimport)
-# define ZEXPORTVA __declspec(dllimport)
-# endif
-# endif
-#endif
-
-#ifndef ZEXTERN
-# define ZEXTERN extern
-#endif
-#ifndef ZEXPORT
-# define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-# define ZEXPORTVA
-#endif
-
-#ifndef FAR
-# define FAR
-#endif
-
-#if !defined(__MACTYPES__)
-typedef unsigned char Byte; /* 8 bits */
-#endif
-typedef unsigned int uInt; /* 16 bits or more */
-#ifdef _LP64
-typedef unsigned int uLong; /* 32 bits or more */
-#else
-typedef unsigned long uLong; /* 32 bits or more */
-#endif
-
-#ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-# define Bytef Byte FAR
-#else
- typedef Byte FAR Bytef;
-#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
- typedef void const *voidpc;
- typedef void FAR *voidpf;
- typedef void *voidp;
-#else
- typedef Byte const *voidpc;
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
-#endif
-
-#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
-# include <sys/types.h> /* for off_t */
-# include <unistd.h> /* for SEEK_* and off_t */
-# ifdef VMS
-# include <unixio.h> /* for off_t */
-# endif
-# define z_off_t off_t
-#endif
-#ifndef SEEK_SET
-# define SEEK_SET 0 /* Seek from beginning of file. */
-# define SEEK_CUR 1 /* Seek from current position. */
-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
-#endif
-#ifndef z_off_t
-# define z_off_t long
-#endif
-
-#if defined(__OS400__)
-# define NO_vsnprintf
-#endif
-
-#if defined(__MVS__)
-# define NO_vsnprintf
-# ifdef FAR
-# undef FAR
-# endif
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
-# pragma map(deflateInit_,"DEIN")
-# pragma map(deflateInit2_,"DEIN2")
-# pragma map(deflateEnd,"DEEND")
-# pragma map(deflateBound,"DEBND")
-# pragma map(inflateInit_,"ININ")
-# pragma map(inflateInit2_,"ININ2")
-# pragma map(inflateEnd,"INEND")
-# pragma map(inflateSync,"INSY")
-# pragma map(inflateSetDictionary,"INSEDI")
-# pragma map(compressBound,"CMBND")
-# pragma map(inflate_table,"INTABL")
-# pragma map(inflate_fast,"INFA")
-# pragma map(inflate_copyright,"INCOPY")
-#endif
-
-#endif /* ZCONF_H */
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c
deleted file mode 100644
index 0fd9a92..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Thanks to Rodney Brown <rbrown64 at csc.com.au> for his contribution of faster
- * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
- * tables for updating the shift register in one step with three exclusive-ors
- * instead of four steps with four exclusive-ors. This results in about a
- * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
- */
-
-/* @(#) $Id$ */
-
-/*
- Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
- protection on the static variables used to control the first-use generation
- of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
- first call get_crc_table() to initialize the tables before allowing more than
- one thread to use crc32().
- */
-
-#ifdef MAKECRCH
-# include <stdio.h>
-# ifndef DYNAMIC_CRC_TABLE
-# define DYNAMIC_CRC_TABLE
-# endif /* !DYNAMIC_CRC_TABLE */
-#endif /* MAKECRCH */
-
-#include "zutil.h" /* for STDC and FAR definitions */
-
-#define local static
-
-/* Find a four-byte integer type for crc32_little() and crc32_big(). */
-#ifndef NOBYFOUR
-# ifdef STDC /* need ANSI C limits.h to determine sizes */
-# include <limits.h>
-# define BYFOUR
-# if (UINT_MAX == 0xffffffffUL)
- typedef unsigned int u4;
-# else
-# if (ULONG_MAX == 0xffffffffUL)
- typedef unsigned long u4;
-# else
-# if (USHRT_MAX == 0xffffffffUL)
- typedef unsigned short u4;
-# else
-# undef BYFOUR /* can't find a four-byte integer type! */
-# endif
-# endif
-# endif
-# endif /* STDC */
-#endif /* !NOBYFOUR */
-
-/* Definitions for doing the crc four data bytes at a time. */
-#ifdef BYFOUR
-# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
- (((w)&0xff00)<<8)+(((w)&0xff)<<24))
- local unsigned long crc32_little OF((unsigned long,
- const unsigned char FAR *, unsigned));
- local unsigned long crc32_big OF((unsigned long,
- const unsigned char FAR *, unsigned));
-# define TBLS 8
-#else
-# define TBLS 1
-#endif /* BYFOUR */
-
-/* Local functions for crc concatenation */
-local unsigned long gf2_matrix_times OF((unsigned long *mat,
- unsigned long vec));
-local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
-
-#ifdef DYNAMIC_CRC_TABLE
-
-local volatile int crc_table_empty = 1;
-local unsigned long FAR crc_table[TBLS][256];
-local void make_crc_table OF((void));
-#ifdef MAKECRCH
- local void write_table OF((FILE *, const unsigned long FAR *));
-#endif /* MAKECRCH */
-/*
- Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
- x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
-
- Polynomials over GF(2) are represented in binary, one bit per coefficient,
- with the lowest powers in the most significant bit. Then adding polynomials
- is just exclusive-or, and multiplying a polynomial by x is a right shift by
- one. If we call the above polynomial p, and represent a byte as the
- polynomial q, also with the lowest power in the most significant bit (so the
- byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
- where a mod b means the remainder after dividing a by b.
-
- This calculation is done using the shift-register method of multiplying and
- taking the remainder. The register is initialized to zero, and for each
- incoming bit, x^32 is added mod p to the register if the bit is a one (where
- x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
- x (which is shifting right by one and adding x^32 mod p if the bit shifted
- out is a one). We start with the highest power (least significant bit) of
- q and repeat for all eight bits of q.
-
- The first table is simply the CRC of all possible eight bit values. This is
- all the information needed to generate CRCs on data a byte at a time for all
- combinations of CRC register values and incoming bytes. The remaining tables
- allow for word-at-a-time CRC calculation for both big-endian and little-
- endian machines, where a word is four bytes.
-*/
-local void make_crc_table()
-{
- unsigned long c;
- int n, k;
- unsigned long poly; /* polynomial exclusive-or pattern */
- /* terms of polynomial defining this crc (except x^32): */
- static volatile int first = 1; /* flag to limit concurrent making */
- static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
-
- /* See if another task is already doing this (not thread-safe, but better
- than nothing -- significantly reduces duration of vulnerability in
- case the advice about DYNAMIC_CRC_TABLE is ignored) */
- if (first) {
- first = 0;
-
- /* make exclusive-or pattern from polynomial (0xedb88320UL) */
- poly = 0UL;
- for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
- poly |= 1UL << (31 - p[n]);
-
- /* generate a crc for every 8-bit value */
- for (n = 0; n < 256; n++) {
- c = (unsigned long)n;
- for (k = 0; k < 8; k++)
- c = c & 1 ? poly ^ (c >> 1) : c >> 1;
- crc_table[0][n] = c;
- }
-
-#ifdef BYFOUR
- /* generate crc for each value followed by one, two, and three zeros,
- and then the byte reversal of those as well as the first table */
- for (n = 0; n < 256; n++) {
- c = crc_table[0][n];
- crc_table[4][n] = REV(c);
- for (k = 1; k < 4; k++) {
- c = crc_table[0][c & 0xff] ^ (c >> 8);
- crc_table[k][n] = c;
- crc_table[k + 4][n] = REV(c);
- }
- }
-#endif /* BYFOUR */
-
- crc_table_empty = 0;
- }
- else { /* not first */
- /* wait for the other guy to finish (not efficient, but rare) */
- while (crc_table_empty)
- ;
- }
-
-#ifdef MAKECRCH
- /* write out CRC tables to crc32.h */
- {
- FILE *out;
-
- out = fopen("crc32.h", "w");
- if (out == NULL) return;
- fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
- fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
- fprintf(out, "local const unsigned long FAR ");
- fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
- write_table(out, crc_table[0]);
-# ifdef BYFOUR
- fprintf(out, "#ifdef BYFOUR\n");
- for (k = 1; k < 8; k++) {
- fprintf(out, " },\n {\n");
- write_table(out, crc_table[k]);
- }
- fprintf(out, "#endif\n");
-# endif /* BYFOUR */
- fprintf(out, " }\n};\n");
- fclose(out);
- }
-#endif /* MAKECRCH */
-}
-
-#ifdef MAKECRCH
-local void write_table(out, table)
- FILE *out;
- const unsigned long FAR *table;
-{
- int n;
-
- for (n = 0; n < 256; n++)
- fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n],
- n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
-}
-#endif /* MAKECRCH */
-
-#else /* !DYNAMIC_CRC_TABLE */
-/* ========================================================================
- * Tables of CRC-32s of all single-byte values, made by make_crc_table().
- */
-#include "crc32.h"
-#endif /* DYNAMIC_CRC_TABLE */
-
-/* =========================================================================
- * This function can be used by asm versions of crc32()
- */
-const unsigned long FAR * ZEXPORT get_crc_table()
-{
-#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
-#endif /* DYNAMIC_CRC_TABLE */
- return (const unsigned long FAR *)crc_table;
-}
-
-/* ========================================================================= */
-#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
-#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
-
-/* ========================================================================= */
-uLong ZEXPORT crc32(crc, buf, len)
- uLong crc;
- const unsigned char FAR *buf;
- unsigned len;
-{
- if (buf == Z_NULL) return 0UL;
-
-#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
-#endif /* DYNAMIC_CRC_TABLE */
-
-#ifdef BYFOUR
- if (sizeof(void *) == sizeof(ptrdiff_t)) {
- u4 endian;
-
- endian = 1;
- if (*((unsigned char *)(&endian)))
- return (uLong)crc32_little(crc, buf, len);
- else
- return (uLong)crc32_big(crc, buf, len);
- }
-#endif /* BYFOUR */
- crc = crc ^ 0xffffffffUL;
- while (len >= 8) {
- DO8;
- len -= 8;
- }
- if (len) do {
- DO1;
- } while (--len);
- return crc ^ 0xffffffffUL;
-}
-
-#ifdef BYFOUR
-
-/* ========================================================================= */
-#define DOLIT4 c ^= *buf4++; \
- c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
- crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
-#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
-
-/* ========================================================================= */
-local unsigned long crc32_little(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
-{
- register u4 c;
- register const u4 FAR *buf4;
-
- c = (u4)crc;
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- len--;
- }
-
- buf4 = (const u4 FAR *)(const void FAR *)buf;
- while (len >= 32) {
- DOLIT32;
- len -= 32;
- }
- while (len >= 4) {
- DOLIT4;
- len -= 4;
- }
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- } while (--len);
- c = ~c;
- return (unsigned long)c;
-}
-
-/* ========================================================================= */
-#define DOBIG4 c ^= *++buf4; \
- c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
- crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
-#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
-
-/* ========================================================================= */
-local unsigned long crc32_big(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
-{
- register u4 c;
- register const u4 FAR *buf4;
-
- c = REV((u4)crc);
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- len--;
- }
-
- buf4 = (const u4 FAR *)(const void FAR *)buf;
- buf4--;
- while (len >= 32) {
- DOBIG32;
- len -= 32;
- }
- while (len >= 4) {
- DOBIG4;
- len -= 4;
- }
- buf4++;
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- } while (--len);
- c = ~c;
- return (unsigned long)(REV(c));
-}
-
-#endif /* BYFOUR */
-
-#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
-
-/* ========================================================================= */
-local unsigned long gf2_matrix_times(mat, vec)
- unsigned long *mat;
- unsigned long vec;
-{
- unsigned long sum;
-
- sum = 0;
- while (vec) {
- if (vec & 1)
- sum ^= *mat;
- vec >>= 1;
- mat++;
- }
- return sum;
-}
-
-/* ========================================================================= */
-local void gf2_matrix_square(square, mat)
- unsigned long *square;
- unsigned long *mat;
-{
- int n;
-
- for (n = 0; n < GF2_DIM; n++)
- square[n] = gf2_matrix_times(mat, mat[n]);
-}
-
-/* ========================================================================= */
-uLong ZEXPORT crc32_combine(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off_t len2;
-{
- int n;
- unsigned long row;
- unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
- unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
-
- /* degenerate case */
- if (len2 == 0)
- return crc1;
-
- /* put operator for one zero bit in odd */
- odd[0] = 0xedb88320UL; /* CRC-32 polynomial */
- row = 1;
- for (n = 1; n < GF2_DIM; n++) {
- odd[n] = row;
- row <<= 1;
- }
-
- /* put operator for two zero bits in even */
- gf2_matrix_square(even, odd);
-
- /* put operator for four zero bits in odd */
- gf2_matrix_square(odd, even);
-
- /* apply len2 zeros to crc1 (first square will put the operator for one
- zero byte, eight zero bits, in even) */
- do {
- /* apply zeros operator for this bit of len2 */
- gf2_matrix_square(even, odd);
- if (len2 & 1)
- crc1 = gf2_matrix_times(even, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- if (len2 == 0)
- break;
-
- /* another iteration of the loop with odd and even swapped */
- gf2_matrix_square(odd, even);
- if (len2 & 1)
- crc1 = gf2_matrix_times(odd, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- } while (len2 != 0);
-
- /* return combined crc */
- crc1 ^= crc2;
- return crc1;
-}
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zlib.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zlib.h
deleted file mode 100644
index 518b31a..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zlib.h
+++ /dev/null
@@ -1,1381 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.3, July 18th, 2005
-
- Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
-
- 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.
-
- Jean-loup Gailly Mark Adler
- jloup at gzip.org madler at alumni.caltech.edu
-
-
- The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
- (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
-
-#ifndef ZLIB_H
-#define ZLIB_H
-
-#include "zconf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.2.3"
-#define ZLIB_VERNUM 0x1230
-
-/*
- The 'zlib' compression library provides in-memory compression and
- decompression functions, including integrity checks of the uncompressed
- data. This version of the library supports only one compression method
- (deflation) but other algorithms will be added later and will have the same
- stream interface.
-
- Compression can be done in a single step if the buffers are large
- enough (for example if an input file is mmap'ed), or can be done by
- repeated calls of the compression function. In the latter case, the
- application must provide more input and/or consume the output
- (providing more output space) before each call.
-
- The compressed data format used by default by the in-memory functions is
- the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
- around a deflate stream, which is itself documented in RFC 1951.
-
- The library also supports reading and writing files in gzip (.gz) format
- with an interface similar to that of stdio using the functions that start
- with "gz". The gzip format is different from the zlib format. gzip is a
- gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
-
- This library can optionally read and write gzip streams in memory as well.
-
- The zlib format was designed to be compact and fast for use in memory
- and on communications channels. The gzip format was designed for single-
- file compression on file systems, has a larger header than zlib to maintain
- directory information, and uses a different, slower check method than zlib.
-
- The library does not install any signal handler. The decoder checks
- the consistency of the compressed data, so the library should never
- crash even in case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
- Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
- long long total_in; /* total nb of input bytes read so far */
-
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
- long long total_out;/* total nb of bytes output so far */
-
- char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
-
- alloc_func zalloc; /* used to allocate the internal state */
- free_func zfree; /* used to free the internal state */
- voidpf opaque; /* private data object passed to zalloc and zfree */
-
- int data_type; /* best guess about the data type: binary or text */
- uLong adler; /* adler32 value of the uncompressed data */
- uLong reserved; /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
- gzip header information passed to and from zlib routines. See RFC 1952
- for more details on the meanings of these fields.
-*/
-typedef struct gz_header_s {
- int text; /* true if compressed data believed to be text */
- uLong time; /* modification time */
- int xflags; /* extra flags (not used when writing a gzip file) */
- int os; /* operating system */
- Bytef *extra; /* pointer to extra field or Z_NULL if none */
- uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
- uInt extra_max; /* space at extra (only when reading header) */
- Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
- uInt name_max; /* space at name (only when reading header) */
- Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
- uInt comm_max; /* space at comment (only when reading header) */
- int hcrc; /* true if there was or will be a header crc */
- int done; /* true when done reading gzip header (not used
- when writing a gzip file) */
-} gz_header;
-
-typedef gz_header FAR *gz_headerp;
-
-/*
- The application must update next_in and avail_in when avail_in has
- dropped to zero. It must update next_out and avail_out when avail_out
- has dropped to zero. The application must initialize zalloc, zfree and
- opaque before calling the init function. All other fields are set by the
- compression library and must not be updated by the application.
-
- The opaque value provided by the application will be passed as the first
- parameter for calls of zalloc and zfree. This can be useful for custom
- memory management. The compression library attaches no meaning to the
- opaque value.
-
- zalloc must return Z_NULL if there is not enough memory for the object.
- If zlib is used in a multi-threaded application, zalloc and zfree must be
- thread safe.
-
- On 16-bit systems, the functions zalloc and zfree must be able to allocate
- exactly 65536 bytes, but will not be required to allocate more than this
- if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
- pointers returned by zalloc for objects of exactly 65536 bytes *must*
- have their offset normalized to zero. The default allocation function
- provided by this library ensures this (see zutil.c). To reduce memory
- requirements and avoid any allocation of 64K objects, at the expense of
- compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
-
- The fields total_in and total_out can be used for statistics or
- progress reports. After compression, total_in holds the total size of
- the uncompressed data and may be saved for use in the decompressor
- (particularly if the decompressor wants to decompress everything in
- a single step).
-*/
-
- /* constants */
-
-#define Z_NO_FLUSH 0
-#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH 2
-#define Z_FULL_FLUSH 3
-#define Z_FINISH 4
-#define Z_BLOCK 5
-/* Allowed flush values; see deflate() and inflate() below for details */
-
-#define Z_OK 0
-#define Z_STREAM_END 1
-#define Z_NEED_DICT 2
-#define Z_ERRNO (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR (-3)
-#define Z_MEM_ERROR (-4)
-#define Z_BUF_ERROR (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION 0
-#define Z_BEST_SPEED 1
-#define Z_BEST_COMPRESSION 9
-#define Z_DEFAULT_COMPRESSION (-1)
-/* compression levels */
-
-#define Z_FILTERED 1
-#define Z_HUFFMAN_ONLY 2
-#define Z_RLE 3
-#define Z_FIXED 4
-#define Z_DEFAULT_STRATEGY 0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY 0
-#define Z_TEXT 1
-#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
-#define Z_UNKNOWN 2
-/* Possible values of the data_type field (though see inflate()) */
-
-#define Z_DEFLATED 8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
- /* basic functions */
-
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
- If the first character differs, the library code actually used is
- not compatible with the zlib.h header file used by the application.
- This check is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
-
- Initializes the internal stream state for compression. The fields
- zalloc, zfree and opaque must be initialized before by the caller.
- If zalloc and zfree are set to Z_NULL, deflateInit updates them to
- use default allocation functions.
-
- The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
- 1 gives best speed, 9 gives best compression, 0 gives no compression at
- all (the input data is simply copied a block at a time).
- Z_DEFAULT_COMPRESSION requests a default compromise between speed and
- compression (currently equivalent to level 6).
-
- deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if level is not a valid compression level,
- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
- with the version assumed by the caller (ZLIB_VERSION).
- msg is set to null if there is no error message. deflateInit does not
- perform any compression: this will be done by deflate().
-*/
-
-
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
-/*
- deflate compresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce some
- output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. deflate performs one or both of the
- following actions:
-
- - Compress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in and avail_in are updated and
- processing will resume at this point for the next call of deflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. This action is forced if the parameter flush is non zero.
- Forcing flush frequently degrades the compression ratio, so this parameter
- should be set only when necessary (in interactive applications).
- Some output may be provided even if flush is not set.
-
- Before the call of deflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating avail_in or avail_out accordingly; avail_out
- should never be zero before the call. The application can consume the
- compressed output when it wants, for example when the output buffer is full
- (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
- and with zero avail_out, it must be called again after making room in the
- output buffer because there might be more output pending.
-
- Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
- decide how much data to accumualte before producing output, in order to
- maximize compression.
-
- If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
- flushed to the output buffer and the output is aligned on a byte boundary, so
- that the decompressor can get all input data available so far. (In particular
- avail_in is zero after the call if enough output space has been provided
- before the call.) Flushing may degrade compression for some compression
- algorithms and so it should be used only when necessary.
-
- If flush is set to Z_FULL_FLUSH, all output is flushed as with
- Z_SYNC_FLUSH, and the compression state is reset so that decompression can
- restart from this point if previous compressed data has been damaged or if
- random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
- compression.
-
- If deflate returns with avail_out == 0, this function must be called again
- with the same value of the flush parameter and more output space (updated
- avail_out), until the flush is complete (deflate returns with non-zero
- avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
- avail_out is greater than six to avoid repeated flush markers due to
- avail_out == 0 on return.
-
- If the parameter flush is set to Z_FINISH, pending input is processed,
- pending output is flushed and deflate returns with Z_STREAM_END if there
- was enough output space; if deflate returns with Z_OK, this function must be
- called again with Z_FINISH and more output space (updated avail_out) but no
- more input data, until it returns with Z_STREAM_END or an error. After
- deflate has returned Z_STREAM_END, the only possible operations on the
- stream are deflateReset or deflateEnd.
-
- Z_FINISH can be used immediately after deflateInit if all the compression
- is to be done in a single step. In this case, avail_out must be at least
- the value returned by deflateBound (see below). If deflate does not return
- Z_STREAM_END, then it must be called again as described above.
-
- deflate() sets strm->adler to the adler32 checksum of all input read
- so far (that is, total_in bytes).
-
- deflate() may update strm->data_type if it can make a good guess about
- the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
- binary. This field is only for information purposes and does not affect
- the compression algorithm in any manner.
-
- deflate() returns Z_OK if some progress has been made (more input
- processed or more output produced), Z_STREAM_END if all input has been
- consumed and all output has been produced (only when flush is set to
- Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
- if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
- (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
- fatal, and deflate() can be called again with more input and more output
- space to continue compressing.
-*/
-
-
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
- stream state was inconsistent, Z_DATA_ERROR if the stream was freed
- prematurely (some input or output was discarded). In the error case,
- msg may be set but then points to a static string (which must not be
- deallocated).
-*/
-
-
-/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-
- Initializes the internal stream state for decompression. The fields
- next_in, avail_in, zalloc, zfree and opaque must be initialized before by
- the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
- value depends on the compression method), inflateInit determines the
- compression method from the zlib header and allocates all data structures
- accordingly; otherwise the allocation will be deferred to the first call of
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
- use default allocation functions.
-
- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
- version assumed by the caller. msg is set to null if there is no error
- message. inflateInit does not perform any decompression apart from reading
- the zlib header if present: this will be done by inflate(). (So next_in and
- avail_in may be modified, but next_out and avail_out are unchanged.)
-*/
-
-
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
-/*
- inflate decompresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce
- some output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. inflate performs one or both of the
- following actions:
-
- - Decompress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in is updated and processing
- will resume at this point for the next call of inflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. inflate() provides as much output as possible, until there
- is no more input data or no more space in the output buffer (see below
- about the flush parameter).
-
- Before the call of inflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating the next_* and avail_* values accordingly.
- The application can consume the uncompressed output when it wants, for
- example when the output buffer is full (avail_out == 0), or after each
- call of inflate(). If inflate returns Z_OK and with zero avail_out, it
- must be called again after making room in the output buffer because there
- might be more output pending.
-
- The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
- Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
- output as possible to the output buffer. Z_BLOCK requests that inflate() stop
- if and when it gets to the next deflate block boundary. When decoding the
- zlib or gzip format, this will cause inflate() to return immediately after
- the header and before the first block. When doing a raw inflate, inflate()
- will go ahead and process the first block, and will return when it gets to
- the end of that block, or when it runs out of data.
-
- The Z_BLOCK option assists in appending to or combining deflate streams.
- Also to assist in this, on return inflate() will set strm->data_type to the
- number of unused bits in the last byte taken from strm->next_in, plus 64
- if inflate() is currently decoding the last block in the deflate stream,
- plus 128 if inflate() returned immediately after decoding an end-of-block
- code or decoding the complete header up to just before the first byte of the
- deflate stream. The end-of-block will not be indicated until all of the
- uncompressed data from that block has been written to strm->next_out. The
- number of unused bits may in general be greater than seven, except when
- bit 7 of data_type is set, in which case the number of unused bits will be
- less than eight.
-
- inflate() should normally be called until it returns Z_STREAM_END or an
- error. However if all decompression is to be performed in a single step
- (a single call of inflate), the parameter flush should be set to
- Z_FINISH. In this case all pending input is processed and all pending
- output is flushed; avail_out must be large enough to hold all the
- uncompressed data. (The size of the uncompressed data may have been saved
- by the compressor for this purpose.) The next operation on this stream must
- be inflateEnd to deallocate the decompression state. The use of Z_FINISH
- is never required, but can be used to inform inflate that a faster approach
- may be used for the single inflate() call.
-
- In this implementation, inflate() always flushes as much output as
- possible to the output buffer, and always uses the faster approach on the
- first call. So the only effect of the flush parameter in this implementation
- is on the return value of inflate(), as noted below, or when it returns early
- because Z_BLOCK is used.
-
- If a preset dictionary is needed after this call (see inflateSetDictionary
- below), inflate sets strm->adler to the adler32 checksum of the dictionary
- chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
- strm->adler to the adler32 checksum of all output produced so far (that is,
- total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
- below. At the end of the stream, inflate() checks that its computed adler32
- checksum is equal to that saved by the compressor and returns Z_STREAM_END
- only if the checksum is correct.
-
- inflate() will decompress and check either zlib-wrapped or gzip-wrapped
- deflate data. The header type is detected automatically. Any information
- contained in the gzip header is not retained, so applications that need that
- information should instead use raw inflate, see inflateInit2() below, or
- inflateBack() and perform their own processing of the gzip header and
- trailer.
-
- inflate() returns Z_OK if some progress has been made (more input processed
- or more output produced), Z_STREAM_END if the end of the compressed data has
- been reached and all uncompressed output has been produced, Z_NEED_DICT if a
- preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
- corrupted (input stream not conforming to the zlib format or incorrect check
- value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
- if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
- Z_BUF_ERROR if no progress is possible or if there was not enough room in the
- output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
- inflate() can be called again with more input and more output space to
- continue decompressing. If Z_DATA_ERROR is returned, the application may then
- call inflateSync() to look for a good compression block if a partial recovery
- of the data is desired.
-*/
-
-
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
- was inconsistent. In the error case, msg may be set but then points to a
- static string (which must not be deallocated).
-*/
-
- /* Advanced functions */
-
-/*
- The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
-
- This is another version of deflateInit with more compression options. The
- fields next_in, zalloc, zfree and opaque must be initialized before by
- the caller.
-
- The method parameter is the compression method. It must be Z_DEFLATED in
- this version of the library.
-
- The windowBits parameter is the base two logarithm of the window size
- (the size of the history buffer). It should be in the range 8..15 for this
- version of the library. Larger values of this parameter result in better
- compression at the expense of memory usage. The default value is 15 if
- deflateInit is used instead.
-
- windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
- determines the window size. deflate() will then generate raw deflate data
- with no zlib header or trailer, and will not compute an adler32 check value.
-
- windowBits can also be greater than 15 for optional gzip encoding. Add
- 16 to windowBits to write a simple gzip header and trailer around the
- compressed data instead of a zlib wrapper. The gzip header will have no
- file name, no extra data, no comment, no modification time (set to zero),
- no header crc, and the operating system will be set to 255 (unknown). If a
- gzip stream is being written, strm->adler is a crc32 instead of an adler32.
-
- The memLevel parameter specifies how much memory should be allocated
- for the internal compression state. memLevel=1 uses minimum memory but
- is slow and reduces compression ratio; memLevel=9 uses maximum memory
- for optimal speed. The default value is 8. See zconf.h for total memory
- usage as a function of windowBits and memLevel.
-
- The strategy parameter is used to tune the compression algorithm. Use the
- value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
- filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
- string match), or Z_RLE to limit match distances to one (run-length
- encoding). Filtered data consists mostly of small values with a somewhat
- random distribution. In this case, the compression algorithm is tuned to
- compress them better. The effect of Z_FILTERED is to force more Huffman
- coding and less string matching; it is somewhat intermediate between
- Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
- Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
- parameter only affects the compression ratio but not the correctness of the
- compressed output even if it is not set appropriately. Z_FIXED prevents the
- use of dynamic Huffman codes, allowing for a simpler decoder for special
- applications.
-
- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
- method). msg is set to null if there is no error message. deflateInit2 does
- not perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. This function must be called
- immediately after deflateInit, deflateInit2 or deflateReset, before any
- call of deflate. The compressor and decompressor must use exactly the same
- dictionary (see inflateSetDictionary).
-
- The dictionary should consist of strings (byte sequences) that are likely
- to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
- dictionary is most useful when the data to be compressed is short and can be
- predicted with good accuracy; the data can then be compressed better than
- with the default empty dictionary.
-
- Depending on the size of the compression data structures selected by
- deflateInit or deflateInit2, a part of the dictionary may in effect be
- discarded, for example if the dictionary is larger than the window size in
- deflate or deflate2. Thus the strings most likely to be useful should be
- put at the end of the dictionary, not at the front. In addition, the
- current implementation of deflate will use at most the window size minus
- 262 bytes of the provided dictionary.
-
- Upon return of this function, strm->adler is set to the adler32 value
- of the dictionary; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The adler32 value
- applies to the whole dictionary even if only a subset of the dictionary is
- actually used by the compressor.) If a raw deflate was requested, then the
- adler32 value is not computed and strm->adler is not set.
-
- deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent (for example if deflate has already been called for this stream
- or if the compression method is bsort). deflateSetDictionary does not
- perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when several compression strategies will be
- tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
- by calling deflateEnd. Note that deflateCopy duplicates the internal
- compression state which can be quite large, so this strategy is slow and
- can consume lots of memory.
-
- deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
-/*
- This function is equivalent to deflateEnd followed by deflateInit,
- but does not free and reallocate all the internal compression state.
- The stream will keep the same compression level and any other attributes
- that may have been set by deflateInit2.
-
- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
-/*
- Dynamically update the compression level and compression strategy. The
- interpretation of level and strategy is as in deflateInit2. This can be
- used to switch between compression and straight copy of the input data, or
- to switch to a different kind of input data requiring a different
- strategy. If the compression level is changed, the input available so far
- is compressed with the old level (and may be flushed); the new level will
- take effect only at the next call of deflate().
-
- Before the call of deflateParams, the stream state must be set as for
- a call of deflate(), since the currently available input may have to
- be compressed and flushed. In particular, strm->avail_out must be non-zero.
-
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
- if strm->avail_out was zero.
-*/
-
-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
- int good_length,
- int max_lazy,
- int nice_length,
- int max_chain));
-/*
- Fine tune deflate's internal compression parameters. This should only be
- used by someone who understands the algorithm used by zlib's deflate for
- searching for the best matching string, and even then only by the most
- fanatic optimizer trying to squeeze out the last compressed bit for their
- specific input data. Read the deflate.c source code for the meaning of the
- max_lazy, good_length, nice_length, and max_chain parameters.
-
- deflateTune() can be called after deflateInit() or deflateInit2(), and
- returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
- */
-
-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
- uLong sourceLen));
-/*
- deflateBound() returns an upper bound on the compressed size after
- deflation of sourceLen bytes. It must be called after deflateInit()
- or deflateInit2(). This would be used to allocate an output buffer
- for deflation in a single pass, and so would be called before deflate().
-*/
-
-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- deflatePrime() inserts bits in the deflate output stream. The intent
- is that this function is used to start off the deflate output with the
- bits leftover from a previous deflate stream when appending to it. As such,
- this function can only be used for raw deflate, and must be used before the
- first deflate() call after a deflateInit2() or deflateReset(). bits must be
- less than or equal to 16, and that many of the least significant bits of
- value will be inserted in the output.
-
- deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- deflateSetHeader() provides gzip header information for when a gzip
- stream is requested by deflateInit2(). deflateSetHeader() may be called
- after deflateInit2() or deflateReset() and before the first call of
- deflate(). The text, time, os, extra field, name, and comment information
- in the provided gz_header structure are written to the gzip header (xflag is
- ignored -- the extra flags are set according to the compression level). The
- caller must assure that, if not Z_NULL, name and comment are terminated with
- a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
- available there. If hcrc is true, a gzip header crc is included. Note that
- the current versions of the command-line version of gzip (up through version
- 1.3.x) do not support header crc's, and will report that it is a "multi-part
- gzip file" and give up.
-
- If deflateSetHeader is not used, the default gzip header has text false,
- the time set to zero, and os set to 255, with no extra, name, or comment
- fields. The gzip header is returned to the default state by deflateReset().
-
- deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
-
- This is another version of inflateInit with an extra parameter. The
- fields next_in, avail_in, zalloc, zfree and opaque must be initialized
- before by the caller.
-
- The windowBits parameter is the base two logarithm of the maximum window
- size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library. The default value is 15 if inflateInit is used
- instead. windowBits must be greater than or equal to the windowBits value
- provided to deflateInit2() while compressing, or it must be equal to 15 if
- deflateInit2() was not used. If a compressed stream with a larger window
- size is given as input, inflate() will return with the error code
- Z_DATA_ERROR instead of trying to allocate a larger window.
-
- windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
- determines the window size. inflate() will then process raw deflate data,
- not looking for a zlib or gzip header, not generating a check value, and not
- looking for any check values for comparison at the end of the stream. This
- is for use with other formats that use the deflate compressed data format
- such as zip. Those formats provide their own check values. If a custom
- format is developed using the raw deflate format for compressed data, it is
- recommended that a check value such as an adler32 or a crc32 be applied to
- the uncompressed data as is done in the zlib, gzip, and zip formats. For
- most applications, the zlib format should be used as is. Note that comments
- above on the use in deflateInit2() applies to the magnitude of windowBits.
-
- windowBits can also be greater than 15 for optional gzip decoding. Add
- 32 to windowBits to enable zlib and gzip decoding with automatic header
- detection, or add 16 to decode only the gzip format (the zlib format will
- return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
- a crc32 instead of an adler32.
-
- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
- is set to null if there is no error message. inflateInit2 does not perform
- any decompression apart from reading the zlib header if present: this will
- be done by inflate(). (So next_in and avail_in may be modified, but next_out
- and avail_out are unchanged.)
-*/
-
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the decompression dictionary from the given uncompressed byte
- sequence. This function must be called immediately after a call of inflate,
- if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
- can be determined from the adler32 value returned by that call of inflate.
- The compressor and decompressor must use exactly the same dictionary (see
- deflateSetDictionary). For raw inflate, this function can be called
- immediately after inflateInit2() or inflateReset() and before any call of
- inflate() to set the dictionary. The application must insure that the
- dictionary that was used for compression is provided.
-
- inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
- expected one (incorrect adler32 value). inflateSetDictionary does not
- perform any decompression: this will be done by subsequent calls of
- inflate().
-*/
-
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
-/*
- Skips invalid compressed data until a full flush point (see above the
- description of deflate with Z_FULL_FLUSH) can be found, or until all
- available input is skipped. No output is provided.
-
- inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
- if no more input was provided, Z_DATA_ERROR if no flush point has been found,
- or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
- case, the application may save the current current value of total_in which
- indicates where valid compressed data was found. In the error case, the
- application may repeatedly call inflateSync, providing more input each time,
- until success or end of the input data.
-*/
-
-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when randomly accessing a large stream. The
- first pass through the stream can periodically record the inflate state,
- allowing restarting inflate at those points when randomly accessing the
- stream.
-
- inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
-/*
- This function is equivalent to inflateEnd followed by inflateInit,
- but does not free and reallocate all the internal decompression state.
- The stream will keep attributes that may have been set by inflateInit2.
-
- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- This function inserts bits in the inflate input stream. The intent is
- that this function is used to start inflating at a bit position in the
- middle of a byte. The provided bits will be used before any bytes are used
- from next_in. This function should only be used with raw inflate, and
- should be used before the first inflate() call after inflateInit2() or
- inflateReset(). bits must be less than or equal to 16, and that many of the
- least significant bits of value will be inserted in the input.
-
- inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- inflateGetHeader() requests that gzip header information be stored in the
- provided gz_header structure. inflateGetHeader() may be called after
- inflateInit2() or inflateReset(), and before the first call of inflate().
- As inflate() processes the gzip stream, head->done is zero until the header
- is completed, at which time head->done is set to one. If a zlib stream is
- being decoded, then head->done is set to -1 to indicate that there will be
- no gzip header information forthcoming. Note that Z_BLOCK can be used to
- force inflate() to return immediately after header processing is complete
- and before any actual data is decompressed.
-
- The text, time, xflags, and os fields are filled in with the gzip header
- contents. hcrc is set to true if there is a header CRC. (The header CRC
- was valid if done is set to one.) If extra is not Z_NULL, then extra_max
- contains the maximum number of bytes to write to extra. Once done is true,
- extra_len contains the actual extra field length, and extra contains the
- extra field, or that field truncated if extra_max is less than extra_len.
- If name is not Z_NULL, then up to name_max characters are written there,
- terminated with a zero unless the length is greater than name_max. If
- comment is not Z_NULL, then up to comm_max characters are written there,
- terminated with a zero unless the length is greater than comm_max. When
- any of extra, name, or comment are not Z_NULL and the respective field is
- not present in the header, then that field is set to Z_NULL to signal its
- absence. This allows the use of deflateSetHeader() with the returned
- structure to duplicate the header. However if those fields are set to
- allocated memory, then the application will need to save those pointers
- elsewhere so that they can be eventually freed.
-
- If inflateGetHeader is not used, then the header information is simply
- discarded. The header is always checked for validity, including the header
- CRC if present. inflateReset() will reset the process to discard the header
- information. The application would need to call inflateGetHeader() again to
- retrieve the header from the next gzip stream.
-
- inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
- unsigned char FAR *window));
-
- Initialize the internal stream state for decompression using inflateBack()
- calls. The fields zalloc, zfree and opaque in strm must be initialized
- before the call. If zalloc and zfree are Z_NULL, then the default library-
- derived memory allocation routines are used. windowBits is the base two
- logarithm of the window size, in the range 8..15. window is a caller
- supplied buffer of that size. Except for special applications where it is
- assured that deflate was used with small window sizes, windowBits must be 15
- and a 32K byte window must be supplied to be able to decompress general
- deflate streams.
-
- See inflateBack() for the usage of these routines.
-
- inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
- the paramaters are invalid, Z_MEM_ERROR if the internal state could not
- be allocated, or Z_VERSION_ERROR if the version of the library does not
- match the version of the header file.
-*/
-
-typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
-
-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
- in_func in, void FAR *in_desc,
- out_func out, void FAR *out_desc));
-/*
- inflateBack() does a raw inflate with a single call using a call-back
- interface for input and output. This is more efficient than inflate() for
- file i/o applications in that it avoids copying between the output and the
- sliding window by simply making the window itself the output buffer. This
- function trusts the application to not change the output buffer passed by
- the output function, at least until inflateBack() returns.
-
- inflateBackInit() must be called first to allocate the internal state
- and to initialize the state with the user-provided window buffer.
- inflateBack() may then be used multiple times to inflate a complete, raw
- deflate stream with each call. inflateBackEnd() is then called to free
- the allocated state.
-
- A raw deflate stream is one with no zlib or gzip header or trailer.
- This routine would normally be used in a utility that reads zip or gzip
- files and writes out uncompressed files. The utility would decode the
- header and process the trailer on its own, hence this routine expects
- only the raw deflate stream to decompress. This is different from the
- normal behavior of inflate(), which expects either a zlib or gzip header and
- trailer around the deflate stream.
-
- inflateBack() uses two subroutines supplied by the caller that are then
- called by inflateBack() for input and output. inflateBack() calls those
- routines until it reads a complete deflate stream and writes out all of the
- uncompressed data, or until it encounters an error. The function's
- parameters and return types are defined above in the in_func and out_func
- typedefs. inflateBack() will call in(in_desc, &buf) which should return the
- number of bytes of provided input, and a pointer to that input in buf. If
- there is no input available, in() must return zero--buf is ignored in that
- case--and inflateBack() will return a buffer error. inflateBack() will call
- out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
- should return zero on success, or non-zero on failure. If out() returns
- non-zero, inflateBack() will return with an error. Neither in() nor out()
- are permitted to change the contents of the window provided to
- inflateBackInit(), which is also the buffer that out() uses to write from.
- The length written by out() will be at most the window size. Any non-zero
- amount of input may be provided by in().
-
- For convenience, inflateBack() can be provided input on the first call by
- setting strm->next_in and strm->avail_in. If that input is exhausted, then
- in() will be called. Therefore strm->next_in must be initialized before
- calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
- immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
- must also be initialized, and then if strm->avail_in is not zero, input will
- initially be taken from strm->next_in[0 .. strm->avail_in - 1].
-
- The in_desc and out_desc parameters of inflateBack() is passed as the
- first parameter of in() and out() respectively when they are called. These
- descriptors can be optionally used to pass any information that the caller-
- supplied in() and out() functions need to do their job.
-
- On return, inflateBack() will set strm->next_in and strm->avail_in to
- pass back any unused input that was provided by the last in() call. The
- return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
- if in() or out() returned an error, Z_DATA_ERROR if there was a format
- error in the deflate stream (in which case strm->msg is set to indicate the
- nature of the error), or Z_STREAM_ERROR if the stream was not properly
- initialized. In the case of Z_BUF_ERROR, an input or output error can be
- distinguished using strm->next_in which will be Z_NULL only if in() returned
- an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
- out() returning non-zero. (in() will always be called before out(), so
- strm->next_in is assured to be defined if out() returns non-zero.) Note
- that inflateBack() cannot return Z_OK.
-*/
-
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
-/*
- All memory allocated by inflateBackInit() is freed.
-
- inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
- state was inconsistent.
-*/
-
-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
-/* Return flags indicating compile-time options.
-
- Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
- 1.0: size of uInt
- 3.2: size of uLong
- 5.4: size of voidpf (pointer)
- 7.6: size of z_off_t
-
- Compiler, assembler, and debug options:
- 8: DEBUG
- 9: ASMV or ASMINF -- use ASM code
- 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
- 11: 0 (reserved)
-
- One-time table building (smaller code, but not thread-safe if true):
- 12: BUILDFIXED -- build static block decoding tables when needed
- 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
- 14,15: 0 (reserved)
-
- Library content (indicates missing functionality):
- 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
- deflate code when not needed)
- 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
- and decode gzip streams (to avoid linking crc code)
- 18-19: 0 (reserved)
-
- Operation variations (changes in library functionality):
- 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
- 21: FASTEST -- deflate algorithm with only one, lowest compression level
- 22,23: 0 (reserved)
-
- The sprintf variant used by gzprintf (zero is best):
- 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
- 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
- 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
-
- Remainder:
- 27-31: 0 (reserved)
- */
-
-
- /* utility functions */
-
-/*
- The following utility functions are implemented on top of the
- basic stream-oriented functions. To simplify the interface, some
- default options are assumed (compression level and memory usage,
- standard memory allocation functions). The source code of these
- utility functions can easily be modified if you need special options.
-*/
-
-ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be at least the value returned
- by compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
- This function can be used to compress a whole file at once if the
- input file is mmap'ed.
- compress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer.
-*/
-
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
-/*
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least the value returned by
- compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
-/*
- compressBound() returns an upper bound on the compressed size after
- compress() or compress2() on sourceLen bytes. It would be used before
- a compress() or compress2() call to allocate the destination buffer.
-*/
-
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
-*/
-
-
-typedef voidp gzFile;
-
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
-/*
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb") but can also include a compression level
- ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
- Huffman only compression as in "wb1h", or 'R' for run-length encoding
- as in "wb1R". (See the description of deflateInit2 for more information
- about the strategy parameter.)
-
- gzopen can be used to read a file which is not in gzip format; in this
- case gzread will directly read from the file without decompression.
-
- gzopen returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR). */
-
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
-/*
- gzdopen() associates a gzFile with the file descriptor fd. File
- descriptors are obtained from calls like open, dup, creat, pipe or
- fileno (in the file has been previously opened with fopen).
- The mode parameter is as in gzopen.
- The next call of gzclose on the returned gzFile will also close the
- file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
- descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
- gzdopen returns NULL if there was insufficient memory to allocate
- the (de)compression state.
-*/
-
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
-/*
- Dynamically update the compression level or strategy. See the description
- of deflateInit2 for the meaning of these parameters.
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
- opened for writing.
-*/
-
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
- Reads the given number of uncompressed bytes from the compressed file.
- If the input file was not in gzip format, gzread copies the given number
- of bytes into the buffer.
- gzread returns the number of uncompressed bytes actually read (0 for
- end of file, -1 for error). */
-
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
- voidpc buf, unsigned len));
-/*
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of uncompressed bytes actually written
- (0 in case of error).
-*/
-
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
-/*
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written (0 in case of error). The number of
- uncompressed bytes written is limited to 4095. The caller should assure that
- this limit is not exceeded. If it is exceeded, then gzprintf() will return
- return an error (0) with nothing written. In this case, there may also be a
- buffer overflow with unpredictable consequences, which is possible only if
- zlib was compiled with the insecure functions sprintf() or vsprintf()
- because the secure snprintf() or vsnprintf() functions were not available.
-*/
-
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
-/*
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
-/*
- Reads bytes from the compressed file until len-1 characters are read, or
- a newline character is read and transferred to buf, or an end-of-file
- condition is encountered. The string is then terminated with a null
- character.
- gzgets returns buf, or Z_NULL in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
-/*
- Writes c, converted to an unsigned char, into the compressed file.
- gzputc returns the value that was written, or -1 in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
-/*
- Reads one byte from the compressed file. gzgetc returns this byte
- or -1 in case of end of file or error.
-*/
-
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
-/*
- Push one character back onto the stream to be read again later.
- Only one character of push-back is allowed. gzungetc() returns the
- character pushed, or -1 on failure. gzungetc() will fail if a
- character has been pushed but not read yet, or if c is -1. The pushed
- character will be discarded if the stream is repositioned with gzseek()
- or gzrewind().
-*/
-
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
-/*
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function. The return value is the zlib
- error number (see function gzerror below). gzflush returns Z_OK if
- the flush parameter is Z_FINISH and all output could be flushed.
- gzflush should be called only when strictly necessary because it can
- degrade compression.
-*/
-
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
-/*
- Sets the starting position for the next gzread or gzwrite on the
- given compressed file. The offset represents a number of bytes in the
- uncompressed data stream. The whence parameter is defined as in lseek(2);
- the value SEEK_END is not supported.
- If the file is opened for reading, this function is emulated but can be
- extremely slow. If the file is opened for writing, only forward seeks are
- supported; gzseek then compresses a sequence of zeroes up to the new
- starting position.
-
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error, in
- particular if the file is opened for writing and the new starting position
- would be before the current position.
-*/
-
-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
-/*
- Rewinds the given file. This function is supported only for reading.
-
- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
-/*
- Returns the starting position for the next gzread or gzwrite on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
-
- gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
-/*
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
-*/
-
-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
-/*
- Returns 1 if file is being read directly without decompression, otherwise
- zero.
-*/
-
-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
-/*
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state. The return value is the zlib
- error number (see function gzerror below).
-*/
-
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
-/*
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
-*/
-
-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
-/*
- Clears the error and end-of-file flags for file. This is analogous to the
- clearerr() function in stdio. This is useful for continuing to read a gzip
- file that is being written concurrently.
-*/
-
- /* checksum functions */
-
-/*
- These functions are not related to compression but are exported
- anyway because they might be useful in applications using the
- compression library.
-*/
-
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-/*
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is NULL, this function returns
- the required initial value for the checksum.
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster. Usage example:
-
- uLong adler = adler32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- adler = adler32(adler, buffer, length);
- }
- if (adler != original_adler) error();
-*/
-
-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
- z_off_t len2));
-/*
- Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
- and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
- each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
- seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
-*/
-
-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
-/*
- Update a running CRC-32 with the bytes buf[0..len-1] and return the
- updated CRC-32. If buf is NULL, this function returns the required initial
- value for the for the crc. Pre- and post-conditioning (one's complement) is
- performed within this function so it shouldn't be done by the application.
- Usage example:
-
- uLong crc = crc32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- crc = crc32(crc, buffer, length);
- }
- if (crc != original_crc) error();
-*/
-
-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
-
-/*
- Combine two CRC-32 check values into one. For two sequences of bytes,
- seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
- calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
- check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
- len2.
-*/
-
-
- /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
- unsigned char FAR *window,
- const char *version,
- int stream_size));
-#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
-#define inflateBackInit(strm, windowBits, window) \
- inflateBackInit_((strm), (windowBits), (window), \
- ZLIB_VERSION, sizeof(z_stream))
-
-
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;}; /* hack for buggy compilers */
-#endif
-
-ZEXTERN const char * ZEXPORT zError OF((int));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
-ZEXTERN const unsigned long FAR * ZEXPORT get_crc_table OF((void));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZLIB_H */
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.c b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.c
deleted file mode 100644
index 24cb60a..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#include "zutil.h"
-
-#ifndef NO_DUMMY_DECL
-struct internal_state {int dummy;}; /* for buggy compilers */
-#endif
-
-const char * const z_errmsg[10] = {
-"need dictionary", /* Z_NEED_DICT 2 */
-"stream end", /* Z_STREAM_END 1 */
-"", /* Z_OK 0 */
-"file error", /* Z_ERRNO (-1) */
-"stream error", /* Z_STREAM_ERROR (-2) */
-"data error", /* Z_DATA_ERROR (-3) */
-"insufficient memory", /* Z_MEM_ERROR (-4) */
-"buffer error", /* Z_BUF_ERROR (-5) */
-"incompatible version",/* Z_VERSION_ERROR (-6) */
-""};
-
-
-const char * ZEXPORT zlibVersion()
-{
- return ZLIB_VERSION;
-}
-
-uLong ZEXPORT zlibCompileFlags()
-{
- uLong flags;
-
- flags = 0;
- switch (sizeof(uInt)) {
- case 2: break;
- case 4: flags += 1; break;
- case 8: flags += 2; break;
- default: flags += 3;
- }
- switch (sizeof(uLong)) {
- case 2: break;
- case 4: flags += 1 << 2; break;
- case 8: flags += 2 << 2; break;
- default: flags += 3 << 2;
- }
- switch (sizeof(voidpf)) {
- case 2: break;
- case 4: flags += 1 << 4; break;
- case 8: flags += 2 << 4; break;
- default: flags += 3 << 4;
- }
- switch (sizeof(z_off_t)) {
- case 2: break;
- case 4: flags += 1 << 6; break;
- case 8: flags += 2 << 6; break;
- default: flags += 3 << 6;
- }
-#ifdef DEBUG
- flags += 1 << 8;
-#endif
-#if defined(ASMV) || defined(ASMINF)
- flags += 1 << 9;
-#endif
-#ifdef ZLIB_WINAPI
- flags += 1 << 10;
-#endif
-#ifdef BUILDFIXED
- flags += 1 << 12;
-#endif
-#ifdef DYNAMIC_CRC_TABLE
- flags += 1 << 13;
-#endif
-#ifdef NO_GZCOMPRESS
- flags += 1L << 16;
-#endif
-#ifdef NO_GZIP
- flags += 1L << 17;
-#endif
-#ifdef PKZIP_BUG_WORKAROUND
- flags += 1L << 20;
-#endif
-#ifdef FASTEST
- flags += 1L << 21;
-#endif
-#ifdef STDC
-# ifdef NO_vsnprintf
- flags += 1L << 25;
-# ifdef HAS_vsprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_vsnprintf_void
- flags += 1L << 26;
-# endif
-# endif
-#else
- flags += 1L << 24;
-# ifdef NO_snprintf
- flags += 1L << 25;
-# ifdef HAS_sprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_snprintf_void
- flags += 1L << 26;
-# endif
-# endif
-#endif
- return flags;
-}
-
-#ifdef DEBUG
-
-# ifndef verbose
-# define verbose 0
-# endif
-int z_verbose = verbose;
-
-void z_error (m)
- char *m;
-{
- fprintf(stderr, "%s\n", m);
- exit(1);
-}
-#endif
-
-/* exported to allow conversion of error code to string for compress() and
- * uncompress()
- */
-const char * ZEXPORT zError(err)
- int err;
-{
- return ERR_MSG(err);
-}
-
-#if defined(_WIN32_WCE)
- /* The Microsoft C Run-Time Library for Windows CE doesn't have
- * errno. We define it as a global variable to simplify porting.
- * Its value is always 0 and should not be used.
- */
- int errno = 0;
-#endif
-
-#ifndef HAVE_MEMCPY
-
-void zmemcpy(dest, source, len)
- Bytef* dest;
- const Bytef* source;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = *source++; /* ??? to be unrolled */
- } while (--len != 0);
-}
-
-int zmemcmp(s1, s2, len)
- const Bytef* s1;
- const Bytef* s2;
- uInt len;
-{
- uInt j;
-
- for (j = 0; j < len; j++) {
- if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
- }
- return 0;
-}
-
-void zmemzero(dest, len)
- Bytef* dest;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = 0; /* ??? to be unrolled */
- } while (--len != 0);
-}
-#endif
-
-
-#ifdef SYS16BIT
-
-#ifdef __TURBOC__
-/* Turbo C in 16-bit mode */
-
-# define MY_ZCALLOC
-
-/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
- * and farmalloc(64K) returns a pointer with an offset of 8, so we
- * must fix the pointer. Warning: the pointer must be put back to its
- * original form in order to free it, use zcfree().
- */
-
-#define MAX_PTR 10
-/* 10*64K = 640K */
-
-local int next_ptr = 0;
-
-typedef struct ptr_table_s {
- voidpf org_ptr;
- voidpf new_ptr;
-} ptr_table;
-
-local ptr_table table[MAX_PTR];
-/* This table is used to remember the original form of pointers
- * to large buffers (64K). Such pointers are normalized with a zero offset.
- * Since MSDOS is not a preemptive multitasking OS, this table is not
- * protected from concurrent access. This hack doesn't work anyway on
- * a protected system like OS/2. Use Microsoft C instead.
- */
-
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
- voidpf buf = opaque; /* just to make some compilers happy */
- ulg bsize = (ulg)items*size;
-
- /* If we allocate less than 65520 bytes, we assume that farmalloc
- * will return a usable pointer which doesn't have to be normalized.
- */
- if (bsize < 65520L) {
- buf = farmalloc(bsize);
- if (*(ush*)&buf != 0) return buf;
- } else {
- buf = farmalloc(bsize + 16L);
- }
- if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
- table[next_ptr].org_ptr = buf;
-
- /* Normalize the pointer to seg:0 */
- *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
- *(ush*)&buf = 0;
- table[next_ptr++].new_ptr = buf;
- return buf;
-}
-
-void zcfree (voidpf opaque, voidpf ptr)
-{
- int n;
- if (*(ush*)&ptr != 0) { /* object < 64K */
- farfree(ptr);
- return;
- }
- /* Find the original pointer */
- for (n = 0; n < next_ptr; n++) {
- if (ptr != table[n].new_ptr) continue;
-
- farfree(table[n].org_ptr);
- while (++n < next_ptr) {
- table[n-1] = table[n];
- }
- next_ptr--;
- return;
- }
- ptr = opaque; /* just to make some compilers happy */
- Assert(0, "zcfree: ptr not found");
-}
-
-#endif /* __TURBOC__ */
-
-
-#ifdef M_I86
-/* Microsoft C in 16-bit mode */
-
-# define MY_ZCALLOC
-
-#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
-# define _halloc halloc
-# define _hfree hfree
-#endif
-
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- return _halloc((long)items, size);
-}
-
-void zcfree (voidpf opaque, voidpf ptr)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- _hfree(ptr);
-}
-
-#endif /* M_I86 */
-
-#endif /* SYS16BIT */
-
-
-#ifndef MY_ZCALLOC /* Any system without a special alloc function */
-
-#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern voidp calloc OF((uInt items, uInt size));
-extern void free OF((voidpf ptr));
-#endif
-
-voidpf zcalloc (opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
-{
- if (opaque) items += size - size; /* make compiler happy */
- return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
- (voidpf)calloc(items, size);
-}
-
-void zcfree (opaque, ptr)
- voidpf opaque;
- voidpf ptr;
-{
- free(ptr);
- if (opaque) return; /* make compiler happy */
-}
-
-#endif /* MY_ZCALLOC */
diff --git a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.h b/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.h
deleted file mode 100644
index 0a2ec6c..0000000
--- a/jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZUTIL_H
-#define ZUTIL_H
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-#ifdef STDC
-# ifndef _WIN32_WCE
-# include <stddef.h>
-# endif
-# include <string.h>
-# include <stdlib.h>
-#endif
-#ifdef NO_ERRNO_H
-# ifdef _WIN32_WCE
- /* The Microsoft C Run-Time Library for Windows CE doesn't have
- * errno. We define it as a global variable to simplify porting.
- * Its value is always 0 and should not be used. We rename it to
- * avoid conflict with other libraries that use the same workaround.
- */
-# define errno z_errno
-# endif
- extern int errno;
-#else
-# ifndef _WIN32_WCE
-# include <errno.h>
-# endif
-#endif
-
-#ifndef local
-# define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-typedef unsigned char uch;
-typedef uch FAR uchf;
-typedef unsigned short ush;
-typedef ush FAR ushf;
-typedef unsigned long ulg;
-
-extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
-/* (size given to avoid silly warnings with Visual C++) */
-
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
-
-#define ERR_RETURN(strm,err) \
- return (strm->msg = (char*)ERR_MSG(err), (err))
-/* To be used only when the state is known to be valid */
-
- /* common constants */
-
-#ifndef DEF_WBITS
-# define DEF_WBITS MAX_WBITS
-#endif
-/* default windowBits for decompression. MAX_WBITS is for compression only */
-
-#if MAX_MEM_LEVEL >= 8
-# define DEF_MEM_LEVEL 8
-#else
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
-#endif
-/* default memLevel */
-
-#define STORED_BLOCK 0
-#define STATIC_TREES 1
-#define DYN_TREES 2
-/* The three kinds of block type */
-
-#define MIN_MATCH 3
-#define MAX_MATCH 258
-/* The minimum and maximum match lengths */
-
-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
-
- /* target dependencies */
-
-#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
-# define OS_CODE 0x00
-# if defined(__TURBOC__) || defined(__BORLANDC__)
-# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
- /* Allow compilation with ANSI keywords only enabled */
- void _Cdecl farfree( void *block );
- void *_Cdecl farmalloc( unsigned long nbytes );
-# else
-# include <alloc.h>
-# endif
-# else /* MSC or DJGPP */
-# include <malloc.h>
-# endif
-#endif
-
-#ifdef AMIGA
-# define OS_CODE 0x01
-#endif
-
-#if defined(VAXC) || defined(VMS)
-# define OS_CODE 0x02
-# define F_OPEN(name, mode) \
- fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
-#endif
-
-#if defined(ATARI) || defined(atarist)
-# define OS_CODE 0x05
-#endif
-
-#ifdef OS2
-# define OS_CODE 0x06
-# ifdef M_I86
- #include <malloc.h>
-# endif
-#endif
-
-#if defined(MACOS) || defined(TARGET_OS_MAC)
-# define OS_CODE 0x07
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* for fdopen */
-# else
-# ifndef fdopen
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# endif
-# endif
-#endif
-
-#ifdef TOPS20
-# define OS_CODE 0x0a
-#endif
-
-#ifdef WIN32
-# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
-# define OS_CODE 0x0b
-# endif
-#endif
-
-#ifdef __50SERIES /* Prime/PRIMOS */
-# define OS_CODE 0x0f
-#endif
-
-#if defined(_BEOS_) || defined(RISCOS)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
-#if (defined(_MSC_VER) && (_MSC_VER > 600))
-# if defined(_WIN32_WCE)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# ifndef _PTRDIFF_T_DEFINED
- typedef int ptrdiff_t;
-# define _PTRDIFF_T_DEFINED
-# endif
-# else
-# define fdopen(fd,type) _fdopen(fd,type)
-# endif
-#endif
-
- /* common defaults */
-
-#ifndef OS_CODE
-# define OS_CODE 0x03 /* assume Unix */
-#endif
-
-#ifndef F_OPEN
-# define F_OPEN(name, mode) fopen((name), (mode))
-#endif
-
- /* functions */
-
-#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-#if defined(__CYGWIN__)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-#ifndef HAVE_VSNPRINTF
-# ifdef MSDOS
- /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
- but for now we just assume it doesn't. */
-# define NO_vsnprintf
-# endif
-# ifdef __TURBOC__
-# define NO_vsnprintf
-# endif
-# ifdef WIN32
- /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
-# if !defined(vsnprintf) && !defined(NO_vsnprintf) && (!defined(_MSC_VER) || (_MSC_VER < 1500))
- /* Only needed before Visual Studio 2008 */
-# define vsnprintf _vsnprintf
-# endif
-# endif
-# ifdef __SASC
-# define NO_vsnprintf
-# endif
-#endif
-#ifdef VMS
-# define NO_vsnprintf
-#endif
-
-#if defined(pyr)
-# define NO_MEMCPY
-#endif
-#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
- /* Use our own functions for small and medium model with MSC <= 5.0.
- * You may have to use the same strategy for Borland C (untested).
- * The __SC__ check is for Symantec.
- */
-# define NO_MEMCPY
-#endif
-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
-# define HAVE_MEMCPY
-#endif
-#ifdef HAVE_MEMCPY
-# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
-# define zmemcpy _fmemcpy
-# define zmemcmp _fmemcmp
-# define zmemzero(dest, len) _fmemset(dest, 0, len)
-# else
-# define zmemcpy memcpy
-# define zmemcmp memcmp
-# define zmemzero(dest, len) memset(dest, 0, len)
-# endif
-#else
- extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
- extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
- extern void zmemzero OF((Bytef* dest, uInt len));
-#endif
-
-/* Diagnostic functions */
-#ifdef DEBUG
-# include <stdio.h>
- extern int z_verbose;
- extern void z_error OF((char *m));
-# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
-# define Trace(x) {if (z_verbose>=0) fprintf x ;}
-# define Tracev(x) {if (z_verbose>0) fprintf x ;}
-# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
-# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
-# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
-#else
-# define Assert(cond,msg)
-# define Trace(x)
-# define Tracev(x)
-# define Tracevv(x)
-# define Tracec(c,x)
-# define Tracecv(c,x)
-#endif
-
-
-voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
-void zcfree OF((voidpf opaque, voidpf ptr));
-
-#define ZALLOC(strm, items, size) \
- (*((strm)->zalloc))((strm)->opaque, (items), (size))
-#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
-#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
-
-#endif /* ZUTIL_H */
diff --git a/jdk/src/share/native/sun/awt/libpng/pnggccrd.c b/jdk/src/share/native/sun/awt/libpng/pnggccrd.c
deleted file mode 100644
index 548e74e..0000000
--- a/jdk/src/share/native/sun/awt/libpng/pnggccrd.c
+++ /dev/null
@@ -1,5448 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* pnggccrd.c - mixed C/assembler version of utilities to read a PNG file
- *
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file and, per its terms, should not be removed:
- *
- * For Intel x86 CPU (Pentium-MMX or later) and GNU C compiler.
- *
- * See http://www.intel.com/drg/pentiumII/appnotes/916/916.htm
- * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
- * for Intel's performance analysis of the MMX vs. non-MMX code.
- *
- * Last changed in libpng 1.2.15 January 5, 2007
- * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2007 Glenn Randers-Pehrson
- * Copyright (c) 1998, Intel Corporation
- *
- * Based on MSVC code contributed by Nirav Chhatrapati, Intel Corp., 1998.
- * Interface to libpng contributed by Gilles Vollant, 1999.
- * GNU C port by Greg Roelofs, 1999-2001.
- *
- * Lines 2350-4300 converted in place with intel2gas 1.3.1:
- *
- * intel2gas -mdI pnggccrd.c.partially-msvc -o pnggccrd.c
- *
- * and then cleaned up by hand. See http://hermes.terminal.at/intel2gas/ .
- *
- * NOTE: A sufficiently recent version of GNU as (or as.exe under DOS/Windows)
- * is required to assemble the newer MMX instructions such as movq.
- * For djgpp, see
- *
- * ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu281b.zip
- *
- * (or a later version in the same directory). For Linux, check your
- * distribution's web site(s) or try these links:
- *
- * http://rufus.w3.org/linux/RPM/binutils.html
- * http://www.debian.org/Packages/stable/devel/binutils.html
- * ftp://ftp.slackware.com/pub/linux/slackware/slackware/slakware/d1/
- * binutils.tgz
- *
- * For other platforms, see the main GNU site:
- *
- * ftp://ftp.gnu.org/pub/gnu/binutils/
- *
- * Version 2.5.2l.15 is definitely too old...
- */
-
-/*
- * TEMPORARY PORTING NOTES AND CHANGELOG (mostly by Greg Roelofs)
- * =====================================
- *
- * 19991006:
- * - fixed sign error in post-MMX cleanup code (16- & 32-bit cases)
- *
- * 19991007:
- * - additional optimizations (possible or definite):
- * x [DONE] write MMX code for 64-bit case (pixel_bytes == 8) [not tested]
- * - write MMX code for 48-bit case (pixel_bytes == 6)
- * - figure out what's up with 24-bit case (pixel_bytes == 3):
- * why subtract 8 from width_mmx in the pass 4/5 case?
- * (only width_mmx case) (near line 1606)
- * x [DONE] replace pixel_bytes within each block with the true
- * constant value (or are compilers smart enough to do that?)
- * - rewrite all MMX interlacing code so it's aligned with
- * the *beginning* of the row buffer, not the end. This
- * would not only allow one to eliminate half of the memory
- * writes for odd passes (that is, pass == odd), it may also
- * eliminate some unaligned-data-access exceptions (assuming
- * there's a penalty for not aligning 64-bit accesses on
- * 64-bit boundaries). The only catch is that the "leftover"
- * pixel(s) at the end of the row would have to be saved,
- * but there are enough unused MMX registers in every case,
- * so this is not a problem. A further benefit is that the
- * post-MMX cleanup code (C code) in at least some of the
- * cases could be done within the assembler block.
- * x [DONE] the "v3 v2 v1 v0 v7 v6 v5 v4" comments are confusing,
- * inconsistent, and don't match the MMX Programmer's Reference
- * Manual conventions anyway. They should be changed to
- * "b7 b6 b5 b4 b3 b2 b1 b0," where b0 indicates the byte that
- * was lowest in memory (e.g., corresponding to a left pixel)
- * and b7 is the byte that was highest (e.g., a right pixel).
- *
- * 19991016:
- * - Brennan's Guide notwithstanding, gcc under Linux does *not*
- * want globals prefixed by underscores when referencing them--
- * i.e., if the variable is const4, then refer to it as const4,
- * not _const4. This seems to be a djgpp-specific requirement.
- * Also, such variables apparently *must* be declared outside
- * of functions; neither static nor automatic variables work if
- * defined within the scope of a single function, but both
- * static and truly global (multi-module) variables work fine.
- *
- * 19991023:
- * - fixed png_combine_row() non-MMX replication bug (odd passes only?)
- * - switched from string-concatenation-with-macros to cleaner method of
- * renaming global variables for djgpp--i.e., always use prefixes in
- * inlined assembler code (== strings) and conditionally rename the
- * variables, not the other way around. Hence _const4, _mask8_0, etc.
- *
- * 19991024:
- * - fixed mmxsupport()/png_do_read_interlace() first-row bug
- * This one was severely weird: even though mmxsupport() doesn't touch
- * ebx (where "row" pointer was stored), it nevertheless managed to zero
- * the register (even in static/non-fPIC code--see below), which in turn
- * caused png_do_read_interlace() to return prematurely on the first row of
- * interlaced images (i.e., without expanding the interlaced pixels).
- * Inspection of the generated assembly code didn't turn up any clues,
- * although it did point at a minor optimization (i.e., get rid of
- * mmx_supported_local variable and just use eax). Possibly the CPUID
- * instruction is more destructive than it looks? (Not yet checked.)
- * - "info gcc" was next to useless, so compared fPIC and non-fPIC assembly
- * listings... Apparently register spillage has to do with ebx, since
- * it's used to index the global offset table. Commenting it out of the
- * input-reg lists in png_combine_row() eliminated compiler barfage, so
- * ifdef'd with __PIC__ macro: if defined, use a global for unmask
- *
- * 19991107:
- * - verified CPUID clobberage: 12-char string constant ("GenuineIntel",
- * "AuthenticAMD", etc.) placed in ebx:ecx:edx. Still need to polish.
- *
- * 19991120:
- * - made "diff" variable (now "_dif") global to simplify conversion of
- * filtering routines (running out of regs, sigh). "diff" is still used
- * in interlacing routines, however.
- * - fixed up both versions of mmxsupport() (ORIG_THAT_USED_TO_CLOBBER_EBX
- * macro determines which is used); original not yet tested.
- *
- * 20000213:
- * - when compiling with gcc, be sure to use -fomit-frame-pointer
- *
- * 20000319:
- * - fixed a register-name typo in png_do_read_interlace(), default (MMX) case,
- * pass == 4 or 5, that caused visible corruption of interlaced images
- *
- * 20000623:
- * - Various problems were reported with gcc 2.95.2 in the Cygwin environment,
- * many of the form "forbidden register 0 (ax) was spilled for class AREG."
- * This is explained at http://gcc.gnu.org/fom_serv/cache/23.html, and
- * Chuck Wilson supplied a patch involving dummy output registers. See
- * http://sourceforge.net/bugs/?func=detailbug&bug_id=108741&group_id=5624
- * for the original (anonymous) SourceForge bug report.
- *
- * 20000706:
- * - Chuck Wilson passed along these remaining gcc 2.95.2 errors:
- * pnggccrd.c: In function `png_combine_row':
- * pnggccrd.c:525: more than 10 operands in `asm'
- * pnggccrd.c:669: more than 10 operands in `asm'
- * pnggccrd.c:828: more than 10 operands in `asm'
- * pnggccrd.c:994: more than 10 operands in `asm'
- * pnggccrd.c:1177: more than 10 operands in `asm'
- * They are all the same problem and can be worked around by using the
- * global _unmask variable unconditionally, not just in the -fPIC case.
- * Reportedly earlier versions of gcc also have the problem with more than
- * 10 operands; they just don't report it. Much strangeness ensues, etc.
- *
- * 20000729:
- * - enabled png_read_filter_row_mmx_up() (shortest remaining unconverted
- * MMX routine); began converting png_read_filter_row_mmx_sub()
- * - to finish remaining sections:
- * - clean up indentation and comments
- * - preload local variables
- * - add output and input regs (order of former determines numerical
- * mapping of latter)
- * - avoid all usage of ebx (including bx, bh, bl) register [20000823]
- * - remove "$" from addressing of Shift and Mask variables [20000823]
- *
- * 20000731:
- * - global union vars causing segfaults in png_read_filter_row_mmx_sub()?
- *
- * 20000822:
- * - ARGH, stupid png_read_filter_row_mmx_sub() segfault only happens with
- * shared-library (-fPIC) version! Code works just fine as part of static
- * library. Damn damn damn damn damn, should have tested that sooner.
- * ebx is getting clobbered again (explicitly this time); need to save it
- * on stack or rewrite asm code to avoid using it altogether. Blargh!
- *
- * 20000823:
- * - first section was trickiest; all remaining sections have ebx -> edx now.
- * (-fPIC works again.) Also added missing underscores to various Shift*
- * and *Mask* globals and got rid of leading "$" signs.
- *
- * 20000826:
- * - added visual separators to help navigate microscopic printed copies
- * (http://pobox.com/~newt/code/gpr-latest.zip, mode 10); started working
- * on png_read_filter_row_mmx_avg()
- *
- * 20000828:
- * - finished png_read_filter_row_mmx_avg(): only Paeth left! (930 lines...)
- * What the hell, did png_read_filter_row_mmx_paeth(), too. Comments not
- * cleaned up/shortened in either routine, but functionality is complete
- * and seems to be working fine.
- *
- * 20000829:
- * - ahhh, figured out last(?) bit of gcc/gas asm-fu: if register is listed
- * as an input reg (with dummy output variables, etc.), then it *cannot*
- * also appear in the clobber list or gcc 2.95.2 will barf. The solution
- * is simple enough...
- *
- * 20000914:
- * - bug in png_read_filter_row_mmx_avg(): 16-bit grayscale not handled
- * correctly (but 48-bit RGB just fine)
- *
- * 20000916:
- * - fixed bug in png_read_filter_row_mmx_avg(), bpp == 2 case; three errors:
- * - "_ShiftBpp.use = 24;" should have been "_ShiftBpp.use = 16;"
- * - "_ShiftRem.use = 40;" should have been "_ShiftRem.use = 48;"
- * - "psllq _ShiftRem, %%mm2" should have been "psrlq _ShiftRem, %%mm2"
- *
- * 20010101:
- * - added new png_init_mmx_flags() function (here only because it needs to
- * call mmxsupport(), which should probably become global png_mmxsupport());
- * modified other MMX routines to run conditionally (png_ptr->asm_flags)
- *
- * 20010103:
- * - renamed mmxsupport() to png_mmx_support(), with auto-set of mmx_supported,
- * and made it public; moved png_init_mmx_flags() to png.c as internal func
- *
- * 20010104:
- * - removed dependency on png_read_filter_row_c() (C code already duplicated
- * within MMX version of png_read_filter_row()) so no longer necessary to
- * compile it into pngrutil.o
- *
- * 20010310:
- * - fixed buffer-overrun bug in png_combine_row() C code (non-MMX)
- *
- * 20020304:
- * - eliminated incorrect use of width_mmx in pixel_bytes == 8 case
- *
- * 20040724:
- * - more tinkering with clobber list at lines 4529 and 5033, to get
- * it to compile on gcc-3.4.
- *
- * STILL TO DO:
- * - test png_do_read_interlace() 64-bit case (pixel_bytes == 8)
- * - write MMX code for 48-bit case (pixel_bytes == 6)
- * - figure out what's up with 24-bit case (pixel_bytes == 3):
- * why subtract 8 from width_mmx in the pass 4/5 case?
- * (only width_mmx case) (near line 1606)
- * - rewrite all MMX interlacing code so it's aligned with beginning
- * of the row buffer, not the end (see 19991007 for details)
- * x pick one version of mmxsupport() and get rid of the other
- * - add error messages to any remaining bogus default cases
- * - enable pixel_depth == 8 cases in png_read_filter_row()? (test speed)
- * x add support for runtime enable/disable/query of various MMX routines
- */
-
-#define PNG_INTERNAL
-#include "png.h"
-
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGGCCRD)
-
-int PNGAPI png_mmx_support(void);
-
-#ifdef PNG_USE_LOCAL_ARRAYS
-const static int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-const static int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-const static int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
-#endif
-
-#if defined(PNG_MMX_CODE_SUPPORTED)
-/* djgpp, Win32, Cygwin, and OS2 add their own underscores to global variables,
- * so define them without: */
-#if defined(__DJGPP__) || defined(WIN32) || defined(__CYGWIN__) || \
- defined(__OS2__)
-# define _mmx_supported mmx_supported
-# define _const4 const4
-# define _const6 const6
-# define _mask8_0 mask8_0
-# define _mask16_1 mask16_1
-# define _mask16_0 mask16_0
-# define _mask24_2 mask24_2
-# define _mask24_1 mask24_1
-# define _mask24_0 mask24_0
-# define _mask32_3 mask32_3
-# define _mask32_2 mask32_2
-# define _mask32_1 mask32_1
-# define _mask32_0 mask32_0
-# define _mask48_5 mask48_5
-# define _mask48_4 mask48_4
-# define _mask48_3 mask48_3
-# define _mask48_2 mask48_2
-# define _mask48_1 mask48_1
-# define _mask48_0 mask48_0
-# define _LBCarryMask LBCarryMask
-# define _HBClearMask HBClearMask
-# define _ActiveMask ActiveMask
-# define _ActiveMask2 ActiveMask2
-# define _ActiveMaskEnd ActiveMaskEnd
-# define _ShiftBpp ShiftBpp
-# define _ShiftRem ShiftRem
-#ifdef PNG_THREAD_UNSAFE_OK
-# define _unmask unmask
-# define _FullLength FullLength
-# define _MMXLength MMXLength
-# define _dif dif
-# define _patemp patemp
-# define _pbtemp pbtemp
-# define _pctemp pctemp
-#endif
-#endif
-
-
-/* These constants are used in the inlined MMX assembly code.
- Ignore gcc's "At top level: defined but not used" warnings. */
-
-/* GRR 20000706: originally _unmask was needed only when compiling with -fPIC,
- * since that case uses the %ebx register for indexing the Global Offset Table
- * and there were no other registers available. But gcc 2.95 and later emit
- * "more than 10 operands in `asm'" errors when %ebx is used to preload unmask
- * in the non-PIC case, so we'll just use the global unconditionally now.
- */
-#ifdef PNG_THREAD_UNSAFE_OK
-static int _unmask;
-#endif
-
-const static unsigned long long _mask8_0 = 0x0102040810204080LL;
-
-const static unsigned long long _mask16_1 = 0x0101020204040808LL;
-const static unsigned long long _mask16_0 = 0x1010202040408080LL;
-
-const static unsigned long long _mask24_2 = 0x0101010202020404LL;
-const static unsigned long long _mask24_1 = 0x0408080810101020LL;
-const static unsigned long long _mask24_0 = 0x2020404040808080LL;
-
-const static unsigned long long _mask32_3 = 0x0101010102020202LL;
-const static unsigned long long _mask32_2 = 0x0404040408080808LL;
-const static unsigned long long _mask32_1 = 0x1010101020202020LL;
-const static unsigned long long _mask32_0 = 0x4040404080808080LL;
-
-const static unsigned long long _mask48_5 = 0x0101010101010202LL;
-const static unsigned long long _mask48_4 = 0x0202020204040404LL;
-const static unsigned long long _mask48_3 = 0x0404080808080808LL;
-const static unsigned long long _mask48_2 = 0x1010101010102020LL;
-const static unsigned long long _mask48_1 = 0x2020202040404040LL;
-const static unsigned long long _mask48_0 = 0x4040808080808080LL;
-
-const static unsigned long long _const4 = 0x0000000000FFFFFFLL;
-//const static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED
-const static unsigned long long _const6 = 0x00000000000000FFLL;
-
-// These are used in the row-filter routines and should/would be local
-// variables if not for gcc addressing limitations.
-// WARNING: Their presence probably defeats the thread safety of libpng.
-
-#ifdef PNG_THREAD_UNSAFE_OK
-static png_uint_32 _FullLength;
-static png_uint_32 _MMXLength;
-static int _dif;
-static int _patemp; // temp variables for Paeth routine
-static int _pbtemp;
-static int _pctemp;
-#endif
-
-void /* PRIVATE */
-png_squelch_warnings(void)
-{
-#ifdef PNG_THREAD_UNSAFE_OK
- _dif = _dif;
- _patemp = _patemp;
- _pbtemp = _pbtemp;
- _pctemp = _pctemp;
- _MMXLength = _MMXLength;
-#endif
- _const4 = _const4;
- _const6 = _const6;
- _mask8_0 = _mask8_0;
- _mask16_1 = _mask16_1;
- _mask16_0 = _mask16_0;
- _mask24_2 = _mask24_2;
- _mask24_1 = _mask24_1;
- _mask24_0 = _mask24_0;
- _mask32_3 = _mask32_3;
- _mask32_2 = _mask32_2;
- _mask32_1 = _mask32_1;
- _mask32_0 = _mask32_0;
- _mask48_5 = _mask48_5;
- _mask48_4 = _mask48_4;
- _mask48_3 = _mask48_3;
- _mask48_2 = _mask48_2;
- _mask48_1 = _mask48_1;
- _mask48_0 = _mask48_0;
-}
-#endif /* PNG_MMX_CODE_SUPPORTED */
-
-
-static int _mmx_supported = 2;
-
-/*===========================================================================*/
-/* */
-/* P N G _ C O M B I N E _ R O W */
-/* */
-/*===========================================================================*/
-
-#if defined(PNG_HAVE_MMX_COMBINE_ROW)
-
-#define BPP2 2
-#define BPP3 3 /* bytes per pixel (a.k.a. pixel_bytes) */
-#define BPP4 4
-#define BPP6 6 /* (defined only to help avoid cut-and-paste errors) */
-#define BPP8 8
-
-/* Combines the row recently read in with the previous row.
- This routine takes care of alpha and transparency if requested.
- This routine also handles the two methods of progressive display
- of interlaced images, depending on the mask value.
- The mask value describes which pixels are to be combined with
- the row. The pattern always repeats every 8 pixels, so just 8
- bits are needed. A one indicates the pixel is to be combined; a
- zero indicates the pixel is to be skipped. This is in addition
- to any alpha or transparency value associated with the pixel.
- If you want all pixels to be combined, pass 0xff (255) in mask. */
-
-/* Use this routine for the x86 platform - it uses a faster MMX routine
- if the machine supports MMX. */
-
-void /* PRIVATE */
-png_combine_row(png_structp png_ptr, png_bytep row, int mask)
-{
- png_debug(1, "in png_combine_row (pnggccrd.c)\n");
-
-#if defined(PNG_MMX_CODE_SUPPORTED)
- if (_mmx_supported == 2) {
-#if !defined(PNG_1_0_X)
- /* this should have happened in png_init_mmx_flags() already */
- png_warning(png_ptr, "asm_flags may not have been initialized");
-#endif
- png_mmx_support();
- }
-#endif
-
- if (mask == 0xff)
- {
- png_debug(2,"mask == 0xff: doing single png_memcpy()\n");
- png_memcpy(row, png_ptr->row_buf + 1,
- (png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth,png_ptr->width));
- }
- else /* (png_combine_row() is never called with mask == 0) */
- {
- switch (png_ptr->row_info.pixel_depth)
- {
- case 1: /* png_ptr->row_info.pixel_depth */
- {
- png_bytep sp;
- png_bytep dp;
- int s_inc, s_start, s_end;
- int m;
- int shift;
- png_uint_32 i;
-
- sp = png_ptr->row_buf + 1;
- dp = row;
- m = 0x80;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (png_ptr->transformations & PNG_PACKSWAP)
- {
- s_start = 0;
- s_end = 7;
- s_inc = 1;
- }
- else
-#endif
- {
- s_start = 7;
- s_end = 0;
- s_inc = -1;
- }
-
- shift = s_start;
-
- for (i = 0; i < png_ptr->width; i++)
- {
- if (m & mask)
- {
- int value;
-
- value = (*sp >> shift) & 0x1;
- *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff);
- *dp |= (png_byte)(value << shift);
- }
-
- if (shift == s_end)
- {
- shift = s_start;
- sp++;
- dp++;
- }
- else
- shift += s_inc;
-
- if (m == 1)
- m = 0x80;
- else
- m >>= 1;
- }
- break;
- }
-
- case 2: /* png_ptr->row_info.pixel_depth */
- {
- png_bytep sp;
- png_bytep dp;
- int s_start, s_end, s_inc;
- int m;
- int shift;
- png_uint_32 i;
- int value;
-
- sp = png_ptr->row_buf + 1;
- dp = row;
- m = 0x80;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (png_ptr->transformations & PNG_PACKSWAP)
- {
- s_start = 0;
- s_end = 6;
- s_inc = 2;
- }
- else
-#endif
- {
- s_start = 6;
- s_end = 0;
- s_inc = -2;
- }
-
- shift = s_start;
-
- for (i = 0; i < png_ptr->width; i++)
- {
- if (m & mask)
- {
- value = (*sp >> shift) & 0x3;
- *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff);
- *dp |= (png_byte)(value << shift);
- }
-
- if (shift == s_end)
- {
- shift = s_start;
- sp++;
- dp++;
- }
- else
- shift += s_inc;
- if (m == 1)
- m = 0x80;
- else
- m >>= 1;
- }
- break;
- }
-
- case 4: /* png_ptr->row_info.pixel_depth */
- {
- png_bytep sp;
- png_bytep dp;
- int s_start, s_end, s_inc;
- int m;
- int shift;
- png_uint_32 i;
- int value;
-
- sp = png_ptr->row_buf + 1;
- dp = row;
- m = 0x80;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (png_ptr->transformations & PNG_PACKSWAP)
- {
- s_start = 0;
- s_end = 4;
- s_inc = 4;
- }
- else
-#endif
- {
- s_start = 4;
- s_end = 0;
- s_inc = -4;
- }
- shift = s_start;
-
- for (i = 0; i < png_ptr->width; i++)
- {
- if (m & mask)
- {
- value = (*sp >> shift) & 0xf;
- *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff);
- *dp |= (png_byte)(value << shift);
- }
-
- if (shift == s_end)
- {
- shift = s_start;
- sp++;
- dp++;
- }
- else
- shift += s_inc;
- if (m == 1)
- m = 0x80;
- else
- m >>= 1;
- }
- break;
- }
-
- case 8: /* png_ptr->row_info.pixel_depth */
- {
- png_bytep srcptr;
- png_bytep dstptr;
-
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && _mmx_supported */ )
-#else
- if (_mmx_supported)
-#endif
- {
- png_uint_32 len;
- int diff;
- int dummy_value_a; // fix 'forbidden register spilled' error
- int dummy_value_d;
- int dummy_value_c;
- int dummy_value_S;
- int dummy_value_D;
- _unmask = ~mask; // global variable for -fPIC version
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
- len = png_ptr->width &~7; // reduce to multiple of 8
- diff = (int) (png_ptr->width & 7); // amount lost
-
- __asm__ __volatile__ (
- "movd _unmask, %%mm7 \n\t" // load bit pattern
- "psubb %%mm6, %%mm6 \n\t" // zero mm6
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklwd %%mm7, %%mm7 \n\t"
- "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks
-
- "movq _mask8_0, %%mm0 \n\t"
- "pand %%mm7, %%mm0 \n\t" // nonzero if keep byte
- "pcmpeqb %%mm6, %%mm0 \n\t" // zeros->1s, v versa
-
-// preload "movl len, %%ecx \n\t" // load length of line
-// preload "movl srcptr, %%esi \n\t" // load source
-// preload "movl dstptr, %%edi \n\t" // load dest
-
- "cmpl $0, %%ecx \n\t" // len == 0 ?
- "je mainloop8end \n\t"
-
- "mainloop8: \n\t"
- "movq (%%esi), %%mm4 \n\t" // *srcptr
- "pand %%mm0, %%mm4 \n\t"
- "movq %%mm0, %%mm6 \n\t"
- "pandn (%%edi), %%mm6 \n\t" // *dstptr
- "por %%mm6, %%mm4 \n\t"
- "movq %%mm4, (%%edi) \n\t"
- "addl $8, %%esi \n\t" // inc by 8 bytes processed
- "addl $8, %%edi \n\t"
- "subl $8, %%ecx \n\t" // dec by 8 pixels processed
- "ja mainloop8 \n\t"
-
- "mainloop8end: \n\t"
-// preload "movl diff, %%ecx \n\t" // (diff is in eax)
- "movl %%eax, %%ecx \n\t"
- "cmpl $0, %%ecx \n\t"
- "jz end8 \n\t"
-// preload "movl mask, %%edx \n\t"
- "sall $24, %%edx \n\t" // make low byte, high byte
-
- "secondloop8: \n\t"
- "sall %%edx \n\t" // move high bit to CF
- "jnc skip8 \n\t" // if CF = 0
- "movb (%%esi), %%al \n\t"
- "movb %%al, (%%edi) \n\t"
-
- "skip8: \n\t"
- "incl %%esi \n\t"
- "incl %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz secondloop8 \n\t"
-
- "end8: \n\t"
- "EMMS \n\t" // DONE
-
- : "=a" (dummy_value_a), // output regs (dummy)
- "=d" (dummy_value_d),
- "=c" (dummy_value_c),
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "3" (srcptr), // esi // input regs
- "4" (dstptr), // edi
- "0" (diff), // eax
-// was (unmask) "b" RESERVED // ebx // Global Offset Table idx
- "2" (len), // ecx
- "1" (mask) // edx
-
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm4", "%mm6", "%mm7" // clobber list
-#endif
- );
- }
- else /* mmx _not supported - Use modified C routine */
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- register png_uint_32 i;
- png_uint_32 initial_val = png_pass_start[png_ptr->pass];
- /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
- register int stride = png_pass_inc[png_ptr->pass];
- /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
- register int rep_bytes = png_pass_width[png_ptr->pass];
- /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
- png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
- int diff = (int) (png_ptr->width & 7); /* amount lost */
- register png_uint_32 final_val = len; /* GRR bugfix */
-
- srcptr = png_ptr->row_buf + 1 + initial_val;
- dstptr = row + initial_val;
-
- for (i = initial_val; i < final_val; i += stride)
- {
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- if (diff) /* number of leftover pixels: 3 for pngtest */
- {
- final_val+=diff /* *BPP1 */ ;
- for (; i < final_val; i += stride)
- {
- if (rep_bytes > (int)(final_val-i))
- rep_bytes = (int)(final_val-i);
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- }
-
- } /* end of else (_mmx_supported) */
-
- break;
- } /* end 8 bpp */
-
- case 16: /* png_ptr->row_info.pixel_depth */
- {
- png_bytep srcptr;
- png_bytep dstptr;
-
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && _mmx_supported */ )
-#else
- if (_mmx_supported)
-#endif
- {
- png_uint_32 len;
- int diff;
- int dummy_value_a; // fix 'forbidden register spilled' error
- int dummy_value_d;
- int dummy_value_c;
- int dummy_value_S;
- int dummy_value_D;
- _unmask = ~mask; // global variable for -fPIC version
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
- len = png_ptr->width &~7; // reduce to multiple of 8
- diff = (int) (png_ptr->width & 7); // amount lost //
-
- __asm__ __volatile__ (
- "movd _unmask, %%mm7 \n\t" // load bit pattern
- "psubb %%mm6, %%mm6 \n\t" // zero mm6
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklwd %%mm7, %%mm7 \n\t"
- "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks
-
- "movq _mask16_0, %%mm0 \n\t"
- "movq _mask16_1, %%mm1 \n\t"
-
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm1 \n\t"
-
- "pcmpeqb %%mm6, %%mm0 \n\t"
- "pcmpeqb %%mm6, %%mm1 \n\t"
-
-// preload "movl len, %%ecx \n\t" // load length of line
-// preload "movl srcptr, %%esi \n\t" // load source
-// preload "movl dstptr, %%edi \n\t" // load dest
-
- "cmpl $0, %%ecx \n\t"
- "jz mainloop16end \n\t"
-
- "mainloop16: \n\t"
- "movq (%%esi), %%mm4 \n\t"
- "pand %%mm0, %%mm4 \n\t"
- "movq %%mm0, %%mm6 \n\t"
- "movq (%%edi), %%mm7 \n\t"
- "pandn %%mm7, %%mm6 \n\t"
- "por %%mm6, %%mm4 \n\t"
- "movq %%mm4, (%%edi) \n\t"
-
- "movq 8(%%esi), %%mm5 \n\t"
- "pand %%mm1, %%mm5 \n\t"
- "movq %%mm1, %%mm7 \n\t"
- "movq 8(%%edi), %%mm6 \n\t"
- "pandn %%mm6, %%mm7 \n\t"
- "por %%mm7, %%mm5 \n\t"
- "movq %%mm5, 8(%%edi) \n\t"
-
- "addl $16, %%esi \n\t" // inc by 16 bytes processed
- "addl $16, %%edi \n\t"
- "subl $8, %%ecx \n\t" // dec by 8 pixels processed
- "ja mainloop16 \n\t"
-
- "mainloop16end: \n\t"
-// preload "movl diff, %%ecx \n\t" // (diff is in eax)
- "movl %%eax, %%ecx \n\t"
- "cmpl $0, %%ecx \n\t"
- "jz end16 \n\t"
-// preload "movl mask, %%edx \n\t"
- "sall $24, %%edx \n\t" // make low byte, high byte
-
- "secondloop16: \n\t"
- "sall %%edx \n\t" // move high bit to CF
- "jnc skip16 \n\t" // if CF = 0
- "movw (%%esi), %%ax \n\t"
- "movw %%ax, (%%edi) \n\t"
-
- "skip16: \n\t"
- "addl $2, %%esi \n\t"
- "addl $2, %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz secondloop16 \n\t"
-
- "end16: \n\t"
- "EMMS \n\t" // DONE
-
- : "=a" (dummy_value_a), // output regs (dummy)
- "=c" (dummy_value_c),
- "=d" (dummy_value_d),
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "0" (diff), // eax // input regs
-// was (unmask) " " RESERVED // ebx // Global Offset Table idx
- "1" (len), // ecx
- "2" (mask), // edx
- "3" (srcptr), // esi
- "4" (dstptr) // edi
-
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1", "%mm4" // clobber list
- , "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- else /* mmx _not supported - Use modified C routine */
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- register png_uint_32 i;
- png_uint_32 initial_val = BPP2 * png_pass_start[png_ptr->pass];
- /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
- register int stride = BPP2 * png_pass_inc[png_ptr->pass];
- /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
- register int rep_bytes = BPP2 * png_pass_width[png_ptr->pass];
- /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
- png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
- int diff = (int) (png_ptr->width & 7); /* amount lost */
- register png_uint_32 final_val = BPP2 * len; /* GRR bugfix */
-
- srcptr = png_ptr->row_buf + 1 + initial_val;
- dstptr = row + initial_val;
-
- for (i = initial_val; i < final_val; i += stride)
- {
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- if (diff) /* number of leftover pixels: 3 for pngtest */
- {
- final_val+=diff*BPP2;
- for (; i < final_val; i += stride)
- {
- if (rep_bytes > (int)(final_val-i))
- rep_bytes = (int)(final_val-i);
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- }
- } /* end of else (_mmx_supported) */
-
- break;
- } /* end 16 bpp */
-
- case 24: /* png_ptr->row_info.pixel_depth */
- {
- png_bytep srcptr;
- png_bytep dstptr;
-
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && _mmx_supported */ )
-#else
- if (_mmx_supported)
-#endif
- {
- png_uint_32 len;
- int diff;
- int dummy_value_a; // fix 'forbidden register spilled' error
- int dummy_value_d;
- int dummy_value_c;
- int dummy_value_S;
- int dummy_value_D;
- _unmask = ~mask; // global variable for -fPIC version
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
- len = png_ptr->width &~7; // reduce to multiple of 8
- diff = (int) (png_ptr->width & 7); // amount lost //
-
- __asm__ __volatile__ (
- "movd _unmask, %%mm7 \n\t" // load bit pattern
- "psubb %%mm6, %%mm6 \n\t" // zero mm6
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklwd %%mm7, %%mm7 \n\t"
- "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks
-
- "movq _mask24_0, %%mm0 \n\t"
- "movq _mask24_1, %%mm1 \n\t"
- "movq _mask24_2, %%mm2 \n\t"
-
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm2 \n\t"
-
- "pcmpeqb %%mm6, %%mm0 \n\t"
- "pcmpeqb %%mm6, %%mm1 \n\t"
- "pcmpeqb %%mm6, %%mm2 \n\t"
-
-// preload "movl len, %%ecx \n\t" // load length of line
-// preload "movl srcptr, %%esi \n\t" // load source
-// preload "movl dstptr, %%edi \n\t" // load dest
-
- "cmpl $0, %%ecx \n\t"
- "jz mainloop24end \n\t"
-
- "mainloop24: \n\t"
- "movq (%%esi), %%mm4 \n\t"
- "pand %%mm0, %%mm4 \n\t"
- "movq %%mm0, %%mm6 \n\t"
- "movq (%%edi), %%mm7 \n\t"
- "pandn %%mm7, %%mm6 \n\t"
- "por %%mm6, %%mm4 \n\t"
- "movq %%mm4, (%%edi) \n\t"
-
- "movq 8(%%esi), %%mm5 \n\t"
- "pand %%mm1, %%mm5 \n\t"
- "movq %%mm1, %%mm7 \n\t"
- "movq 8(%%edi), %%mm6 \n\t"
- "pandn %%mm6, %%mm7 \n\t"
- "por %%mm7, %%mm5 \n\t"
- "movq %%mm5, 8(%%edi) \n\t"
-
- "movq 16(%%esi), %%mm6 \n\t"
- "pand %%mm2, %%mm6 \n\t"
- "movq %%mm2, %%mm4 \n\t"
- "movq 16(%%edi), %%mm7 \n\t"
- "pandn %%mm7, %%mm4 \n\t"
- "por %%mm4, %%mm6 \n\t"
- "movq %%mm6, 16(%%edi) \n\t"
-
- "addl $24, %%esi \n\t" // inc by 24 bytes processed
- "addl $24, %%edi \n\t"
- "subl $8, %%ecx \n\t" // dec by 8 pixels processed
-
- "ja mainloop24 \n\t"
-
- "mainloop24end: \n\t"
-// preload "movl diff, %%ecx \n\t" // (diff is in eax)
- "movl %%eax, %%ecx \n\t"
- "cmpl $0, %%ecx \n\t"
- "jz end24 \n\t"
-// preload "movl mask, %%edx \n\t"
- "sall $24, %%edx \n\t" // make low byte, high byte
-
- "secondloop24: \n\t"
- "sall %%edx \n\t" // move high bit to CF
- "jnc skip24 \n\t" // if CF = 0
- "movw (%%esi), %%ax \n\t"
- "movw %%ax, (%%edi) \n\t"
- "xorl %%eax, %%eax \n\t"
- "movb 2(%%esi), %%al \n\t"
- "movb %%al, 2(%%edi) \n\t"
-
- "skip24: \n\t"
- "addl $3, %%esi \n\t"
- "addl $3, %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz secondloop24 \n\t"
-
- "end24: \n\t"
- "EMMS \n\t" // DONE
-
- : "=a" (dummy_value_a), // output regs (dummy)
- "=d" (dummy_value_d),
- "=c" (dummy_value_c),
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "3" (srcptr), // esi // input regs
- "4" (dstptr), // edi
- "0" (diff), // eax
-// was (unmask) "b" RESERVED // ebx // Global Offset Table idx
- "2" (len), // ecx
- "1" (mask) // edx
-
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1", "%mm2" // clobber list
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- else /* mmx _not supported - Use modified C routine */
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- register png_uint_32 i;
- png_uint_32 initial_val = BPP3 * png_pass_start[png_ptr->pass];
- /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
- register int stride = BPP3 * png_pass_inc[png_ptr->pass];
- /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
- register int rep_bytes = BPP3 * png_pass_width[png_ptr->pass];
- /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
- png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
- int diff = (int) (png_ptr->width & 7); /* amount lost */
- register png_uint_32 final_val = BPP3 * len; /* GRR bugfix */
-
- srcptr = png_ptr->row_buf + 1 + initial_val;
- dstptr = row + initial_val;
-
- for (i = initial_val; i < final_val; i += stride)
- {
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- if (diff) /* number of leftover pixels: 3 for pngtest */
- {
- final_val+=diff*BPP3;
- for (; i < final_val; i += stride)
- {
- if (rep_bytes > (int)(final_val-i))
- rep_bytes = (int)(final_val-i);
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- }
- } /* end of else (_mmx_supported) */
-
- break;
- } /* end 24 bpp */
-
- case 32: /* png_ptr->row_info.pixel_depth */
- {
- png_bytep srcptr;
- png_bytep dstptr;
-
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && _mmx_supported */ )
-#else
- if (_mmx_supported)
-#endif
- {
- png_uint_32 len;
- int diff;
- int dummy_value_a; // fix 'forbidden register spilled' error
- int dummy_value_d;
- int dummy_value_c;
- int dummy_value_S;
- int dummy_value_D;
- _unmask = ~mask; // global variable for -fPIC version
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
- len = png_ptr->width &~7; // reduce to multiple of 8
- diff = (int) (png_ptr->width & 7); // amount lost //
-
- __asm__ __volatile__ (
- "movd _unmask, %%mm7 \n\t" // load bit pattern
- "psubb %%mm6, %%mm6 \n\t" // zero mm6
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklwd %%mm7, %%mm7 \n\t"
- "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks
-
- "movq _mask32_0, %%mm0 \n\t"
- "movq _mask32_1, %%mm1 \n\t"
- "movq _mask32_2, %%mm2 \n\t"
- "movq _mask32_3, %%mm3 \n\t"
-
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm3 \n\t"
-
- "pcmpeqb %%mm6, %%mm0 \n\t"
- "pcmpeqb %%mm6, %%mm1 \n\t"
- "pcmpeqb %%mm6, %%mm2 \n\t"
- "pcmpeqb %%mm6, %%mm3 \n\t"
-
-// preload "movl len, %%ecx \n\t" // load length of line
-// preload "movl srcptr, %%esi \n\t" // load source
-// preload "movl dstptr, %%edi \n\t" // load dest
-
- "cmpl $0, %%ecx \n\t" // lcr
- "jz mainloop32end \n\t"
-
- "mainloop32: \n\t"
- "movq (%%esi), %%mm4 \n\t"
- "pand %%mm0, %%mm4 \n\t"
- "movq %%mm0, %%mm6 \n\t"
- "movq (%%edi), %%mm7 \n\t"
- "pandn %%mm7, %%mm6 \n\t"
- "por %%mm6, %%mm4 \n\t"
- "movq %%mm4, (%%edi) \n\t"
-
- "movq 8(%%esi), %%mm5 \n\t"
- "pand %%mm1, %%mm5 \n\t"
- "movq %%mm1, %%mm7 \n\t"
- "movq 8(%%edi), %%mm6 \n\t"
- "pandn %%mm6, %%mm7 \n\t"
- "por %%mm7, %%mm5 \n\t"
- "movq %%mm5, 8(%%edi) \n\t"
-
- "movq 16(%%esi), %%mm6 \n\t"
- "pand %%mm2, %%mm6 \n\t"
- "movq %%mm2, %%mm4 \n\t"
- "movq 16(%%edi), %%mm7 \n\t"
- "pandn %%mm7, %%mm4 \n\t"
- "por %%mm4, %%mm6 \n\t"
- "movq %%mm6, 16(%%edi) \n\t"
-
- "movq 24(%%esi), %%mm7 \n\t"
- "pand %%mm3, %%mm7 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "movq 24(%%edi), %%mm4 \n\t"
- "pandn %%mm4, %%mm5 \n\t"
- "por %%mm5, %%mm7 \n\t"
- "movq %%mm7, 24(%%edi) \n\t"
-
- "addl $32, %%esi \n\t" // inc by 32 bytes processed
- "addl $32, %%edi \n\t"
- "subl $8, %%ecx \n\t" // dec by 8 pixels processed
- "ja mainloop32 \n\t"
-
- "mainloop32end: \n\t"
-// preload "movl diff, %%ecx \n\t" // (diff is in eax)
- "movl %%eax, %%ecx \n\t"
- "cmpl $0, %%ecx \n\t"
- "jz end32 \n\t"
-// preload "movl mask, %%edx \n\t"
- "sall $24, %%edx \n\t" // low byte => high byte
-
- "secondloop32: \n\t"
- "sall %%edx \n\t" // move high bit to CF
- "jnc skip32 \n\t" // if CF = 0
- "movl (%%esi), %%eax \n\t"
- "movl %%eax, (%%edi) \n\t"
-
- "skip32: \n\t"
- "addl $4, %%esi \n\t"
- "addl $4, %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz secondloop32 \n\t"
-
- "end32: \n\t"
- "EMMS \n\t" // DONE
-
- : "=a" (dummy_value_a), // output regs (dummy)
- "=d" (dummy_value_d),
- "=c" (dummy_value_c),
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "3" (srcptr), // esi // input regs
- "4" (dstptr), // edi
- "0" (diff), // eax
-// was (unmask) "b" RESERVED // ebx // Global Offset Table idx
- "2" (len), // ecx
- "1" (mask) // edx
-
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- else /* mmx _not supported - Use modified C routine */
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- register png_uint_32 i;
- png_uint_32 initial_val = BPP4 * png_pass_start[png_ptr->pass];
- /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
- register int stride = BPP4 * png_pass_inc[png_ptr->pass];
- /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
- register int rep_bytes = BPP4 * png_pass_width[png_ptr->pass];
- /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
- png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
- int diff = (int) (png_ptr->width & 7); /* amount lost */
- register png_uint_32 final_val = BPP4 * len; /* GRR bugfix */
-
- srcptr = png_ptr->row_buf + 1 + initial_val;
- dstptr = row + initial_val;
-
- for (i = initial_val; i < final_val; i += stride)
- {
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- if (diff) /* number of leftover pixels: 3 for pngtest */
- {
- final_val+=diff*BPP4;
- for (; i < final_val; i += stride)
- {
- if (rep_bytes > (int)(final_val-i))
- rep_bytes = (int)(final_val-i);
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- }
- } /* end of else (_mmx_supported) */
-
- break;
- } /* end 32 bpp */
-
- case 48: /* png_ptr->row_info.pixel_depth */
- {
- png_bytep srcptr;
- png_bytep dstptr;
-
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && _mmx_supported */ )
-#else
- if (_mmx_supported)
-#endif
- {
- png_uint_32 len;
- int diff;
- int dummy_value_a; // fix 'forbidden register spilled' error
- int dummy_value_d;
- int dummy_value_c;
- int dummy_value_S;
- int dummy_value_D;
- _unmask = ~mask; // global variable for -fPIC version
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
- len = png_ptr->width &~7; // reduce to multiple of 8
- diff = (int) (png_ptr->width & 7); // amount lost //
-
- __asm__ __volatile__ (
- "movd _unmask, %%mm7 \n\t" // load bit pattern
- "psubb %%mm6, %%mm6 \n\t" // zero mm6
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklwd %%mm7, %%mm7 \n\t"
- "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks
-
- "movq _mask48_0, %%mm0 \n\t"
- "movq _mask48_1, %%mm1 \n\t"
- "movq _mask48_2, %%mm2 \n\t"
- "movq _mask48_3, %%mm3 \n\t"
- "movq _mask48_4, %%mm4 \n\t"
- "movq _mask48_5, %%mm5 \n\t"
-
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "pand %%mm7, %%mm4 \n\t"
- "pand %%mm7, %%mm5 \n\t"
-
- "pcmpeqb %%mm6, %%mm0 \n\t"
- "pcmpeqb %%mm6, %%mm1 \n\t"
- "pcmpeqb %%mm6, %%mm2 \n\t"
- "pcmpeqb %%mm6, %%mm3 \n\t"
- "pcmpeqb %%mm6, %%mm4 \n\t"
- "pcmpeqb %%mm6, %%mm5 \n\t"
-
-// preload "movl len, %%ecx \n\t" // load length of line
-// preload "movl srcptr, %%esi \n\t" // load source
-// preload "movl dstptr, %%edi \n\t" // load dest
-
- "cmpl $0, %%ecx \n\t"
- "jz mainloop48end \n\t"
-
- "mainloop48: \n\t"
- "movq (%%esi), %%mm7 \n\t"
- "pand %%mm0, %%mm7 \n\t"
- "movq %%mm0, %%mm6 \n\t"
- "pandn (%%edi), %%mm6 \n\t"
- "por %%mm6, %%mm7 \n\t"
- "movq %%mm7, (%%edi) \n\t"
-
- "movq 8(%%esi), %%mm6 \n\t"
- "pand %%mm1, %%mm6 \n\t"
- "movq %%mm1, %%mm7 \n\t"
- "pandn 8(%%edi), %%mm7 \n\t"
- "por %%mm7, %%mm6 \n\t"
- "movq %%mm6, 8(%%edi) \n\t"
-
- "movq 16(%%esi), %%mm6 \n\t"
- "pand %%mm2, %%mm6 \n\t"
- "movq %%mm2, %%mm7 \n\t"
- "pandn 16(%%edi), %%mm7 \n\t"
- "por %%mm7, %%mm6 \n\t"
- "movq %%mm6, 16(%%edi) \n\t"
-
- "movq 24(%%esi), %%mm7 \n\t"
- "pand %%mm3, %%mm7 \n\t"
- "movq %%mm3, %%mm6 \n\t"
- "pandn 24(%%edi), %%mm6 \n\t"
- "por %%mm6, %%mm7 \n\t"
- "movq %%mm7, 24(%%edi) \n\t"
-
- "movq 32(%%esi), %%mm6 \n\t"
- "pand %%mm4, %%mm6 \n\t"
- "movq %%mm4, %%mm7 \n\t"
- "pandn 32(%%edi), %%mm7 \n\t"
- "por %%mm7, %%mm6 \n\t"
- "movq %%mm6, 32(%%edi) \n\t"
-
- "movq 40(%%esi), %%mm7 \n\t"
- "pand %%mm5, %%mm7 \n\t"
- "movq %%mm5, %%mm6 \n\t"
- "pandn 40(%%edi), %%mm6 \n\t"
- "por %%mm6, %%mm7 \n\t"
- "movq %%mm7, 40(%%edi) \n\t"
-
- "addl $48, %%esi \n\t" // inc by 48 bytes processed
- "addl $48, %%edi \n\t"
- "subl $8, %%ecx \n\t" // dec by 8 pixels processed
-
- "ja mainloop48 \n\t"
-
- "mainloop48end: \n\t"
-// preload "movl diff, %%ecx \n\t" // (diff is in eax)
- "movl %%eax, %%ecx \n\t"
- "cmpl $0, %%ecx \n\t"
- "jz end48 \n\t"
-// preload "movl mask, %%edx \n\t"
- "sall $24, %%edx \n\t" // make low byte, high byte
-
- "secondloop48: \n\t"
- "sall %%edx \n\t" // move high bit to CF
- "jnc skip48 \n\t" // if CF = 0
- "movl (%%esi), %%eax \n\t"
- "movl %%eax, (%%edi) \n\t"
-
- "skip48: \n\t"
- "addl $4, %%esi \n\t"
- "addl $4, %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz secondloop48 \n\t"
-
- "end48: \n\t"
- "EMMS \n\t" // DONE
-
- : "=a" (dummy_value_a), // output regs (dummy)
- "=d" (dummy_value_d),
- "=c" (dummy_value_c),
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "3" (srcptr), // esi // input regs
- "4" (dstptr), // edi
- "0" (diff), // eax
-// was (unmask) "b" RESERVED // ebx // Global Offset Table idx
- "2" (len), // ecx
- "1" (mask) // edx
-
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- else /* mmx _not supported - Use modified C routine */
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- register png_uint_32 i;
- png_uint_32 initial_val = BPP6 * png_pass_start[png_ptr->pass];
- /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
- register int stride = BPP6 * png_pass_inc[png_ptr->pass];
- /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
- register int rep_bytes = BPP6 * png_pass_width[png_ptr->pass];
- /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
- png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
- int diff = (int) (png_ptr->width & 7); /* amount lost */
- register png_uint_32 final_val = BPP6 * len; /* GRR bugfix */
-
- srcptr = png_ptr->row_buf + 1 + initial_val;
- dstptr = row + initial_val;
-
- for (i = initial_val; i < final_val; i += stride)
- {
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- if (diff) /* number of leftover pixels: 3 for pngtest */
- {
- final_val+=diff*BPP6;
- for (; i < final_val; i += stride)
- {
- if (rep_bytes > (int)(final_val-i))
- rep_bytes = (int)(final_val-i);
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- }
- } /* end of else (_mmx_supported) */
-
- break;
- } /* end 48 bpp */
-
- case 64: /* png_ptr->row_info.pixel_depth */
- {
- png_bytep srcptr;
- png_bytep dstptr;
- register png_uint_32 i;
- png_uint_32 initial_val = BPP8 * png_pass_start[png_ptr->pass];
- /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
- register int stride = BPP8 * png_pass_inc[png_ptr->pass];
- /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
- register int rep_bytes = BPP8 * png_pass_width[png_ptr->pass];
- /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
- png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
- int diff = (int) (png_ptr->width & 7); /* amount lost */
- register png_uint_32 final_val = BPP8 * len; /* GRR bugfix */
-
- srcptr = png_ptr->row_buf + 1 + initial_val;
- dstptr = row + initial_val;
-
- for (i = initial_val; i < final_val; i += stride)
- {
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- if (diff) /* number of leftover pixels: 3 for pngtest */
- {
- final_val+=diff*BPP8;
- for (; i < final_val; i += stride)
- {
- if (rep_bytes > (int)(final_val-i))
- rep_bytes = (int)(final_val-i);
- png_memcpy(dstptr, srcptr, rep_bytes);
- srcptr += stride;
- dstptr += stride;
- }
- }
-
- break;
- } /* end 64 bpp */
-
- default: /* png_ptr->row_info.pixel_depth != 1,2,4,8,16,24,32,48,64 */
- {
- /* this should never happen */
- png_warning(png_ptr, "Invalid row_info.pixel_depth in pnggccrd");
- break;
- }
- } /* end switch (png_ptr->row_info.pixel_depth) */
-
- } /* end if (non-trivial mask) */
-
-} /* end png_combine_row() */
-
-#endif /* PNG_HAVE_MMX_COMBINE_ROW */
-
-
-
-
-/*===========================================================================*/
-/* */
-/* P N G _ D O _ R E A D _ I N T E R L A C E */
-/* */
-/*===========================================================================*/
-
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
-#if defined(PNG_HAVE_MMX_READ_INTERLACE)
-
-/* png_do_read_interlace() is called after any 16-bit to 8-bit conversion
- * has taken place. [GRR: what other steps come before and/or after?]
- */
-
-void /* PRIVATE */
-png_do_read_interlace(png_structp png_ptr)
-{
- png_row_infop row_info = &(png_ptr->row_info);
- png_bytep row = png_ptr->row_buf + 1;
- int pass = png_ptr->pass;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- png_uint_32 transformations = png_ptr->transformations;
-#endif
-
- png_debug(1, "in png_do_read_interlace (pnggccrd.c)\n");
-
-#if defined(PNG_MMX_CODE_SUPPORTED)
- if (_mmx_supported == 2) {
-#if !defined(PNG_1_0_X)
- /* this should have happened in png_init_mmx_flags() already */
- png_warning(png_ptr, "asm_flags may not have been initialized");
-#endif
- png_mmx_support();
- }
-#endif
-
- if (row != NULL && row_info != NULL)
- {
- png_uint_32 final_width;
-
- final_width = row_info->width * png_pass_inc[pass];
-
- switch (row_info->pixel_depth)
- {
- case 1:
- {
- png_bytep sp, dp;
- int sshift, dshift;
- int s_start, s_end, s_inc;
- png_byte v;
- png_uint_32 i;
- int j;
-
- sp = row + (png_size_t)((row_info->width - 1) >> 3);
- dp = row + (png_size_t)((final_width - 1) >> 3);
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (transformations & PNG_PACKSWAP)
- {
- sshift = (int)((row_info->width + 7) & 7);
- dshift = (int)((final_width + 7) & 7);
- s_start = 7;
- s_end = 0;
- s_inc = -1;
- }
- else
-#endif
- {
- sshift = 7 - (int)((row_info->width + 7) & 7);
- dshift = 7 - (int)((final_width + 7) & 7);
- s_start = 0;
- s_end = 7;
- s_inc = 1;
- }
-
- for (i = row_info->width; i; i--)
- {
- v = (png_byte)((*sp >> sshift) & 0x1);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff);
- *dp |= (png_byte)(v << dshift);
- if (dshift == s_end)
- {
- dshift = s_start;
- dp--;
- }
- else
- dshift += s_inc;
- }
- if (sshift == s_end)
- {
- sshift = s_start;
- sp--;
- }
- else
- sshift += s_inc;
- }
- break;
- }
-
- case 2:
- {
- png_bytep sp, dp;
- int sshift, dshift;
- int s_start, s_end, s_inc;
- png_uint_32 i;
-
- sp = row + (png_size_t)((row_info->width - 1) >> 2);
- dp = row + (png_size_t)((final_width - 1) >> 2);
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (transformations & PNG_PACKSWAP)
- {
- sshift = (png_size_t)(((row_info->width + 3) & 3) << 1);
- dshift = (png_size_t)(((final_width + 3) & 3) << 1);
- s_start = 6;
- s_end = 0;
- s_inc = -2;
- }
- else
-#endif
- {
- sshift = (png_size_t)((3 - ((row_info->width + 3) & 3)) << 1);
- dshift = (png_size_t)((3 - ((final_width + 3) & 3)) << 1);
- s_start = 0;
- s_end = 6;
- s_inc = 2;
- }
-
- for (i = row_info->width; i; i--)
- {
- png_byte v;
- int j;
-
- v = (png_byte)((*sp >> sshift) & 0x3);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff);
- *dp |= (png_byte)(v << dshift);
- if (dshift == s_end)
- {
- dshift = s_start;
- dp--;
- }
- else
- dshift += s_inc;
- }
- if (sshift == s_end)
- {
- sshift = s_start;
- sp--;
- }
- else
- sshift += s_inc;
- }
- break;
- }
-
- case 4:
- {
- png_bytep sp, dp;
- int sshift, dshift;
- int s_start, s_end, s_inc;
- png_uint_32 i;
-
- sp = row + (png_size_t)((row_info->width - 1) >> 1);
- dp = row + (png_size_t)((final_width - 1) >> 1);
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (transformations & PNG_PACKSWAP)
- {
- sshift = (png_size_t)(((row_info->width + 1) & 1) << 2);
- dshift = (png_size_t)(((final_width + 1) & 1) << 2);
- s_start = 4;
- s_end = 0;
- s_inc = -4;
- }
- else
-#endif
- {
- sshift = (png_size_t)((1 - ((row_info->width + 1) & 1)) << 2);
- dshift = (png_size_t)((1 - ((final_width + 1) & 1)) << 2);
- s_start = 0;
- s_end = 4;
- s_inc = 4;
- }
-
- for (i = row_info->width; i; i--)
- {
- png_byte v;
- int j;
-
- v = (png_byte)((*sp >> sshift) & 0xf);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff);
- *dp |= (png_byte)(v << dshift);
- if (dshift == s_end)
- {
- dshift = s_start;
- dp--;
- }
- else
- dshift += s_inc;
- }
- if (sshift == s_end)
- {
- sshift = s_start;
- sp--;
- }
- else
- sshift += s_inc;
- }
- break;
- }
-
- /*====================================================================*/
-
- default: /* 8-bit or larger (this is where the routine is modified) */
- {
-#if 0
-// static unsigned long long _const4 = 0x0000000000FFFFFFLL; no good
-// static unsigned long long const4 = 0x0000000000FFFFFFLL; no good
-// unsigned long long _const4 = 0x0000000000FFFFFFLL; no good
-// unsigned long long const4 = 0x0000000000FFFFFFLL; no good
-#endif
- png_bytep sptr, dp;
- png_uint_32 i;
- png_size_t pixel_bytes;
- int width = (int)row_info->width;
-
- pixel_bytes = (row_info->pixel_depth >> 3);
-
- /* point sptr at the last pixel in the pre-expanded row: */
- sptr = row + (width - 1) * pixel_bytes;
-
- /* point dp at the last pixel position in the expanded row: */
- dp = row + (final_width - 1) * pixel_bytes;
-
- /* New code by Nirav Chhatrapati - Intel Corporation */
-
-#if defined(PNG_MMX_CODE_SUPPORTED)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)
- /* && _mmx_supported */ )
-#else
- if (_mmx_supported)
-#endif
- {
- //--------------------------------------------------------------
- if (pixel_bytes == 3)
- {
- if (((pass == 0) || (pass == 1)) && width)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
- int dummy_value_a;
-
- __asm__ __volatile__ (
- "subl $21, %%edi \n\t"
- // (png_pass_inc[pass] - 1)*pixel_bytes
-
- ".loop3_pass0: \n\t"
- "movd (%%esi), %%mm0 \n\t" // x x x x x 2 1 0
- "pand (%3), %%mm0 \n\t" // z z z z z 2 1 0
- "movq %%mm0, %%mm1 \n\t" // z z z z z 2 1 0
- "psllq $16, %%mm0 \n\t" // z z z 2 1 0 z z
- "movq %%mm0, %%mm2 \n\t" // z z z 2 1 0 z z
- "psllq $24, %%mm0 \n\t" // 2 1 0 z z z z z
- "psrlq $8, %%mm1 \n\t" // z z z z z z 2 1
- "por %%mm2, %%mm0 \n\t" // 2 1 0 2 1 0 z z
- "por %%mm1, %%mm0 \n\t" // 2 1 0 2 1 0 2 1
- "movq %%mm0, %%mm3 \n\t" // 2 1 0 2 1 0 2 1
- "psllq $16, %%mm0 \n\t" // 0 2 1 0 2 1 z z
- "movq %%mm3, %%mm4 \n\t" // 2 1 0 2 1 0 2 1
- "punpckhdq %%mm0, %%mm3 \n\t" // 0 2 1 0 2 1 0 2
- "movq %%mm4, 16(%%edi) \n\t"
- "psrlq $32, %%mm0 \n\t" // z z z z 0 2 1 0
- "movq %%mm3, 8(%%edi) \n\t"
- "punpckldq %%mm4, %%mm0 \n\t" // 1 0 2 1 0 2 1 0
- "subl $3, %%esi \n\t"
- "movq %%mm0, (%%edi) \n\t"
- "subl $24, %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz .loop3_pass0 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D),
- "=a" (dummy_value_a)
-
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width), // ecx
- "3" (&_const4) // %1(?) (0x0000000000FFFFFFLL)
-
-#if 0 /* %mm0, ..., %mm4 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1", "%mm2" // clobber list
- , "%mm3", "%mm4"
-#endif
- );
- }
- else if (((pass == 2) || (pass == 3)) && width)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
- int dummy_value_a;
-
- __asm__ __volatile__ (
- "subl $9, %%edi \n\t"
- // (png_pass_inc[pass] - 1)*pixel_bytes
-
- ".loop3_pass2: \n\t"
- "movd (%%esi), %%mm0 \n\t" // x x x x x 2 1 0
- "pand (%3), %%mm0 \n\t" // z z z z z 2 1 0
- "movq %%mm0, %%mm1 \n\t" // z z z z z 2 1 0
- "psllq $16, %%mm0 \n\t" // z z z 2 1 0 z z
- "movq %%mm0, %%mm2 \n\t" // z z z 2 1 0 z z
- "psllq $24, %%mm0 \n\t" // 2 1 0 z z z z z
- "psrlq $8, %%mm1 \n\t" // z z z z z z 2 1
- "por %%mm2, %%mm0 \n\t" // 2 1 0 2 1 0 z z
- "por %%mm1, %%mm0 \n\t" // 2 1 0 2 1 0 2 1
- "movq %%mm0, 4(%%edi) \n\t"
- "psrlq $16, %%mm0 \n\t" // z z 2 1 0 2 1 0
- "subl $3, %%esi \n\t"
- "movd %%mm0, (%%edi) \n\t"
- "subl $12, %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz .loop3_pass2 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D),
- "=a" (dummy_value_a)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width), // ecx
- "3" (&_const4) // (0x0000000000FFFFFFLL)
-
-#if 0 /* %mm0, ..., %mm2 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1", "%mm2" // clobber list
-#endif
- );
- }
- else if (width) /* && ((pass == 4) || (pass == 5)) */
- {
- int width_mmx = ((width >> 1) << 1) - 8; // GRR: huh?
- if (width_mmx < 0)
- width_mmx = 0;
- width -= width_mmx; // 8 or 9 pix, 24 or 27 bytes
- if (width_mmx)
- {
- // png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
- // sptr points at last pixel in pre-expanded row
- // dp points at last pixel position in expanded row
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
- int dummy_value_a;
- int dummy_value_d;
-
- __asm__ __volatile__ (
- "subl $3, %%esi \n\t"
- "subl $9, %%edi \n\t"
- // (png_pass_inc[pass] + 1)*pixel_bytes
-
- ".loop3_pass4: \n\t"
- "movq (%%esi), %%mm0 \n\t" // x x 5 4 3 2 1 0
- "movq %%mm0, %%mm1 \n\t" // x x 5 4 3 2 1 0
- "movq %%mm0, %%mm2 \n\t" // x x 5 4 3 2 1 0
- "psllq $24, %%mm0 \n\t" // 4 3 2 1 0 z z z
- "pand (%3), %%mm1 \n\t" // z z z z z 2 1 0
- "psrlq $24, %%mm2 \n\t" // z z z x x 5 4 3
- "por %%mm1, %%mm0 \n\t" // 4 3 2 1 0 2 1 0
- "movq %%mm2, %%mm3 \n\t" // z z z x x 5 4 3
- "psllq $8, %%mm2 \n\t" // z z x x 5 4 3 z
- "movq %%mm0, (%%edi) \n\t"
- "psrlq $16, %%mm3 \n\t" // z z z z z x x 5
- "pand (%4), %%mm3 \n\t" // z z z z z z z 5
- "por %%mm3, %%mm2 \n\t" // z z x x 5 4 3 5
- "subl $6, %%esi \n\t"
- "movd %%mm2, 8(%%edi) \n\t"
- "subl $12, %%edi \n\t"
- "subl $2, %%ecx \n\t"
- "jnz .loop3_pass4 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D),
- "=a" (dummy_value_a),
- "=d" (dummy_value_d)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx), // ecx
- "3" (&_const4), // 0x0000000000FFFFFFLL
- "4" (&_const6) // 0x00000000000000FFLL
-
-#if 0 /* %mm0, ..., %mm3 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1" // clobber list
- , "%mm2", "%mm3"
-#endif
- );
- }
-
- sptr -= width_mmx*3;
- dp -= width_mmx*6;
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
-
- png_memcpy(v, sptr, 3);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, 3);
- dp -= 3;
- }
- sptr -= 3;
- }
- }
- } /* end of pixel_bytes == 3 */
-
- //--------------------------------------------------------------
- else if (pixel_bytes == 1)
- {
- if (((pass == 0) || (pass == 1)) && width)
- {
- int width_mmx = ((width >> 2) << 2);
- width -= width_mmx; // 0-3 pixels => 0-3 bytes
- if (width_mmx)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $3, %%esi \n\t"
- "subl $31, %%edi \n\t"
-
- ".loop1_pass0: \n\t"
- "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0
- "movq %%mm0, %%mm1 \n\t" // x x x x 3 2 1 0
- "punpcklbw %%mm0, %%mm0 \n\t" // 3 3 2 2 1 1 0 0
- "movq %%mm0, %%mm2 \n\t" // 3 3 2 2 1 1 0 0
- "punpcklwd %%mm0, %%mm0 \n\t" // 1 1 1 1 0 0 0 0
- "movq %%mm0, %%mm3 \n\t" // 1 1 1 1 0 0 0 0
- "punpckldq %%mm0, %%mm0 \n\t" // 0 0 0 0 0 0 0 0
- "punpckhdq %%mm3, %%mm3 \n\t" // 1 1 1 1 1 1 1 1
- "movq %%mm0, (%%edi) \n\t"
- "punpckhwd %%mm2, %%mm2 \n\t" // 3 3 3 3 2 2 2 2
- "movq %%mm3, 8(%%edi) \n\t"
- "movq %%mm2, %%mm4 \n\t" // 3 3 3 3 2 2 2 2
- "punpckldq %%mm2, %%mm2 \n\t" // 2 2 2 2 2 2 2 2
- "punpckhdq %%mm4, %%mm4 \n\t" // 3 3 3 3 3 3 3 3
- "movq %%mm2, 16(%%edi) \n\t"
- "subl $4, %%esi \n\t"
- "movq %%mm4, 24(%%edi) \n\t"
- "subl $32, %%edi \n\t"
- "subl $4, %%ecx \n\t"
- "jnz .loop1_pass0 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx) // ecx
-
-#if 0 /* %mm0, ..., %mm4 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1", "%mm2" // clobber list
- , "%mm3", "%mm4"
-#endif
- );
- }
-
- sptr -= width_mmx;
- dp -= width_mmx*8;
- for (i = width; i; i--)
- {
- int j;
-
- /* I simplified this part in version 1.0.4e
- * here and in several other instances where
- * pixel_bytes == 1 -- GR-P
- *
- * Original code:
- *
- * png_byte v[8];
- * png_memcpy(v, sptr, pixel_bytes);
- * for (j = 0; j < png_pass_inc[pass]; j++)
- * {
- * png_memcpy(dp, v, pixel_bytes);
- * dp -= pixel_bytes;
- * }
- * sptr -= pixel_bytes;
- *
- * Replacement code is in the next three lines:
- */
-
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp-- = *sptr;
- }
- --sptr;
- }
- }
- else if (((pass == 2) || (pass == 3)) && width)
- {
- int width_mmx = ((width >> 2) << 2);
- width -= width_mmx; // 0-3 pixels => 0-3 bytes
- if (width_mmx)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $3, %%esi \n\t"
- "subl $15, %%edi \n\t"
-
- ".loop1_pass2: \n\t"
- "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0
- "punpcklbw %%mm0, %%mm0 \n\t" // 3 3 2 2 1 1 0 0
- "movq %%mm0, %%mm1 \n\t" // 3 3 2 2 1 1 0 0
- "punpcklwd %%mm0, %%mm0 \n\t" // 1 1 1 1 0 0 0 0
- "punpckhwd %%mm1, %%mm1 \n\t" // 3 3 3 3 2 2 2 2
- "movq %%mm0, (%%edi) \n\t"
- "subl $4, %%esi \n\t"
- "movq %%mm1, 8(%%edi) \n\t"
- "subl $16, %%edi \n\t"
- "subl $4, %%ecx \n\t"
- "jnz .loop1_pass2 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx) // ecx
-
-#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1" // clobber list
-#endif
- );
- }
-
- sptr -= width_mmx;
- dp -= width_mmx*4;
- for (i = width; i; i--)
- {
- int j;
-
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp-- = *sptr;
- }
- --sptr;
- }
- }
- else if (width) /* && ((pass == 4) || (pass == 5)) */
- {
- int width_mmx = ((width >> 3) << 3);
- width -= width_mmx; // 0-3 pixels => 0-3 bytes
- if (width_mmx)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $7, %%esi \n\t"
- "subl $15, %%edi \n\t"
-
- ".loop1_pass4: \n\t"
- "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0
- "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0
- "punpcklbw %%mm0, %%mm0 \n\t" // 3 3 2 2 1 1 0 0
- "punpckhbw %%mm1, %%mm1 \n\t" // 7 7 6 6 5 5 4 4
- "movq %%mm1, 8(%%edi) \n\t"
- "subl $8, %%esi \n\t"
- "movq %%mm0, (%%edi) \n\t"
- "subl $16, %%edi \n\t"
- "subl $8, %%ecx \n\t"
- "jnz .loop1_pass4 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (none)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx) // ecx
-
-#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1" // clobber list
-#endif
- );
- }
-
- sptr -= width_mmx;
- dp -= width_mmx*2;
- for (i = width; i; i--)
- {
- int j;
-
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp-- = *sptr;
- }
- --sptr;
- }
- }
- } /* end of pixel_bytes == 1 */
-
- //--------------------------------------------------------------
- else if (pixel_bytes == 2)
- {
- if (((pass == 0) || (pass == 1)) && width)
- {
- int width_mmx = ((width >> 1) << 1);
- width -= width_mmx; // 0,1 pixels => 0,2 bytes
- if (width_mmx)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $2, %%esi \n\t"
- "subl $30, %%edi \n\t"
-
- ".loop2_pass0: \n\t"
- "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0
- "punpcklwd %%mm0, %%mm0 \n\t" // 3 2 3 2 1 0 1 0
- "movq %%mm0, %%mm1 \n\t" // 3 2 3 2 1 0 1 0
- "punpckldq %%mm0, %%mm0 \n\t" // 1 0 1 0 1 0 1 0
- "punpckhdq %%mm1, %%mm1 \n\t" // 3 2 3 2 3 2 3 2
- "movq %%mm0, (%%edi) \n\t"
- "movq %%mm0, 8(%%edi) \n\t"
- "movq %%mm1, 16(%%edi) \n\t"
- "subl $4, %%esi \n\t"
- "movq %%mm1, 24(%%edi) \n\t"
- "subl $32, %%edi \n\t"
- "subl $2, %%ecx \n\t"
- "jnz .loop2_pass0 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx) // ecx
-
-#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1" // clobber list
-#endif
- );
- }
-
- sptr -= (width_mmx*2 - 2); // sign fixed
- dp -= (width_mmx*16 - 2); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 2;
- png_memcpy(v, sptr, 2);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 2;
- png_memcpy(dp, v, 2);
- }
- }
- }
- else if (((pass == 2) || (pass == 3)) && width)
- {
- int width_mmx = ((width >> 1) << 1) ;
- width -= width_mmx; // 0,1 pixels => 0,2 bytes
- if (width_mmx)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $2, %%esi \n\t"
- "subl $14, %%edi \n\t"
-
- ".loop2_pass2: \n\t"
- "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0
- "punpcklwd %%mm0, %%mm0 \n\t" // 3 2 3 2 1 0 1 0
- "movq %%mm0, %%mm1 \n\t" // 3 2 3 2 1 0 1 0
- "punpckldq %%mm0, %%mm0 \n\t" // 1 0 1 0 1 0 1 0
- "punpckhdq %%mm1, %%mm1 \n\t" // 3 2 3 2 3 2 3 2
- "movq %%mm0, (%%edi) \n\t"
- "subl $4, %%esi \n\t"
- "movq %%mm1, 8(%%edi) \n\t"
- "subl $16, %%edi \n\t"
- "subl $2, %%ecx \n\t"
- "jnz .loop2_pass2 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx) // ecx
-
-#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1" // clobber list
-#endif
- );
- }
-
- sptr -= (width_mmx*2 - 2); // sign fixed
- dp -= (width_mmx*8 - 2); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 2;
- png_memcpy(v, sptr, 2);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 2;
- png_memcpy(dp, v, 2);
- }
- }
- }
- else if (width) // pass == 4 or 5
- {
- int width_mmx = ((width >> 1) << 1) ;
- width -= width_mmx; // 0,1 pixels => 0,2 bytes
- if (width_mmx)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $2, %%esi \n\t"
- "subl $6, %%edi \n\t"
-
- ".loop2_pass4: \n\t"
- "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0
- "punpcklwd %%mm0, %%mm0 \n\t" // 3 2 3 2 1 0 1 0
- "subl $4, %%esi \n\t"
- "movq %%mm0, (%%edi) \n\t"
- "subl $8, %%edi \n\t"
- "subl $2, %%ecx \n\t"
- "jnz .loop2_pass4 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx) // ecx
-
-#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0" // clobber list
-#endif
- );
- }
-
- sptr -= (width_mmx*2 - 2); // sign fixed
- dp -= (width_mmx*4 - 2); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 2;
- png_memcpy(v, sptr, 2);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 2;
- png_memcpy(dp, v, 2);
- }
- }
- }
- } /* end of pixel_bytes == 2 */
-
- //--------------------------------------------------------------
- else if (pixel_bytes == 4)
- {
- if (((pass == 0) || (pass == 1)) && width)
- {
- int width_mmx = ((width >> 1) << 1);
- width -= width_mmx; // 0,1 pixels => 0,4 bytes
- if (width_mmx)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $4, %%esi \n\t"
- "subl $60, %%edi \n\t"
-
- ".loop4_pass0: \n\t"
- "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0
- "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0
- "punpckldq %%mm0, %%mm0 \n\t" // 3 2 1 0 3 2 1 0
- "punpckhdq %%mm1, %%mm1 \n\t" // 7 6 5 4 7 6 5 4
- "movq %%mm0, (%%edi) \n\t"
- "movq %%mm0, 8(%%edi) \n\t"
- "movq %%mm0, 16(%%edi) \n\t"
- "movq %%mm0, 24(%%edi) \n\t"
- "movq %%mm1, 32(%%edi) \n\t"
- "movq %%mm1, 40(%%edi) \n\t"
- "movq %%mm1, 48(%%edi) \n\t"
- "subl $8, %%esi \n\t"
- "movq %%mm1, 56(%%edi) \n\t"
- "subl $64, %%edi \n\t"
- "subl $2, %%ecx \n\t"
- "jnz .loop4_pass0 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx) // ecx
-
-#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1" // clobber list
-#endif
- );
- }
-
- sptr -= (width_mmx*4 - 4); // sign fixed
- dp -= (width_mmx*32 - 4); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 4;
- png_memcpy(v, sptr, 4);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 4;
- png_memcpy(dp, v, 4);
- }
- }
- }
- else if (((pass == 2) || (pass == 3)) && width)
- {
- int width_mmx = ((width >> 1) << 1);
- width -= width_mmx; // 0,1 pixels => 0,4 bytes
- if (width_mmx)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $4, %%esi \n\t"
- "subl $28, %%edi \n\t"
-
- ".loop4_pass2: \n\t"
- "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0
- "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0
- "punpckldq %%mm0, %%mm0 \n\t" // 3 2 1 0 3 2 1 0
- "punpckhdq %%mm1, %%mm1 \n\t" // 7 6 5 4 7 6 5 4
- "movq %%mm0, (%%edi) \n\t"
- "movq %%mm0, 8(%%edi) \n\t"
- "movq %%mm1, 16(%%edi) \n\t"
- "movq %%mm1, 24(%%edi) \n\t"
- "subl $8, %%esi \n\t"
- "subl $32, %%edi \n\t"
- "subl $2, %%ecx \n\t"
- "jnz .loop4_pass2 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx) // ecx
-
-#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1" // clobber list
-#endif
- );
- }
-
- sptr -= (width_mmx*4 - 4); // sign fixed
- dp -= (width_mmx*16 - 4); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 4;
- png_memcpy(v, sptr, 4);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 4;
- png_memcpy(dp, v, 4);
- }
- }
- }
- else if (width) // pass == 4 or 5
- {
- int width_mmx = ((width >> 1) << 1) ;
- width -= width_mmx; // 0,1 pixels => 0,4 bytes
- if (width_mmx)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $4, %%esi \n\t"
- "subl $12, %%edi \n\t"
-
- ".loop4_pass4: \n\t"
- "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0
- "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0
- "punpckldq %%mm0, %%mm0 \n\t" // 3 2 1 0 3 2 1 0
- "punpckhdq %%mm1, %%mm1 \n\t" // 7 6 5 4 7 6 5 4
- "movq %%mm0, (%%edi) \n\t"
- "subl $8, %%esi \n\t"
- "movq %%mm1, 8(%%edi) \n\t"
- "subl $16, %%edi \n\t"
- "subl $2, %%ecx \n\t"
- "jnz .loop4_pass4 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width_mmx) // ecx
-
-#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0", "%mm1" // clobber list
-#endif
- );
- }
-
- sptr -= (width_mmx*4 - 4); // sign fixed
- dp -= (width_mmx*8 - 4); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 4;
- png_memcpy(v, sptr, 4);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 4;
- png_memcpy(dp, v, 4);
- }
- }
- }
- } /* end of pixel_bytes == 4 */
-
- //--------------------------------------------------------------
- else if (pixel_bytes == 8)
- {
-// GRR TEST: should work, but needs testing (special 64-bit version of rpng2?)
- // GRR NOTE: no need to combine passes here!
- if (((pass == 0) || (pass == 1)) && width)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- // source is 8-byte RRGGBBAA
- // dest is 64-byte RRGGBBAA RRGGBBAA RRGGBBAA RRGGBBAA ...
- __asm__ __volatile__ (
- "subl $56, %%edi \n\t" // start of last block
-
- ".loop8_pass0: \n\t"
- "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0
- "movq %%mm0, (%%edi) \n\t"
- "movq %%mm0, 8(%%edi) \n\t"
- "movq %%mm0, 16(%%edi) \n\t"
- "movq %%mm0, 24(%%edi) \n\t"
- "movq %%mm0, 32(%%edi) \n\t"
- "movq %%mm0, 40(%%edi) \n\t"
- "movq %%mm0, 48(%%edi) \n\t"
- "subl $8, %%esi \n\t"
- "movq %%mm0, 56(%%edi) \n\t"
- "subl $64, %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz .loop8_pass0 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width) // ecx
-
-#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0" // clobber list
-#endif
- );
- }
- else if (((pass == 2) || (pass == 3)) && width)
- {
- // source is 8-byte RRGGBBAA
- // dest is 32-byte RRGGBBAA RRGGBBAA RRGGBBAA RRGGBBAA
- // (recall that expansion is _in place_: sptr and dp
- // both point at locations within same row buffer)
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $24, %%edi \n\t" // start of last block
-
- ".loop8_pass2: \n\t"
- "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0
- "movq %%mm0, (%%edi) \n\t"
- "movq %%mm0, 8(%%edi) \n\t"
- "movq %%mm0, 16(%%edi) \n\t"
- "subl $8, %%esi \n\t"
- "movq %%mm0, 24(%%edi) \n\t"
- "subl $32, %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz .loop8_pass2 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width) // ecx
-
-#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0" // clobber list
-#endif
- );
- }
- }
- else if (width) // pass == 4 or 5
- {
- // source is 8-byte RRGGBBAA
- // dest is 16-byte RRGGBBAA RRGGBBAA
- {
- int dummy_value_c; // fix 'forbidden register spilled'
- int dummy_value_S;
- int dummy_value_D;
-
- __asm__ __volatile__ (
- "subl $8, %%edi \n\t" // start of last block
-
- ".loop8_pass4: \n\t"
- "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0
- "movq %%mm0, (%%edi) \n\t"
- "subl $8, %%esi \n\t"
- "movq %%mm0, 8(%%edi) \n\t"
- "subl $16, %%edi \n\t"
- "decl %%ecx \n\t"
- "jnz .loop8_pass4 \n\t"
- "EMMS \n\t" // DONE
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "1" (sptr), // esi // input regs
- "2" (dp), // edi
- "0" (width) // ecx
-
-#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */
- : "%mm0" // clobber list
-#endif
- );
- }
- }
-
- } /* end of pixel_bytes == 8 */
-
- //--------------------------------------------------------------
- else if (pixel_bytes == 6)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, 6);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, 6);
- dp -= 6;
- }
- sptr -= 6;
- }
- } /* end of pixel_bytes == 6 */
-
- //--------------------------------------------------------------
- else
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, pixel_bytes);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, pixel_bytes);
- dp -= pixel_bytes;
- }
- sptr-= pixel_bytes;
- }
- }
- } // end of _mmx_supported ========================================
-
- else /* MMX not supported: use modified C code - takes advantage
- * of inlining of png_memcpy for a constant */
- /* GRR 19991007: does it? or should pixel_bytes in each
- * block be replaced with immediate value (e.g., 1)? */
- /* GRR 19991017: replaced with constants in each case */
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- if (pixel_bytes == 1)
- {
- for (i = width; i; i--)
- {
- int j;
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp-- = *sptr;
- }
- --sptr;
- }
- }
- else if (pixel_bytes == 3)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, 3);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, 3);
- dp -= 3;
- }
- sptr -= 3;
- }
- }
- else if (pixel_bytes == 2)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, 2);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, 2);
- dp -= 2;
- }
- sptr -= 2;
- }
- }
- else if (pixel_bytes == 4)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, 4);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
-#ifdef PNG_DEBUG
- if (dp < row || dp+3 > row+png_ptr->row_buf_size)
- {
- printf("dp out of bounds: row=%d, dp=%d, rp=%d\n",
- row, dp, row+png_ptr->row_buf_size);
- printf("row_buf=%d\n",png_ptr->row_buf_size);
- }
-#endif
- png_memcpy(dp, v, 4);
- dp -= 4;
- }
- sptr -= 4;
- }
- }
- else if (pixel_bytes == 6)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, 6);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, 6);
- dp -= 6;
- }
- sptr -= 6;
- }
- }
- else if (pixel_bytes == 8)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, 8);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, 8);
- dp -= 8;
- }
- sptr -= 8;
- }
- }
- else /* GRR: should never be reached */
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, pixel_bytes);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, pixel_bytes);
- dp -= pixel_bytes;
- }
- sptr -= pixel_bytes;
- }
- }
-
- } /* end if (MMX not supported) */
- break;
- }
- } /* end switch (row_info->pixel_depth) */
-
- row_info->width = final_width;
-
- row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width);
- }
-
-} /* end png_do_read_interlace() */
-
-#endif /* PNG_HAVE_MMX_READ_INTERLACE */
-#endif /* PNG_READ_INTERLACING_SUPPORTED */
-
-
-
-#if defined(PNG_HAVE_MMX_READ_FILTER_ROW)
-#if defined(PNG_MMX_CODE_SUPPORTED)
-
-// These variables are utilized in the functions below. They are declared
-// globally here to ensure alignment on 8-byte boundaries.
-
-union uAll {
- long long use;
- double align;
-} _LBCarryMask = {0x0101010101010101LL},
- _HBClearMask = {0x7f7f7f7f7f7f7f7fLL},
- _ActiveMask, _ActiveMask2, _ActiveMaskEnd, _ShiftBpp, _ShiftRem;
-
-#ifdef PNG_THREAD_UNSAFE_OK
-//===========================================================================//
-// //
-// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ A V G //
-// //
-//===========================================================================//
-
-// Optimized code for PNG Average filter decoder
-
-static void /* PRIVATE */
-png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
- png_bytep prev_row)
-{
- int bpp;
- int dummy_value_c; // fix 'forbidden register 2 (cx) was spilled' error
- int dummy_value_S;
- int dummy_value_D;
-
- bpp = (row_info->pixel_depth + 7) >> 3; // get # bytes per pixel
- _FullLength = row_info->rowbytes; // # of bytes to filter
-
- __asm__ __volatile__ (
- // initialize address pointers and offset
-#ifdef __PIC__
- "pushl %%ebx \n\t" // save index to Global Offset Table
-#endif
-//pre "movl row, %%edi \n\t" // edi: Avg(x)
- "xorl %%ebx, %%ebx \n\t" // ebx: x
- "movl %%edi, %%edx \n\t"
-//pre "movl prev_row, %%esi \n\t" // esi: Prior(x)
-//pre "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx)
- "subl %%ecx, %%edx \n\t" // edx: Raw(x-bpp)
-
- "xorl %%eax,%%eax \n\t"
-
- // Compute the Raw value for the first bpp bytes
- // Raw(x) = Avg(x) + (Prior(x)/2)
- "avg_rlp: \n\t"
- "movb (%%esi,%%ebx,),%%al \n\t" // load al with Prior(x)
- "incl %%ebx \n\t"
- "shrb %%al \n\t" // divide by 2
- "addb -1(%%edi,%%ebx,),%%al \n\t" // add Avg(x); -1 to offset inc ebx
-//pre "cmpl bpp, %%ebx \n\t" // (bpp is preloaded into ecx)
- "cmpl %%ecx, %%ebx \n\t"
- "movb %%al,-1(%%edi,%%ebx,) \n\t" // write Raw(x); -1 to offset inc ebx
- "jb avg_rlp \n\t" // mov does not affect flags
-
- // get # of bytes to alignment
- "movl %%edi, _dif \n\t" // take start of row
- "addl %%ebx, _dif \n\t" // add bpp
- "addl $0xf, _dif \n\t" // add 7+8 to incr past alignment bdry
- "andl $0xfffffff8, _dif \n\t" // mask to alignment boundary
- "subl %%edi, _dif \n\t" // subtract from start => value ebx at
- "jz avg_go \n\t" // alignment
-
- // fix alignment
- // Compute the Raw value for the bytes up to the alignment boundary
- // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2)
- "xorl %%ecx, %%ecx \n\t"
-
- "avg_lp1: \n\t"
- "xorl %%eax, %%eax \n\t"
- "movb (%%esi,%%ebx,), %%cl \n\t" // load cl with Prior(x)
- "movb (%%edx,%%ebx,), %%al \n\t" // load al with Raw(x-bpp)
- "addw %%cx, %%ax \n\t"
- "incl %%ebx \n\t"
- "shrw %%ax \n\t" // divide by 2
- "addb -1(%%edi,%%ebx,), %%al \n\t" // add Avg(x); -1 to offset inc ebx
- "cmpl _dif, %%ebx \n\t" // check if at alignment boundary
- "movb %%al, -1(%%edi,%%ebx,) \n\t" // write Raw(x); -1 to offset inc ebx
- "jb avg_lp1 \n\t" // repeat until at alignment boundary
-
- "avg_go: \n\t"
- "movl _FullLength, %%eax \n\t"
- "movl %%eax, %%ecx \n\t"
- "subl %%ebx, %%eax \n\t" // subtract alignment fix
- "andl $0x00000007, %%eax \n\t" // calc bytes over mult of 8
- "subl %%eax, %%ecx \n\t" // drop over bytes from original length
- "movl %%ecx, _MMXLength \n\t"
-#ifdef __PIC__
- "popl %%ebx \n\t" // restore index to Global Offset Table
-#endif
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "0" (bpp), // ecx // input regs
- "1" (prev_row), // esi
- "2" (row) // edi
-
- : "%eax", "%edx" // clobber list
-#ifndef __PIC__
- , "%ebx"
-#endif
- // GRR: INCLUDE "memory" as clobbered? (_dif, _MMXLength)
- // (seems to work fine without...)
- );
-
- // now do the math for the rest of the row
- switch (bpp)
- {
- case 3:
- {
- _ActiveMask.use = 0x0000000000ffffffLL;
- _ShiftBpp.use = 24; // == 3 * 8
- _ShiftRem.use = 40; // == 64 - 24
-
- __asm__ __volatile__ (
- // re-init address pointers and offset
- "movq _ActiveMask, %%mm7 \n\t"
- "movl _dif, %%ecx \n\t" // ecx: x = offset to
- "movq _LBCarryMask, %%mm5 \n\t" // alignment boundary
-// preload "movl row, %%edi \n\t" // edi: Avg(x)
- "movq _HBClearMask, %%mm4 \n\t"
-// preload "movl prev_row, %%esi \n\t" // esi: Prior(x)
-
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes
- // (correct pos. in loop below)
- "avg_3lp: \n\t"
- "movq (%%edi,%%ecx,), %%mm0 \n\t" // load mm0 with Avg(x)
- "movq %%mm5, %%mm3 \n\t"
- "psrlq _ShiftRem, %%mm2 \n\t" // correct position Raw(x-bpp)
- // data
- "movq (%%esi,%%ecx,), %%mm1 \n\t" // load mm1 with Prior(x)
- "movq %%mm7, %%mm6 \n\t"
- "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte
- "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2
- "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for
- // each byte
- // add 1st active group (Raw(x-bpp)/2) to average with LBCarry
- "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting
- // LBCarrys
- "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte
- // where both
- // lsb's were == 1 (only valid for active group)
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2)
- // for each byte
- "pand %%mm6, %%mm2 \n\t" // leave only Active Group 1
- // bytes to add to Avg
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to
- // Avg for each Active
- // byte
- // add 2nd active group (Raw(x-bpp)/2) to average with _LBCarry
- "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover
- // bytes 3-5
- "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2
- "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly
- "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting
- // LBCarrys
- "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte
- // where both
- // lsb's were == 1 (only valid for active group)
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2)
- // for each byte
- "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2
- // bytes to add to Avg
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to
- // Avg for each Active
- // byte
-
- // add 3rd active group (Raw(x-bpp)/2) to average with _LBCarry
- "psllq _ShiftBpp, %%mm6 \n\t" // shift mm6 mask to cover last
- // two
- // bytes
- "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2
- "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly
- // Data only needs to be shifted once here to
- // get the correct x-bpp offset.
- "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting
- // LBCarrys
- "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte
- // where both
- // lsb's were == 1 (only valid for active group)
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2)
- // for each byte
- "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2
- // bytes to add to Avg
- "addl $8, %%ecx \n\t"
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to
- // Avg for each Active
- // byte
- // now ready to write back to memory
- "movq %%mm0, -8(%%edi,%%ecx,) \n\t"
- // move updated Raw(x) to use as Raw(x-bpp) for next loop
- "cmpl _MMXLength, %%ecx \n\t"
- "movq %%mm0, %%mm2 \n\t" // mov updated Raw(x) to mm2
- "jb avg_3lp \n\t"
-
- : "=S" (dummy_value_S), // output regs (dummy)
- "=D" (dummy_value_D)
-
- : "0" (prev_row), // esi // input regs
- "1" (row) // edi
-
- : "%ecx" // clobber list
-#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3"
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- break; // end 3 bpp
-
- case 6:
- case 4:
- //case 7: // who wrote this? PNG doesn't support 5 or 7 bytes/pixel
- //case 5: // GRR BOGUS
- {
- _ActiveMask.use = 0xffffffffffffffffLL; // use shift below to clear
- // appropriate inactive bytes
- _ShiftBpp.use = bpp << 3;
- _ShiftRem.use = 64 - _ShiftBpp.use;
-
- __asm__ __volatile__ (
- "movq _HBClearMask, %%mm4 \n\t"
-
- // re-init address pointers and offset
- "movl _dif, %%ecx \n\t" // ecx: x = offset to
- // alignment boundary
-
- // load _ActiveMask and clear all bytes except for 1st active group
- "movq _ActiveMask, %%mm7 \n\t"
-// preload "movl row, %%edi \n\t" // edi: Avg(x)
- "psrlq _ShiftRem, %%mm7 \n\t"
-// preload "movl prev_row, %%esi \n\t" // esi: Prior(x)
- "movq %%mm7, %%mm6 \n\t"
- "movq _LBCarryMask, %%mm5 \n\t"
- "psllq _ShiftBpp, %%mm6 \n\t" // create mask for 2nd active
- // group
-
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes
- // (we correct pos. in loop below)
- "avg_4lp: \n\t"
- "movq (%%edi,%%ecx,), %%mm0 \n\t"
- "psrlq _ShiftRem, %%mm2 \n\t" // shift data to pos. correctly
- "movq (%%esi,%%ecx,), %%mm1 \n\t"
- // add (Prev_row/2) to average
- "movq %%mm5, %%mm3 \n\t"
- "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte
- "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2
- "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for
- // each byte
- // add 1st active group (Raw(x-bpp)/2) to average with _LBCarry
- "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting
- // LBCarrys
- "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte
- // where both
- // lsb's were == 1 (only valid for active group)
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2)
- // for each byte
- "pand %%mm7, %%mm2 \n\t" // leave only Active Group 1
- // bytes to add to Avg
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to Avg
- // for each Active
- // byte
- // add 2nd active group (Raw(x-bpp)/2) to average with _LBCarry
- "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2
- "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly
- "addl $8, %%ecx \n\t"
- "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting
- // LBCarrys
- "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte
- // where both
- // lsb's were == 1 (only valid for active group)
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2)
- // for each byte
- "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2
- // bytes to add to Avg
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to
- // Avg for each Active
- // byte
- "cmpl _MMXLength, %%ecx \n\t"
- // now ready to write back to memory
- "movq %%mm0, -8(%%edi,%%ecx,) \n\t"
- // prep Raw(x-bpp) for next loop
- "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2
- "jb avg_4lp \n\t"
-
- : "=S" (dummy_value_S), // output regs (dummy)
- "=D" (dummy_value_D)
-
- : "0" (prev_row), // esi // input regs
- "1" (row) // edi
-
- : "%ecx" // clobber list
-#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3"
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- break; // end 4,6 bpp
-
- case 2:
- {
- _ActiveMask.use = 0x000000000000ffffLL;
- _ShiftBpp.use = 16; // == 2 * 8
- _ShiftRem.use = 48; // == 64 - 16
-
- __asm__ __volatile__ (
- // load _ActiveMask
- "movq _ActiveMask, %%mm7 \n\t"
- // re-init address pointers and offset
- "movl _dif, %%ecx \n\t" // ecx: x = offset to alignment
- // boundary
- "movq _LBCarryMask, %%mm5 \n\t"
-// preload "movl row, %%edi \n\t" // edi: Avg(x)
- "movq _HBClearMask, %%mm4 \n\t"
-// preload "movl prev_row, %%esi \n\t" // esi: Prior(x)
-
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes
- // (we correct pos. in loop below)
- "avg_2lp: \n\t"
- "movq (%%edi,%%ecx,), %%mm0 \n\t"
- "psrlq _ShiftRem, %%mm2 \n\t" // shift data to pos. correctly
- "movq (%%esi,%%ecx,), %%mm1 \n\t" // (GRR BUGFIX: was psllq)
- // add (Prev_row/2) to average
- "movq %%mm5, %%mm3 \n\t"
- "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte
- "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2
- "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each
- // byte
- "movq %%mm7, %%mm6 \n\t"
- "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for
- // each byte
-
- // add 1st active group (Raw(x-bpp)/2) to average with _LBCarry
- "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting
- // LBCarrys
- "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte
- // where both
- // lsb's were == 1 (only valid
- // for active group)
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2)
- // for each byte
- "pand %%mm6, %%mm2 \n\t" // leave only Active Group 1
- // bytes to add to Avg
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to Avg
- // for each Active byte
-
- // add 2nd active group (Raw(x-bpp)/2) to average with _LBCarry
- "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover
- // bytes 2 & 3
- "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2
- "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly
- "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting
- // LBCarrys
- "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte
- // where both
- // lsb's were == 1 (only valid
- // for active group)
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2)
- // for each byte
- "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2
- // bytes to add to Avg
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to
- // Avg for each Active byte
-
- // add 3rd active group (Raw(x-bpp)/2) to average with _LBCarry
- "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover
- // bytes 4 & 5
- "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2
- "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly
- "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting
- // LBCarrys
- "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte
- // where both lsb's were == 1
- // (only valid for active group)
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2)
- // for each byte
- "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2
- // bytes to add to Avg
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to
- // Avg for each Active byte
-
- // add 4th active group (Raw(x-bpp)/2) to average with _LBCarry
- "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover
- // bytes 6 & 7
- "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2
- "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly
- "addl $8, %%ecx \n\t"
- "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting
- // LBCarrys
- "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte
- // where both
- // lsb's were == 1 (only valid
- // for active group)
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2)
- // for each byte
- "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2
- // bytes to add to Avg
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to
- // Avg for each Active byte
-
- "cmpl _MMXLength, %%ecx \n\t"
- // now ready to write back to memory
- "movq %%mm0, -8(%%edi,%%ecx,) \n\t"
- // prep Raw(x-bpp) for next loop
- "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2
- "jb avg_2lp \n\t"
-
- : "=S" (dummy_value_S), // output regs (dummy)
- "=D" (dummy_value_D)
-
- : "0" (prev_row), // esi // input regs
- "1" (row) // edi
-
- : "%ecx" // clobber list
-#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3"
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- break; // end 2 bpp
-
- case 1:
- {
- __asm__ __volatile__ (
- // re-init address pointers and offset
-#ifdef __PIC__
- "pushl %%ebx \n\t" // save Global Offset Table index
-#endif
- "movl _dif, %%ebx \n\t" // ebx: x = offset to alignment
- // boundary
-// preload "movl row, %%edi \n\t" // edi: Avg(x)
- "cmpl _FullLength, %%ebx \n\t" // test if offset at end of array
- "jnb avg_1end \n\t"
- // do Paeth decode for remaining bytes
-// preload "movl prev_row, %%esi \n\t" // esi: Prior(x)
- "movl %%edi, %%edx \n\t"
-// preload "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx)
- "subl %%ecx, %%edx \n\t" // edx: Raw(x-bpp)
- "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx
- // in loop below
- "avg_1lp: \n\t"
- // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2)
- "xorl %%eax, %%eax \n\t"
- "movb (%%esi,%%ebx,), %%cl \n\t" // load cl with Prior(x)
- "movb (%%edx,%%ebx,), %%al \n\t" // load al with Raw(x-bpp)
- "addw %%cx, %%ax \n\t"
- "incl %%ebx \n\t"
- "shrw %%ax \n\t" // divide by 2
- "addb -1(%%edi,%%ebx,), %%al \n\t" // add Avg(x); -1 to offset
- // inc ebx
- "cmpl _FullLength, %%ebx \n\t" // check if at end of array
- "movb %%al, -1(%%edi,%%ebx,) \n\t" // write back Raw(x);
- // mov does not affect flags; -1 to offset inc ebx
- "jb avg_1lp \n\t"
-
- "avg_1end: \n\t"
-#ifdef __PIC__
- "popl %%ebx \n\t" // Global Offset Table index
-#endif
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "0" (bpp), // ecx // input regs
- "1" (prev_row), // esi
- "2" (row) // edi
-
- : "%eax", "%edx" // clobber list
-#ifndef __PIC__
- , "%ebx"
-#endif
- );
- }
- return; // end 1 bpp
-
- case 8:
- {
- __asm__ __volatile__ (
- // re-init address pointers and offset
- "movl _dif, %%ecx \n\t" // ecx: x == offset to alignment
- "movq _LBCarryMask, %%mm5 \n\t" // boundary
-// preload "movl row, %%edi \n\t" // edi: Avg(x)
- "movq _HBClearMask, %%mm4 \n\t"
-// preload "movl prev_row, %%esi \n\t" // esi: Prior(x)
-
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes
- // (NO NEED to correct pos. in loop below)
-
- "avg_8lp: \n\t"
- "movq (%%edi,%%ecx,), %%mm0 \n\t"
- "movq %%mm5, %%mm3 \n\t"
- "movq (%%esi,%%ecx,), %%mm1 \n\t"
- "addl $8, %%ecx \n\t"
- "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte
- "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2
- "pand %%mm2, %%mm3 \n\t" // get LBCarrys for each byte
- // where both lsb's were == 1
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7, each byte
- "paddb %%mm3, %%mm0 \n\t" // add LBCarrys to Avg, each byte
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7, each byte
- "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg, each
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) to Avg for each
- "cmpl _MMXLength, %%ecx \n\t"
- "movq %%mm0, -8(%%edi,%%ecx,) \n\t"
- "movq %%mm0, %%mm2 \n\t" // reuse as Raw(x-bpp)
- "jb avg_8lp \n\t"
-
- : "=S" (dummy_value_S), // output regs (dummy)
- "=D" (dummy_value_D)
-
- : "0" (prev_row), // esi // input regs
- "1" (row) // edi
-
- : "%ecx" // clobber list
-#if 0 /* %mm0, ..., %mm5 not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2"
- , "%mm3", "%mm4", "%mm5"
-#endif
- );
- }
- break; // end 8 bpp
-
- default: // bpp greater than 8 (!= 1,2,3,4,[5],6,[7],8)
- {
-
-#ifdef PNG_DEBUG
- // GRR: PRINT ERROR HERE: SHOULD NEVER BE REACHED
- png_debug(1,
- "Internal logic error in pnggccrd (png_read_filter_row_mmx_avg())\n");
-#endif
-
-#if 0
- __asm__ __volatile__ (
- "movq _LBCarryMask, %%mm5 \n\t"
- // re-init address pointers and offset
- "movl _dif, %%ebx \n\t" // ebx: x = offset to
- // alignment boundary
- "movl row, %%edi \n\t" // edi: Avg(x)
- "movq _HBClearMask, %%mm4 \n\t"
- "movl %%edi, %%edx \n\t"
- "movl prev_row, %%esi \n\t" // esi: Prior(x)
- "subl bpp, %%edx \n\t" // edx: Raw(x-bpp)
- "avg_Alp: \n\t"
- "movq (%%edi,%%ebx,), %%mm0 \n\t"
- "movq %%mm5, %%mm3 \n\t"
- "movq (%%esi,%%ebx,), %%mm1 \n\t"
- "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte
- "movq (%%edx,%%ebx,), %%mm2 \n\t"
- "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2
- "pand %%mm2, %%mm3 \n\t" // get LBCarrys for each byte
- // where both lsb's were == 1
- "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2
- "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm3, %%mm0 \n\t" // add LBCarrys to Avg for each
- // byte
- "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each
- // byte
- "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for
- // each byte
- "addl $8, %%ebx \n\t"
- "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) to Avg for each
- // byte
- "cmpl _MMXLength, %%ebx \n\t"
- "movq %%mm0, -8(%%edi,%%ebx,) \n\t"
- "jb avg_Alp \n\t"
-
- : // FIXASM: output regs/vars go here, e.g.: "=m" (memory_var)
-
- : // FIXASM: input regs, e.g.: "c" (count), "S" (src), "D" (dest)
-
- : "%ebx", "%edx", "%edi", "%esi" // CHECKASM: clobber list
- );
-#endif /* 0 - NEVER REACHED */
- }
- break;
-
- } // end switch (bpp)
-
- __asm__ __volatile__ (
- // MMX acceleration complete; now do clean-up
- // check if any remaining bytes left to decode
-#ifdef __PIC__
- "pushl %%ebx \n\t" // save index to Global Offset Table
-#endif
- "movl _MMXLength, %%ebx \n\t" // ebx: x == offset bytes after MMX
-//pre "movl row, %%edi \n\t" // edi: Avg(x)
- "cmpl _FullLength, %%ebx \n\t" // test if offset at end of array
- "jnb avg_end \n\t"
-
- // do Avg decode for remaining bytes
-//pre "movl prev_row, %%esi \n\t" // esi: Prior(x)
- "movl %%edi, %%edx \n\t"
-//pre "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx)
- "subl %%ecx, %%edx \n\t" // edx: Raw(x-bpp)
- "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx below
-
- "avg_lp2: \n\t"
- // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2)
- "xorl %%eax, %%eax \n\t"
- "movb (%%esi,%%ebx,), %%cl \n\t" // load cl with Prior(x)
- "movb (%%edx,%%ebx,), %%al \n\t" // load al with Raw(x-bpp)
- "addw %%cx, %%ax \n\t"
- "incl %%ebx \n\t"
- "shrw %%ax \n\t" // divide by 2
- "addb -1(%%edi,%%ebx,), %%al \n\t" // add Avg(x); -1 to offset inc ebx
- "cmpl _FullLength, %%ebx \n\t" // check if at end of array
- "movb %%al, -1(%%edi,%%ebx,) \n\t" // write back Raw(x) [mov does not
- "jb avg_lp2 \n\t" // affect flags; -1 to offset inc ebx]
-
- "avg_end: \n\t"
- "EMMS \n\t" // end MMX; prep for poss. FP instrs.
-#ifdef __PIC__
- "popl %%ebx \n\t" // restore index to Global Offset Table
-#endif
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "0" (bpp), // ecx // input regs
- "1" (prev_row), // esi
- "2" (row) // edi
-
- : "%eax", "%edx" // clobber list
-#ifndef __PIC__
- , "%ebx"
-#endif
- );
-
-} /* end png_read_filter_row_mmx_avg() */
-#endif
-
-
-
-#ifdef PNG_THREAD_UNSAFE_OK
-//===========================================================================//
-// //
-// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ P A E T H //
-// //
-//===========================================================================//
-
-// Optimized code for PNG Paeth filter decoder
-
-static void /* PRIVATE */
-png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
- png_bytep prev_row)
-{
- int bpp;
- int dummy_value_c; // fix 'forbidden register 2 (cx) was spilled' error
- int dummy_value_S;
- int dummy_value_D;
-
- bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel
- _FullLength = row_info->rowbytes; // # of bytes to filter
-
- __asm__ __volatile__ (
-#ifdef __PIC__
- "pushl %%ebx \n\t" // save index to Global Offset Table
-#endif
- "xorl %%ebx, %%ebx \n\t" // ebx: x offset
-//pre "movl row, %%edi \n\t"
- "xorl %%edx, %%edx \n\t" // edx: x-bpp offset
-//pre "movl prev_row, %%esi \n\t"
- "xorl %%eax, %%eax \n\t"
-
- // Compute the Raw value for the first bpp bytes
- // Note: the formula works out to be always
- // Paeth(x) = Raw(x) + Prior(x) where x < bpp
- "paeth_rlp: \n\t"
- "movb (%%edi,%%ebx,), %%al \n\t"
- "addb (%%esi,%%ebx,), %%al \n\t"
- "incl %%ebx \n\t"
-//pre "cmpl bpp, %%ebx \n\t" (bpp is preloaded into ecx)
- "cmpl %%ecx, %%ebx \n\t"
- "movb %%al, -1(%%edi,%%ebx,) \n\t"
- "jb paeth_rlp \n\t"
- // get # of bytes to alignment
- "movl %%edi, _dif \n\t" // take start of row
- "addl %%ebx, _dif \n\t" // add bpp
- "xorl %%ecx, %%ecx \n\t"
- "addl $0xf, _dif \n\t" // add 7 + 8 to incr past alignment
- // boundary
- "andl $0xfffffff8, _dif \n\t" // mask to alignment boundary
- "subl %%edi, _dif \n\t" // subtract from start ==> value ebx
- // at alignment
- "jz paeth_go \n\t"
- // fix alignment
-
- "paeth_lp1: \n\t"
- "xorl %%eax, %%eax \n\t"
- // pav = p - a = (a + b - c) - a = b - c
- "movb (%%esi,%%ebx,), %%al \n\t" // load Prior(x) into al
- "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl
- "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp)
- "movl %%eax, _patemp \n\t" // Save pav for later use
- "xorl %%eax, %%eax \n\t"
- // pbv = p - b = (a + b - c) - b = a - c
- "movb (%%edi,%%edx,), %%al \n\t" // load Raw(x-bpp) into al
- "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp)
- "movl %%eax, %%ecx \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "addl _patemp, %%eax \n\t" // pcv = pav + pbv
- // pc = abs(pcv)
- "testl $0x80000000, %%eax \n\t"
- "jz paeth_pca \n\t"
- "negl %%eax \n\t" // reverse sign of neg values
-
- "paeth_pca: \n\t"
- "movl %%eax, _pctemp \n\t" // save pc for later use
- // pb = abs(pbv)
- "testl $0x80000000, %%ecx \n\t"
- "jz paeth_pba \n\t"
- "negl %%ecx \n\t" // reverse sign of neg values
-
- "paeth_pba: \n\t"
- "movl %%ecx, _pbtemp \n\t" // save pb for later use
- // pa = abs(pav)
- "movl _patemp, %%eax \n\t"
- "testl $0x80000000, %%eax \n\t"
- "jz paeth_paa \n\t"
- "negl %%eax \n\t" // reverse sign of neg values
-
- "paeth_paa: \n\t"
- "movl %%eax, _patemp \n\t" // save pa for later use
- // test if pa <= pb
- "cmpl %%ecx, %%eax \n\t"
- "jna paeth_abb \n\t"
- // pa > pb; now test if pb <= pc
- "cmpl _pctemp, %%ecx \n\t"
- "jna paeth_bbc \n\t"
- // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl
- "jmp paeth_paeth \n\t"
-
- "paeth_bbc: \n\t"
- // pb <= pc; Raw(x) = Paeth(x) + Prior(x)
- "movb (%%esi,%%ebx,), %%cl \n\t" // load Prior(x) into cl
- "jmp paeth_paeth \n\t"
-
- "paeth_abb: \n\t"
- // pa <= pb; now test if pa <= pc
- "cmpl _pctemp, %%eax \n\t"
- "jna paeth_abc \n\t"
- // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl
- "jmp paeth_paeth \n\t"
-
- "paeth_abc: \n\t"
- // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp)
- "movb (%%edi,%%edx,), %%cl \n\t" // load Raw(x-bpp) into cl
-
- "paeth_paeth: \n\t"
- "incl %%ebx \n\t"
- "incl %%edx \n\t"
- // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256
- "addb %%cl, -1(%%edi,%%ebx,) \n\t"
- "cmpl _dif, %%ebx \n\t"
- "jb paeth_lp1 \n\t"
-
- "paeth_go: \n\t"
- "movl _FullLength, %%ecx \n\t"
- "movl %%ecx, %%eax \n\t"
- "subl %%ebx, %%eax \n\t" // subtract alignment fix
- "andl $0x00000007, %%eax \n\t" // calc bytes over mult of 8
- "subl %%eax, %%ecx \n\t" // drop over bytes from original length
- "movl %%ecx, _MMXLength \n\t"
-#ifdef __PIC__
- "popl %%ebx \n\t" // restore index to Global Offset Table
-#endif
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "0" (bpp), // ecx // input regs
- "1" (prev_row), // esi
- "2" (row) // edi
-
- : "%eax", "%edx" // clobber list
-#ifndef __PIC__
- , "%ebx"
-#endif
- );
-
- // now do the math for the rest of the row
- switch (bpp)
- {
- case 3:
- {
- _ActiveMask.use = 0x0000000000ffffffLL;
- _ActiveMaskEnd.use = 0xffff000000000000LL;
- _ShiftBpp.use = 24; // == bpp(3) * 8
- _ShiftRem.use = 40; // == 64 - 24
-
- __asm__ __volatile__ (
- "movl _dif, %%ecx \n\t"
-// preload "movl row, %%edi \n\t"
-// preload "movl prev_row, %%esi \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%ecx,), %%mm1 \n\t"
- "paeth_3lp: \n\t"
- "psrlq _ShiftRem, %%mm1 \n\t" // shift last 3 bytes to 1st
- // 3 bytes
- "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x)
- "punpcklbw %%mm0, %%mm1 \n\t" // unpack High bytes of a
- "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // prep c=Prior(x-bpp) bytes
- "punpcklbw %%mm0, %%mm2 \n\t" // unpack High bytes of b
- "psrlq _ShiftRem, %%mm3 \n\t" // shift last 3 bytes to 1st
- // 3 bytes
- // pav = p - a = (a + b - c) - a = b - c
- "movq %%mm2, %%mm4 \n\t"
- "punpcklbw %%mm0, %%mm3 \n\t" // unpack High bytes of c
- // pbv = p - b = (a + b - c) - b = a - c
- "movq %%mm1, %%mm5 \n\t"
- "psubw %%mm3, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "movq %%mm4, %%mm6 \n\t"
- "psubw %%mm3, %%mm5 \n\t"
-
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0
- "paddw %%mm5, %%mm6 \n\t"
- "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0
- "psubw %%mm0, %%mm4 \n\t"
- "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0
- "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm7, %%mm5 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- // test pa <= pb
- "movq %%mm4, %%mm7 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb?
- "movq %%mm7, %%mm0 \n\t"
- // use mm7 mask to merge pa & pb
- "pand %%mm7, %%mm5 \n\t"
- // use mm0 mask copy to merge a & b
- "pand %%mm0, %%mm2 \n\t"
- "pandn %%mm4, %%mm7 \n\t"
- "pandn %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm7 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- // test ((pa <= pb)? pa:pb) <= pc
- "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc?
- "pxor %%mm1, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "pandn %%mm0, %%mm7 \n\t"
- "paddw %%mm3, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "packuswb %%mm1, %%mm7 \n\t"
- "movq (%%esi,%%ecx,), %%mm3 \n\t" // load c=Prior(x-bpp)
- "pand _ActiveMask, %%mm7 \n\t"
- "movq %%mm3, %%mm2 \n\t" // load b=Prior(x) step 1
- "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x)
- "punpcklbw %%mm0, %%mm3 \n\t" // unpack High bytes of c
- "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value
- "movq %%mm7, %%mm1 \n\t" // now mm1 will be used as
- // Raw(x-bpp)
- // now do Paeth for 2nd set of bytes (3-5)
- "psrlq _ShiftBpp, %%mm2 \n\t" // load b=Prior(x) step 2
- "punpcklbw %%mm0, %%mm1 \n\t" // unpack High bytes of a
- "pxor %%mm7, %%mm7 \n\t"
- "punpcklbw %%mm0, %%mm2 \n\t" // unpack High bytes of b
- // pbv = p - b = (a + b - c) - b = a - c
- "movq %%mm1, %%mm5 \n\t"
- // pav = p - a = (a + b - c) - a = b - c
- "movq %%mm2, %%mm4 \n\t"
- "psubw %%mm3, %%mm5 \n\t"
- "psubw %%mm3, %%mm4 \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) =
- // pav + pbv = pbv + pav
- "movq %%mm5, %%mm6 \n\t"
- "paddw %%mm4, %%mm6 \n\t"
-
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- "pcmpgtw %%mm5, %%mm0 \n\t" // create mask pbv bytes < 0
- "pcmpgtw %%mm4, %%mm7 \n\t" // create mask pav bytes < 0
- "pand %%mm5, %%mm0 \n\t" // only pbv bytes < 0 in mm0
- "pand %%mm4, %%mm7 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm0, %%mm5 \n\t"
- "psubw %%mm7, %%mm4 \n\t"
- "psubw %%mm0, %%mm5 \n\t"
- "psubw %%mm7, %%mm4 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0
- "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm0, %%mm6 \n\t"
- // test pa <= pb
- "movq %%mm4, %%mm7 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb?
- "movq %%mm7, %%mm0 \n\t"
- // use mm7 mask to merge pa & pb
- "pand %%mm7, %%mm5 \n\t"
- // use mm0 mask copy to merge a & b
- "pand %%mm0, %%mm2 \n\t"
- "pandn %%mm4, %%mm7 \n\t"
- "pandn %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm7 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- // test ((pa <= pb)? pa:pb) <= pc
- "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc?
- "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x)
- "pand %%mm7, %%mm3 \n\t"
- "pandn %%mm0, %%mm7 \n\t"
- "pxor %%mm1, %%mm1 \n\t"
- "paddw %%mm3, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "packuswb %%mm1, %%mm7 \n\t"
- "movq %%mm2, %%mm3 \n\t" // load c=Prior(x-bpp) step 1
- "pand _ActiveMask, %%mm7 \n\t"
- "punpckhbw %%mm0, %%mm2 \n\t" // unpack High bytes of b
- "psllq _ShiftBpp, %%mm7 \n\t" // shift bytes to 2nd group of
- // 3 bytes
- // pav = p - a = (a + b - c) - a = b - c
- "movq %%mm2, %%mm4 \n\t"
- "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x)
- "psllq _ShiftBpp, %%mm3 \n\t" // load c=Prior(x-bpp) step 2
- "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value
- "movq %%mm7, %%mm1 \n\t"
- "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c
- "psllq _ShiftBpp, %%mm1 \n\t" // shift bytes
- // now mm1 will be used as Raw(x-bpp)
- // now do Paeth for 3rd, and final, set of bytes (6-7)
- "pxor %%mm7, %%mm7 \n\t"
- "punpckhbw %%mm0, %%mm1 \n\t" // unpack High bytes of a
- "psubw %%mm3, %%mm4 \n\t"
- // pbv = p - b = (a + b - c) - b = a - c
- "movq %%mm1, %%mm5 \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "movq %%mm4, %%mm6 \n\t"
- "psubw %%mm3, %%mm5 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "paddw %%mm5, %%mm6 \n\t"
-
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0
- "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0
- "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0
- "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm0, %%mm6 \n\t"
- // test pa <= pb
- "movq %%mm4, %%mm7 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb?
- "movq %%mm7, %%mm0 \n\t"
- // use mm0 mask copy to merge a & b
- "pand %%mm0, %%mm2 \n\t"
- // use mm7 mask to merge pa & pb
- "pand %%mm7, %%mm5 \n\t"
- "pandn %%mm1, %%mm0 \n\t"
- "pandn %%mm4, %%mm7 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- "paddw %%mm5, %%mm7 \n\t"
- // test ((pa <= pb)? pa:pb) <= pc
- "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc?
- "pand %%mm7, %%mm3 \n\t"
- "pandn %%mm0, %%mm7 \n\t"
- "paddw %%mm3, %%mm7 \n\t"
- "pxor %%mm1, %%mm1 \n\t"
- "packuswb %%mm7, %%mm1 \n\t"
- // step ecx to next set of 8 bytes and repeat loop til done
- "addl $8, %%ecx \n\t"
- "pand _ActiveMaskEnd, %%mm1 \n\t"
- "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add Paeth predictor with
- // Raw(x)
-
- "cmpl _MMXLength, %%ecx \n\t"
- "pxor %%mm0, %%mm0 \n\t" // pxor does not affect flags
- "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value
- // mm1 will be used as Raw(x-bpp) next loop
- // mm3 ready to be used as Prior(x-bpp) next loop
- "jb paeth_3lp \n\t"
-
- : "=S" (dummy_value_S), // output regs (dummy)
- "=D" (dummy_value_D)
-
- : "0" (prev_row), // esi // input regs
- "1" (row) // edi
-
- : "%ecx" // clobber list
-#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3"
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- break; // end 3 bpp
-
- case 6:
- //case 7: // GRR BOGUS
- //case 5: // GRR BOGUS
- {
- _ActiveMask.use = 0x00000000ffffffffLL;
- _ActiveMask2.use = 0xffffffff00000000LL;
- _ShiftBpp.use = bpp << 3; // == bpp * 8
- _ShiftRem.use = 64 - _ShiftBpp.use;
-
- __asm__ __volatile__ (
- "movl _dif, %%ecx \n\t"
-// preload "movl row, %%edi \n\t"
-// preload "movl prev_row, %%esi \n\t"
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%ecx,), %%mm1 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
-
- "paeth_6lp: \n\t"
- // must shift to position Raw(x-bpp) data
- "psrlq _ShiftRem, %%mm1 \n\t"
- // do first set of 4 bytes
- "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes
- "punpcklbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a
- "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x)
- "punpcklbw %%mm0, %%mm2 \n\t" // unpack Low bytes of b
- // must shift to position Prior(x-bpp) data
- "psrlq _ShiftRem, %%mm3 \n\t"
- // pav = p - a = (a + b - c) - a = b - c
- "movq %%mm2, %%mm4 \n\t"
- "punpcklbw %%mm0, %%mm3 \n\t" // unpack Low bytes of c
- // pbv = p - b = (a + b - c) - b = a - c
- "movq %%mm1, %%mm5 \n\t"
- "psubw %%mm3, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "movq %%mm4, %%mm6 \n\t"
- "psubw %%mm3, %%mm5 \n\t"
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0
- "paddw %%mm5, %%mm6 \n\t"
- "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0
- "psubw %%mm0, %%mm4 \n\t"
- "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0
- "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm7, %%mm5 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- // test pa <= pb
- "movq %%mm4, %%mm7 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb?
- "movq %%mm7, %%mm0 \n\t"
- // use mm7 mask to merge pa & pb
- "pand %%mm7, %%mm5 \n\t"
- // use mm0 mask copy to merge a & b
- "pand %%mm0, %%mm2 \n\t"
- "pandn %%mm4, %%mm7 \n\t"
- "pandn %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm7 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- // test ((pa <= pb)? pa:pb) <= pc
- "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc?
- "pxor %%mm1, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "pandn %%mm0, %%mm7 \n\t"
- "paddw %%mm3, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "packuswb %%mm1, %%mm7 \n\t"
- "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // load c=Prior(x-bpp)
- "pand _ActiveMask, %%mm7 \n\t"
- "psrlq _ShiftRem, %%mm3 \n\t"
- "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) step 1
- "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor and Raw(x)
- "movq %%mm2, %%mm6 \n\t"
- "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value
- "movq -8(%%edi,%%ecx,), %%mm1 \n\t"
- "psllq _ShiftBpp, %%mm6 \n\t"
- "movq %%mm7, %%mm5 \n\t"
- "psrlq _ShiftRem, %%mm1 \n\t"
- "por %%mm6, %%mm3 \n\t"
- "psllq _ShiftBpp, %%mm5 \n\t"
- "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c
- "por %%mm5, %%mm1 \n\t"
- // do second set of 4 bytes
- "punpckhbw %%mm0, %%mm2 \n\t" // unpack High bytes of b
- "punpckhbw %%mm0, %%mm1 \n\t" // unpack High bytes of a
- // pav = p - a = (a + b - c) - a = b - c
- "movq %%mm2, %%mm4 \n\t"
- // pbv = p - b = (a + b - c) - b = a - c
- "movq %%mm1, %%mm5 \n\t"
- "psubw %%mm3, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "movq %%mm4, %%mm6 \n\t"
- "psubw %%mm3, %%mm5 \n\t"
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0
- "paddw %%mm5, %%mm6 \n\t"
- "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0
- "psubw %%mm0, %%mm4 \n\t"
- "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0
- "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm7, %%mm5 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- // test pa <= pb
- "movq %%mm4, %%mm7 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb?
- "movq %%mm7, %%mm0 \n\t"
- // use mm7 mask to merge pa & pb
- "pand %%mm7, %%mm5 \n\t"
- // use mm0 mask copy to merge a & b
- "pand %%mm0, %%mm2 \n\t"
- "pandn %%mm4, %%mm7 \n\t"
- "pandn %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm7 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- // test ((pa <= pb)? pa:pb) <= pc
- "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc?
- "pxor %%mm1, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "pandn %%mm0, %%mm7 \n\t"
- "pxor %%mm1, %%mm1 \n\t"
- "paddw %%mm3, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- // step ecx to next set of 8 bytes and repeat loop til done
- "addl $8, %%ecx \n\t"
- "packuswb %%mm7, %%mm1 \n\t"
- "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add Paeth predictor with Raw(x)
- "cmpl _MMXLength, %%ecx \n\t"
- "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value
- // mm1 will be used as Raw(x-bpp) next loop
- "jb paeth_6lp \n\t"
-
- : "=S" (dummy_value_S), // output regs (dummy)
- "=D" (dummy_value_D)
-
- : "0" (prev_row), // esi // input regs
- "1" (row) // edi
-
- : "%ecx" // clobber list
-#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3"
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- break; // end 6 bpp
-
- case 4:
- {
- _ActiveMask.use = 0x00000000ffffffffLL;
-
- __asm__ __volatile__ (
- "movl _dif, %%ecx \n\t"
-// preload "movl row, %%edi \n\t"
-// preload "movl prev_row, %%esi \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%ecx,), %%mm1 \n\t" // only time should need to read
- // a=Raw(x-bpp) bytes
- "paeth_4lp: \n\t"
- // do first set of 4 bytes
- "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes
- "punpckhbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a
- "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x)
- "punpcklbw %%mm0, %%mm2 \n\t" // unpack High bytes of b
- // pav = p - a = (a + b - c) - a = b - c
- "movq %%mm2, %%mm4 \n\t"
- "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c
- // pbv = p - b = (a + b - c) - b = a - c
- "movq %%mm1, %%mm5 \n\t"
- "psubw %%mm3, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "movq %%mm4, %%mm6 \n\t"
- "psubw %%mm3, %%mm5 \n\t"
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0
- "paddw %%mm5, %%mm6 \n\t"
- "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0
- "psubw %%mm0, %%mm4 \n\t"
- "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0
- "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm7, %%mm5 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- // test pa <= pb
- "movq %%mm4, %%mm7 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb?
- "movq %%mm7, %%mm0 \n\t"
- // use mm7 mask to merge pa & pb
- "pand %%mm7, %%mm5 \n\t"
- // use mm0 mask copy to merge a & b
- "pand %%mm0, %%mm2 \n\t"
- "pandn %%mm4, %%mm7 \n\t"
- "pandn %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm7 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- // test ((pa <= pb)? pa:pb) <= pc
- "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc?
- "pxor %%mm1, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "pandn %%mm0, %%mm7 \n\t"
- "paddw %%mm3, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "packuswb %%mm1, %%mm7 \n\t"
- "movq (%%esi,%%ecx,), %%mm3 \n\t" // load c=Prior(x-bpp)
- "pand _ActiveMask, %%mm7 \n\t"
- "movq %%mm3, %%mm2 \n\t" // load b=Prior(x) step 1
- "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x)
- "punpcklbw %%mm0, %%mm3 \n\t" // unpack High bytes of c
- "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value
- "movq %%mm7, %%mm1 \n\t" // now mm1 will be used as Raw(x-bpp)
- // do second set of 4 bytes
- "punpckhbw %%mm0, %%mm2 \n\t" // unpack Low bytes of b
- "punpcklbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a
- // pav = p - a = (a + b - c) - a = b - c
- "movq %%mm2, %%mm4 \n\t"
- // pbv = p - b = (a + b - c) - b = a - c
- "movq %%mm1, %%mm5 \n\t"
- "psubw %%mm3, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "movq %%mm4, %%mm6 \n\t"
- "psubw %%mm3, %%mm5 \n\t"
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0
- "paddw %%mm5, %%mm6 \n\t"
- "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0
- "psubw %%mm0, %%mm4 \n\t"
- "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0
- "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm7, %%mm5 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- // test pa <= pb
- "movq %%mm4, %%mm7 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb?
- "movq %%mm7, %%mm0 \n\t"
- // use mm7 mask to merge pa & pb
- "pand %%mm7, %%mm5 \n\t"
- // use mm0 mask copy to merge a & b
- "pand %%mm0, %%mm2 \n\t"
- "pandn %%mm4, %%mm7 \n\t"
- "pandn %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm7 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- // test ((pa <= pb)? pa:pb) <= pc
- "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc?
- "pxor %%mm1, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "pandn %%mm0, %%mm7 \n\t"
- "pxor %%mm1, %%mm1 \n\t"
- "paddw %%mm3, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- // step ecx to next set of 8 bytes and repeat loop til done
- "addl $8, %%ecx \n\t"
- "packuswb %%mm7, %%mm1 \n\t"
- "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add predictor with Raw(x)
- "cmpl _MMXLength, %%ecx \n\t"
- "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value
- // mm1 will be used as Raw(x-bpp) next loop
- "jb paeth_4lp \n\t"
-
- : "=S" (dummy_value_S), // output regs (dummy)
- "=D" (dummy_value_D)
-
- : "0" (prev_row), // esi // input regs
- "1" (row) // edi
-
- : "%ecx" // clobber list
-#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3"
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- break; // end 4 bpp
-
- case 8: // bpp == 8
- {
- _ActiveMask.use = 0x00000000ffffffffLL;
-
- __asm__ __volatile__ (
- "movl _dif, %%ecx \n\t"
-// preload "movl row, %%edi \n\t"
-// preload "movl prev_row, %%esi \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%ecx,), %%mm1 \n\t" // only time should need to read
- // a=Raw(x-bpp) bytes
- "paeth_8lp: \n\t"
- // do first set of 4 bytes
- "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes
- "punpcklbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a
- "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x)
- "punpcklbw %%mm0, %%mm2 \n\t" // unpack Low bytes of b
- // pav = p - a = (a + b - c) - a = b - c
- "movq %%mm2, %%mm4 \n\t"
- "punpcklbw %%mm0, %%mm3 \n\t" // unpack Low bytes of c
- // pbv = p - b = (a + b - c) - b = a - c
- "movq %%mm1, %%mm5 \n\t"
- "psubw %%mm3, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "movq %%mm4, %%mm6 \n\t"
- "psubw %%mm3, %%mm5 \n\t"
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0
- "paddw %%mm5, %%mm6 \n\t"
- "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0
- "psubw %%mm0, %%mm4 \n\t"
- "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0
- "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm7, %%mm5 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- // test pa <= pb
- "movq %%mm4, %%mm7 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb?
- "movq %%mm7, %%mm0 \n\t"
- // use mm7 mask to merge pa & pb
- "pand %%mm7, %%mm5 \n\t"
- // use mm0 mask copy to merge a & b
- "pand %%mm0, %%mm2 \n\t"
- "pandn %%mm4, %%mm7 \n\t"
- "pandn %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm7 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- // test ((pa <= pb)? pa:pb) <= pc
- "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc?
- "pxor %%mm1, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "pandn %%mm0, %%mm7 \n\t"
- "paddw %%mm3, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "packuswb %%mm1, %%mm7 \n\t"
- "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes
- "pand _ActiveMask, %%mm7 \n\t"
- "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x)
- "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x)
- "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c
- "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value
- "movq -8(%%edi,%%ecx,), %%mm1 \n\t" // read a=Raw(x-bpp) bytes
-
- // do second set of 4 bytes
- "punpckhbw %%mm0, %%mm2 \n\t" // unpack High bytes of b
- "punpckhbw %%mm0, %%mm1 \n\t" // unpack High bytes of a
- // pav = p - a = (a + b - c) - a = b - c
- "movq %%mm2, %%mm4 \n\t"
- // pbv = p - b = (a + b - c) - b = a - c
- "movq %%mm1, %%mm5 \n\t"
- "psubw %%mm3, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "movq %%mm4, %%mm6 \n\t"
- "psubw %%mm3, %%mm5 \n\t"
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0
- "paddw %%mm5, %%mm6 \n\t"
- "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0
- "psubw %%mm0, %%mm4 \n\t"
- "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0
- "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7
- "psubw %%mm7, %%mm5 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- // test pa <= pb
- "movq %%mm4, %%mm7 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
- "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb?
- "movq %%mm7, %%mm0 \n\t"
- // use mm7 mask to merge pa & pb
- "pand %%mm7, %%mm5 \n\t"
- // use mm0 mask copy to merge a & b
- "pand %%mm0, %%mm2 \n\t"
- "pandn %%mm4, %%mm7 \n\t"
- "pandn %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm7 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- // test ((pa <= pb)? pa:pb) <= pc
- "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc?
- "pxor %%mm1, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "pandn %%mm0, %%mm7 \n\t"
- "pxor %%mm1, %%mm1 \n\t"
- "paddw %%mm3, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- // step ecx to next set of 8 bytes and repeat loop til done
- "addl $8, %%ecx \n\t"
- "packuswb %%mm7, %%mm1 \n\t"
- "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add Paeth predictor with Raw(x)
- "cmpl _MMXLength, %%ecx \n\t"
- "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value
- // mm1 will be used as Raw(x-bpp) next loop
- "jb paeth_8lp \n\t"
-
- : "=S" (dummy_value_S), // output regs (dummy)
- "=D" (dummy_value_D)
-
- : "0" (prev_row), // esi // input regs
- "1" (row) // edi
-
- : "%ecx" // clobber list
-#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3"
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- break; // end 8 bpp
-
- case 1: // bpp = 1
- case 2: // bpp = 2
- default: // bpp > 8
- {
- __asm__ __volatile__ (
-#ifdef __PIC__
- "pushl %%ebx \n\t" // save Global Offset Table index
-#endif
- "movl _dif, %%ebx \n\t"
- "cmpl _FullLength, %%ebx \n\t"
- "jnb paeth_dend \n\t"
-
-// preload "movl row, %%edi \n\t"
-// preload "movl prev_row, %%esi \n\t"
- // do Paeth decode for remaining bytes
- "movl %%ebx, %%edx \n\t"
-// preload "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx)
- "subl %%ecx, %%edx \n\t" // edx = ebx - bpp
- "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx
-
- "paeth_dlp: \n\t"
- "xorl %%eax, %%eax \n\t"
- // pav = p - a = (a + b - c) - a = b - c
- "movb (%%esi,%%ebx,), %%al \n\t" // load Prior(x) into al
- "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl
- "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp)
- "movl %%eax, _patemp \n\t" // Save pav for later use
- "xorl %%eax, %%eax \n\t"
- // pbv = p - b = (a + b - c) - b = a - c
- "movb (%%edi,%%edx,), %%al \n\t" // load Raw(x-bpp) into al
- "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp)
- "movl %%eax, %%ecx \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "addl _patemp, %%eax \n\t" // pcv = pav + pbv
- // pc = abs(pcv)
- "testl $0x80000000, %%eax \n\t"
- "jz paeth_dpca \n\t"
- "negl %%eax \n\t" // reverse sign of neg values
-
- "paeth_dpca: \n\t"
- "movl %%eax, _pctemp \n\t" // save pc for later use
- // pb = abs(pbv)
- "testl $0x80000000, %%ecx \n\t"
- "jz paeth_dpba \n\t"
- "negl %%ecx \n\t" // reverse sign of neg values
-
- "paeth_dpba: \n\t"
- "movl %%ecx, _pbtemp \n\t" // save pb for later use
- // pa = abs(pav)
- "movl _patemp, %%eax \n\t"
- "testl $0x80000000, %%eax \n\t"
- "jz paeth_dpaa \n\t"
- "negl %%eax \n\t" // reverse sign of neg values
-
- "paeth_dpaa: \n\t"
- "movl %%eax, _patemp \n\t" // save pa for later use
- // test if pa <= pb
- "cmpl %%ecx, %%eax \n\t"
- "jna paeth_dabb \n\t"
- // pa > pb; now test if pb <= pc
- "cmpl _pctemp, %%ecx \n\t"
- "jna paeth_dbbc \n\t"
- // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl
- "jmp paeth_dpaeth \n\t"
-
- "paeth_dbbc: \n\t"
- // pb <= pc; Raw(x) = Paeth(x) + Prior(x)
- "movb (%%esi,%%ebx,), %%cl \n\t" // load Prior(x) into cl
- "jmp paeth_dpaeth \n\t"
-
- "paeth_dabb: \n\t"
- // pa <= pb; now test if pa <= pc
- "cmpl _pctemp, %%eax \n\t"
- "jna paeth_dabc \n\t"
- // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl
- "jmp paeth_dpaeth \n\t"
-
- "paeth_dabc: \n\t"
- // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp)
- "movb (%%edi,%%edx,), %%cl \n\t" // load Raw(x-bpp) into cl
-
- "paeth_dpaeth: \n\t"
- "incl %%ebx \n\t"
- "incl %%edx \n\t"
- // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256
- "addb %%cl, -1(%%edi,%%ebx,) \n\t"
- "cmpl _FullLength, %%ebx \n\t"
- "jb paeth_dlp \n\t"
-
- "paeth_dend: \n\t"
-#ifdef __PIC__
- "popl %%ebx \n\t" // index to Global Offset Table
-#endif
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "0" (bpp), // ecx // input regs
- "1" (prev_row), // esi
- "2" (row) // edi
-
- : "%eax", "%edx" // clobber list
-#ifndef __PIC__
- , "%ebx"
-#endif
- );
- }
- return; // No need to go further with this one
-
- } // end switch (bpp)
-
- __asm__ __volatile__ (
- // MMX acceleration complete; now do clean-up
- // check if any remaining bytes left to decode
-#ifdef __PIC__
- "pushl %%ebx \n\t" // save index to Global Offset Table
-#endif
- "movl _MMXLength, %%ebx \n\t"
- "cmpl _FullLength, %%ebx \n\t"
- "jnb paeth_end \n\t"
-//pre "movl row, %%edi \n\t"
-//pre "movl prev_row, %%esi \n\t"
- // do Paeth decode for remaining bytes
- "movl %%ebx, %%edx \n\t"
-//pre "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx)
- "subl %%ecx, %%edx \n\t" // edx = ebx - bpp
- "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx below
-
- "paeth_lp2: \n\t"
- "xorl %%eax, %%eax \n\t"
- // pav = p - a = (a + b - c) - a = b - c
- "movb (%%esi,%%ebx,), %%al \n\t" // load Prior(x) into al
- "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl
- "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp)
- "movl %%eax, _patemp \n\t" // Save pav for later use
- "xorl %%eax, %%eax \n\t"
- // pbv = p - b = (a + b - c) - b = a - c
- "movb (%%edi,%%edx,), %%al \n\t" // load Raw(x-bpp) into al
- "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp)
- "movl %%eax, %%ecx \n\t"
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- "addl _patemp, %%eax \n\t" // pcv = pav + pbv
- // pc = abs(pcv)
- "testl $0x80000000, %%eax \n\t"
- "jz paeth_pca2 \n\t"
- "negl %%eax \n\t" // reverse sign of neg values
-
- "paeth_pca2: \n\t"
- "movl %%eax, _pctemp \n\t" // save pc for later use
- // pb = abs(pbv)
- "testl $0x80000000, %%ecx \n\t"
- "jz paeth_pba2 \n\t"
- "negl %%ecx \n\t" // reverse sign of neg values
-
- "paeth_pba2: \n\t"
- "movl %%ecx, _pbtemp \n\t" // save pb for later use
- // pa = abs(pav)
- "movl _patemp, %%eax \n\t"
- "testl $0x80000000, %%eax \n\t"
- "jz paeth_paa2 \n\t"
- "negl %%eax \n\t" // reverse sign of neg values
-
- "paeth_paa2: \n\t"
- "movl %%eax, _patemp \n\t" // save pa for later use
- // test if pa <= pb
- "cmpl %%ecx, %%eax \n\t"
- "jna paeth_abb2 \n\t"
- // pa > pb; now test if pb <= pc
- "cmpl _pctemp, %%ecx \n\t"
- "jna paeth_bbc2 \n\t"
- // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl
- "jmp paeth_paeth2 \n\t"
-
- "paeth_bbc2: \n\t"
- // pb <= pc; Raw(x) = Paeth(x) + Prior(x)
- "movb (%%esi,%%ebx,), %%cl \n\t" // load Prior(x) into cl
- "jmp paeth_paeth2 \n\t"
-
- "paeth_abb2: \n\t"
- // pa <= pb; now test if pa <= pc
- "cmpl _pctemp, %%eax \n\t"
- "jna paeth_abc2 \n\t"
- // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl
- "jmp paeth_paeth2 \n\t"
-
- "paeth_abc2: \n\t"
- // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp)
- "movb (%%edi,%%edx,), %%cl \n\t" // load Raw(x-bpp) into cl
-
- "paeth_paeth2: \n\t"
- "incl %%ebx \n\t"
- "incl %%edx \n\t"
- // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256
- "addb %%cl, -1(%%edi,%%ebx,) \n\t"
- "cmpl _FullLength, %%ebx \n\t"
- "jb paeth_lp2 \n\t"
-
- "paeth_end: \n\t"
- "EMMS \n\t" // end MMX; prep for poss. FP instrs.
-#ifdef __PIC__
- "popl %%ebx \n\t" // restore index to Global Offset Table
-#endif
-
- : "=c" (dummy_value_c), // output regs (dummy)
- "=S" (dummy_value_S),
- "=D" (dummy_value_D)
-
- : "0" (bpp), // ecx // input regs
- "1" (prev_row), // esi
- "2" (row) // edi
-
- : "%eax", "%edx" // clobber list (no input regs!)
-#ifndef __PIC__
- , "%ebx"
-#endif
- );
-
-} /* end png_read_filter_row_mmx_paeth() */
-#endif
-
-
-
-
-#ifdef PNG_THREAD_UNSAFE_OK
-//===========================================================================//
-// //
-// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ S U B //
-// //
-//===========================================================================//
-
-// Optimized code for PNG Sub filter decoder
-
-static void /* PRIVATE */
-png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
-{
- int bpp;
- int dummy_value_a;
- int dummy_value_D;
-
- bpp = (row_info->pixel_depth + 7) >> 3; // calc number of bytes per pixel
- _FullLength = row_info->rowbytes - bpp; // number of bytes to filter
-
- __asm__ __volatile__ (
-//pre "movl row, %%edi \n\t"
- "movl %%edi, %%esi \n\t" // lp = row
-//pre "movl bpp, %%eax \n\t"
- "addl %%eax, %%edi \n\t" // rp = row + bpp
-//irr "xorl %%eax, %%eax \n\t"
- // get # of bytes to alignment
- "movl %%edi, _dif \n\t" // take start of row
- "addl $0xf, _dif \n\t" // add 7 + 8 to incr past
- // alignment boundary
- "xorl %%ecx, %%ecx \n\t"
- "andl $0xfffffff8, _dif \n\t" // mask to alignment boundary
- "subl %%edi, _dif \n\t" // subtract from start ==> value
- "jz sub_go \n\t" // ecx at alignment
-
- "sub_lp1: \n\t" // fix alignment
- "movb (%%esi,%%ecx,), %%al \n\t"
- "addb %%al, (%%edi,%%ecx,) \n\t"
- "incl %%ecx \n\t"
- "cmpl _dif, %%ecx \n\t"
- "jb sub_lp1 \n\t"
-
- "sub_go: \n\t"
- "movl _FullLength, %%eax \n\t"
- "movl %%eax, %%edx \n\t"
- "subl %%ecx, %%edx \n\t" // subtract alignment fix
- "andl $0x00000007, %%edx \n\t" // calc bytes over mult of 8
- "subl %%edx, %%eax \n\t" // drop over bytes from length
- "movl %%eax, _MMXLength \n\t"
-
- : "=a" (dummy_value_a), // 0 // output regs (dummy)
- "=D" (dummy_value_D) // 1
-
- : "0" (bpp), // eax // input regs
- "1" (row) // edi
-
- : "%esi", "%ecx", "%edx" // clobber list
-
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3"
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
-
- // now do the math for the rest of the row
- switch (bpp)
- {
- case 3:
- {
- _ActiveMask.use = 0x0000ffffff000000LL;
- _ShiftBpp.use = 24; // == 3 * 8
- _ShiftRem.use = 40; // == 64 - 24
-
- __asm__ __volatile__ (
-// preload "movl row, %%edi \n\t"
- "movq _ActiveMask, %%mm7 \n\t" // load _ActiveMask for 2nd
- // active byte group
- "movl %%edi, %%esi \n\t" // lp = row
-// preload "movl bpp, %%eax \n\t"
- "addl %%eax, %%edi \n\t" // rp = row + bpp
- "movq %%mm7, %%mm6 \n\t"
- "movl _dif, %%edx \n\t"
- "psllq _ShiftBpp, %%mm6 \n\t" // move mask in mm6 to cover
- // 3rd active byte group
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%edx,), %%mm1 \n\t"
-
- "sub_3lp: \n\t" // shift data for adding first
- "psrlq _ShiftRem, %%mm1 \n\t" // bpp bytes (no need for mask;
- // shift clears inactive bytes)
- // add 1st active group
- "movq (%%edi,%%edx,), %%mm0 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- // add 2nd active group
- "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1
- "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly
- "pand %%mm7, %%mm1 \n\t" // mask to use 2nd active group
- "paddb %%mm1, %%mm0 \n\t"
-
- // add 3rd active group
- "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1
- "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly
- "pand %%mm6, %%mm1 \n\t" // mask to use 3rd active group
- "addl $8, %%edx \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- "cmpl _MMXLength, %%edx \n\t"
- "movq %%mm0, -8(%%edi,%%edx,) \n\t" // write updated Raws to array
- "movq %%mm0, %%mm1 \n\t" // prep 1st add at top of loop
- "jb sub_3lp \n\t"
-
- : "=a" (dummy_value_a), // 0 // output regs (dummy)
- "=D" (dummy_value_D) // 1
-
- : "0" (bpp), // eax // input regs
- "1" (row) // edi
-
- : "%edx", "%esi" // clobber list
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm6", "%mm7"
-#endif
- );
- }
- break;
-
- case 1:
- {
- __asm__ __volatile__ (
- "movl _dif, %%edx \n\t"
-// preload "movl row, %%edi \n\t"
- "cmpl _FullLength, %%edx \n\t"
- "jnb sub_1end \n\t"
- "movl %%edi, %%esi \n\t" // lp = row
- "xorl %%eax, %%eax \n\t"
-// preload "movl bpp, %%eax \n\t"
- "addl %%eax, %%edi \n\t" // rp = row + bpp
-
- "sub_1lp: \n\t"
- "movb (%%esi,%%edx,), %%al \n\t"
- "addb %%al, (%%edi,%%edx,) \n\t"
- "incl %%edx \n\t"
- "cmpl _FullLength, %%edx \n\t"
- "jb sub_1lp \n\t"
-
- "sub_1end: \n\t"
-
- : "=a" (dummy_value_a), // 0 // output regs (dummy)
- "=D" (dummy_value_D) // 1
-
- : "0" (bpp), // eax // input regs
- "1" (row) // edi
-
- : "%edx", "%esi" // clobber list
- );
- }
- return;
-
- case 6:
- case 4:
- //case 7: // GRR BOGUS
- //case 5: // GRR BOGUS
- {
- _ShiftBpp.use = bpp << 3;
- _ShiftRem.use = 64 - _ShiftBpp.use;
-
- __asm__ __volatile__ (
-// preload "movl row, %%edi \n\t"
- "movl _dif, %%edx \n\t"
- "movl %%edi, %%esi \n\t" // lp = row
-// preload "movl bpp, %%eax \n\t"
- "addl %%eax, %%edi \n\t" // rp = row + bpp
-
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%edx,), %%mm1 \n\t"
-
- "sub_4lp: \n\t" // shift data for adding first
- "psrlq _ShiftRem, %%mm1 \n\t" // bpp bytes (no need for mask;
- // shift clears inactive bytes)
- "movq (%%edi,%%edx,), %%mm0 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- // add 2nd active group
- "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1
- "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly
- "addl $8, %%edx \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- "cmpl _MMXLength, %%edx \n\t"
- "movq %%mm0, -8(%%edi,%%edx,) \n\t"
- "movq %%mm0, %%mm1 \n\t" // prep 1st add at top of loop
- "jb sub_4lp \n\t"
-
- : "=a" (dummy_value_a), // 0 // output regs (dummy)
- "=D" (dummy_value_D) // 1
-
- : "0" (bpp), // eax // input regs
- "1" (row) // edi
-
- : "%edx", "%esi" // clobber list
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1"
-#endif
- );
- }
- break;
-
- case 2:
- {
- _ActiveMask.use = 0x00000000ffff0000LL;
- _ShiftBpp.use = 16; // == 2 * 8
- _ShiftRem.use = 48; // == 64 - 16
-
- __asm__ __volatile__ (
- "movq _ActiveMask, %%mm7 \n\t" // load _ActiveMask for 2nd
- // active byte group
- "movl _dif, %%edx \n\t"
- "movq %%mm7, %%mm6 \n\t"
-// preload "movl row, %%edi \n\t"
- "psllq _ShiftBpp, %%mm6 \n\t" // move mask in mm6 to cover
- // 3rd active byte group
- "movl %%edi, %%esi \n\t" // lp = row
- "movq %%mm6, %%mm5 \n\t"
-// preload "movl bpp, %%eax \n\t"
- "addl %%eax, %%edi \n\t" // rp = row + bpp
- "psllq _ShiftBpp, %%mm5 \n\t" // move mask in mm5 to cover
- // 4th active byte group
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%edx,), %%mm1 \n\t"
-
- "sub_2lp: \n\t" // shift data for adding first
- "psrlq _ShiftRem, %%mm1 \n\t" // bpp bytes (no need for mask;
- // shift clears inactive bytes)
- // add 1st active group
- "movq (%%edi,%%edx,), %%mm0 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- // add 2nd active group
- "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1
- "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly
- "pand %%mm7, %%mm1 \n\t" // mask to use 2nd active group
- "paddb %%mm1, %%mm0 \n\t"
-
- // add 3rd active group
- "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1
- "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly
- "pand %%mm6, %%mm1 \n\t" // mask to use 3rd active group
- "paddb %%mm1, %%mm0 \n\t"
-
- // add 4th active group
- "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1
- "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly
- "pand %%mm5, %%mm1 \n\t" // mask to use 4th active group
- "addl $8, %%edx \n\t"
- "paddb %%mm1, %%mm0 \n\t"
- "cmpl _MMXLength, %%edx \n\t"
- "movq %%mm0, -8(%%edi,%%edx,) \n\t" // write updated Raws to array
- "movq %%mm0, %%mm1 \n\t" // prep 1st add at top of loop
- "jb sub_2lp \n\t"
-
- : "=a" (dummy_value_a), // 0 // output regs (dummy)
- "=D" (dummy_value_D) // 1
-
- : "0" (bpp), // eax // input regs
- "1" (row) // edi
-
- : "%edx", "%esi" // clobber list
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- break;
-
- case 8:
- {
- __asm__ __volatile__ (
-// preload "movl row, %%edi \n\t"
- "movl _dif, %%edx \n\t"
- "movl %%edi, %%esi \n\t" // lp = row
-// preload "movl bpp, %%eax \n\t"
- "addl %%eax, %%edi \n\t" // rp = row + bpp
- "movl _MMXLength, %%ecx \n\t"
-
- // prime the pump: load the first Raw(x-bpp) data set
- "movq -8(%%edi,%%edx,), %%mm7 \n\t"
- "andl $0x0000003f, %%ecx \n\t" // calc bytes over mult of 64
-
- "sub_8lp: \n\t"
- "movq (%%edi,%%edx,), %%mm0 \n\t" // load Sub(x) for 1st 8 bytes
- "paddb %%mm7, %%mm0 \n\t"
- "movq 8(%%edi,%%edx,), %%mm1 \n\t" // load Sub(x) for 2nd 8 bytes
- "movq %%mm0, (%%edi,%%edx,) \n\t" // write Raw(x) for 1st 8 bytes
-
- // Now mm0 will be used as Raw(x-bpp) for the 2nd group of 8 bytes.
- // This will be repeated for each group of 8 bytes with the 8th
- // group being used as the Raw(x-bpp) for the 1st group of the
- // next loop.
-
- "paddb %%mm0, %%mm1 \n\t"
- "movq 16(%%edi,%%edx,), %%mm2 \n\t" // load Sub(x) for 3rd 8 bytes
- "movq %%mm1, 8(%%edi,%%edx,) \n\t" // write Raw(x) for 2nd 8 bytes
- "paddb %%mm1, %%mm2 \n\t"
- "movq 24(%%edi,%%edx,), %%mm3 \n\t" // load Sub(x) for 4th 8 bytes
- "movq %%mm2, 16(%%edi,%%edx,) \n\t" // write Raw(x) for 3rd 8 bytes
- "paddb %%mm2, %%mm3 \n\t"
- "movq 32(%%edi,%%edx,), %%mm4 \n\t" // load Sub(x) for 5th 8 bytes
- "movq %%mm3, 24(%%edi,%%edx,) \n\t" // write Raw(x) for 4th 8 bytes
- "paddb %%mm3, %%mm4 \n\t"
- "movq 40(%%edi,%%edx,), %%mm5 \n\t" // load Sub(x) for 6th 8 bytes
- "movq %%mm4, 32(%%edi,%%edx,) \n\t" // write Raw(x) for 5th 8 bytes
- "paddb %%mm4, %%mm5 \n\t"
- "movq 48(%%edi,%%edx,), %%mm6 \n\t" // load Sub(x) for 7th 8 bytes
- "movq %%mm5, 40(%%edi,%%edx,) \n\t" // write Raw(x) for 6th 8 bytes
- "paddb %%mm5, %%mm6 \n\t"
- "movq 56(%%edi,%%edx,), %%mm7 \n\t" // load Sub(x) for 8th 8 bytes
- "movq %%mm6, 48(%%edi,%%edx,) \n\t" // write Raw(x) for 7th 8 bytes
- "addl $64, %%edx \n\t"
- "paddb %%mm6, %%mm7 \n\t"
- "cmpl %%ecx, %%edx \n\t"
- "movq %%mm7, -8(%%edi,%%edx,) \n\t" // write Raw(x) for 8th 8 bytes
- "jb sub_8lp \n\t"
-
- "cmpl _MMXLength, %%edx \n\t"
- "jnb sub_8lt8 \n\t"
-
- "sub_8lpA: \n\t"
- "movq (%%edi,%%edx,), %%mm0 \n\t"
- "addl $8, %%edx \n\t"
- "paddb %%mm7, %%mm0 \n\t"
- "cmpl _MMXLength, %%edx \n\t"
- "movq %%mm0, -8(%%edi,%%edx,) \n\t" // -8 to offset early addl edx
- "movq %%mm0, %%mm7 \n\t" // move calculated Raw(x) data
- // to mm1 to be new Raw(x-bpp)
- // for next loop
- "jb sub_8lpA \n\t"
-
- "sub_8lt8: \n\t"
-
- : "=a" (dummy_value_a), // 0 // output regs (dummy)
- "=D" (dummy_value_D) // 1
-
- : "0" (bpp), // eax // input regs
- "1" (row) // edi
-
- : "%ecx", "%edx", "%esi" // clobber list
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
- }
- break;
-
- default: // bpp greater than 8 bytes GRR BOGUS
- {
- __asm__ __volatile__ (
- "movl _dif, %%edx \n\t"
-// preload "movl row, %%edi \n\t"
- "movl %%edi, %%esi \n\t" // lp = row
-// preload "movl bpp, %%eax \n\t"
- "addl %%eax, %%edi \n\t" // rp = row + bpp
-
- "sub_Alp: \n\t"
- "movq (%%edi,%%edx,), %%mm0 \n\t"
- "movq (%%esi,%%edx,), %%mm1 \n\t"
- "addl $8, %%edx \n\t"
- "paddb %%mm1, %%mm0 \n\t"
- "cmpl _MMXLength, %%edx \n\t"
- "movq %%mm0, -8(%%edi,%%edx,) \n\t" // mov does not affect flags;
- // -8 to offset addl edx
- "jb sub_Alp \n\t"
-
- : "=a" (dummy_value_a), // 0 // output regs (dummy)
- "=D" (dummy_value_D) // 1
-
- : "0" (bpp), // eax // input regs
- "1" (row) // edi
-
- : "%edx", "%esi" // clobber list
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1"
-#endif
- );
- }
- break;
-
- } // end switch (bpp)
-
- __asm__ __volatile__ (
- "movl _MMXLength, %%edx \n\t"
-//pre "movl row, %%edi \n\t"
- "cmpl _FullLength, %%edx \n\t"
- "jnb sub_end \n\t"
-
- "movl %%edi, %%esi \n\t" // lp = row
-//pre "movl bpp, %%eax \n\t"
- "addl %%eax, %%edi \n\t" // rp = row + bpp
- "xorl %%eax, %%eax \n\t"
-
- "sub_lp2: \n\t"
- "movb (%%esi,%%edx,), %%al \n\t"
- "addb %%al, (%%edi,%%edx,) \n\t"
- "incl %%edx \n\t"
- "cmpl _FullLength, %%edx \n\t"
- "jb sub_lp2 \n\t"
-
- "sub_end: \n\t"
- "EMMS \n\t" // end MMX instructions
-
- : "=a" (dummy_value_a), // 0 // output regs (dummy)
- "=D" (dummy_value_D) // 1
-
- : "0" (bpp), // eax // input regs
- "1" (row) // edi
-
- : "%edx", "%esi" // clobber list
- );
-
-} // end of png_read_filter_row_mmx_sub()
-#endif
-
-
-
-
-//===========================================================================//
-// //
-// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ U P //
-// //
-//===========================================================================//
-
-// Optimized code for PNG Up filter decoder
-
-static void /* PRIVATE */
-png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row,
- png_bytep prev_row)
-{
- png_uint_32 len;
- int dummy_value_d; // fix 'forbidden register 3 (dx) was spilled' error
- int dummy_value_S;
- int dummy_value_D;
-
- len = row_info->rowbytes; // number of bytes to filter
-
- __asm__ __volatile__ (
-//pre "movl row, %%edi \n\t"
- // get # of bytes to alignment
-#ifdef __PIC__
- "pushl %%ebx \n\t"
-#endif
- "movl %%edi, %%ecx \n\t"
- "xorl %%ebx, %%ebx \n\t"
- "addl $0x7, %%ecx \n\t"
- "xorl %%eax, %%eax \n\t"
- "andl $0xfffffff8, %%ecx \n\t"
-//pre "movl prev_row, %%esi \n\t"
- "subl %%edi, %%ecx \n\t"
- "jz up_go \n\t"
-
- "up_lp1: \n\t" // fix alignment
- "movb (%%edi,%%ebx,), %%al \n\t"
- "addb (%%esi,%%ebx,), %%al \n\t"
- "incl %%ebx \n\t"
- "cmpl %%ecx, %%ebx \n\t"
- "movb %%al, -1(%%edi,%%ebx,) \n\t" // mov does not affect flags; -1 to
- "jb up_lp1 \n\t" // offset incl ebx
-
- "up_go: \n\t"
-//pre "movl len, %%edx \n\t"
- "movl %%edx, %%ecx \n\t"
- "subl %%ebx, %%edx \n\t" // subtract alignment fix
- "andl $0x0000003f, %%edx \n\t" // calc bytes over mult of 64
- "subl %%edx, %%ecx \n\t" // drop over bytes from length
-
- // unrolled loop - use all MMX registers and interleave to reduce
- // number of branch instructions (loops) and reduce partial stalls
- "up_loop: \n\t"
- "movq (%%esi,%%ebx,), %%mm1 \n\t"
- "movq (%%edi,%%ebx,), %%mm0 \n\t"
- "movq 8(%%esi,%%ebx,), %%mm3 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
- "movq 8(%%edi,%%ebx,), %%mm2 \n\t"
- "movq %%mm0, (%%edi,%%ebx,) \n\t"
- "paddb %%mm3, %%mm2 \n\t"
- "movq 16(%%esi,%%ebx,), %%mm5 \n\t"
- "movq %%mm2, 8(%%edi,%%ebx,) \n\t"
- "movq 16(%%edi,%%ebx,), %%mm4 \n\t"
- "movq 24(%%esi,%%ebx,), %%mm7 \n\t"
- "paddb %%mm5, %%mm4 \n\t"
- "movq 24(%%edi,%%ebx,), %%mm6 \n\t"
- "movq %%mm4, 16(%%edi,%%ebx,) \n\t"
- "paddb %%mm7, %%mm6 \n\t"
- "movq 32(%%esi,%%ebx,), %%mm1 \n\t"
- "movq %%mm6, 24(%%edi,%%ebx,) \n\t"
- "movq 32(%%edi,%%ebx,), %%mm0 \n\t"
- "movq 40(%%esi,%%ebx,), %%mm3 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
- "movq 40(%%edi,%%ebx,), %%mm2 \n\t"
- "movq %%mm0, 32(%%edi,%%ebx,) \n\t"
- "paddb %%mm3, %%mm2 \n\t"
- "movq 48(%%esi,%%ebx,), %%mm5 \n\t"
- "movq %%mm2, 40(%%edi,%%ebx,) \n\t"
- "movq 48(%%edi,%%ebx,), %%mm4 \n\t"
- "movq 56(%%esi,%%ebx,), %%mm7 \n\t"
- "paddb %%mm5, %%mm4 \n\t"
- "movq 56(%%edi,%%ebx,), %%mm6 \n\t"
- "movq %%mm4, 48(%%edi,%%ebx,) \n\t"
- "addl $64, %%ebx \n\t"
- "paddb %%mm7, %%mm6 \n\t"
- "cmpl %%ecx, %%ebx \n\t"
- "movq %%mm6, -8(%%edi,%%ebx,) \n\t" // (+56)movq does not affect flags;
- "jb up_loop \n\t" // -8 to offset addl ebx
-
- "cmpl $0, %%edx \n\t" // test for bytes over mult of 64
- "jz up_end \n\t"
-
- "cmpl $8, %%edx \n\t" // test for less than 8 bytes
- "jb up_lt8 \n\t" // [added by lcreeve at netins.net]
-
- "addl %%edx, %%ecx \n\t"
- "andl $0x00000007, %%edx \n\t" // calc bytes over mult of 8
- "subl %%edx, %%ecx \n\t" // drop over bytes from length
- "jz up_lt8 \n\t"
-
- "up_lpA: \n\t" // use MMX regs to update 8 bytes sim.
- "movq (%%esi,%%ebx,), %%mm1 \n\t"
- "movq (%%edi,%%ebx,), %%mm0 \n\t"
- "addl $8, %%ebx \n\t"
- "paddb %%mm1, %%mm0 \n\t"
- "cmpl %%ecx, %%ebx \n\t"
- "movq %%mm0, -8(%%edi,%%ebx,) \n\t" // movq does not affect flags; -8 to
- "jb up_lpA \n\t" // offset add ebx
- "cmpl $0, %%edx \n\t" // test for bytes over mult of 8
- "jz up_end \n\t"
-
- "up_lt8: \n\t"
- "xorl %%eax, %%eax \n\t"
- "addl %%edx, %%ecx \n\t" // move over byte count into counter
-
- "up_lp2: \n\t" // use x86 regs for remaining bytes
- "movb (%%edi,%%ebx,), %%al \n\t"
- "addb (%%esi,%%ebx,), %%al \n\t"
- "incl %%ebx \n\t"
- "cmpl %%ecx, %%ebx \n\t"
- "movb %%al, -1(%%edi,%%ebx,) \n\t" // mov does not affect flags; -1 to
- "jb up_lp2 \n\t" // offset inc ebx
-
- "up_end: \n\t"
- "EMMS \n\t" // conversion of filtered row complete
-#ifdef __PIC__
- "popl %%ebx \n\t"
-#endif
-
- : "=d" (dummy_value_d), // 0 // output regs (dummy)
- "=S" (dummy_value_S), // 1
- "=D" (dummy_value_D) // 2
-
- : "0" (len), // edx // input regs
- "1" (prev_row), // esi
- "2" (row) // edi
-
- : "%eax", "%ecx" // clobber list (no input regs!)
-#ifndef __PIC__
- , "%ebx"
-#endif
-
-#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
- , "%mm0", "%mm1", "%mm2", "%mm3"
- , "%mm4", "%mm5", "%mm6", "%mm7"
-#endif
- );
-
-} // end of png_read_filter_row_mmx_up()
-
-#endif /* PNG_MMX_CODE_SUPPORTED */
-
-
-
-
-/*===========================================================================*/
-/* */
-/* P N G _ R E A D _ F I L T E R _ R O W */
-/* */
-/*===========================================================================*/
-
-
-/* Optimized png_read_filter_row routines */
-
-void /* PRIVATE */
-png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
- row, png_bytep prev_row, int filter)
-{
-#ifdef PNG_DEBUG
- char filnm[10];
-#endif
-
-#if defined(PNG_MMX_CODE_SUPPORTED)
-/* GRR: these are superseded by png_ptr->asm_flags: */
-#define UseMMX_sub 1 // GRR: converted 20000730
-#define UseMMX_up 1 // GRR: converted 20000729
-#define UseMMX_avg 1 // GRR: converted 20000828 (+ 16-bit bugfix 20000916)
-#define UseMMX_paeth 1 // GRR: converted 20000828
-
- if (_mmx_supported == 2) {
- /* this should have happened in png_init_mmx_flags() already */
-#if !defined(PNG_1_0_X)
- png_warning(png_ptr, "asm_flags may not have been initialized");
-#endif
- png_mmx_support();
- }
-#endif /* PNG_MMX_CODE_SUPPORTED */
-
-#ifdef PNG_DEBUG
- png_debug(1, "in png_read_filter_row (pnggccrd.c)\n");
- switch (filter)
- {
- case 0: sprintf(filnm, "none");
- break;
- case 1: sprintf(filnm, "sub-%s",
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" :
-#endif
-#endif
-"x86");
- break;
- case 2: sprintf(filnm, "up-%s",
-#ifdef PNG_MMX_CODE_SUPPORTED
-#if !defined(PNG_1_0_X)
- (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" :
-#endif
-#endif
- "x86");
- break;
- case 3: sprintf(filnm, "avg-%s",
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" :
-#endif
-#endif
- "x86");
- break;
- case 4: sprintf(filnm, "Paeth-%s",
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX":
-#endif
-#endif
-"x86");
- break;
- default: sprintf(filnm, "unknw");
- break;
- }
- png_debug2(0, "row_number=%5ld, %5s, ", png_ptr->row_number, filnm);
- png_debug1(0, "row=0x%08lx, ", (unsigned long)row);
- png_debug2(0, "pixdepth=%2d, bytes=%d, ", (int)row_info->pixel_depth,
- (int)((row_info->pixel_depth + 7) >> 3));
- png_debug1(0,"rowbytes=%8ld\n", row_info->rowbytes);
-#endif /* PNG_DEBUG */
-
- switch (filter)
- {
- case PNG_FILTER_VALUE_NONE:
- break;
-
- case PNG_FILTER_VALUE_SUB:
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) &&
- (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
- (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
-#else
- if (_mmx_supported)
-#endif
- {
- png_read_filter_row_mmx_sub(row_info, row);
- }
- else
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- png_uint_32 i;
- png_uint_32 istop = row_info->rowbytes;
- png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3;
- png_bytep rp = row + bpp;
- png_bytep lp = row;
-
- for (i = bpp; i < istop; i++)
- {
- *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
- rp++;
- }
- } /* end !UseMMX_sub */
- break;
-
- case PNG_FILTER_VALUE_UP:
-#if defined(PNG_MMX_CODE_SUPPORTED)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) &&
- (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
- (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
-#else
- if (_mmx_supported)
-#endif
- {
- png_read_filter_row_mmx_up(row_info, row, prev_row);
- }
- else
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- png_uint_32 i;
- png_uint_32 istop = row_info->rowbytes;
- png_bytep rp = row;
- png_bytep pp = prev_row;
-
- for (i = 0; i < istop; ++i)
- {
- *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
- rp++;
- }
- } /* end !UseMMX_up */
- break;
-
- case PNG_FILTER_VALUE_AVG:
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) &&
- (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
- (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
-#else
- if (_mmx_supported)
-#endif
- {
- png_read_filter_row_mmx_avg(row_info, row, prev_row);
- }
- else
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- png_uint_32 i;
- png_bytep rp = row;
- png_bytep pp = prev_row;
- png_bytep lp = row;
- png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3;
- png_uint_32 istop = row_info->rowbytes - bpp;
-
- for (i = 0; i < bpp; i++)
- {
- *rp = (png_byte)(((int)(*rp) +
- ((int)(*pp++) >> 1)) & 0xff);
- rp++;
- }
-
- for (i = 0; i < istop; i++)
- {
- *rp = (png_byte)(((int)(*rp) +
- ((int)(*pp++ + *lp++) >> 1)) & 0xff);
- rp++;
- }
- } /* end !UseMMX_avg */
- break;
-
- case PNG_FILTER_VALUE_PAETH:
-#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) &&
- (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
- (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
-#else
- if (_mmx_supported)
-#endif
- {
- png_read_filter_row_mmx_paeth(row_info, row, prev_row);
- }
- else
-#endif /* PNG_MMX_CODE_SUPPORTED */
- {
- png_uint_32 i;
- png_bytep rp = row;
- png_bytep pp = prev_row;
- png_bytep lp = row;
- png_bytep cp = prev_row;
- png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3;
- png_uint_32 istop = row_info->rowbytes - bpp;
-
- for (i = 0; i < bpp; i++)
- {
- *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
- rp++;
- }
-
- for (i = 0; i < istop; i++) /* use leftover rp,pp */
- {
- int a, b, c, pa, pb, pc, p;
-
- a = *lp++;
- b = *pp++;
- c = *cp++;
-
- p = b - c;
- pc = a - c;
-
-#ifdef PNG_USE_ABS
- pa = abs(p);
- pb = abs(pc);
- pc = abs(p + pc);
-#else
- pa = p < 0 ? -p : p;
- pb = pc < 0 ? -pc : pc;
- pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-#endif
-
- /*
- if (pa <= pb && pa <= pc)
- p = a;
- else if (pb <= pc)
- p = b;
- else
- p = c;
- */
-
- p = (pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c;
-
- *rp = (png_byte)(((int)(*rp) + p) & 0xff);
- rp++;
- }
- } /* end !UseMMX_paeth */
- break;
-
- default:
- png_warning(png_ptr, "Ignoring bad row-filter type");
- *row=0;
- break;
- }
-}
-
-#endif /* PNG_HAVE_MMX_READ_FILTER_ROW */
-
-
-/*===========================================================================*/
-/* */
-/* P N G _ M M X _ S U P P O R T */
-/* */
-/*===========================================================================*/
-
-/* GRR NOTES: (1) the following code assumes 386 or better (pushfl/popfl)
- * (2) all instructions compile with gcc 2.7.2.3 and later
- * (3) the function is moved down here to prevent gcc from
- * inlining it in multiple places and then barfing be-
- * cause the ".NOT_SUPPORTED" label is multiply defined
- * [is there a way to signal that a *single* function should
- * not be inlined? is there a way to modify the label for
- * each inlined instance, e.g., by appending _1, _2, etc.?
- * maybe if don't use leading "." in label name? (nope...sigh)]
- */
-
-int PNGAPI
-png_mmx_support(void)
-{
-#if defined(PNG_MMX_CODE_SUPPORTED)
- int result;
- __asm__ __volatile__ (
- "pushl %%ebx \n\t" // ebx gets clobbered by CPUID instruction
- "pushl %%ecx \n\t" // so does ecx...
- "pushl %%edx \n\t" // ...and edx (but ecx & edx safe on Linux)
-// ".byte 0x66 \n\t" // convert 16-bit pushf to 32-bit pushfd
-// "pushf \n\t" // 16-bit pushf
- "pushfl \n\t" // save Eflag to stack
- "popl %%eax \n\t" // get Eflag from stack into eax
- "movl %%eax, %%ecx \n\t" // make another copy of Eflag in ecx
- "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
- "pushl %%eax \n\t" // save modified Eflag back to stack
-// ".byte 0x66 \n\t" // convert 16-bit popf to 32-bit popfd
-// "popf \n\t" // 16-bit popf
- "popfl \n\t" // restore modified value to Eflag reg
- "pushfl \n\t" // save Eflag to stack
- "popl %%eax \n\t" // get Eflag from stack
- "pushl %%ecx \n\t" // save original Eflag to stack
- "popfl \n\t" // restore original Eflag
- "xorl %%ecx, %%eax \n\t" // compare new Eflag with original Eflag
- "jz 0f \n\t" // if same, CPUID instr. is not supported
-
- "xorl %%eax, %%eax \n\t" // set eax to zero
-// ".byte 0x0f, 0xa2 \n\t" // CPUID instruction (two-byte opcode)
- "cpuid \n\t" // get the CPU identification info
- "cmpl $1, %%eax \n\t" // make sure eax return non-zero value
- "jl 0f \n\t" // if eax is zero, MMX is not supported
-
- "xorl %%eax, %%eax \n\t" // set eax to zero and...
- "incl %%eax \n\t" // ...increment eax to 1. This pair is
- // faster than the instruction "mov eax, 1"
- "cpuid \n\t" // get the CPU identification info again
- "andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23)
- "cmpl $0, %%edx \n\t" // 0 = MMX not supported
- "jz 0f \n\t" // non-zero = yes, MMX IS supported
-
- "movl $1, %%eax \n\t" // set return value to 1
- "jmp 1f \n\t" // DONE: have MMX support
-
- "0: \n\t" // .NOT_SUPPORTED: target label for jump instructions
- "movl $0, %%eax \n\t" // set return value to 0
- "1: \n\t" // .RETURN: target label for jump instructions
- "popl %%edx \n\t" // restore edx
- "popl %%ecx \n\t" // restore ecx
- "popl %%ebx \n\t" // restore ebx
-
-// "ret \n\t" // DONE: no MMX support
- // (fall through to standard C "ret")
-
- : "=a" (result) // output list
-
- : // any variables used on input (none)
-
- // no clobber list
-// , "%ebx", "%ecx", "%edx" // GRR: we handle these manually
-// , "memory" // if write to a variable gcc thought was in a reg
-// , "cc" // "condition codes" (flag bits)
- );
- _mmx_supported = result;
-#else
- _mmx_supported = 0;
-#endif /* PNG_MMX_CODE_SUPPORTED */
-
- return _mmx_supported;
-}
-
-
-#endif /* PNG_USE_PNGGCCRD */
diff --git a/jdk/src/share/native/sun/awt/libpng/pngvcrd.c b/jdk/src/share/native/sun/awt/libpng/pngvcrd.c
deleted file mode 100644
index 30f2a18..0000000
--- a/jdk/src/share/native/sun/awt/libpng/pngvcrd.c
+++ /dev/null
@@ -1,3932 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* pngvcrd.c - mixed C/assembler version of utilities to read a PNG file
- *
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file and, per its terms, should not be removed:
- *
- * For Intel x86 CPU and Microsoft Visual C++ compiler
- *
- * Last changed in libpng 1.2.6 - August 15, 2004
- * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
- * Copyright (c) 1998, Intel Corporation
- *
- * Contributed by Nirav Chhatrapati, Intel Corporation, 1998
- * Interface to libpng contributed by Gilles Vollant, 1999
- *
- *
- * In png_do_read_interlace() in libpng versions 1.0.3a through 1.0.4d,
- * a sign error in the post-MMX cleanup code for each pixel_depth resulted
- * in bad pixels at the beginning of some rows of some images, and also
- * (due to out-of-range memory reads and writes) caused heap corruption
- * when compiled with MSVC 6.0. The error was fixed in version 1.0.4e.
- *
- * [png_read_filter_row_mmx_avg() bpp == 2 bugfix, GRR 20000916]
- *
- * [runtime MMX configuration, GRR 20010102]
- *
- */
-
-#define PNG_INTERNAL
-#include "png.h"
-
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD)
-
-static int mmx_supported=2;
-
-
-int PNGAPI
-png_mmx_support(void)
-{
- int mmx_supported_local = 0;
- _asm {
- push ebx //CPUID will trash these
- push ecx
- push edx
-
- pushfd //Save Eflag to stack
- pop eax //Get Eflag from stack into eax
- mov ecx, eax //Make another copy of Eflag in ecx
- xor eax, 0x200000 //Toggle ID bit in Eflag [i.e. bit(21)]
- push eax //Save modified Eflag back to stack
-
- popfd //Restored modified value back to Eflag reg
- pushfd //Save Eflag to stack
- pop eax //Get Eflag from stack
- push ecx // save original Eflag to stack
- popfd // restore original Eflag
- xor eax, ecx //Compare the new Eflag with the original Eflag
- jz NOT_SUPPORTED //If the same, CPUID instruction is not supported,
- //skip following instructions and jump to
- //NOT_SUPPORTED label
-
- xor eax, eax //Set eax to zero
-
- _asm _emit 0x0f //CPUID instruction (two bytes opcode)
- _asm _emit 0xa2
-
- cmp eax, 1 //make sure eax return non-zero value
- jl NOT_SUPPORTED //If eax is zero, mmx not supported
-
- xor eax, eax //set eax to zero
- inc eax //Now increment eax to 1. This instruction is
- //faster than the instruction "mov eax, 1"
-
- _asm _emit 0x0f //CPUID instruction
- _asm _emit 0xa2
-
- and edx, 0x00800000 //mask out all bits but mmx bit(24)
- cmp edx, 0 // 0 = mmx not supported
- jz NOT_SUPPORTED // non-zero = Yes, mmx IS supported
-
- mov mmx_supported_local, 1 //set return value to 1
-
-NOT_SUPPORTED:
- mov eax, mmx_supported_local //move return value to eax
- pop edx //CPUID trashed these
- pop ecx
- pop ebx
- }
-
- //mmx_supported_local=0; // test code for force don't support MMX
- //printf("MMX : %u (1=MMX supported)\n",mmx_supported_local);
-
- mmx_supported = mmx_supported_local;
- return mmx_supported_local;
-}
-
-/* Combines the row recently read in with the previous row.
- This routine takes care of alpha and transparency if requested.
- This routine also handles the two methods of progressive display
- of interlaced images, depending on the mask value.
- The mask value describes which pixels are to be combined with
- the row. The pattern always repeats every 8 pixels, so just 8
- bits are needed. A one indicates the pixel is to be combined; a
- zero indicates the pixel is to be skipped. This is in addition
- to any alpha or transparency value associated with the pixel. If
- you want all pixels to be combined, pass 0xff (255) in mask. */
-
-/* Use this routine for x86 platform - uses faster MMX routine if machine
- supports MMX */
-
-void /* PRIVATE */
-png_combine_row(png_structp png_ptr, png_bytep row, int mask)
-{
-#ifdef PNG_USE_LOCAL_ARRAYS
- const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-#endif
-
- png_debug(1,"in png_combine_row_asm\n");
-
- if (mmx_supported == 2) {
-#if !defined(PNG_1_0_X)
- /* this should have happened in png_init_mmx_flags() already */
- png_warning(png_ptr, "asm_flags may not have been initialized");
-#endif
- png_mmx_support();
- }
-
- if (mask == 0xff)
- {
- png_memcpy(row, png_ptr->row_buf + 1,
- (png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
- png_ptr->width));
- }
- /* GRR: add "else if (mask == 0)" case?
- * or does png_combine_row() not even get called in that case? */
- else
- {
- switch (png_ptr->row_info.pixel_depth)
- {
- case 1:
- {
- png_bytep sp;
- png_bytep dp;
- int s_inc, s_start, s_end;
- int m;
- int shift;
- png_uint_32 i;
-
- sp = png_ptr->row_buf + 1;
- dp = row;
- m = 0x80;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (png_ptr->transformations & PNG_PACKSWAP)
- {
- s_start = 0;
- s_end = 7;
- s_inc = 1;
- }
- else
-#endif
- {
- s_start = 7;
- s_end = 0;
- s_inc = -1;
- }
-
- shift = s_start;
-
- for (i = 0; i < png_ptr->width; i++)
- {
- if (m & mask)
- {
- int value;
-
- value = (*sp >> shift) & 0x1;
- *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff);
- *dp |= (png_byte)(value << shift);
- }
-
- if (shift == s_end)
- {
- shift = s_start;
- sp++;
- dp++;
- }
- else
- shift += s_inc;
-
- if (m == 1)
- m = 0x80;
- else
- m >>= 1;
- }
- break;
- }
-
- case 2:
- {
- png_bytep sp;
- png_bytep dp;
- int s_start, s_end, s_inc;
- int m;
- int shift;
- png_uint_32 i;
- int value;
-
- sp = png_ptr->row_buf + 1;
- dp = row;
- m = 0x80;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (png_ptr->transformations & PNG_PACKSWAP)
- {
- s_start = 0;
- s_end = 6;
- s_inc = 2;
- }
- else
-#endif
- {
- s_start = 6;
- s_end = 0;
- s_inc = -2;
- }
-
- shift = s_start;
-
- for (i = 0; i < png_ptr->width; i++)
- {
- if (m & mask)
- {
- value = (*sp >> shift) & 0x3;
- *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff);
- *dp |= (png_byte)(value << shift);
- }
-
- if (shift == s_end)
- {
- shift = s_start;
- sp++;
- dp++;
- }
- else
- shift += s_inc;
- if (m == 1)
- m = 0x80;
- else
- m >>= 1;
- }
- break;
- }
-
- case 4:
- {
- png_bytep sp;
- png_bytep dp;
- int s_start, s_end, s_inc;
- int m;
- int shift;
- png_uint_32 i;
- int value;
-
- sp = png_ptr->row_buf + 1;
- dp = row;
- m = 0x80;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (png_ptr->transformations & PNG_PACKSWAP)
- {
- s_start = 0;
- s_end = 4;
- s_inc = 4;
- }
- else
-#endif
- {
- s_start = 4;
- s_end = 0;
- s_inc = -4;
- }
- shift = s_start;
-
- for (i = 0; i < png_ptr->width; i++)
- {
- if (m & mask)
- {
- value = (*sp >> shift) & 0xf;
- *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff);
- *dp |= (png_byte)(value << shift);
- }
-
- if (shift == s_end)
- {
- shift = s_start;
- sp++;
- dp++;
- }
- else
- shift += s_inc;
- if (m == 1)
- m = 0x80;
- else
- m >>= 1;
- }
- break;
- }
-
- case 8:
- {
- png_bytep srcptr;
- png_bytep dstptr;
- png_uint_32 len;
- int m;
- int diff, unmask;
-
- __int64 mask0=0x0102040810204080;
-
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && mmx_supported */ )
-#else
- if (mmx_supported)
-#endif
- {
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
- m = 0x80;
- unmask = ~mask;
- len = png_ptr->width &~7; //reduce to multiple of 8
- diff = png_ptr->width & 7; //amount lost
-
- _asm
- {
- movd mm7, unmask //load bit pattern
- psubb mm6,mm6 //zero mm6
- punpcklbw mm7,mm7
- punpcklwd mm7,mm7
- punpckldq mm7,mm7 //fill register with 8 masks
-
- movq mm0,mask0
-
- pand mm0,mm7 //nonzero if keep byte
- pcmpeqb mm0,mm6 //zeros->1s, v versa
-
- mov ecx,len //load length of line (pixels)
- mov esi,srcptr //load source
- mov ebx,dstptr //load dest
- cmp ecx,0 //lcr
- je mainloop8end
-
-mainloop8:
- movq mm4,[esi]
- pand mm4,mm0
- movq mm6,mm0
- pandn mm6,[ebx]
- por mm4,mm6
- movq [ebx],mm4
-
- add esi,8 //inc by 8 bytes processed
- add ebx,8
- sub ecx,8 //dec by 8 pixels processed
-
- ja mainloop8
-mainloop8end:
-
- mov ecx,diff
- cmp ecx,0
- jz end8
-
- mov edx,mask
- sal edx,24 //make low byte the high byte
-
-secondloop8:
- sal edx,1 //move high bit to CF
- jnc skip8 //if CF = 0
- mov al,[esi]
- mov [ebx],al
-skip8:
- inc esi
- inc ebx
-
- dec ecx
- jnz secondloop8
-end8:
- emms
- }
- }
- else /* mmx not supported - use modified C routine */
- {
- register unsigned int incr1, initial_val, final_val;
- png_size_t pixel_bytes;
- png_uint_32 i;
- register int disp = png_pass_inc[png_ptr->pass];
- int offset_table[7] = {0, 4, 0, 2, 0, 1, 0};
-
- pixel_bytes = (png_ptr->row_info.pixel_depth >> 3);
- srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]*
- pixel_bytes;
- dstptr = row + offset_table[png_ptr->pass]*pixel_bytes;
- initial_val = offset_table[png_ptr->pass]*pixel_bytes;
- final_val = png_ptr->width*pixel_bytes;
- incr1 = (disp)*pixel_bytes;
- for (i = initial_val; i < final_val; i += incr1)
- {
- png_memcpy(dstptr, srcptr, pixel_bytes);
- srcptr += incr1;
- dstptr += incr1;
- }
- } /* end of else */
-
- break;
- } // end 8 bpp
-
- case 16:
- {
- png_bytep srcptr;
- png_bytep dstptr;
- png_uint_32 len;
- int unmask, diff;
- __int64 mask1=0x0101020204040808,
- mask0=0x1010202040408080;
-
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && mmx_supported */ )
-#else
- if (mmx_supported)
-#endif
- {
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
-
- unmask = ~mask;
- len = (png_ptr->width)&~7;
- diff = (png_ptr->width)&7;
- _asm
- {
- movd mm7, unmask //load bit pattern
- psubb mm6,mm6 //zero mm6
- punpcklbw mm7,mm7
- punpcklwd mm7,mm7
- punpckldq mm7,mm7 //fill register with 8 masks
-
- movq mm0,mask0
- movq mm1,mask1
-
- pand mm0,mm7
- pand mm1,mm7
-
- pcmpeqb mm0,mm6
- pcmpeqb mm1,mm6
-
- mov ecx,len //load length of line
- mov esi,srcptr //load source
- mov ebx,dstptr //load dest
- cmp ecx,0 //lcr
- jz mainloop16end
-
-mainloop16:
- movq mm4,[esi]
- pand mm4,mm0
- movq mm6,mm0
- movq mm7,[ebx]
- pandn mm6,mm7
- por mm4,mm6
- movq [ebx],mm4
-
- movq mm5,[esi+8]
- pand mm5,mm1
- movq mm7,mm1
- movq mm6,[ebx+8]
- pandn mm7,mm6
- por mm5,mm7
- movq [ebx+8],mm5
-
- add esi,16 //inc by 16 bytes processed
- add ebx,16
- sub ecx,8 //dec by 8 pixels processed
-
- ja mainloop16
-
-mainloop16end:
- mov ecx,diff
- cmp ecx,0
- jz end16
-
- mov edx,mask
- sal edx,24 //make low byte the high byte
-secondloop16:
- sal edx,1 //move high bit to CF
- jnc skip16 //if CF = 0
- mov ax,[esi]
- mov [ebx],ax
-skip16:
- add esi,2
- add ebx,2
-
- dec ecx
- jnz secondloop16
-end16:
- emms
- }
- }
- else /* mmx not supported - use modified C routine */
- {
- register unsigned int incr1, initial_val, final_val;
- png_size_t pixel_bytes;
- png_uint_32 i;
- register int disp = png_pass_inc[png_ptr->pass];
- int offset_table[7] = {0, 4, 0, 2, 0, 1, 0};
-
- pixel_bytes = (png_ptr->row_info.pixel_depth >> 3);
- srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]*
- pixel_bytes;
- dstptr = row + offset_table[png_ptr->pass]*pixel_bytes;
- initial_val = offset_table[png_ptr->pass]*pixel_bytes;
- final_val = png_ptr->width*pixel_bytes;
- incr1 = (disp)*pixel_bytes;
- for (i = initial_val; i < final_val; i += incr1)
- {
- png_memcpy(dstptr, srcptr, pixel_bytes);
- srcptr += incr1;
- dstptr += incr1;
- }
- } /* end of else */
-
- break;
- } // end 16 bpp
-
- case 24:
- {
- png_bytep srcptr;
- png_bytep dstptr;
- png_uint_32 len;
- int unmask, diff;
-
- __int64 mask2=0x0101010202020404, //24bpp
- mask1=0x0408080810101020,
- mask0=0x2020404040808080;
-
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
-
- unmask = ~mask;
- len = (png_ptr->width)&~7;
- diff = (png_ptr->width)&7;
-
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && mmx_supported */ )
-#else
- if (mmx_supported)
-#endif
- {
- _asm
- {
- movd mm7, unmask //load bit pattern
- psubb mm6,mm6 //zero mm6
- punpcklbw mm7,mm7
- punpcklwd mm7,mm7
- punpckldq mm7,mm7 //fill register with 8 masks
-
- movq mm0,mask0
- movq mm1,mask1
- movq mm2,mask2
-
- pand mm0,mm7
- pand mm1,mm7
- pand mm2,mm7
-
- pcmpeqb mm0,mm6
- pcmpeqb mm1,mm6
- pcmpeqb mm2,mm6
-
- mov ecx,len //load length of line
- mov esi,srcptr //load source
- mov ebx,dstptr //load dest
- cmp ecx,0
- jz mainloop24end
-
-mainloop24:
- movq mm4,[esi]
- pand mm4,mm0
- movq mm6,mm0
- movq mm7,[ebx]
- pandn mm6,mm7
- por mm4,mm6
- movq [ebx],mm4
-
-
- movq mm5,[esi+8]
- pand mm5,mm1
- movq mm7,mm1
- movq mm6,[ebx+8]
- pandn mm7,mm6
- por mm5,mm7
- movq [ebx+8],mm5
-
- movq mm6,[esi+16]
- pand mm6,mm2
- movq mm4,mm2
- movq mm7,[ebx+16]
- pandn mm4,mm7
- por mm6,mm4
- movq [ebx+16],mm6
-
- add esi,24 //inc by 24 bytes processed
- add ebx,24
- sub ecx,8 //dec by 8 pixels processed
-
- ja mainloop24
-
-mainloop24end:
- mov ecx,diff
- cmp ecx,0
- jz end24
-
- mov edx,mask
- sal edx,24 //make low byte the high byte
-secondloop24:
- sal edx,1 //move high bit to CF
- jnc skip24 //if CF = 0
- mov ax,[esi]
- mov [ebx],ax
- xor eax,eax
- mov al,[esi+2]
- mov [ebx+2],al
-skip24:
- add esi,3
- add ebx,3
-
- dec ecx
- jnz secondloop24
-
-end24:
- emms
- }
- }
- else /* mmx not supported - use modified C routine */
- {
- register unsigned int incr1, initial_val, final_val;
- png_size_t pixel_bytes;
- png_uint_32 i;
- register int disp = png_pass_inc[png_ptr->pass];
- int offset_table[7] = {0, 4, 0, 2, 0, 1, 0};
-
- pixel_bytes = (png_ptr->row_info.pixel_depth >> 3);
- srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]*
- pixel_bytes;
- dstptr = row + offset_table[png_ptr->pass]*pixel_bytes;
- initial_val = offset_table[png_ptr->pass]*pixel_bytes;
- final_val = png_ptr->width*pixel_bytes;
- incr1 = (disp)*pixel_bytes;
- for (i = initial_val; i < final_val; i += incr1)
- {
- png_memcpy(dstptr, srcptr, pixel_bytes);
- srcptr += incr1;
- dstptr += incr1;
- }
- } /* end of else */
-
- break;
- } // end 24 bpp
-
- case 32:
- {
- png_bytep srcptr;
- png_bytep dstptr;
- png_uint_32 len;
- int unmask, diff;
-
- __int64 mask3=0x0101010102020202, //32bpp
- mask2=0x0404040408080808,
- mask1=0x1010101020202020,
- mask0=0x4040404080808080;
-
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
-
- unmask = ~mask;
- len = (png_ptr->width)&~7;
- diff = (png_ptr->width)&7;
-
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && mmx_supported */ )
-#else
- if (mmx_supported)
-#endif
- {
- _asm
- {
- movd mm7, unmask //load bit pattern
- psubb mm6,mm6 //zero mm6
- punpcklbw mm7,mm7
- punpcklwd mm7,mm7
- punpckldq mm7,mm7 //fill register with 8 masks
-
- movq mm0,mask0
- movq mm1,mask1
- movq mm2,mask2
- movq mm3,mask3
-
- pand mm0,mm7
- pand mm1,mm7
- pand mm2,mm7
- pand mm3,mm7
-
- pcmpeqb mm0,mm6
- pcmpeqb mm1,mm6
- pcmpeqb mm2,mm6
- pcmpeqb mm3,mm6
-
- mov ecx,len //load length of line
- mov esi,srcptr //load source
- mov ebx,dstptr //load dest
-
- cmp ecx,0 //lcr
- jz mainloop32end
-
-mainloop32:
- movq mm4,[esi]
- pand mm4,mm0
- movq mm6,mm0
- movq mm7,[ebx]
- pandn mm6,mm7
- por mm4,mm6
- movq [ebx],mm4
-
- movq mm5,[esi+8]
- pand mm5,mm1
- movq mm7,mm1
- movq mm6,[ebx+8]
- pandn mm7,mm6
- por mm5,mm7
- movq [ebx+8],mm5
-
- movq mm6,[esi+16]
- pand mm6,mm2
- movq mm4,mm2
- movq mm7,[ebx+16]
- pandn mm4,mm7
- por mm6,mm4
- movq [ebx+16],mm6
-
- movq mm7,[esi+24]
- pand mm7,mm3
- movq mm5,mm3
- movq mm4,[ebx+24]
- pandn mm5,mm4
- por mm7,mm5
- movq [ebx+24],mm7
-
- add esi,32 //inc by 32 bytes processed
- add ebx,32
- sub ecx,8 //dec by 8 pixels processed
-
- ja mainloop32
-
-mainloop32end:
- mov ecx,diff
- cmp ecx,0
- jz end32
-
- mov edx,mask
- sal edx,24 //make low byte the high byte
-secondloop32:
- sal edx,1 //move high bit to CF
- jnc skip32 //if CF = 0
- mov eax,[esi]
- mov [ebx],eax
-skip32:
- add esi,4
- add ebx,4
-
- dec ecx
- jnz secondloop32
-
-end32:
- emms
- }
- }
- else /* mmx _not supported - Use modified C routine */
- {
- register unsigned int incr1, initial_val, final_val;
- png_size_t pixel_bytes;
- png_uint_32 i;
- register int disp = png_pass_inc[png_ptr->pass];
- int offset_table[7] = {0, 4, 0, 2, 0, 1, 0};
-
- pixel_bytes = (png_ptr->row_info.pixel_depth >> 3);
- srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]*
- pixel_bytes;
- dstptr = row + offset_table[png_ptr->pass]*pixel_bytes;
- initial_val = offset_table[png_ptr->pass]*pixel_bytes;
- final_val = png_ptr->width*pixel_bytes;
- incr1 = (disp)*pixel_bytes;
- for (i = initial_val; i < final_val; i += incr1)
- {
- png_memcpy(dstptr, srcptr, pixel_bytes);
- srcptr += incr1;
- dstptr += incr1;
- }
- } /* end of else */
-
- break;
- } // end 32 bpp
-
- case 48:
- {
- png_bytep srcptr;
- png_bytep dstptr;
- png_uint_32 len;
- int unmask, diff;
-
- __int64 mask5=0x0101010101010202,
- mask4=0x0202020204040404,
- mask3=0x0404080808080808,
- mask2=0x1010101010102020,
- mask1=0x2020202040404040,
- mask0=0x4040808080808080;
-
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
- /* && mmx_supported */ )
-#else
- if (mmx_supported)
-#endif
- {
- srcptr = png_ptr->row_buf + 1;
- dstptr = row;
-
- unmask = ~mask;
- len = (png_ptr->width)&~7;
- diff = (png_ptr->width)&7;
- _asm
- {
- movd mm7, unmask //load bit pattern
- psubb mm6,mm6 //zero mm6
- punpcklbw mm7,mm7
- punpcklwd mm7,mm7
- punpckldq mm7,mm7 //fill register with 8 masks
-
- movq mm0,mask0
- movq mm1,mask1
- movq mm2,mask2
- movq mm3,mask3
- movq mm4,mask4
- movq mm5,mask5
-
- pand mm0,mm7
- pand mm1,mm7
- pand mm2,mm7
- pand mm3,mm7
- pand mm4,mm7
- pand mm5,mm7
-
- pcmpeqb mm0,mm6
- pcmpeqb mm1,mm6
- pcmpeqb mm2,mm6
- pcmpeqb mm3,mm6
- pcmpeqb mm4,mm6
- pcmpeqb mm5,mm6
-
- mov ecx,len //load length of line
- mov esi,srcptr //load source
- mov ebx,dstptr //load dest
-
- cmp ecx,0
- jz mainloop48end
-
-mainloop48:
- movq mm7,[esi]
- pand mm7,mm0
- movq mm6,mm0
- pandn mm6,[ebx]
- por mm7,mm6
- movq [ebx],mm7
-
- movq mm6,[esi+8]
- pand mm6,mm1
- movq mm7,mm1
- pandn mm7,[ebx+8]
- por mm6,mm7
- movq [ebx+8],mm6
-
- movq mm6,[esi+16]
- pand mm6,mm2
- movq mm7,mm2
- pandn mm7,[ebx+16]
- por mm6,mm7
- movq [ebx+16],mm6
-
- movq mm7,[esi+24]
- pand mm7,mm3
- movq mm6,mm3
- pandn mm6,[ebx+24]
- por mm7,mm6
- movq [ebx+24],mm7
-
- movq mm6,[esi+32]
- pand mm6,mm4
- movq mm7,mm4
- pandn mm7,[ebx+32]
- por mm6,mm7
- movq [ebx+32],mm6
-
- movq mm7,[esi+40]
- pand mm7,mm5
- movq mm6,mm5
- pandn mm6,[ebx+40]
- por mm7,mm6
- movq [ebx+40],mm7
-
- add esi,48 //inc by 32 bytes processed
- add ebx,48
- sub ecx,8 //dec by 8 pixels processed
-
- ja mainloop48
-mainloop48end:
-
- mov ecx,diff
- cmp ecx,0
- jz end48
-
- mov edx,mask
- sal edx,24 //make low byte the high byte
-
-secondloop48:
- sal edx,1 //move high bit to CF
- jnc skip48 //if CF = 0
- mov eax,[esi]
- mov [ebx],eax
-skip48:
- add esi,4
- add ebx,4
-
- dec ecx
- jnz secondloop48
-
-end48:
- emms
- }
- }
- else /* mmx _not supported - Use modified C routine */
- {
- register unsigned int incr1, initial_val, final_val;
- png_size_t pixel_bytes;
- png_uint_32 i;
- register int disp = png_pass_inc[png_ptr->pass];
- int offset_table[7] = {0, 4, 0, 2, 0, 1, 0};
-
- pixel_bytes = (png_ptr->row_info.pixel_depth >> 3);
- srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]*
- pixel_bytes;
- dstptr = row + offset_table[png_ptr->pass]*pixel_bytes;
- initial_val = offset_table[png_ptr->pass]*pixel_bytes;
- final_val = png_ptr->width*pixel_bytes;
- incr1 = (disp)*pixel_bytes;
- for (i = initial_val; i < final_val; i += incr1)
- {
- png_memcpy(dstptr, srcptr, pixel_bytes);
- srcptr += incr1;
- dstptr += incr1;
- }
- } /* end of else */
-
- break;
- } // end 48 bpp
-
- default:
- {
- png_bytep sptr;
- png_bytep dp;
- png_size_t pixel_bytes;
- int offset_table[7] = {0, 4, 0, 2, 0, 1, 0};
- unsigned int i;
- register int disp = png_pass_inc[png_ptr->pass]; // get the offset
- register unsigned int incr1, initial_val, final_val;
-
- pixel_bytes = (png_ptr->row_info.pixel_depth >> 3);
- sptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]*
- pixel_bytes;
- dp = row + offset_table[png_ptr->pass]*pixel_bytes;
- initial_val = offset_table[png_ptr->pass]*pixel_bytes;
- final_val = png_ptr->width*pixel_bytes;
- incr1 = (disp)*pixel_bytes;
- for (i = initial_val; i < final_val; i += incr1)
- {
- png_memcpy(dp, sptr, pixel_bytes);
- sptr += incr1;
- dp += incr1;
- }
- break;
- }
- } /* end switch (png_ptr->row_info.pixel_depth) */
- } /* end if (non-trivial mask) */
-
-} /* end png_combine_row() */
-
-
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
-
-void /* PRIVATE */
-png_do_read_interlace(png_structp png_ptr)
-{
- png_row_infop row_info = &(png_ptr->row_info);
- png_bytep row = png_ptr->row_buf + 1;
- int pass = png_ptr->pass;
- png_uint_32 transformations = png_ptr->transformations;
-#ifdef PNG_USE_LOCAL_ARRAYS
- const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-#endif
-
- png_debug(1,"in png_do_read_interlace\n");
-
- if (mmx_supported == 2) {
-#if !defined(PNG_1_0_X)
- /* this should have happened in png_init_mmx_flags() already */
- png_warning(png_ptr, "asm_flags may not have been initialized");
-#endif
- png_mmx_support();
- }
-
- if (row != NULL && row_info != NULL)
- {
- png_uint_32 final_width;
-
- final_width = row_info->width * png_pass_inc[pass];
-
- switch (row_info->pixel_depth)
- {
- case 1:
- {
- png_bytep sp, dp;
- int sshift, dshift;
- int s_start, s_end, s_inc;
- png_byte v;
- png_uint_32 i;
- int j;
-
- sp = row + (png_size_t)((row_info->width - 1) >> 3);
- dp = row + (png_size_t)((final_width - 1) >> 3);
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (transformations & PNG_PACKSWAP)
- {
- sshift = (int)((row_info->width + 7) & 7);
- dshift = (int)((final_width + 7) & 7);
- s_start = 7;
- s_end = 0;
- s_inc = -1;
- }
- else
-#endif
- {
- sshift = 7 - (int)((row_info->width + 7) & 7);
- dshift = 7 - (int)((final_width + 7) & 7);
- s_start = 0;
- s_end = 7;
- s_inc = 1;
- }
-
- for (i = row_info->width; i; i--)
- {
- v = (png_byte)((*sp >> sshift) & 0x1);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff);
- *dp |= (png_byte)(v << dshift);
- if (dshift == s_end)
- {
- dshift = s_start;
- dp--;
- }
- else
- dshift += s_inc;
- }
- if (sshift == s_end)
- {
- sshift = s_start;
- sp--;
- }
- else
- sshift += s_inc;
- }
- break;
- }
-
- case 2:
- {
- png_bytep sp, dp;
- int sshift, dshift;
- int s_start, s_end, s_inc;
- png_uint_32 i;
-
- sp = row + (png_size_t)((row_info->width - 1) >> 2);
- dp = row + (png_size_t)((final_width - 1) >> 2);
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (transformations & PNG_PACKSWAP)
- {
- sshift = (png_size_t)(((row_info->width + 3) & 3) << 1);
- dshift = (png_size_t)(((final_width + 3) & 3) << 1);
- s_start = 6;
- s_end = 0;
- s_inc = -2;
- }
- else
-#endif
- {
- sshift = (png_size_t)((3 - ((row_info->width + 3) & 3)) << 1);
- dshift = (png_size_t)((3 - ((final_width + 3) & 3)) << 1);
- s_start = 0;
- s_end = 6;
- s_inc = 2;
- }
-
- for (i = row_info->width; i; i--)
- {
- png_byte v;
- int j;
-
- v = (png_byte)((*sp >> sshift) & 0x3);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff);
- *dp |= (png_byte)(v << dshift);
- if (dshift == s_end)
- {
- dshift = s_start;
- dp--;
- }
- else
- dshift += s_inc;
- }
- if (sshift == s_end)
- {
- sshift = s_start;
- sp--;
- }
- else
- sshift += s_inc;
- }
- break;
- }
-
- case 4:
- {
- png_bytep sp, dp;
- int sshift, dshift;
- int s_start, s_end, s_inc;
- png_uint_32 i;
-
- sp = row + (png_size_t)((row_info->width - 1) >> 1);
- dp = row + (png_size_t)((final_width - 1) >> 1);
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
- if (transformations & PNG_PACKSWAP)
- {
- sshift = (png_size_t)(((row_info->width + 1) & 1) << 2);
- dshift = (png_size_t)(((final_width + 1) & 1) << 2);
- s_start = 4;
- s_end = 0;
- s_inc = -4;
- }
- else
-#endif
- {
- sshift = (png_size_t)((1 - ((row_info->width + 1) & 1)) << 2);
- dshift = (png_size_t)((1 - ((final_width + 1) & 1)) << 2);
- s_start = 0;
- s_end = 4;
- s_inc = 4;
- }
-
- for (i = row_info->width; i; i--)
- {
- png_byte v;
- int j;
-
- v = (png_byte)((*sp >> sshift) & 0xf);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff);
- *dp |= (png_byte)(v << dshift);
- if (dshift == s_end)
- {
- dshift = s_start;
- dp--;
- }
- else
- dshift += s_inc;
- }
- if (sshift == s_end)
- {
- sshift = s_start;
- sp--;
- }
- else
- sshift += s_inc;
- }
- break;
- }
-
- default: // This is the place where the routine is modified
- {
- __int64 const4 = 0x0000000000FFFFFF;
- // __int64 const5 = 0x000000FFFFFF0000; // unused...
- __int64 const6 = 0x00000000000000FF;
- png_bytep sptr, dp;
- png_uint_32 i;
- png_size_t pixel_bytes;
- int width = row_info->width;
-
- pixel_bytes = (row_info->pixel_depth >> 3);
-
- sptr = row + (width - 1) * pixel_bytes;
- dp = row + (final_width - 1) * pixel_bytes;
- // New code by Nirav Chhatrapati - Intel Corporation
- // sign fix by GRR
- // NOTE: there is NO MMX code for 48-bit and 64-bit images
-
- // use MMX routine if machine supports it
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)
- /* && mmx_supported */ )
-#else
- if (mmx_supported)
-#endif
- {
- if (pixel_bytes == 3)
- {
- if (((pass == 0) || (pass == 1)) && width)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width
- sub edi, 21 // (png_pass_inc[pass] - 1)*pixel_bytes
-loop_pass0:
- movd mm0, [esi] ; X X X X X v2 v1 v0
- pand mm0, const4 ; 0 0 0 0 0 v2 v1 v0
- movq mm1, mm0 ; 0 0 0 0 0 v2 v1 v0
- psllq mm0, 16 ; 0 0 0 v2 v1 v0 0 0
- movq mm2, mm0 ; 0 0 0 v2 v1 v0 0 0
- psllq mm0, 24 ; v2 v1 v0 0 0 0 0 0
- psrlq mm1, 8 ; 0 0 0 0 0 0 v2 v1
- por mm0, mm2 ; v2 v1 v0 v2 v1 v0 0 0
- por mm0, mm1 ; v2 v1 v0 v2 v1 v0 v2 v1
- movq mm3, mm0 ; v2 v1 v0 v2 v1 v0 v2 v1
- psllq mm0, 16 ; v0 v2 v1 v0 v2 v1 0 0
- movq mm4, mm3 ; v2 v1 v0 v2 v1 v0 v2 v1
- punpckhdq mm3, mm0 ; v0 v2 v1 v0 v2 v1 v0 v2
- movq [edi+16] , mm4
- psrlq mm0, 32 ; 0 0 0 0 v0 v2 v1 v0
- movq [edi+8] , mm3
- punpckldq mm0, mm4 ; v1 v0 v2 v1 v0 v2 v1 v0
- sub esi, 3
- movq [edi], mm0
- sub edi, 24
- //sub esi, 3
- dec ecx
- jnz loop_pass0
- EMMS
- }
- }
- else if (((pass == 2) || (pass == 3)) && width)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width
- sub edi, 9 // (png_pass_inc[pass] - 1)*pixel_bytes
-loop_pass2:
- movd mm0, [esi] ; X X X X X v2 v1 v0
- pand mm0, const4 ; 0 0 0 0 0 v2 v1 v0
- movq mm1, mm0 ; 0 0 0 0 0 v2 v1 v0
- psllq mm0, 16 ; 0 0 0 v2 v1 v0 0 0
- movq mm2, mm0 ; 0 0 0 v2 v1 v0 0 0
- psllq mm0, 24 ; v2 v1 v0 0 0 0 0 0
- psrlq mm1, 8 ; 0 0 0 0 0 0 v2 v1
- por mm0, mm2 ; v2 v1 v0 v2 v1 v0 0 0
- por mm0, mm1 ; v2 v1 v0 v2 v1 v0 v2 v1
- movq [edi+4], mm0 ; move to memory
- psrlq mm0, 16 ; 0 0 v2 v1 v0 v2 v1 v0
- movd [edi], mm0 ; move to memory
- sub esi, 3
- sub edi, 12
- dec ecx
- jnz loop_pass2
- EMMS
- }
- }
- else if (width) /* && ((pass == 4) || (pass == 5)) */
- {
- int width_mmx = ((width >> 1) << 1) - 8;
- if (width_mmx < 0)
- width_mmx = 0;
- width -= width_mmx; // 8 or 9 pix, 24 or 27 bytes
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub esi, 3
- sub edi, 9
-loop_pass4:
- movq mm0, [esi] ; X X v2 v1 v0 v5 v4 v3
- movq mm7, mm0 ; X X v2 v1 v0 v5 v4 v3
- movq mm6, mm0 ; X X v2 v1 v0 v5 v4 v3
- psllq mm0, 24 ; v1 v0 v5 v4 v3 0 0 0
- pand mm7, const4 ; 0 0 0 0 0 v5 v4 v3
- psrlq mm6, 24 ; 0 0 0 X X v2 v1 v0
- por mm0, mm7 ; v1 v0 v5 v4 v3 v5 v4 v3
- movq mm5, mm6 ; 0 0 0 X X v2 v1 v0
- psllq mm6, 8 ; 0 0 X X v2 v1 v0 0
- movq [edi], mm0 ; move quad to memory
- psrlq mm5, 16 ; 0 0 0 0 0 X X v2
- pand mm5, const6 ; 0 0 0 0 0 0 0 v2
- por mm6, mm5 ; 0 0 X X v2 v1 v0 v2
- movd [edi+8], mm6 ; move double to memory
- sub esi, 6
- sub edi, 12
- sub ecx, 2
- jnz loop_pass4
- EMMS
- }
- }
-
- sptr -= width_mmx*3;
- dp -= width_mmx*6;
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
-
- png_memcpy(v, sptr, 3);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, 3);
- dp -= 3;
- }
- sptr -= 3;
- }
- }
- } /* end of pixel_bytes == 3 */
-
- else if (pixel_bytes == 1)
- {
- if (((pass == 0) || (pass == 1)) && width)
- {
- int width_mmx = ((width >> 2) << 2);
- width -= width_mmx;
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub edi, 31
- sub esi, 3
-loop1_pass0:
- movd mm0, [esi] ; X X X X v0 v1 v2 v3
- movq mm1, mm0 ; X X X X v0 v1 v2 v3
- punpcklbw mm0, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3
- movq mm2, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3
- punpcklwd mm0, mm0 ; v2 v2 v2 v2 v3 v3 v3 v3
- movq mm3, mm0 ; v2 v2 v2 v2 v3 v3 v3 v3
- punpckldq mm0, mm0 ; v3 v3 v3 v3 v3 v3 v3 v3
- punpckhdq mm3, mm3 ; v2 v2 v2 v2 v2 v2 v2 v2
- movq [edi], mm0 ; move to memory v3
- punpckhwd mm2, mm2 ; v0 v0 v0 v0 v1 v1 v1 v1
- movq [edi+8], mm3 ; move to memory v2
- movq mm4, mm2 ; v0 v0 v0 v0 v1 v1 v1 v1
- punpckldq mm2, mm2 ; v1 v1 v1 v1 v1 v1 v1 v1
- punpckhdq mm4, mm4 ; v0 v0 v0 v0 v0 v0 v0 v0
- movq [edi+16], mm2 ; move to memory v1
- movq [edi+24], mm4 ; move to memory v0
- sub esi, 4
- sub edi, 32
- sub ecx, 4
- jnz loop1_pass0
- EMMS
- }
- }
-
- sptr -= width_mmx;
- dp -= width_mmx*8;
- for (i = width; i; i--)
- {
- int j;
-
- /* I simplified this part in version 1.0.4e
- * here and in several other instances where
- * pixel_bytes == 1 -- GR-P
- *
- * Original code:
- *
- * png_byte v[8];
- * png_memcpy(v, sptr, pixel_bytes);
- * for (j = 0; j < png_pass_inc[pass]; j++)
- * {
- * png_memcpy(dp, v, pixel_bytes);
- * dp -= pixel_bytes;
- * }
- * sptr -= pixel_bytes;
- *
- * Replacement code is in the next three lines:
- */
-
- for (j = 0; j < png_pass_inc[pass]; j++)
- *dp-- = *sptr;
- sptr--;
- }
- }
- else if (((pass == 2) || (pass == 3)) && width)
- {
- int width_mmx = ((width >> 2) << 2);
- width -= width_mmx;
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub edi, 15
- sub esi, 3
-loop1_pass2:
- movd mm0, [esi] ; X X X X v0 v1 v2 v3
- punpcklbw mm0, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3
- movq mm1, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3
- punpcklwd mm0, mm0 ; v2 v2 v2 v2 v3 v3 v3 v3
- punpckhwd mm1, mm1 ; v0 v0 v0 v0 v1 v1 v1 v1
- movq [edi], mm0 ; move to memory v2 and v3
- sub esi, 4
- movq [edi+8], mm1 ; move to memory v1 and v0
- sub edi, 16
- sub ecx, 4
- jnz loop1_pass2
- EMMS
- }
- }
-
- sptr -= width_mmx;
- dp -= width_mmx*4;
- for (i = width; i; i--)
- {
- int j;
-
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp-- = *sptr;
- }
- sptr --;
- }
- }
- else if (width) /* && ((pass == 4) || (pass == 5))) */
- {
- int width_mmx = ((width >> 3) << 3);
- width -= width_mmx;
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub edi, 15
- sub esi, 7
-loop1_pass4:
- movq mm0, [esi] ; v0 v1 v2 v3 v4 v5 v6 v7
- movq mm1, mm0 ; v0 v1 v2 v3 v4 v5 v6 v7
- punpcklbw mm0, mm0 ; v4 v4 v5 v5 v6 v6 v7 v7
- //movq mm1, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3
- punpckhbw mm1, mm1 ;v0 v0 v1 v1 v2 v2 v3 v3
- movq [edi+8], mm1 ; move to memory v0 v1 v2 and v3
- sub esi, 8
- movq [edi], mm0 ; move to memory v4 v5 v6 and v7
- //sub esi, 4
- sub edi, 16
- sub ecx, 8
- jnz loop1_pass4
- EMMS
- }
- }
-
- sptr -= width_mmx;
- dp -= width_mmx*2;
- for (i = width; i; i--)
- {
- int j;
-
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- *dp-- = *sptr;
- }
- sptr --;
- }
- }
- } /* end of pixel_bytes == 1 */
-
- else if (pixel_bytes == 2)
- {
- if (((pass == 0) || (pass == 1)) && width)
- {
- int width_mmx = ((width >> 1) << 1);
- width -= width_mmx;
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub esi, 2
- sub edi, 30
-loop2_pass0:
- movd mm0, [esi] ; X X X X v1 v0 v3 v2
- punpcklwd mm0, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2
- movq mm1, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2
- punpckldq mm0, mm0 ; v3 v2 v3 v2 v3 v2 v3 v2
- punpckhdq mm1, mm1 ; v1 v0 v1 v0 v1 v0 v1 v0
- movq [edi], mm0
- movq [edi + 8], mm0
- movq [edi + 16], mm1
- movq [edi + 24], mm1
- sub esi, 4
- sub edi, 32
- sub ecx, 2
- jnz loop2_pass0
- EMMS
- }
- }
-
- sptr -= (width_mmx*2 - 2); // sign fixed
- dp -= (width_mmx*16 - 2); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 2;
- png_memcpy(v, sptr, 2);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 2;
- png_memcpy(dp, v, 2);
- }
- }
- }
- else if (((pass == 2) || (pass == 3)) && width)
- {
- int width_mmx = ((width >> 1) << 1) ;
- width -= width_mmx;
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub esi, 2
- sub edi, 14
-loop2_pass2:
- movd mm0, [esi] ; X X X X v1 v0 v3 v2
- punpcklwd mm0, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2
- movq mm1, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2
- punpckldq mm0, mm0 ; v3 v2 v3 v2 v3 v2 v3 v2
- punpckhdq mm1, mm1 ; v1 v0 v1 v0 v1 v0 v1 v0
- movq [edi], mm0
- sub esi, 4
- movq [edi + 8], mm1
- //sub esi, 4
- sub edi, 16
- sub ecx, 2
- jnz loop2_pass2
- EMMS
- }
- }
-
- sptr -= (width_mmx*2 - 2); // sign fixed
- dp -= (width_mmx*8 - 2); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 2;
- png_memcpy(v, sptr, 2);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 2;
- png_memcpy(dp, v, 2);
- }
- }
- }
- else if (width) // pass == 4 or 5
- {
- int width_mmx = ((width >> 1) << 1) ;
- width -= width_mmx;
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub esi, 2
- sub edi, 6
-loop2_pass4:
- movd mm0, [esi] ; X X X X v1 v0 v3 v2
- punpcklwd mm0, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2
- sub esi, 4
- movq [edi], mm0
- sub edi, 8
- sub ecx, 2
- jnz loop2_pass4
- EMMS
- }
- }
-
- sptr -= (width_mmx*2 - 2); // sign fixed
- dp -= (width_mmx*4 - 2); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 2;
- png_memcpy(v, sptr, 2);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 2;
- png_memcpy(dp, v, 2);
- }
- }
- }
- } /* end of pixel_bytes == 2 */
-
- else if (pixel_bytes == 4)
- {
- if (((pass == 0) || (pass == 1)) && width)
- {
- int width_mmx = ((width >> 1) << 1) ;
- width -= width_mmx;
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub esi, 4
- sub edi, 60
-loop4_pass0:
- movq mm0, [esi] ; v3 v2 v1 v0 v7 v6 v5 v4
- movq mm1, mm0 ; v3 v2 v1 v0 v7 v6 v5 v4
- punpckldq mm0, mm0 ; v7 v6 v5 v4 v7 v6 v5 v4
- punpckhdq mm1, mm1 ; v3 v2 v1 v0 v3 v2 v1 v0
- movq [edi], mm0
- movq [edi + 8], mm0
- movq [edi + 16], mm0
- movq [edi + 24], mm0
- movq [edi+32], mm1
- movq [edi + 40], mm1
- movq [edi+ 48], mm1
- sub esi, 8
- movq [edi + 56], mm1
- sub edi, 64
- sub ecx, 2
- jnz loop4_pass0
- EMMS
- }
- }
-
- sptr -= (width_mmx*4 - 4); // sign fixed
- dp -= (width_mmx*32 - 4); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 4;
- png_memcpy(v, sptr, 4);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 4;
- png_memcpy(dp, v, 4);
- }
- }
- }
- else if (((pass == 2) || (pass == 3)) && width)
- {
- int width_mmx = ((width >> 1) << 1) ;
- width -= width_mmx;
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub esi, 4
- sub edi, 28
-loop4_pass2:
- movq mm0, [esi] ; v3 v2 v1 v0 v7 v6 v5 v4
- movq mm1, mm0 ; v3 v2 v1 v0 v7 v6 v5 v4
- punpckldq mm0, mm0 ; v7 v6 v5 v4 v7 v6 v5 v4
- punpckhdq mm1, mm1 ; v3 v2 v1 v0 v3 v2 v1 v0
- movq [edi], mm0
- movq [edi + 8], mm0
- movq [edi+16], mm1
- movq [edi + 24], mm1
- sub esi, 8
- sub edi, 32
- sub ecx, 2
- jnz loop4_pass2
- EMMS
- }
- }
-
- sptr -= (width_mmx*4 - 4); // sign fixed
- dp -= (width_mmx*16 - 4); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 4;
- png_memcpy(v, sptr, 4);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 4;
- png_memcpy(dp, v, 4);
- }
- }
- }
- else if (width) // pass == 4 or 5
- {
- int width_mmx = ((width >> 1) << 1) ;
- width -= width_mmx;
- if (width_mmx)
- {
- _asm
- {
- mov esi, sptr
- mov edi, dp
- mov ecx, width_mmx
- sub esi, 4
- sub edi, 12
-loop4_pass4:
- movq mm0, [esi] ; v3 v2 v1 v0 v7 v6 v5 v4
- movq mm1, mm0 ; v3 v2 v1 v0 v7 v6 v5 v4
- punpckldq mm0, mm0 ; v7 v6 v5 v4 v7 v6 v5 v4
- punpckhdq mm1, mm1 ; v3 v2 v1 v0 v3 v2 v1 v0
- movq [edi], mm0
- sub esi, 8
- movq [edi + 8], mm1
- sub edi, 16
- sub ecx, 2
- jnz loop4_pass4
- EMMS
- }
- }
-
- sptr -= (width_mmx*4 - 4); // sign fixed
- dp -= (width_mmx*8 - 4); // sign fixed
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- sptr -= 4;
- png_memcpy(v, sptr, 4);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- dp -= 4;
- png_memcpy(dp, v, 4);
- }
- }
- }
-
- } /* end of pixel_bytes == 4 */
-
- else if (pixel_bytes == 6)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, 6);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, 6);
- dp -= 6;
- }
- sptr -= 6;
- }
- } /* end of pixel_bytes == 6 */
-
- else
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, pixel_bytes);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, pixel_bytes);
- dp -= pixel_bytes;
- }
- sptr-= pixel_bytes;
- }
- }
- } /* end of mmx_supported */
-
- else /* MMX not supported: use modified C code - takes advantage
- * of inlining of memcpy for a constant */
- {
- if (pixel_bytes == 1)
- {
- for (i = width; i; i--)
- {
- int j;
- for (j = 0; j < png_pass_inc[pass]; j++)
- *dp-- = *sptr;
- sptr--;
- }
- }
- else if (pixel_bytes == 3)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, pixel_bytes);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, pixel_bytes);
- dp -= pixel_bytes;
- }
- sptr -= pixel_bytes;
- }
- }
- else if (pixel_bytes == 2)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, pixel_bytes);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, pixel_bytes);
- dp -= pixel_bytes;
- }
- sptr -= pixel_bytes;
- }
- }
- else if (pixel_bytes == 4)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, pixel_bytes);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, pixel_bytes);
- dp -= pixel_bytes;
- }
- sptr -= pixel_bytes;
- }
- }
- else if (pixel_bytes == 6)
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, pixel_bytes);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, pixel_bytes);
- dp -= pixel_bytes;
- }
- sptr -= pixel_bytes;
- }
- }
- else
- {
- for (i = width; i; i--)
- {
- png_byte v[8];
- int j;
- png_memcpy(v, sptr, pixel_bytes);
- for (j = 0; j < png_pass_inc[pass]; j++)
- {
- png_memcpy(dp, v, pixel_bytes);
- dp -= pixel_bytes;
- }
- sptr -= pixel_bytes;
- }
- }
-
- } /* end of MMX not supported */
- break;
- }
- } /* end switch (row_info->pixel_depth) */
-
- row_info->width = final_width;
-
- row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width);
- }
-
-}
-
-#endif /* PNG_READ_INTERLACING_SUPPORTED */
-
-
-// These variables are utilized in the functions below. They are declared
-// globally here to ensure alignment on 8-byte boundaries.
-
-union uAll {
- __int64 use;
- double align;
-} LBCarryMask = {0x0101010101010101},
- HBClearMask = {0x7f7f7f7f7f7f7f7f},
- ActiveMask, ActiveMask2, ActiveMaskEnd, ShiftBpp, ShiftRem;
-
-
-// Optimized code for PNG Average filter decoder
-void /* PRIVATE */
-png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row
- , png_bytep prev_row)
-{
- int bpp;
- png_uint_32 FullLength;
- png_uint_32 MMXLength;
- //png_uint_32 len;
- int diff;
-
- bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel
- FullLength = row_info->rowbytes; // # of bytes to filter
- _asm {
- // Init address pointers and offset
- mov edi, row // edi ==> Avg(x)
- xor ebx, ebx // ebx ==> x
- mov edx, edi
- mov esi, prev_row // esi ==> Prior(x)
- sub edx, bpp // edx ==> Raw(x-bpp)
-
- xor eax, eax
- // Compute the Raw value for the first bpp bytes
- // Raw(x) = Avg(x) + (Prior(x)/2)
-davgrlp:
- mov al, [esi + ebx] // Load al with Prior(x)
- inc ebx
- shr al, 1 // divide by 2
- add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx
- cmp ebx, bpp
- mov [edi+ebx-1], al // Write back Raw(x);
- // mov does not affect flags; -1 to offset inc ebx
- jb davgrlp
- // get # of bytes to alignment
- mov diff, edi // take start of row
- add diff, ebx // add bpp
- add diff, 0xf // add 7 + 8 to incr past alignment boundary
- and diff, 0xfffffff8 // mask to alignment boundary
- sub diff, edi // subtract from start ==> value ebx at alignment
- jz davggo
- // fix alignment
- // Compute the Raw value for the bytes upto the alignment boundary
- // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2)
- xor ecx, ecx
-davglp1:
- xor eax, eax
- mov cl, [esi + ebx] // load cl with Prior(x)
- mov al, [edx + ebx] // load al with Raw(x-bpp)
- add ax, cx
- inc ebx
- shr ax, 1 // divide by 2
- add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx
- cmp ebx, diff // Check if at alignment boundary
- mov [edi+ebx-1], al // Write back Raw(x);
- // mov does not affect flags; -1 to offset inc ebx
- jb davglp1 // Repeat until at alignment boundary
-davggo:
- mov eax, FullLength
- mov ecx, eax
- sub eax, ebx // subtract alignment fix
- and eax, 0x00000007 // calc bytes over mult of 8
- sub ecx, eax // drop over bytes from original length
- mov MMXLength, ecx
- } // end _asm block
- // Now do the math for the rest of the row
- switch ( bpp )
- {
- case 3:
- {
- ActiveMask.use = 0x0000000000ffffff;
- ShiftBpp.use = 24; // == 3 * 8
- ShiftRem.use = 40; // == 64 - 24
- _asm {
- // Re-init address pointers and offset
- movq mm7, ActiveMask
- mov ebx, diff // ebx ==> x = offset to alignment boundary
- movq mm5, LBCarryMask
- mov edi, row // edi ==> Avg(x)
- movq mm4, HBClearMask
- mov esi, prev_row // esi ==> Prior(x)
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes
- // (we correct position in loop below)
-davg3lp:
- movq mm0, [edi + ebx] // Load mm0 with Avg(x)
- // Add (Prev_row/2) to Average
- movq mm3, mm5
- psrlq mm2, ShiftRem // Correct position Raw(x-bpp) data
- movq mm1, [esi + ebx] // Load mm1 with Prior(x)
- movq mm6, mm7
- pand mm3, mm1 // get lsb for each prev_row byte
- psrlq mm1, 1 // divide prev_row bytes by 2
- pand mm1, mm4 // clear invalid bit 7 of each byte
- paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte
- // Add 1st active group (Raw(x-bpp)/2) to Average with LBCarry
- movq mm1, mm3 // now use mm1 for getting LBCarrys
- pand mm1, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1 (Only valid for active group)
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte
- pand mm2, mm6 // Leave only Active Group 1 bytes to add to Avg
- paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active
- // byte
- // Add 2nd active group (Raw(x-bpp)/2) to Average with LBCarry
- psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 3-5
- movq mm2, mm0 // mov updated Raws to mm2
- psllq mm2, ShiftBpp // shift data to position correctly
- movq mm1, mm3 // now use mm1 for getting LBCarrys
- pand mm1, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1 (Only valid for active group)
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte
- pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg
- paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active
- // byte
-
- // Add 3rd active group (Raw(x-bpp)/2) to Average with LBCarry
- psllq mm6, ShiftBpp // shift the mm6 mask to cover the last two
- // bytes
- movq mm2, mm0 // mov updated Raws to mm2
- psllq mm2, ShiftBpp // shift data to position correctly
- // Data only needs to be shifted once here to
- // get the correct x-bpp offset.
- movq mm1, mm3 // now use mm1 for getting LBCarrys
- pand mm1, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1 (Only valid for active group)
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte
- pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg
- add ebx, 8
- paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active
- // byte
-
- // Now ready to write back to memory
- movq [edi + ebx - 8], mm0
- // Move updated Raw(x) to use as Raw(x-bpp) for next loop
- cmp ebx, MMXLength
- movq mm2, mm0 // mov updated Raw(x) to mm2
- jb davg3lp
- } // end _asm block
- }
- break;
-
- case 6:
- case 4:
- case 7:
- case 5:
- {
- ActiveMask.use = 0xffffffffffffffff; // use shift below to clear
- // appropriate inactive bytes
- ShiftBpp.use = bpp << 3;
- ShiftRem.use = 64 - ShiftBpp.use;
- _asm {
- movq mm4, HBClearMask
- // Re-init address pointers and offset
- mov ebx, diff // ebx ==> x = offset to alignment boundary
- // Load ActiveMask and clear all bytes except for 1st active group
- movq mm7, ActiveMask
- mov edi, row // edi ==> Avg(x)
- psrlq mm7, ShiftRem
- mov esi, prev_row // esi ==> Prior(x)
- movq mm6, mm7
- movq mm5, LBCarryMask
- psllq mm6, ShiftBpp // Create mask for 2nd active group
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes
- // (we correct position in loop below)
-davg4lp:
- movq mm0, [edi + ebx]
- psrlq mm2, ShiftRem // shift data to position correctly
- movq mm1, [esi + ebx]
- // Add (Prev_row/2) to Average
- movq mm3, mm5
- pand mm3, mm1 // get lsb for each prev_row byte
- psrlq mm1, 1 // divide prev_row bytes by 2
- pand mm1, mm4 // clear invalid bit 7 of each byte
- paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte
- // Add 1st active group (Raw(x-bpp)/2) to Average with LBCarry
- movq mm1, mm3 // now use mm1 for getting LBCarrys
- pand mm1, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1 (Only valid for active group)
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte
- pand mm2, mm7 // Leave only Active Group 1 bytes to add to Avg
- paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active
- // byte
- // Add 2nd active group (Raw(x-bpp)/2) to Average with LBCarry
- movq mm2, mm0 // mov updated Raws to mm2
- psllq mm2, ShiftBpp // shift data to position correctly
- add ebx, 8
- movq mm1, mm3 // now use mm1 for getting LBCarrys
- pand mm1, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1 (Only valid for active group)
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte
- pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg
- paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active
- // byte
- cmp ebx, MMXLength
- // Now ready to write back to memory
- movq [edi + ebx - 8], mm0
- // Prep Raw(x-bpp) for next loop
- movq mm2, mm0 // mov updated Raws to mm2
- jb davg4lp
- } // end _asm block
- }
- break;
- case 2:
- {
- ActiveMask.use = 0x000000000000ffff;
- ShiftBpp.use = 16; // == 2 * 8 [BUGFIX]
- ShiftRem.use = 48; // == 64 - 16 [BUGFIX]
- _asm {
- // Load ActiveMask
- movq mm7, ActiveMask
- // Re-init address pointers and offset
- mov ebx, diff // ebx ==> x = offset to alignment boundary
- movq mm5, LBCarryMask
- mov edi, row // edi ==> Avg(x)
- movq mm4, HBClearMask
- mov esi, prev_row // esi ==> Prior(x)
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes
- // (we correct position in loop below)
-davg2lp:
- movq mm0, [edi + ebx]
- psrlq mm2, ShiftRem // shift data to position correctly [BUGFIX]
- movq mm1, [esi + ebx]
- // Add (Prev_row/2) to Average
- movq mm3, mm5
- pand mm3, mm1 // get lsb for each prev_row byte
- psrlq mm1, 1 // divide prev_row bytes by 2
- pand mm1, mm4 // clear invalid bit 7 of each byte
- movq mm6, mm7
- paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte
- // Add 1st active group (Raw(x-bpp)/2) to Average with LBCarry
- movq mm1, mm3 // now use mm1 for getting LBCarrys
- pand mm1, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1 (Only valid for active group)
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte
- pand mm2, mm6 // Leave only Active Group 1 bytes to add to Avg
- paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte
- // Add 2nd active group (Raw(x-bpp)/2) to Average with LBCarry
- psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 2 & 3
- movq mm2, mm0 // mov updated Raws to mm2
- psllq mm2, ShiftBpp // shift data to position correctly
- movq mm1, mm3 // now use mm1 for getting LBCarrys
- pand mm1, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1 (Only valid for active group)
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte
- pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg
- paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte
-
- // Add rdd active group (Raw(x-bpp)/2) to Average with LBCarry
- psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 4 & 5
- movq mm2, mm0 // mov updated Raws to mm2
- psllq mm2, ShiftBpp // shift data to position correctly
- // Data only needs to be shifted once here to
- // get the correct x-bpp offset.
- movq mm1, mm3 // now use mm1 for getting LBCarrys
- pand mm1, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1 (Only valid for active group)
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte
- pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg
- paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte
-
- // Add 4th active group (Raw(x-bpp)/2) to Average with LBCarry
- psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 6 & 7
- movq mm2, mm0 // mov updated Raws to mm2
- psllq mm2, ShiftBpp // shift data to position correctly
- // Data only needs to be shifted once here to
- // get the correct x-bpp offset.
- add ebx, 8
- movq mm1, mm3 // now use mm1 for getting LBCarrys
- pand mm1, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1 (Only valid for active group)
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte
- pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg
- paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte
-
- cmp ebx, MMXLength
- // Now ready to write back to memory
- movq [edi + ebx - 8], mm0
- // Prep Raw(x-bpp) for next loop
- movq mm2, mm0 // mov updated Raws to mm2
- jb davg2lp
- } // end _asm block
- }
- break;
-
- case 1: // bpp == 1
- {
- _asm {
- // Re-init address pointers and offset
- mov ebx, diff // ebx ==> x = offset to alignment boundary
- mov edi, row // edi ==> Avg(x)
- cmp ebx, FullLength // Test if offset at end of array
- jnb davg1end
- // Do Paeth decode for remaining bytes
- mov esi, prev_row // esi ==> Prior(x)
- mov edx, edi
- xor ecx, ecx // zero ecx before using cl & cx in loop below
- sub edx, bpp // edx ==> Raw(x-bpp)
-davg1lp:
- // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2)
- xor eax, eax
- mov cl, [esi + ebx] // load cl with Prior(x)
- mov al, [edx + ebx] // load al with Raw(x-bpp)
- add ax, cx
- inc ebx
- shr ax, 1 // divide by 2
- add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx
- cmp ebx, FullLength // Check if at end of array
- mov [edi+ebx-1], al // Write back Raw(x);
- // mov does not affect flags; -1 to offset inc ebx
- jb davg1lp
-davg1end:
- } // end _asm block
- }
- return;
-
- case 8: // bpp == 8
- {
- _asm {
- // Re-init address pointers and offset
- mov ebx, diff // ebx ==> x = offset to alignment boundary
- movq mm5, LBCarryMask
- mov edi, row // edi ==> Avg(x)
- movq mm4, HBClearMask
- mov esi, prev_row // esi ==> Prior(x)
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes
- // (NO NEED to correct position in loop below)
-davg8lp:
- movq mm0, [edi + ebx]
- movq mm3, mm5
- movq mm1, [esi + ebx]
- add ebx, 8
- pand mm3, mm1 // get lsb for each prev_row byte
- psrlq mm1, 1 // divide prev_row bytes by 2
- pand mm3, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm1, mm4 // clear invalid bit 7 of each byte
- paddb mm0, mm3 // add LBCarrys to Avg for each byte
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte
- paddb mm0, mm2 // add (Raw/2) to Avg for each byte
- cmp ebx, MMXLength
- movq [edi + ebx - 8], mm0
- movq mm2, mm0 // reuse as Raw(x-bpp)
- jb davg8lp
- } // end _asm block
- }
- break;
- default: // bpp greater than 8
- {
- _asm {
- movq mm5, LBCarryMask
- // Re-init address pointers and offset
- mov ebx, diff // ebx ==> x = offset to alignment boundary
- mov edi, row // edi ==> Avg(x)
- movq mm4, HBClearMask
- mov edx, edi
- mov esi, prev_row // esi ==> Prior(x)
- sub edx, bpp // edx ==> Raw(x-bpp)
-davgAlp:
- movq mm0, [edi + ebx]
- movq mm3, mm5
- movq mm1, [esi + ebx]
- pand mm3, mm1 // get lsb for each prev_row byte
- movq mm2, [edx + ebx]
- psrlq mm1, 1 // divide prev_row bytes by 2
- pand mm3, mm2 // get LBCarrys for each byte where both
- // lsb's were == 1
- psrlq mm2, 1 // divide raw bytes by 2
- pand mm1, mm4 // clear invalid bit 7 of each byte
- paddb mm0, mm3 // add LBCarrys to Avg for each byte
- pand mm2, mm4 // clear invalid bit 7 of each byte
- paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte
- add ebx, 8
- paddb mm0, mm2 // add (Raw/2) to Avg for each byte
- cmp ebx, MMXLength
- movq [edi + ebx - 8], mm0
- jb davgAlp
- } // end _asm block
- }
- break;
- } // end switch ( bpp )
-
- _asm {
- // MMX acceleration complete now do clean-up
- // Check if any remaining bytes left to decode
- mov ebx, MMXLength // ebx ==> x = offset bytes remaining after MMX
- mov edi, row // edi ==> Avg(x)
- cmp ebx, FullLength // Test if offset at end of array
- jnb davgend
- // Do Paeth decode for remaining bytes
- mov esi, prev_row // esi ==> Prior(x)
- mov edx, edi
- xor ecx, ecx // zero ecx before using cl & cx in loop below
- sub edx, bpp // edx ==> Raw(x-bpp)
-davglp2:
- // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2)
- xor eax, eax
- mov cl, [esi + ebx] // load cl with Prior(x)
- mov al, [edx + ebx] // load al with Raw(x-bpp)
- add ax, cx
- inc ebx
- shr ax, 1 // divide by 2
- add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx
- cmp ebx, FullLength // Check if at end of array
- mov [edi+ebx-1], al // Write back Raw(x);
- // mov does not affect flags; -1 to offset inc ebx
- jb davglp2
-davgend:
- emms // End MMX instructions; prep for possible FP instrs.
- } // end _asm block
-}
-
-// Optimized code for PNG Paeth filter decoder
-void /* PRIVATE */
-png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
- png_bytep prev_row)
-{
- png_uint_32 FullLength;
- png_uint_32 MMXLength;
- //png_uint_32 len;
- int bpp;
- int diff;
- //int ptemp;
- int patemp, pbtemp, pctemp;
-
- bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel
- FullLength = row_info->rowbytes; // # of bytes to filter
- _asm
- {
- xor ebx, ebx // ebx ==> x offset
- mov edi, row
- xor edx, edx // edx ==> x-bpp offset
- mov esi, prev_row
- xor eax, eax
-
- // Compute the Raw value for the first bpp bytes
- // Note: the formula works out to be always
- // Paeth(x) = Raw(x) + Prior(x) where x < bpp
-dpthrlp:
- mov al, [edi + ebx]
- add al, [esi + ebx]
- inc ebx
- cmp ebx, bpp
- mov [edi + ebx - 1], al
- jb dpthrlp
- // get # of bytes to alignment
- mov diff, edi // take start of row
- add diff, ebx // add bpp
- xor ecx, ecx
- add diff, 0xf // add 7 + 8 to incr past alignment boundary
- and diff, 0xfffffff8 // mask to alignment boundary
- sub diff, edi // subtract from start ==> value ebx at alignment
- jz dpthgo
- // fix alignment
-dpthlp1:
- xor eax, eax
- // pav = p - a = (a + b - c) - a = b - c
- mov al, [esi + ebx] // load Prior(x) into al
- mov cl, [esi + edx] // load Prior(x-bpp) into cl
- sub eax, ecx // subtract Prior(x-bpp)
- mov patemp, eax // Save pav for later use
- xor eax, eax
- // pbv = p - b = (a + b - c) - b = a - c
- mov al, [edi + edx] // load Raw(x-bpp) into al
- sub eax, ecx // subtract Prior(x-bpp)
- mov ecx, eax
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- add eax, patemp // pcv = pav + pbv
- // pc = abs(pcv)
- test eax, 0x80000000
- jz dpthpca
- neg eax // reverse sign of neg values
-dpthpca:
- mov pctemp, eax // save pc for later use
- // pb = abs(pbv)
- test ecx, 0x80000000
- jz dpthpba
- neg ecx // reverse sign of neg values
-dpthpba:
- mov pbtemp, ecx // save pb for later use
- // pa = abs(pav)
- mov eax, patemp
- test eax, 0x80000000
- jz dpthpaa
- neg eax // reverse sign of neg values
-dpthpaa:
- mov patemp, eax // save pa for later use
- // test if pa <= pb
- cmp eax, ecx
- jna dpthabb
- // pa > pb; now test if pb <= pc
- cmp ecx, pctemp
- jna dpthbbc
- // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- mov cl, [esi + edx] // load Prior(x-bpp) into cl
- jmp dpthpaeth
-dpthbbc:
- // pb <= pc; Raw(x) = Paeth(x) + Prior(x)
- mov cl, [esi + ebx] // load Prior(x) into cl
- jmp dpthpaeth
-dpthabb:
- // pa <= pb; now test if pa <= pc
- cmp eax, pctemp
- jna dpthabc
- // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- mov cl, [esi + edx] // load Prior(x-bpp) into cl
- jmp dpthpaeth
-dpthabc:
- // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp)
- mov cl, [edi + edx] // load Raw(x-bpp) into cl
-dpthpaeth:
- inc ebx
- inc edx
- // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256
- add [edi + ebx - 1], cl
- cmp ebx, diff
- jb dpthlp1
-dpthgo:
- mov ecx, FullLength
- mov eax, ecx
- sub eax, ebx // subtract alignment fix
- and eax, 0x00000007 // calc bytes over mult of 8
- sub ecx, eax // drop over bytes from original length
- mov MMXLength, ecx
- } // end _asm block
- // Now do the math for the rest of the row
- switch ( bpp )
- {
- case 3:
- {
- ActiveMask.use = 0x0000000000ffffff;
- ActiveMaskEnd.use = 0xffff000000000000;
- ShiftBpp.use = 24; // == bpp(3) * 8
- ShiftRem.use = 40; // == 64 - 24
- _asm
- {
- mov ebx, diff
- mov edi, row
- mov esi, prev_row
- pxor mm0, mm0
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm1, [edi+ebx-8]
-dpth3lp:
- psrlq mm1, ShiftRem // shift last 3 bytes to 1st 3 bytes
- movq mm2, [esi + ebx] // load b=Prior(x)
- punpcklbw mm1, mm0 // Unpack High bytes of a
- movq mm3, [esi+ebx-8] // Prep c=Prior(x-bpp) bytes
- punpcklbw mm2, mm0 // Unpack High bytes of b
- psrlq mm3, ShiftRem // shift last 3 bytes to 1st 3 bytes
- // pav = p - a = (a + b - c) - a = b - c
- movq mm4, mm2
- punpcklbw mm3, mm0 // Unpack High bytes of c
- // pbv = p - b = (a + b - c) - b = a - c
- movq mm5, mm1
- psubw mm4, mm3
- pxor mm7, mm7
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- movq mm6, mm4
- psubw mm5, mm3
-
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- pcmpgtw mm0, mm4 // Create mask pav bytes < 0
- paddw mm6, mm5
- pand mm0, mm4 // Only pav bytes < 0 in mm7
- pcmpgtw mm7, mm5 // Create mask pbv bytes < 0
- psubw mm4, mm0
- pand mm7, mm5 // Only pbv bytes < 0 in mm0
- psubw mm4, mm0
- psubw mm5, mm7
- pxor mm0, mm0
- pcmpgtw mm0, mm6 // Create mask pcv bytes < 0
- pand mm0, mm6 // Only pav bytes < 0 in mm7
- psubw mm5, mm7
- psubw mm6, mm0
- // test pa <= pb
- movq mm7, mm4
- psubw mm6, mm0
- pcmpgtw mm7, mm5 // pa > pb?
- movq mm0, mm7
- // use mm7 mask to merge pa & pb
- pand mm5, mm7
- // use mm0 mask copy to merge a & b
- pand mm2, mm0
- pandn mm7, mm4
- pandn mm0, mm1
- paddw mm7, mm5
- paddw mm0, mm2
- // test ((pa <= pb)? pa:pb) <= pc
- pcmpgtw mm7, mm6 // pab > pc?
- pxor mm1, mm1
- pand mm3, mm7
- pandn mm7, mm0
- paddw mm7, mm3
- pxor mm0, mm0
- packuswb mm7, mm1
- movq mm3, [esi + ebx] // load c=Prior(x-bpp)
- pand mm7, ActiveMask
- movq mm2, mm3 // load b=Prior(x) step 1
- paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x)
- punpcklbw mm3, mm0 // Unpack High bytes of c
- movq [edi + ebx], mm7 // write back updated value
- movq mm1, mm7 // Now mm1 will be used as Raw(x-bpp)
- // Now do Paeth for 2nd set of bytes (3-5)
- psrlq mm2, ShiftBpp // load b=Prior(x) step 2
- punpcklbw mm1, mm0 // Unpack High bytes of a
- pxor mm7, mm7
- punpcklbw mm2, mm0 // Unpack High bytes of b
- // pbv = p - b = (a + b - c) - b = a - c
- movq mm5, mm1
- // pav = p - a = (a + b - c) - a = b - c
- movq mm4, mm2
- psubw mm5, mm3
- psubw mm4, mm3
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) =
- // pav + pbv = pbv + pav
- movq mm6, mm5
- paddw mm6, mm4
-
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- pcmpgtw mm0, mm5 // Create mask pbv bytes < 0
- pcmpgtw mm7, mm4 // Create mask pav bytes < 0
- pand mm0, mm5 // Only pbv bytes < 0 in mm0
- pand mm7, mm4 // Only pav bytes < 0 in mm7
- psubw mm5, mm0
- psubw mm4, mm7
- psubw mm5, mm0
- psubw mm4, mm7
- pxor mm0, mm0
- pcmpgtw mm0, mm6 // Create mask pcv bytes < 0
- pand mm0, mm6 // Only pav bytes < 0 in mm7
- psubw mm6, mm0
- // test pa <= pb
- movq mm7, mm4
- psubw mm6, mm0
- pcmpgtw mm7, mm5 // pa > pb?
- movq mm0, mm7
- // use mm7 mask to merge pa & pb
- pand mm5, mm7
- // use mm0 mask copy to merge a & b
- pand mm2, mm0
- pandn mm7, mm4
- pandn mm0, mm1
- paddw mm7, mm5
- paddw mm0, mm2
- // test ((pa <= pb)? pa:pb) <= pc
- pcmpgtw mm7, mm6 // pab > pc?
- movq mm2, [esi + ebx] // load b=Prior(x)
- pand mm3, mm7
- pandn mm7, mm0
- pxor mm1, mm1
- paddw mm7, mm3
- pxor mm0, mm0
- packuswb mm7, mm1
- movq mm3, mm2 // load c=Prior(x-bpp) step 1
- pand mm7, ActiveMask
- punpckhbw mm2, mm0 // Unpack High bytes of b
- psllq mm7, ShiftBpp // Shift bytes to 2nd group of 3 bytes
- // pav = p - a = (a + b - c) - a = b - c
- movq mm4, mm2
- paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x)
- psllq mm3, ShiftBpp // load c=Prior(x-bpp) step 2
- movq [edi + ebx], mm7 // write back updated value
- movq mm1, mm7
- punpckhbw mm3, mm0 // Unpack High bytes of c
- psllq mm1, ShiftBpp // Shift bytes
- // Now mm1 will be used as Raw(x-bpp)
- // Now do Paeth for 3rd, and final, set of bytes (6-7)
- pxor mm7, mm7
- punpckhbw mm1, mm0 // Unpack High bytes of a
- psubw mm4, mm3
- // pbv = p - b = (a + b - c) - b = a - c
- movq mm5, mm1
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- movq mm6, mm4
- psubw mm5, mm3
- pxor mm0, mm0
- paddw mm6, mm5
-
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- pcmpgtw mm0, mm4 // Create mask pav bytes < 0
- pcmpgtw mm7, mm5 // Create mask pbv bytes < 0
- pand mm0, mm4 // Only pav bytes < 0 in mm7
- pand mm7, mm5 // Only pbv bytes < 0 in mm0
- psubw mm4, mm0
- psubw mm5, mm7
- psubw mm4, mm0
- psubw mm5, mm7
- pxor mm0, mm0
- pcmpgtw mm0, mm6 // Create mask pcv bytes < 0
- pand mm0, mm6 // Only pav bytes < 0 in mm7
- psubw mm6, mm0
- // test pa <= pb
- movq mm7, mm4
- psubw mm6, mm0
- pcmpgtw mm7, mm5 // pa > pb?
- movq mm0, mm7
- // use mm0 mask copy to merge a & b
- pand mm2, mm0
- // use mm7 mask to merge pa & pb
- pand mm5, mm7
- pandn mm0, mm1
- pandn mm7, mm4
- paddw mm0, mm2
- paddw mm7, mm5
- // test ((pa <= pb)? pa:pb) <= pc
- pcmpgtw mm7, mm6 // pab > pc?
- pand mm3, mm7
- pandn mm7, mm0
- paddw mm7, mm3
- pxor mm1, mm1
- packuswb mm1, mm7
- // Step ebx to next set of 8 bytes and repeat loop til done
- add ebx, 8
- pand mm1, ActiveMaskEnd
- paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x)
-
- cmp ebx, MMXLength
- pxor mm0, mm0 // pxor does not affect flags
- movq [edi + ebx - 8], mm1 // write back updated value
- // mm1 will be used as Raw(x-bpp) next loop
- // mm3 ready to be used as Prior(x-bpp) next loop
- jb dpth3lp
- } // end _asm block
- }
- break;
-
- case 6:
- case 7:
- case 5:
- {
- ActiveMask.use = 0x00000000ffffffff;
- ActiveMask2.use = 0xffffffff00000000;
- ShiftBpp.use = bpp << 3; // == bpp * 8
- ShiftRem.use = 64 - ShiftBpp.use;
- _asm
- {
- mov ebx, diff
- mov edi, row
- mov esi, prev_row
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm1, [edi+ebx-8]
- pxor mm0, mm0
-dpth6lp:
- // Must shift to position Raw(x-bpp) data
- psrlq mm1, ShiftRem
- // Do first set of 4 bytes
- movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes
- punpcklbw mm1, mm0 // Unpack Low bytes of a
- movq mm2, [esi + ebx] // load b=Prior(x)
- punpcklbw mm2, mm0 // Unpack Low bytes of b
- // Must shift to position Prior(x-bpp) data
- psrlq mm3, ShiftRem
- // pav = p - a = (a + b - c) - a = b - c
- movq mm4, mm2
- punpcklbw mm3, mm0 // Unpack Low bytes of c
- // pbv = p - b = (a + b - c) - b = a - c
- movq mm5, mm1
- psubw mm4, mm3
- pxor mm7, mm7
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- movq mm6, mm4
- psubw mm5, mm3
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- pcmpgtw mm0, mm4 // Create mask pav bytes < 0
- paddw mm6, mm5
- pand mm0, mm4 // Only pav bytes < 0 in mm7
- pcmpgtw mm7, mm5 // Create mask pbv bytes < 0
- psubw mm4, mm0
- pand mm7, mm5 // Only pbv bytes < 0 in mm0
- psubw mm4, mm0
- psubw mm5, mm7
- pxor mm0, mm0
- pcmpgtw mm0, mm6 // Create mask pcv bytes < 0
- pand mm0, mm6 // Only pav bytes < 0 in mm7
- psubw mm5, mm7
- psubw mm6, mm0
- // test pa <= pb
- movq mm7, mm4
- psubw mm6, mm0
- pcmpgtw mm7, mm5 // pa > pb?
- movq mm0, mm7
- // use mm7 mask to merge pa & pb
- pand mm5, mm7
- // use mm0 mask copy to merge a & b
- pand mm2, mm0
- pandn mm7, mm4
- pandn mm0, mm1
- paddw mm7, mm5
- paddw mm0, mm2
- // test ((pa <= pb)? pa:pb) <= pc
- pcmpgtw mm7, mm6 // pab > pc?
- pxor mm1, mm1
- pand mm3, mm7
- pandn mm7, mm0
- paddw mm7, mm3
- pxor mm0, mm0
- packuswb mm7, mm1
- movq mm3, [esi + ebx - 8] // load c=Prior(x-bpp)
- pand mm7, ActiveMask
- psrlq mm3, ShiftRem
- movq mm2, [esi + ebx] // load b=Prior(x) step 1
- paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x)
- movq mm6, mm2
- movq [edi + ebx], mm7 // write back updated value
- movq mm1, [edi+ebx-8]
- psllq mm6, ShiftBpp
- movq mm5, mm7
- psrlq mm1, ShiftRem
- por mm3, mm6
- psllq mm5, ShiftBpp
- punpckhbw mm3, mm0 // Unpack High bytes of c
- por mm1, mm5
- // Do second set of 4 bytes
- punpckhbw mm2, mm0 // Unpack High bytes of b
- punpckhbw mm1, mm0 // Unpack High bytes of a
- // pav = p - a = (a + b - c) - a = b - c
- movq mm4, mm2
- // pbv = p - b = (a + b - c) - b = a - c
- movq mm5, mm1
- psubw mm4, mm3
- pxor mm7, mm7
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- movq mm6, mm4
- psubw mm5, mm3
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- pcmpgtw mm0, mm4 // Create mask pav bytes < 0
- paddw mm6, mm5
- pand mm0, mm4 // Only pav bytes < 0 in mm7
- pcmpgtw mm7, mm5 // Create mask pbv bytes < 0
- psubw mm4, mm0
- pand mm7, mm5 // Only pbv bytes < 0 in mm0
- psubw mm4, mm0
- psubw mm5, mm7
- pxor mm0, mm0
- pcmpgtw mm0, mm6 // Create mask pcv bytes < 0
- pand mm0, mm6 // Only pav bytes < 0 in mm7
- psubw mm5, mm7
- psubw mm6, mm0
- // test pa <= pb
- movq mm7, mm4
- psubw mm6, mm0
- pcmpgtw mm7, mm5 // pa > pb?
- movq mm0, mm7
- // use mm7 mask to merge pa & pb
- pand mm5, mm7
- // use mm0 mask copy to merge a & b
- pand mm2, mm0
- pandn mm7, mm4
- pandn mm0, mm1
- paddw mm7, mm5
- paddw mm0, mm2
- // test ((pa <= pb)? pa:pb) <= pc
- pcmpgtw mm7, mm6 // pab > pc?
- pxor mm1, mm1
- pand mm3, mm7
- pandn mm7, mm0
- pxor mm1, mm1
- paddw mm7, mm3
- pxor mm0, mm0
- // Step ex to next set of 8 bytes and repeat loop til done
- add ebx, 8
- packuswb mm1, mm7
- paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x)
- cmp ebx, MMXLength
- movq [edi + ebx - 8], mm1 // write back updated value
- // mm1 will be used as Raw(x-bpp) next loop
- jb dpth6lp
- } // end _asm block
- }
- break;
-
- case 4:
- {
- ActiveMask.use = 0x00000000ffffffff;
- _asm {
- mov ebx, diff
- mov edi, row
- mov esi, prev_row
- pxor mm0, mm0
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm1, [edi+ebx-8] // Only time should need to read
- // a=Raw(x-bpp) bytes
-dpth4lp:
- // Do first set of 4 bytes
- movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes
- punpckhbw mm1, mm0 // Unpack Low bytes of a
- movq mm2, [esi + ebx] // load b=Prior(x)
- punpcklbw mm2, mm0 // Unpack High bytes of b
- // pav = p - a = (a + b - c) - a = b - c
- movq mm4, mm2
- punpckhbw mm3, mm0 // Unpack High bytes of c
- // pbv = p - b = (a + b - c) - b = a - c
- movq mm5, mm1
- psubw mm4, mm3
- pxor mm7, mm7
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- movq mm6, mm4
- psubw mm5, mm3
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- pcmpgtw mm0, mm4 // Create mask pav bytes < 0
- paddw mm6, mm5
- pand mm0, mm4 // Only pav bytes < 0 in mm7
- pcmpgtw mm7, mm5 // Create mask pbv bytes < 0
- psubw mm4, mm0
- pand mm7, mm5 // Only pbv bytes < 0 in mm0
- psubw mm4, mm0
- psubw mm5, mm7
- pxor mm0, mm0
- pcmpgtw mm0, mm6 // Create mask pcv bytes < 0
- pand mm0, mm6 // Only pav bytes < 0 in mm7
- psubw mm5, mm7
- psubw mm6, mm0
- // test pa <= pb
- movq mm7, mm4
- psubw mm6, mm0
- pcmpgtw mm7, mm5 // pa > pb?
- movq mm0, mm7
- // use mm7 mask to merge pa & pb
- pand mm5, mm7
- // use mm0 mask copy to merge a & b
- pand mm2, mm0
- pandn mm7, mm4
- pandn mm0, mm1
- paddw mm7, mm5
- paddw mm0, mm2
- // test ((pa <= pb)? pa:pb) <= pc
- pcmpgtw mm7, mm6 // pab > pc?
- pxor mm1, mm1
- pand mm3, mm7
- pandn mm7, mm0
- paddw mm7, mm3
- pxor mm0, mm0
- packuswb mm7, mm1
- movq mm3, [esi + ebx] // load c=Prior(x-bpp)
- pand mm7, ActiveMask
- movq mm2, mm3 // load b=Prior(x) step 1
- paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x)
- punpcklbw mm3, mm0 // Unpack High bytes of c
- movq [edi + ebx], mm7 // write back updated value
- movq mm1, mm7 // Now mm1 will be used as Raw(x-bpp)
- // Do second set of 4 bytes
- punpckhbw mm2, mm0 // Unpack Low bytes of b
- punpcklbw mm1, mm0 // Unpack Low bytes of a
- // pav = p - a = (a + b - c) - a = b - c
- movq mm4, mm2
- // pbv = p - b = (a + b - c) - b = a - c
- movq mm5, mm1
- psubw mm4, mm3
- pxor mm7, mm7
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- movq mm6, mm4
- psubw mm5, mm3
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- pcmpgtw mm0, mm4 // Create mask pav bytes < 0
- paddw mm6, mm5
- pand mm0, mm4 // Only pav bytes < 0 in mm7
- pcmpgtw mm7, mm5 // Create mask pbv bytes < 0
- psubw mm4, mm0
- pand mm7, mm5 // Only pbv bytes < 0 in mm0
- psubw mm4, mm0
- psubw mm5, mm7
- pxor mm0, mm0
- pcmpgtw mm0, mm6 // Create mask pcv bytes < 0
- pand mm0, mm6 // Only pav bytes < 0 in mm7
- psubw mm5, mm7
- psubw mm6, mm0
- // test pa <= pb
- movq mm7, mm4
- psubw mm6, mm0
- pcmpgtw mm7, mm5 // pa > pb?
- movq mm0, mm7
- // use mm7 mask to merge pa & pb
- pand mm5, mm7
- // use mm0 mask copy to merge a & b
- pand mm2, mm0
- pandn mm7, mm4
- pandn mm0, mm1
- paddw mm7, mm5
- paddw mm0, mm2
- // test ((pa <= pb)? pa:pb) <= pc
- pcmpgtw mm7, mm6 // pab > pc?
- pxor mm1, mm1
- pand mm3, mm7
- pandn mm7, mm0
- pxor mm1, mm1
- paddw mm7, mm3
- pxor mm0, mm0
- // Step ex to next set of 8 bytes and repeat loop til done
- add ebx, 8
- packuswb mm1, mm7
- paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x)
- cmp ebx, MMXLength
- movq [edi + ebx - 8], mm1 // write back updated value
- // mm1 will be used as Raw(x-bpp) next loop
- jb dpth4lp
- } // end _asm block
- }
- break;
- case 8: // bpp == 8
- {
- ActiveMask.use = 0x00000000ffffffff;
- _asm {
- mov ebx, diff
- mov edi, row
- mov esi, prev_row
- pxor mm0, mm0
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm1, [edi+ebx-8] // Only time should need to read
- // a=Raw(x-bpp) bytes
-dpth8lp:
- // Do first set of 4 bytes
- movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes
- punpcklbw mm1, mm0 // Unpack Low bytes of a
- movq mm2, [esi + ebx] // load b=Prior(x)
- punpcklbw mm2, mm0 // Unpack Low bytes of b
- // pav = p - a = (a + b - c) - a = b - c
- movq mm4, mm2
- punpcklbw mm3, mm0 // Unpack Low bytes of c
- // pbv = p - b = (a + b - c) - b = a - c
- movq mm5, mm1
- psubw mm4, mm3
- pxor mm7, mm7
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- movq mm6, mm4
- psubw mm5, mm3
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- pcmpgtw mm0, mm4 // Create mask pav bytes < 0
- paddw mm6, mm5
- pand mm0, mm4 // Only pav bytes < 0 in mm7
- pcmpgtw mm7, mm5 // Create mask pbv bytes < 0
- psubw mm4, mm0
- pand mm7, mm5 // Only pbv bytes < 0 in mm0
- psubw mm4, mm0
- psubw mm5, mm7
- pxor mm0, mm0
- pcmpgtw mm0, mm6 // Create mask pcv bytes < 0
- pand mm0, mm6 // Only pav bytes < 0 in mm7
- psubw mm5, mm7
- psubw mm6, mm0
- // test pa <= pb
- movq mm7, mm4
- psubw mm6, mm0
- pcmpgtw mm7, mm5 // pa > pb?
- movq mm0, mm7
- // use mm7 mask to merge pa & pb
- pand mm5, mm7
- // use mm0 mask copy to merge a & b
- pand mm2, mm0
- pandn mm7, mm4
- pandn mm0, mm1
- paddw mm7, mm5
- paddw mm0, mm2
- // test ((pa <= pb)? pa:pb) <= pc
- pcmpgtw mm7, mm6 // pab > pc?
- pxor mm1, mm1
- pand mm3, mm7
- pandn mm7, mm0
- paddw mm7, mm3
- pxor mm0, mm0
- packuswb mm7, mm1
- movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes
- pand mm7, ActiveMask
- movq mm2, [esi + ebx] // load b=Prior(x)
- paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x)
- punpckhbw mm3, mm0 // Unpack High bytes of c
- movq [edi + ebx], mm7 // write back updated value
- movq mm1, [edi+ebx-8] // read a=Raw(x-bpp) bytes
-
- // Do second set of 4 bytes
- punpckhbw mm2, mm0 // Unpack High bytes of b
- punpckhbw mm1, mm0 // Unpack High bytes of a
- // pav = p - a = (a + b - c) - a = b - c
- movq mm4, mm2
- // pbv = p - b = (a + b - c) - b = a - c
- movq mm5, mm1
- psubw mm4, mm3
- pxor mm7, mm7
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- movq mm6, mm4
- psubw mm5, mm3
- // pa = abs(p-a) = abs(pav)
- // pb = abs(p-b) = abs(pbv)
- // pc = abs(p-c) = abs(pcv)
- pcmpgtw mm0, mm4 // Create mask pav bytes < 0
- paddw mm6, mm5
- pand mm0, mm4 // Only pav bytes < 0 in mm7
- pcmpgtw mm7, mm5 // Create mask pbv bytes < 0
- psubw mm4, mm0
- pand mm7, mm5 // Only pbv bytes < 0 in mm0
- psubw mm4, mm0
- psubw mm5, mm7
- pxor mm0, mm0
- pcmpgtw mm0, mm6 // Create mask pcv bytes < 0
- pand mm0, mm6 // Only pav bytes < 0 in mm7
- psubw mm5, mm7
- psubw mm6, mm0
- // test pa <= pb
- movq mm7, mm4
- psubw mm6, mm0
- pcmpgtw mm7, mm5 // pa > pb?
- movq mm0, mm7
- // use mm7 mask to merge pa & pb
- pand mm5, mm7
- // use mm0 mask copy to merge a & b
- pand mm2, mm0
- pandn mm7, mm4
- pandn mm0, mm1
- paddw mm7, mm5
- paddw mm0, mm2
- // test ((pa <= pb)? pa:pb) <= pc
- pcmpgtw mm7, mm6 // pab > pc?
- pxor mm1, mm1
- pand mm3, mm7
- pandn mm7, mm0
- pxor mm1, mm1
- paddw mm7, mm3
- pxor mm0, mm0
- // Step ex to next set of 8 bytes and repeat loop til done
- add ebx, 8
- packuswb mm1, mm7
- paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x)
- cmp ebx, MMXLength
- movq [edi + ebx - 8], mm1 // write back updated value
- // mm1 will be used as Raw(x-bpp) next loop
- jb dpth8lp
- } // end _asm block
- }
- break;
-
- case 1: // bpp = 1
- case 2: // bpp = 2
- default: // bpp > 8
- {
- _asm {
- mov ebx, diff
- cmp ebx, FullLength
- jnb dpthdend
- mov edi, row
- mov esi, prev_row
- // Do Paeth decode for remaining bytes
- mov edx, ebx
- xor ecx, ecx // zero ecx before using cl & cx in loop below
- sub edx, bpp // Set edx = ebx - bpp
-dpthdlp:
- xor eax, eax
- // pav = p - a = (a + b - c) - a = b - c
- mov al, [esi + ebx] // load Prior(x) into al
- mov cl, [esi + edx] // load Prior(x-bpp) into cl
- sub eax, ecx // subtract Prior(x-bpp)
- mov patemp, eax // Save pav for later use
- xor eax, eax
- // pbv = p - b = (a + b - c) - b = a - c
- mov al, [edi + edx] // load Raw(x-bpp) into al
- sub eax, ecx // subtract Prior(x-bpp)
- mov ecx, eax
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- add eax, patemp // pcv = pav + pbv
- // pc = abs(pcv)
- test eax, 0x80000000
- jz dpthdpca
- neg eax // reverse sign of neg values
-dpthdpca:
- mov pctemp, eax // save pc for later use
- // pb = abs(pbv)
- test ecx, 0x80000000
- jz dpthdpba
- neg ecx // reverse sign of neg values
-dpthdpba:
- mov pbtemp, ecx // save pb for later use
- // pa = abs(pav)
- mov eax, patemp
- test eax, 0x80000000
- jz dpthdpaa
- neg eax // reverse sign of neg values
-dpthdpaa:
- mov patemp, eax // save pa for later use
- // test if pa <= pb
- cmp eax, ecx
- jna dpthdabb
- // pa > pb; now test if pb <= pc
- cmp ecx, pctemp
- jna dpthdbbc
- // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- mov cl, [esi + edx] // load Prior(x-bpp) into cl
- jmp dpthdpaeth
-dpthdbbc:
- // pb <= pc; Raw(x) = Paeth(x) + Prior(x)
- mov cl, [esi + ebx] // load Prior(x) into cl
- jmp dpthdpaeth
-dpthdabb:
- // pa <= pb; now test if pa <= pc
- cmp eax, pctemp
- jna dpthdabc
- // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- mov cl, [esi + edx] // load Prior(x-bpp) into cl
- jmp dpthdpaeth
-dpthdabc:
- // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp)
- mov cl, [edi + edx] // load Raw(x-bpp) into cl
-dpthdpaeth:
- inc ebx
- inc edx
- // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256
- add [edi + ebx - 1], cl
- cmp ebx, FullLength
- jb dpthdlp
-dpthdend:
- } // end _asm block
- }
- return; // No need to go further with this one
- } // end switch ( bpp )
- _asm
- {
- // MMX acceleration complete now do clean-up
- // Check if any remaining bytes left to decode
- mov ebx, MMXLength
- cmp ebx, FullLength
- jnb dpthend
- mov edi, row
- mov esi, prev_row
- // Do Paeth decode for remaining bytes
- mov edx, ebx
- xor ecx, ecx // zero ecx before using cl & cx in loop below
- sub edx, bpp // Set edx = ebx - bpp
-dpthlp2:
- xor eax, eax
- // pav = p - a = (a + b - c) - a = b - c
- mov al, [esi + ebx] // load Prior(x) into al
- mov cl, [esi + edx] // load Prior(x-bpp) into cl
- sub eax, ecx // subtract Prior(x-bpp)
- mov patemp, eax // Save pav for later use
- xor eax, eax
- // pbv = p - b = (a + b - c) - b = a - c
- mov al, [edi + edx] // load Raw(x-bpp) into al
- sub eax, ecx // subtract Prior(x-bpp)
- mov ecx, eax
- // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv
- add eax, patemp // pcv = pav + pbv
- // pc = abs(pcv)
- test eax, 0x80000000
- jz dpthpca2
- neg eax // reverse sign of neg values
-dpthpca2:
- mov pctemp, eax // save pc for later use
- // pb = abs(pbv)
- test ecx, 0x80000000
- jz dpthpba2
- neg ecx // reverse sign of neg values
-dpthpba2:
- mov pbtemp, ecx // save pb for later use
- // pa = abs(pav)
- mov eax, patemp
- test eax, 0x80000000
- jz dpthpaa2
- neg eax // reverse sign of neg values
-dpthpaa2:
- mov patemp, eax // save pa for later use
- // test if pa <= pb
- cmp eax, ecx
- jna dpthabb2
- // pa > pb; now test if pb <= pc
- cmp ecx, pctemp
- jna dpthbbc2
- // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- mov cl, [esi + edx] // load Prior(x-bpp) into cl
- jmp dpthpaeth2
-dpthbbc2:
- // pb <= pc; Raw(x) = Paeth(x) + Prior(x)
- mov cl, [esi + ebx] // load Prior(x) into cl
- jmp dpthpaeth2
-dpthabb2:
- // pa <= pb; now test if pa <= pc
- cmp eax, pctemp
- jna dpthabc2
- // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp)
- mov cl, [esi + edx] // load Prior(x-bpp) into cl
- jmp dpthpaeth2
-dpthabc2:
- // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp)
- mov cl, [edi + edx] // load Raw(x-bpp) into cl
-dpthpaeth2:
- inc ebx
- inc edx
- // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256
- add [edi + ebx - 1], cl
- cmp ebx, FullLength
- jb dpthlp2
-dpthend:
- emms // End MMX instructions; prep for possible FP instrs.
- } // end _asm block
-}
-
-// Optimized code for PNG Sub filter decoder
-void /* PRIVATE */
-png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
-{
- //int test;
- int bpp;
- png_uint_32 FullLength;
- png_uint_32 MMXLength;
- int diff;
-
- bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel
- FullLength = row_info->rowbytes - bpp; // # of bytes to filter
- _asm {
- mov edi, row
- mov esi, edi // lp = row
- add edi, bpp // rp = row + bpp
- xor eax, eax
- // get # of bytes to alignment
- mov diff, edi // take start of row
- add diff, 0xf // add 7 + 8 to incr past
- // alignment boundary
- xor ebx, ebx
- and diff, 0xfffffff8 // mask to alignment boundary
- sub diff, edi // subtract from start ==> value
- // ebx at alignment
- jz dsubgo
- // fix alignment
-dsublp1:
- mov al, [esi+ebx]
- add [edi+ebx], al
- inc ebx
- cmp ebx, diff
- jb dsublp1
-dsubgo:
- mov ecx, FullLength
- mov edx, ecx
- sub edx, ebx // subtract alignment fix
- and edx, 0x00000007 // calc bytes over mult of 8
- sub ecx, edx // drop over bytes from length
- mov MMXLength, ecx
- } // end _asm block
-
- // Now do the math for the rest of the row
- switch ( bpp )
- {
- case 3:
- {
- ActiveMask.use = 0x0000ffffff000000;
- ShiftBpp.use = 24; // == 3 * 8
- ShiftRem.use = 40; // == 64 - 24
- _asm {
- mov edi, row
- movq mm7, ActiveMask // Load ActiveMask for 2nd active byte group
- mov esi, edi // lp = row
- add edi, bpp // rp = row + bpp
- movq mm6, mm7
- mov ebx, diff
- psllq mm6, ShiftBpp // Move mask in mm6 to cover 3rd active
- // byte group
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm1, [edi+ebx-8]
-dsub3lp:
- psrlq mm1, ShiftRem // Shift data for adding 1st bpp bytes
- // no need for mask; shift clears inactive bytes
- // Add 1st active group
- movq mm0, [edi+ebx]
- paddb mm0, mm1
- // Add 2nd active group
- movq mm1, mm0 // mov updated Raws to mm1
- psllq mm1, ShiftBpp // shift data to position correctly
- pand mm1, mm7 // mask to use only 2nd active group
- paddb mm0, mm1
- // Add 3rd active group
- movq mm1, mm0 // mov updated Raws to mm1
- psllq mm1, ShiftBpp // shift data to position correctly
- pand mm1, mm6 // mask to use only 3rd active group
- add ebx, 8
- paddb mm0, mm1
- cmp ebx, MMXLength
- movq [edi+ebx-8], mm0 // Write updated Raws back to array
- // Prep for doing 1st add at top of loop
- movq mm1, mm0
- jb dsub3lp
- } // end _asm block
- }
- break;
-
- case 1:
- {
- // Placed here just in case this is a duplicate of the
- // non-MMX code for the SUB filter in png_read_filter_row below
- //
- // png_bytep rp;
- // png_bytep lp;
- // png_uint_32 i;
- // bpp = (row_info->pixel_depth + 7) >> 3;
- // for (i = (png_uint_32)bpp, rp = row + bpp, lp = row;
- // i < row_info->rowbytes; i++, rp++, lp++)
- // {
- // *rp = (png_byte)(((int)(*rp) + (int)(*lp)) & 0xff);
- // }
- _asm {
- mov ebx, diff
- mov edi, row
- cmp ebx, FullLength
- jnb dsub1end
- mov esi, edi // lp = row
- xor eax, eax
- add edi, bpp // rp = row + bpp
-dsub1lp:
- mov al, [esi+ebx]
- add [edi+ebx], al
- inc ebx
- cmp ebx, FullLength
- jb dsub1lp
-dsub1end:
- } // end _asm block
- }
- return;
-
- case 6:
- case 7:
- case 4:
- case 5:
- {
- ShiftBpp.use = bpp << 3;
- ShiftRem.use = 64 - ShiftBpp.use;
- _asm {
- mov edi, row
- mov ebx, diff
- mov esi, edi // lp = row
- add edi, bpp // rp = row + bpp
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm1, [edi+ebx-8]
-dsub4lp:
- psrlq mm1, ShiftRem // Shift data for adding 1st bpp bytes
- // no need for mask; shift clears inactive bytes
- movq mm0, [edi+ebx]
- paddb mm0, mm1
- // Add 2nd active group
- movq mm1, mm0 // mov updated Raws to mm1
- psllq mm1, ShiftBpp // shift data to position correctly
- // there is no need for any mask
- // since shift clears inactive bits/bytes
- add ebx, 8
- paddb mm0, mm1
- cmp ebx, MMXLength
- movq [edi+ebx-8], mm0
- movq mm1, mm0 // Prep for doing 1st add at top of loop
- jb dsub4lp
- } // end _asm block
- }
- break;
-
- case 2:
- {
- ActiveMask.use = 0x00000000ffff0000;
- ShiftBpp.use = 16; // == 2 * 8
- ShiftRem.use = 48; // == 64 - 16
- _asm {
- movq mm7, ActiveMask // Load ActiveMask for 2nd active byte group
- mov ebx, diff
- movq mm6, mm7
- mov edi, row
- psllq mm6, ShiftBpp // Move mask in mm6 to cover 3rd active
- // byte group
- mov esi, edi // lp = row
- movq mm5, mm6
- add edi, bpp // rp = row + bpp
- psllq mm5, ShiftBpp // Move mask in mm5 to cover 4th active
- // byte group
- // PRIME the pump (load the first Raw(x-bpp) data set
- movq mm1, [edi+ebx-8]
-dsub2lp:
- // Add 1st active group
- psrlq mm1, ShiftRem // Shift data for adding 1st bpp bytes
- // no need for mask; shift clears inactive
- // bytes
- movq mm0, [edi+ebx]
- paddb mm0, mm1
- // Add 2nd active group
- movq mm1, mm0 // mov updated Raws to mm1
- psllq mm1, ShiftBpp // shift data to position correctly
- pand mm1, mm7 // mask to use only 2nd active group
- paddb mm0, mm1
- // Add 3rd active group
- movq mm1, mm0 // mov updated Raws to mm1
- psllq mm1, ShiftBpp // shift data to position correctly
- pand mm1, mm6 // mask to use only 3rd active group
- paddb mm0, mm1
- // Add 4th active group
- movq mm1, mm0 // mov updated Raws to mm1
- psllq mm1, ShiftBpp // shift data to position correctly
- pand mm1, mm5 // mask to use only 4th active group
- add ebx, 8
- paddb mm0, mm1
- cmp ebx, MMXLength
- movq [edi+ebx-8], mm0 // Write updated Raws back to array
- movq mm1, mm0 // Prep for doing 1st add at top of loop
- jb dsub2lp
- } // end _asm block
- }
- break;
- case 8:
- {
- _asm {
- mov edi, row
- mov ebx, diff
- mov esi, edi // lp = row
- add edi, bpp // rp = row + bpp
- mov ecx, MMXLength
- movq mm7, [edi+ebx-8] // PRIME the pump (load the first
- // Raw(x-bpp) data set
- and ecx, 0x0000003f // calc bytes over mult of 64
-dsub8lp:
- movq mm0, [edi+ebx] // Load Sub(x) for 1st 8 bytes
- paddb mm0, mm7
- movq mm1, [edi+ebx+8] // Load Sub(x) for 2nd 8 bytes
- movq [edi+ebx], mm0 // Write Raw(x) for 1st 8 bytes
- // Now mm0 will be used as Raw(x-bpp) for
- // the 2nd group of 8 bytes. This will be
- // repeated for each group of 8 bytes with
- // the 8th group being used as the Raw(x-bpp)
- // for the 1st group of the next loop.
- paddb mm1, mm0
- movq mm2, [edi+ebx+16] // Load Sub(x) for 3rd 8 bytes
- movq [edi+ebx+8], mm1 // Write Raw(x) for 2nd 8 bytes
- paddb mm2, mm1
- movq mm3, [edi+ebx+24] // Load Sub(x) for 4th 8 bytes
- movq [edi+ebx+16], mm2 // Write Raw(x) for 3rd 8 bytes
- paddb mm3, mm2
- movq mm4, [edi+ebx+32] // Load Sub(x) for 5th 8 bytes
- movq [edi+ebx+24], mm3 // Write Raw(x) for 4th 8 bytes
- paddb mm4, mm3
- movq mm5, [edi+ebx+40] // Load Sub(x) for 6th 8 bytes
- movq [edi+ebx+32], mm4 // Write Raw(x) for 5th 8 bytes
- paddb mm5, mm4
- movq mm6, [edi+ebx+48] // Load Sub(x) for 7th 8 bytes
- movq [edi+ebx+40], mm5 // Write Raw(x) for 6th 8 bytes
- paddb mm6, mm5
- movq mm7, [edi+ebx+56] // Load Sub(x) for 8th 8 bytes
- movq [edi+ebx+48], mm6 // Write Raw(x) for 7th 8 bytes
- add ebx, 64
- paddb mm7, mm6
- cmp ebx, ecx
- movq [edi+ebx-8], mm7 // Write Raw(x) for 8th 8 bytes
- jb dsub8lp
- cmp ebx, MMXLength
- jnb dsub8lt8
-dsub8lpA:
- movq mm0, [edi+ebx]
- add ebx, 8
- paddb mm0, mm7
- cmp ebx, MMXLength
- movq [edi+ebx-8], mm0 // use -8 to offset early add to ebx
- movq mm7, mm0 // Move calculated Raw(x) data to mm1 to
- // be the new Raw(x-bpp) for the next loop
- jb dsub8lpA
-dsub8lt8:
- } // end _asm block
- }
- break;
-
- default: // bpp greater than 8 bytes
- {
- _asm {
- mov ebx, diff
- mov edi, row
- mov esi, edi // lp = row
- add edi, bpp // rp = row + bpp
-dsubAlp:
- movq mm0, [edi+ebx]
- movq mm1, [esi+ebx]
- add ebx, 8
- paddb mm0, mm1
- cmp ebx, MMXLength
- movq [edi+ebx-8], mm0 // mov does not affect flags; -8 to offset
- // add ebx
- jb dsubAlp
- } // end _asm block
- }
- break;
-
- } // end switch ( bpp )
-
- _asm {
- mov ebx, MMXLength
- mov edi, row
- cmp ebx, FullLength
- jnb dsubend
- mov esi, edi // lp = row
- xor eax, eax
- add edi, bpp // rp = row + bpp
-dsublp2:
- mov al, [esi+ebx]
- add [edi+ebx], al
- inc ebx
- cmp ebx, FullLength
- jb dsublp2
-dsubend:
- emms // End MMX instructions; prep for possible FP instrs.
- } // end _asm block
-}
-
-// Optimized code for PNG Up filter decoder
-void /* PRIVATE */
-png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row,
- png_bytep prev_row)
-{
- png_uint_32 len;
- len = row_info->rowbytes; // # of bytes to filter
- _asm {
- mov edi, row
- // get # of bytes to alignment
- mov ecx, edi
- xor ebx, ebx
- add ecx, 0x7
- xor eax, eax
- and ecx, 0xfffffff8
- mov esi, prev_row
- sub ecx, edi
- jz dupgo
- // fix alignment
-duplp1:
- mov al, [edi+ebx]
- add al, [esi+ebx]
- inc ebx
- cmp ebx, ecx
- mov [edi + ebx-1], al // mov does not affect flags; -1 to offset inc ebx
- jb duplp1
-dupgo:
- mov ecx, len
- mov edx, ecx
- sub edx, ebx // subtract alignment fix
- and edx, 0x0000003f // calc bytes over mult of 64
- sub ecx, edx // drop over bytes from length
- // Unrolled loop - use all MMX registers and interleave to reduce
- // number of branch instructions (loops) and reduce partial stalls
-duploop:
- movq mm1, [esi+ebx]
- movq mm0, [edi+ebx]
- movq mm3, [esi+ebx+8]
- paddb mm0, mm1
- movq mm2, [edi+ebx+8]
- movq [edi+ebx], mm0
- paddb mm2, mm3
- movq mm5, [esi+ebx+16]
- movq [edi+ebx+8], mm2
- movq mm4, [edi+ebx+16]
- movq mm7, [esi+ebx+24]
- paddb mm4, mm5
- movq mm6, [edi+ebx+24]
- movq [edi+ebx+16], mm4
- paddb mm6, mm7
- movq mm1, [esi+ebx+32]
- movq [edi+ebx+24], mm6
- movq mm0, [edi+ebx+32]
- movq mm3, [esi+ebx+40]
- paddb mm0, mm1
- movq mm2, [edi+ebx+40]
- movq [edi+ebx+32], mm0
- paddb mm2, mm3
- movq mm5, [esi+ebx+48]
- movq [edi+ebx+40], mm2
- movq mm4, [edi+ebx+48]
- movq mm7, [esi+ebx+56]
- paddb mm4, mm5
- movq mm6, [edi+ebx+56]
- movq [edi+ebx+48], mm4
- add ebx, 64
- paddb mm6, mm7
- cmp ebx, ecx
- movq [edi+ebx-8], mm6 // (+56)movq does not affect flags;
- // -8 to offset add ebx
- jb duploop
-
- cmp edx, 0 // Test for bytes over mult of 64
- jz dupend
-
-
- // 2 lines added by lcreeve at netins.net
- // (mail 11 Jul 98 in png-implement list)
- cmp edx, 8 //test for less than 8 bytes
- jb duplt8
-
-
- add ecx, edx
- and edx, 0x00000007 // calc bytes over mult of 8
- sub ecx, edx // drop over bytes from length
- jz duplt8
- // Loop using MMX registers mm0 & mm1 to update 8 bytes simultaneously
-duplpA:
- movq mm1, [esi+ebx]
- movq mm0, [edi+ebx]
- add ebx, 8
- paddb mm0, mm1
- cmp ebx, ecx
- movq [edi+ebx-8], mm0 // movq does not affect flags; -8 to offset add ebx
- jb duplpA
- cmp edx, 0 // Test for bytes over mult of 8
- jz dupend
-duplt8:
- xor eax, eax
- add ecx, edx // move over byte count into counter
- // Loop using x86 registers to update remaining bytes
-duplp2:
- mov al, [edi + ebx]
- add al, [esi + ebx]
- inc ebx
- cmp ebx, ecx
- mov [edi + ebx-1], al // mov does not affect flags; -1 to offset inc ebx
- jb duplp2
-dupend:
- // Conversion of filtered row completed
- emms // End MMX instructions; prep for possible FP instrs.
- } // end _asm block
-}
-
-
-// Optimized png_read_filter_row routines
-void /* PRIVATE */
-png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
- row, png_bytep prev_row, int filter)
-{
-#ifdef PNG_DEBUG
- char filnm[10];
-#endif
-
- if (mmx_supported == 2) {
-#if !defined(PNG_1_0_X)
- /* this should have happened in png_init_mmx_flags() already */
- png_warning(png_ptr, "asm_flags may not have been initialized");
-#endif
- png_mmx_support();
- }
-
-#ifdef PNG_DEBUG
- png_debug(1, "in png_read_filter_row\n");
- switch (filter)
- {
- case 0: sprintf(filnm, "none");
- break;
-#if !defined(PNG_1_0_X)
- case 1: sprintf(filnm, "sub-%s",
- (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : "x86");
- break;
- case 2: sprintf(filnm, "up-%s",
- (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" : "x86");
- break;
- case 3: sprintf(filnm, "avg-%s",
- (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" : "x86");
- break;
- case 4: sprintf(filnm, "Paeth-%s",
- (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX":"x86");
- break;
-#else
- case 1: sprintf(filnm, "sub");
- break;
- case 2: sprintf(filnm, "up");
- break;
- case 3: sprintf(filnm, "avg");
- break;
- case 4: sprintf(filnm, "Paeth");
- break;
-#endif
- default: sprintf(filnm, "unknw");
- break;
- }
- png_debug2(0,"row=%5d, %s, ", png_ptr->row_number, filnm);
- png_debug2(0, "pd=%2d, b=%d, ", (int)row_info->pixel_depth,
- (int)((row_info->pixel_depth + 7) >> 3));
- png_debug1(0,"len=%8d, ", row_info->rowbytes);
-#endif /* PNG_DEBUG */
-
- switch (filter)
- {
- case PNG_FILTER_VALUE_NONE:
- break;
-
- case PNG_FILTER_VALUE_SUB:
- {
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) &&
- (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
- (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
-#else
- if (mmx_supported)
-#endif
- {
- png_read_filter_row_mmx_sub(row_info, row);
- }
- else
- {
- png_uint_32 i;
- png_uint_32 istop = row_info->rowbytes;
- png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3;
- png_bytep rp = row + bpp;
- png_bytep lp = row;
-
- for (i = bpp; i < istop; i++)
- {
- *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
- rp++;
- }
- }
- break;
- }
-
- case PNG_FILTER_VALUE_UP:
- {
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) &&
- (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
- (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
-#else
- if (mmx_supported)
-#endif
- {
- png_read_filter_row_mmx_up(row_info, row, prev_row);
- }
- else
- {
- png_uint_32 i;
- png_uint_32 istop = row_info->rowbytes;
- png_bytep rp = row;
- png_bytep pp = prev_row;
-
- for (i = 0; i < istop; ++i)
- {
- *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
- rp++;
- }
- }
- break;
- }
-
- case PNG_FILTER_VALUE_AVG:
- {
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) &&
- (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
- (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
-#else
- if (mmx_supported)
-#endif
- {
- png_read_filter_row_mmx_avg(row_info, row, prev_row);
- }
- else
- {
- png_uint_32 i;
- png_bytep rp = row;
- png_bytep pp = prev_row;
- png_bytep lp = row;
- png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3;
- png_uint_32 istop = row_info->rowbytes - bpp;
-
- for (i = 0; i < bpp; i++)
- {
- *rp = (png_byte)(((int)(*rp) +
- ((int)(*pp++) >> 1)) & 0xff);
- rp++;
- }
-
- for (i = 0; i < istop; i++)
- {
- *rp = (png_byte)(((int)(*rp) +
- ((int)(*pp++ + *lp++) >> 1)) & 0xff);
- rp++;
- }
- }
- break;
- }
-
- case PNG_FILTER_VALUE_PAETH:
- {
-#if !defined(PNG_1_0_X)
- if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) &&
- (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
- (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
-#else
- if (mmx_supported)
-#endif
- {
- png_read_filter_row_mmx_paeth(row_info, row, prev_row);
- }
- else
- {
- png_uint_32 i;
- png_bytep rp = row;
- png_bytep pp = prev_row;
- png_bytep lp = row;
- png_bytep cp = prev_row;
- png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3;
- png_uint_32 istop=row_info->rowbytes - bpp;
-
- for (i = 0; i < bpp; i++)
- {
- *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
- rp++;
- }
-
- for (i = 0; i < istop; i++) // use leftover rp,pp
- {
- int a, b, c, pa, pb, pc, p;
-
- a = *lp++;
- b = *pp++;
- c = *cp++;
-
- p = b - c;
- pc = a - c;
-
-#ifdef PNG_USE_ABS
- pa = abs(p);
- pb = abs(pc);
- pc = abs(p + pc);
-#else
- pa = p < 0 ? -p : p;
- pb = pc < 0 ? -pc : pc;
- pc = (p + pc) < 0 ? -(p + pc) : p + pc;
-#endif
-
- /*
- if (pa <= pb && pa <= pc)
- p = a;
- else if (pb <= pc)
- p = b;
- else
- p = c;
- */
-
- p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
-
- *rp = (png_byte)(((int)(*rp) + p) & 0xff);
- rp++;
- }
- }
- break;
- }
-
- default:
- png_warning(png_ptr, "Ignoring bad row filter type");
- *row=0;
- break;
- }
-}
-
-#endif /* PNG_ASSEMBLER_CODE_SUPPORTED && PNG_USE_PNGVCRD */
diff --git a/jdk/src/share/native/sun/rmi/server/MarshalInputStream.c b/jdk/src/share/native/sun/rmi/server/MarshalInputStream.c
deleted file mode 100644
index 089afbd..0000000
--- a/jdk/src/share/native/sun/rmi/server/MarshalInputStream.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "jni.h"
-#include "jvm.h"
-#include "jni_util.h"
-
-#include "sun_rmi_server_MarshalInputStream.h"
-
-/*
- * Class: sun_rmi_server_MarshalInputStream
- * Method: latestUserDefinedLoader
- * Signature: ()Ljava/lang/ClassLoader;
- *
- * Returns the first non-null class loader up the execution stack, or null
- * if only code from the null class loader is on the stack.
- */
-JNIEXPORT jobject JNICALL
-Java_sun_rmi_server_MarshalInputStream_latestUserDefinedLoader(JNIEnv *env, jclass cls)
-{
- return JVM_LatestUserDefinedLoader(env);
-}
diff --git a/jdk/src/solaris/classes/sun/awt/motif/AWTLockAccess.java b/jdk/src/solaris/classes/sun/awt/motif/AWTLockAccess.java
deleted file mode 100644
index b05828f..0000000
--- a/jdk/src/solaris/classes/sun/awt/motif/AWTLockAccess.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt.motif;
-
-final class AWTLockAccess {
- static native void awtLock();
- static native void awtUnlock();
- static void awtWait() { awtWait(0); }
- static native void awtWait(long timeout);
- static native void awtNotifyAll();
-}
diff --git a/jdk/src/solaris/classes/sun/awt/motif/MFontPeer.java b/jdk/src/solaris/classes/sun/awt/motif/MFontPeer.java
deleted file mode 100644
index c544c02..0000000
--- a/jdk/src/solaris/classes/sun/awt/motif/MFontPeer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.awt.motif;
-
-import java.awt.GraphicsEnvironment;
-import sun.awt.PlatformFont;
-
-public class MFontPeer extends PlatformFont {
-
- /*
- * XLFD name for XFontSet.
- */
- private String xfsname;
-
- /*
- * converter name for this XFontSet encoding.
- */
- private String converter;
-
- static {
- if (!GraphicsEnvironment.isHeadless()) {
- initIDs();
- }
- }
-
- /**
- * Initialize JNI field and method IDs for fields that may be
- accessed from C.
- */
- private static native void initIDs();
-
- public MFontPeer(String name, int style){
- super(name, style);
-
- if (fontConfig != null) {
- xfsname = ((MFontConfiguration) fontConfig).getMotifFontSet(familyName, style);
- }
- }
-
- protected char getMissingGlyphCharacter() {
- return '\u274F';
- }
-}
diff --git a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java
deleted file mode 100644
index 44108be..0000000
--- a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java
+++ /dev/null
@@ -1,849 +0,0 @@
-/*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt.motif;
-
-import java.awt.*;
-import java.awt.im.InputMethodHighlight;
-import java.awt.im.spi.InputMethodDescriptor;
-import java.awt.image.*;
-import java.awt.peer.*;
-import java.awt.datatransfer.Clipboard;
-import java.awt.event.*;
-import java.lang.reflect.*;
-import java.lang.Math;
-import java.io.*;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import java.util.Properties;
-import java.util.Map;
-import java.util.Iterator;
-
-import sun.awt.AppContext;
-import sun.awt.AWTAutoShutdown;
-import sun.awt.SunToolkit;
-import sun.awt.UNIXToolkit;
-import sun.awt.GlobalCursorManager;
-import sun.awt.datatransfer.DataTransferer;
-
-import java.awt.dnd.DragSource;
-import java.awt.dnd.DragGestureListener;
-import java.awt.dnd.DragGestureEvent;
-import java.awt.dnd.DragGestureRecognizer;
-import java.awt.dnd.MouseDragGestureRecognizer;
-import java.awt.dnd.InvalidDnDOperationException;
-import java.awt.dnd.peer.DragSourceContextPeer;
-
-//import sun.awt.motif.MInputMethod;
-import sun.awt.X11FontManager;
-import sun.awt.X11GraphicsConfig;
-import sun.awt.X11GraphicsEnvironment;
-import sun.awt.XSettings;
-
-//import sun.awt.motif.MDragSourceContextPeer;
-
-import sun.print.PrintJob2D;
-
-import sun.misc.PerformanceLogger;
-import sun.misc.Unsafe;
-
-import sun.security.action.GetBooleanAction;
-import sun.util.logging.PlatformLogger;
-
-public class MToolkit extends UNIXToolkit implements Runnable {
-
- private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.motif.MToolkit");
-
- // the system clipboard - CLIPBOARD selection
- //X11Clipboard clipboard;
- // the system selection - PRIMARY selection
- //X11Clipboard selection;
-
- // Dynamic Layout Resize client code setting
- protected static boolean dynamicLayoutSetting = false;
-
- /**
- * True when the x settings have been loaded.
- */
- private boolean loadedXSettings;
-
- /**
- * XSETTINGS for the default screen.
- * <p>
- * <strong>XXX:</strong> see <code>MToolkit.parseXSettings</code>
- * and <code>awt_xsettings_update</code> in
- * <samp>awt_MToolkit.c</samp>
- */
- private XSettings xs;
-
- /*
- * Note: The MToolkit object depends on the static initializer
- * of X11GraphicsEnvironment to initialize the connection to
- * the X11 server.
- */
- static final X11GraphicsConfig config;
-
- private static final boolean motifdnd;
-
- static {
- if (GraphicsEnvironment.isHeadless()) {
- config = null;
- } else {
- config = (X11GraphicsConfig) (GraphicsEnvironment.
- getLocalGraphicsEnvironment().
- getDefaultScreenDevice().
- getDefaultConfiguration());
- }
-
- motifdnd = ((Boolean)java.security.AccessController.doPrivileged(
- new GetBooleanAction("awt.dnd.motifdnd"))).booleanValue();
- }
-
- //public static final String DATA_TRANSFERER_CLASS_NAME = "sun.awt.motif.MDataTransferer";
-
- public MToolkit() {
- super();
- if (PerformanceLogger.loggingEnabled()) {
- PerformanceLogger.setTime("MToolkit construction");
- }
- if (!GraphicsEnvironment.isHeadless()) {
- String mainClassName = null;
-
- StackTraceElement trace[] = (new Throwable()).getStackTrace();
- int bottom = trace.length - 1;
- if (bottom >= 0) {
- mainClassName = trace[bottom].getClassName();
- }
- if (mainClassName == null || mainClassName.equals("")) {
- mainClassName = "AWT";
- }
-
- init(mainClassName);
- //SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
-
- Thread toolkitThread = new Thread(this, "AWT-Motif");
- toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
- toolkitThread.setDaemon(true);
-
- PrivilegedAction<Void> a = new PrivilegedAction<Void>() {
- public Void run() {
- ThreadGroup mainTG = Thread.currentThread().getThreadGroup();
- ThreadGroup parentTG = mainTG.getParent();
-
- while (parentTG != null) {
- mainTG = parentTG;
- parentTG = mainTG.getParent();
- }
- Thread shutdownThread = new Thread(mainTG, new Runnable() {
- public void run() {
- shutdown();
- }
- }, "Shutdown-Thread");
- shutdownThread.setContextClassLoader(null);
- Runtime.getRuntime().addShutdownHook(shutdownThread);
- return null;
- }
- };
- AccessController.doPrivileged(a);
-
- /*
- * Fix for 4701990.
- * AWTAutoShutdown state must be changed before the toolkit thread
- * starts to avoid race condition.
- */
- AWTAutoShutdown.notifyToolkitThreadBusy();
-
- toolkitThread.start();
- }
- }
-
- public native void init(String mainClassName);
- public native void run();
- private native void shutdown();
-
- /*
- * Create peer objects.
- */
-
- public ButtonPeer createButton(Button target) {
- //ButtonPeer peer = new MButtonPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public TextFieldPeer createTextField(TextField target) {
- //TextFieldPeer peer = new MTextFieldPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public LabelPeer createLabel(Label target) {
- //LabelPeer peer = new MLabelPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public ListPeer createList(List target) {
- //ListPeer peer = new MListPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public CheckboxPeer createCheckbox(Checkbox target) {
- //CheckboxPeer peer = new MCheckboxPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public ScrollbarPeer createScrollbar(Scrollbar target) {
- //ScrollbarPeer peer = new MScrollbarPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public ScrollPanePeer createScrollPane(ScrollPane target) {
- //ScrollPanePeer peer = new MScrollPanePeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public TextAreaPeer createTextArea(TextArea target) {
- //TextAreaPeer peer = new MTextAreaPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public ChoicePeer createChoice(Choice target) {
- //ChoicePeer peer = new MChoicePeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public FramePeer createFrame(Frame target) {
- //FramePeer peer = new MFramePeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public CanvasPeer createCanvas(Canvas target) {
- //CanvasPeer peer = (isXEmbedServerRequested() ? new MEmbedCanvasPeer(target) : new MCanvasPeer(target));
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public PanelPeer createPanel(Panel target) {
- //PanelPeer peer = new MPanelPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public WindowPeer createWindow(Window target) {
- //WindowPeer peer = new MWindowPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public DialogPeer createDialog(Dialog target) {
- //DialogPeer peer = new MDialogPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public FileDialogPeer createFileDialog(FileDialog target) {
- //FileDialogPeer peer = new MFileDialogPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public MenuBarPeer createMenuBar(MenuBar target) {
- //MenuBarPeer peer = new MMenuBarPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public MenuPeer createMenu(Menu target) {
- //MenuPeer peer = new MMenuPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public PopupMenuPeer createPopupMenu(PopupMenu target) {
- //PopupMenuPeer peer = new MPopupMenuPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public MenuItemPeer createMenuItem(MenuItem target) {
- //MenuItemPeer peer = new MMenuItemPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
- //CheckboxMenuItemPeer peer = new MCheckboxMenuItemPeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- return null;
- }
-
- public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
- return null;
- }
-
- //public MEmbeddedFramePeer createEmbeddedFrame(MEmbeddedFrame target)
- //{
- //MEmbeddedFramePeer peer = new MEmbeddedFramePeer(target);
- //targetCreatedPeer(target, peer);
- //return peer;
- // return null;
- //}
-
-
- public FontPeer getFontPeer(String name, int style){
- return new MFontPeer(name, style);
- }
-
- /*
- * On X, support for dynamic layout on resizing is governed by the
- * window manager. If the window manager supports it, it happens
- * automatically. The setter method for this property is
- * irrelevant on X.
- */
- public void setDynamicLayout(boolean b) {
- dynamicLayoutSetting = b;
- }
-
- protected boolean isDynamicLayoutSet() {
- return dynamicLayoutSetting;
- }
-
- /* Called from isDynamicLayoutActive() and from
- * lazilyLoadDynamicLayoutSupportedProperty()
- */
- protected native boolean isDynamicLayoutSupportedNative();
-
- public boolean isDynamicLayoutActive() {
- return isDynamicLayoutSupportedNative();
- }
-
- public native boolean isFrameStateSupported(int state);
-
- public TrayIconPeer createTrayIcon(TrayIcon target) throws HeadlessException {
- return null;
- }
-
- public SystemTrayPeer createSystemTray(SystemTray target) throws HeadlessException {
- return null;
- }
-
- public boolean isTraySupported() {
- return false;
- }
-
- static native ColorModel makeColorModel();
- static ColorModel screenmodel;
-
- static ColorModel getStaticColorModel() {
- if (screenmodel == null) {
- screenmodel = config.getColorModel ();
- }
- return screenmodel;
- }
-
- public ColorModel getColorModel() {
- return getStaticColorModel();
- }
-
- public native int getScreenResolution();
-
- public Insets getScreenInsets(GraphicsConfiguration gc) {
- return new Insets(0,0,0,0);
- }
-
- protected native int getScreenWidth();
- protected native int getScreenHeight();
-
- public FontMetrics getFontMetrics(Font font) {
- /*
- // REMIND: platform font flag should be obsolete soon
- if (!RasterOutputManager.usesPlatformFont()) {
- return super.getFontMetrics(font);
- } else {
- return X11FontMetrics.getFontMetrics(font);
- }
- */
- return super.getFontMetrics(font);
- }
-
- public PrintJob getPrintJob(final Frame frame, final String doctitle,
- final Properties props) {
-
- if (GraphicsEnvironment.isHeadless()) {
- throw new IllegalArgumentException();
- }
-
- PrintJob2D printJob = new PrintJob2D(frame, doctitle, props);
-
- if (printJob.printDialog() == false) {
- printJob = null;
- }
-
- return printJob;
- }
-
- public PrintJob getPrintJob(final Frame frame, final String doctitle,
- final JobAttributes jobAttributes,
- final PageAttributes pageAttributes) {
-
-
- if (GraphicsEnvironment.isHeadless()) {
- throw new IllegalArgumentException();
- }
-
- PrintJob2D printJob = new PrintJob2D(frame, doctitle,
- jobAttributes, pageAttributes);
-
- if (printJob.printDialog() == false) {
- printJob = null;
- }
-
- return printJob;
- }
-
- public native void beep();
-
- public Clipboard getSystemClipboard() {
- //SecurityManager security = System.getSecurityManager();
- //if (security != null) {
- // security.checkSystemClipboardAccess();
- //}
- //synchronized (this) {
- // if (clipboard == null) {
- // clipboard = new X11Clipboard("System", "CLIPBOARD");
- // }
- //}
- //return clipboard;
- return null;
- }
-
- public Clipboard getSystemSelection() {
- //SecurityManager security = System.getSecurityManager();
- //if (security != null) {
- // security.checkSystemClipboardAccess();
- //}
- //synchronized (this) {
- // if (selection == null) {
- // selection = new X11Clipboard("Selection", "PRIMARY");
- // }
- //}
- //return selection;
- return null;
- }
-
- public boolean getLockingKeyState(int key) {
- if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK ||
- key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) {
- throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState");
- }
- return getLockingKeyStateNative(key);
- }
-
- public native boolean getLockingKeyStateNative(int key);
-
- public native void loadSystemColors(int[] systemColors);
-
- /**
- * Give native peers the ability to query the native container
- * given a native component (e.g. the direct parent may be lightweight).
- */
- public static Container getNativeContainer(Component c) {
- return Toolkit.getNativeContainer(c);
- }
-
- protected static final Object targetToPeer(Object target) {
- return SunToolkit.targetToPeer(target);
- }
-
- protected static final void targetDisposedPeer(Object target, Object peer) {
- SunToolkit.targetDisposedPeer(target, peer);
- }
-
- public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
- //if (MToolkit.useMotifDnD()) {
- // return MDragSourceContextPeer.createDragSourceContextPeer(dge);
- //} else {
- // return X11DragSourceContextPeer.createDragSourceContextPeer(dge);
- //}
- return null;
- }
-
- public <T extends DragGestureRecognizer> T
- createDragGestureRecognizer(Class<T> abstractRecognizerClass,
- DragSource ds, Component c, int srcActions,
- DragGestureListener dgl)
- {
- //if (MouseDragGestureRecognizer.class.equals(abstractRecognizerClass))
- // return (T)new MMouseDragGestureRecognizer(ds, c, srcActions, dgl);
- //else
- return null;
- }
-
- /**
- * Returns a new input method adapter descriptor for native input methods.
- */
- public InputMethodDescriptor getInputMethodAdapterDescriptor() throws AWTException {
- return null; // return new MInputMethodDescriptor();
- }
-
- /**
- * Returns a style map for the input method highlight.
- */
- public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
- return null; //return MInputMethod.mapInputMethodHighlight(highlight);
- }
-
- /**
- * Returns a new custom cursor.
- */
- public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
- throws IndexOutOfBoundsException {
- return null; //return new MCustomCursor(cursor, hotSpot, name);
- }
-
- /**
- * Returns the supported cursor size
- */
- public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) {
- return null; //MCustomCursor.getBestCursorSize(
- //java.lang.Math.max(1,preferredWidth), java.lang.Math.max(1,preferredHeight));
- }
-
- public int getMaximumCursorColors() {
- return 2; // Black and white.
- }
-
- private final static String prefix = "DnD.Cursor.";
- private final static String postfix = ".32x32";
- private static final String dndPrefix = "DnD.";
-
- protected Object lazilyLoadDesktopProperty(String name) {
- if (name.startsWith(prefix)) {
- String cursorName = name.substring(prefix.length(), name.length()) + postfix;
-
- try {
- return Cursor.getSystemCustomCursor(cursorName);
- } catch (AWTException awte) {
- System.err.println("cannot load system cursor: " + cursorName);
-
- return null;
- }
- }
-
- if (name.equals("awt.dynamicLayoutSupported")) {
- return lazilyLoadDynamicLayoutSupportedProperty(name);
- }
-
- if (!loadedXSettings &&
- (name.startsWith("gnome.") ||
- name.equals(SunToolkit.DESKTOPFONTHINTS) ||
- name.startsWith(dndPrefix))) {
- loadedXSettings = true;
- if (!GraphicsEnvironment.isHeadless()) {
- loadXSettings();
- desktopProperties.put(SunToolkit.DESKTOPFONTHINTS,
- SunToolkit.getDesktopFontHints());
- return desktopProperties.get(name);
- }
- }
-
- return super.lazilyLoadDesktopProperty(name);
- }
-
- /*
- * Called from lazilyLoadDesktopProperty because we may not know if
- * the user has quit the previous window manager and started another.
- */
- protected Boolean lazilyLoadDynamicLayoutSupportedProperty(String name) {
- boolean nativeDynamic = isDynamicLayoutSupportedNative();
-
- if (log.isLoggable(PlatformLogger.FINER)) {
- log.finer("nativeDynamic == " + nativeDynamic);
- }
-
- return Boolean.valueOf(nativeDynamic);
- }
-
- private native int getMulticlickTime();
-
- protected void initializeDesktopProperties() {
- desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50));
- desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50));
- desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5));
-
- /* As of 1.4, no wheel mice are supported on Solaris
- * however, they are on Linux, and there isn't a way to detect them,
- * so we leave this property unset to indicate we're not sure if there's
- * a wheel mouse or not.
- */
- //desktopProperties.put("awt.wheelMousePresent", Boolean.valueOf(false));
-
- // We don't want to call getMultilclickTime() if we're headless
- if (!GraphicsEnvironment.isHeadless()) {
- desktopProperties.put("awt.multiClickInterval",
- Integer.valueOf(getMulticlickTime()));
- desktopProperties.put("awt.mouse.numButtons",
- Integer.valueOf(getNumberOfButtons()));
- }
- }
-
- public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
- /* 'target' is unused for now... */
- //return new MRobotPeer(screen.getDefaultConfiguration());
- return null;
- }
-
- static boolean useMotifDnD() {
- return motifdnd;
- }
-
- //
- // The following support Gnome's equivalent of desktop properties.
- // A writeup of this can be found at:
- // http://www.freedesktop.org/standards/xsettings/xsettings.html
- //
-
- /**
- * Triggers a callback to parseXSettings with the x settings values
- * from the window server. Note that this will NOT call
- * parseXSettings if we are not running on a GNOME desktop.
- */
- private native void loadXSettings();
-
- /**
- * Callback from the native side indicating some, or all, of the
- * desktop properties have changed and need to be reloaded.
- * <code>data</code> is the byte array directly from the x server and
- * may be in little endian format.
- * <p>
- * NB: This could be called from any thread if triggered by
- * <code>loadXSettings</code>. It is called from the toolkit
- * thread if triggered by an XSETTINGS change.
- */
- private void parseXSettings(int screen_XXX_ignored, byte[] data) {
- // XXX: notyet: map screen -> per screen XSettings object
- // for now native code only calls us for default screen
- // see awt_MToolkit.c awt_xsettings_update().
- if (xs == null) {
- xs = new XSettings();
- }
-
- Map updatedSettings = xs.update(data);
- if (updatedSettings == null || updatedSettings.isEmpty()) {
- return;
- }
-
- Iterator i = updatedSettings.entrySet().iterator();
- while (i.hasNext()) {
- Map.Entry e = (Map.Entry)i.next();
- String name = (String)e.getKey();
-
- name = "gnome." + name;
- setDesktopProperty(name, e.getValue());
-
- // XXX: we probably want to do something smarter. In
- // particular, "Net" properties are of interest to the
- // "core" AWT itself. E.g.
- //
- // Net/DndDragThreshold -> ???
- // Net/DoubleClickTime -> awt.multiClickInterval
- }
-
- setDesktopProperty(SunToolkit.DESKTOPFONTHINTS,
- SunToolkit.getDesktopFontHints());
-
- Integer dragThreshold = null;
- synchronized (this) {
- dragThreshold = (Integer)desktopProperties.get("gnome.Net/DndDragThreshold");
- }
- if (dragThreshold != null) {
- setDesktopProperty("DnD.gestureMotionThreshold", dragThreshold);
- }
- }
-
- protected boolean needsXEmbedImpl() {
- return true;
- }
-
- public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
- return (modalityType == Dialog.ModalityType.MODELESS) ||
- (modalityType == Dialog.ModalityType.APPLICATION_MODAL);
- }
-
- public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
- return (exclusionType == Dialog.ModalExclusionType.NO_EXCLUDE);
- }
-
- private native boolean isSyncUpdated();
- private native boolean isSyncFailed();
- private native int getEventNumber();
- private native void updateSyncSelection();
- private static final long WORKAROUND_SLEEP = 100;
-
- /**
- * @inheritDoc
- */
- protected boolean syncNativeQueue(final long timeout) {
- awtLock();
- try {
- long event_number = getEventNumber();
- updateSyncSelection();
-
- // Wait for selection notify for oops on win
- long start = System.currentTimeMillis();
- while (!isSyncUpdated() && !isSyncFailed()) {
- try {
- awtLockWait(timeout);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- // This "while" is a protection from spurious
- // wake-ups. However, we shouldn't wait for too long
- if (((System.currentTimeMillis() - start) > timeout) && (timeout >= 0)) {
- throw new OperationTimedOut();
- }
- }
- if (isSyncFailed() && getEventNumber() - event_number == 1) {
- awtUnlock();
- try {
- Thread.sleep(WORKAROUND_SLEEP);
- } catch (InterruptedException ie) {
- throw new RuntimeException(ie);
- } finally {
- awtLock();
- }
- }
- return getEventNumber() - event_number > 2;
- } finally {
- awtUnlock();
- }
- }
-
- public void grab(Window w) {
- WindowPeer peer = (WindowPeer)w.getPeer();
- if (peer != null) {
- nativeGrab(peer);
- }
- }
-
- public void ungrab(Window w) {
- WindowPeer peer = (WindowPeer)w.getPeer();
- if (peer != null) {
- nativeUnGrab(peer);
- }
- }
- private native void nativeGrab(WindowPeer peer);
- private native void nativeUnGrab(WindowPeer peer);
-
-
- public boolean isDesktopSupported(){
- return false;
- }
-
- public DesktopPeer createDesktopPeer(Desktop target)
- throws HeadlessException{
- throw new UnsupportedOperationException();
- }
-
- public final static int
- UNDETERMINED_WM = 1,
- NO_WM = 2,
- OTHER_WM = 3,
- OPENLOOK_WM = 4,
- MOTIF_WM = 5,
- CDE_WM = 6,
- ENLIGHTEN_WM = 7,
- KDE2_WM = 8,
- SAWFISH_WM = 9,
- ICE_WM = 10,
- METACITY_WM = 11,
- COMPIZ_WM = 12,
- LG3D_WM = 13;
-
- public static int getWMID() {
- String wmName = getWMName();
-
- if ("NO_WM".equals(wmName)) {
- return NO_WM;
- } else if ("OTHER_WM".equals(wmName)) {
- return OTHER_WM;
- } else if ("ENLIGHTEN_WM".equals(wmName)) {
- return ENLIGHTEN_WM;
- } else if ("KDE2_WM".equals(wmName)) {
- return KDE2_WM;
- } else if ("SAWFISH_WM".equals(wmName)) {
- return SAWFISH_WM;
- } else if ("ICE_WM".equals(wmName)) {
- return ICE_WM;
- } else if ("METACITY_WM".equals(wmName)) {
- return METACITY_WM;
- } else if ("OPENLOOK_WM".equals(wmName)) {
- return OPENLOOK_WM;
- } else if ("MOTIF_WM".equals(wmName)) {
- return MOTIF_WM;
- } else if ("CDE_WM".equals(wmName)) {
- return CDE_WM;
- } else if ("COMPIZ_WM".equals(wmName)) {
- return COMPIZ_WM;
- } else if ("LG3D_WM".equals(wmName)) {
- return LG3D_WM;
- }
- return UNDETERMINED_WM;
- }
-
- private static native String getWMName();
-
-} // class MToolkit
diff --git a/jdk/src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java b/jdk/src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java
deleted file mode 100644
index ab3a055..0000000
--- a/jdk/src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt.motif;
-
-import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
-import sun.awt.SunToolkit;
-
-final class MToolkitThreadBlockedHandler implements
- ToolkitThreadBlockedHandler {
- private static ToolkitThreadBlockedHandler priveleged_lock = null;
- static {
- priveleged_lock = new MToolkitThreadBlockedHandler();
- }
- private MToolkitThreadBlockedHandler() {}
- static ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
- return priveleged_lock;
- }
- public void lock() {
- SunToolkit.awtLock();
- }
- public void unlock() {
- SunToolkit.awtUnlock();
- }
- public native void enter();
- public native void exit();
-}
diff --git a/jdk/src/solaris/classes/sun/awt/motif/MWindowAttributes.java b/jdk/src/solaris/classes/sun/awt/motif/MWindowAttributes.java
deleted file mode 100644
index a920cca..0000000
--- a/jdk/src/solaris/classes/sun/awt/motif/MWindowAttributes.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.awt.motif;
-import java.awt.Image;
-
-class MWindowAttributes {
- static int NORMAL = 0;
- static int ICONIC = 1;
- static int MAXIMIZED = 2;
-
- static int AWT_DECOR_NONE = 0;
- static int AWT_DECOR_ALL = 1;
- static int AWT_DECOR_BORDER = 2;
- static int AWT_DECOR_RESIZEH = 4;
- static int AWT_DECOR_TITLE = 8;
- static int AWT_DECOR_MENU = 0x10;
- static int AWT_DECOR_MINIMIZE = 0x20;
- static int AWT_DECOR_MAXIMIZE = 0x40;
- static int AWT_UNOBSCURED = 0; // X11 VisibilityUnobscured
- static int AWT_PARTIALLY_OBSCURED = 1; // X11 VisibilityPartiallyObscured
- static int AWT_FULLY_OBSCURED = 2; // X11 VisibilityFullyObscured
- static int AWT_UNKNOWN_OBSCURITY = 3;
-
- boolean nativeDecor;
- boolean initialFocus;
- boolean isResizable;
- int initialState;
- int visibilityState; // updated by native X11 event handling code.
- String title;
- java.awt.Image icon;
- int decorations; // for future expansion to be able to
- // specify native decorations
-
- private static native void initIDs();
-
- static {
- initIDs();
- }
-
- MWindowAttributes() {
- nativeDecor = false;
- initialFocus = false;
- isResizable = false;
- initialState = NORMAL;
- visibilityState = AWT_UNKNOWN_OBSCURITY;
- title = null;
- icon = null;
- decorations = 0;
- }
-}
diff --git a/jdk/src/solaris/classes/sun/awt/motif/X11FontMetrics.java b/jdk/src/solaris/classes/sun/awt/motif/X11FontMetrics.java
deleted file mode 100644
index f158eae..0000000
--- a/jdk/src/solaris/classes/sun/awt/motif/X11FontMetrics.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt.motif;
-
-import java.awt.*;
-import java.util.Hashtable;
-import sun.awt.PlatformFont;
-
-/**
- * A font metrics object for a WServer font.
- *
- * @author Jim Graham
- */
-public class X11FontMetrics extends FontMetrics {
- /**
- * The widths of the first 256 characters.
- */
- int widths[];
-
- /**
- * The standard ascent of the font. This is the logical height
- * above the baseline for the Alphanumeric characters and should
- * be used for determining line spacing. Note, however, that some
- * characters in the font may extend above this height.
- */
- int ascent;
-
- /**
- * The standard descent of the font. This is the logical height
- * below the baseline for the Alphanumeric characters and should
- * be used for determining line spacing. Note, however, that some
- * characters in the font may extend below this height.
- */
- int descent;
-
- /**
- * The standard leading for the font. This is the logical amount
- * of space to be reserved between the descent of one line of text
- * and the ascent of the next line. The height metric is calculated
- * to include this extra space.
- */
- int leading;
-
- /**
- * The standard height of a line of text in this font. This is
- * the distance between the baseline of adjacent lines of text.
- * It is the sum of the ascent+descent+leading. There is no
- * guarantee that lines of text spaced at this distance will be
- * disjoint; such lines may overlap if some characters overshoot
- * the standard ascent and descent metrics.
- */
- int height;
-
- /**
- * The maximum ascent for all characters in this font. No character
- * will extend further above the baseline than this metric.
- */
- int maxAscent;
-
- /**
- * The maximum descent for all characters in this font. No character
- * will descend further below the baseline than this metric.
- */
- int maxDescent;
-
- /**
- * The maximum possible height of a line of text in this font.
- * Adjacent lines of text spaced this distance apart will be
- * guaranteed not to overlap. Note, however, that many paragraphs
- * that contain ordinary alphanumeric text may look too widely
- * spaced if this metric is used to determine line spacing. The
- * height field should be preferred unless the text in a given
- * line contains particularly tall characters.
- */
- int maxHeight;
-
- /**
- * The maximum advance width of any character in this font.
- */
- int maxAdvance;
-
- static {
- initIDs();
- }
-
- /**
- * Initialize JNI field and method IDs for fields that may be
- accessed from C.
- */
- private static native void initIDs();
-
- /**
- * Calculate the metrics from the given WServer and font.
- */
- public X11FontMetrics(Font font) {
- super(font);
- init();
- }
-
- /**
- * Get leading
- */
- public int getLeading() {
- return leading;
- }
-
- /**
- * Get ascent.
- */
- public int getAscent() {
- return ascent;
- }
-
- /**
- * Get descent
- */
- public int getDescent() {
- return descent;
- }
-
- /**
- * Get height
- */
- public int getHeight() {
- return height;
- }
-
- /**
- * Get maxAscent
- */
- public int getMaxAscent() {
- return maxAscent;
- }
-
- /**
- * Get maxDescent
- */
- public int getMaxDescent() {
- return maxDescent;
- }
-
- /**
- * Get maxAdvance
- */
- public int getMaxAdvance() {
- return maxAdvance;
- }
-
- /**
- * Return the width of the specified string in this Font.
- */
- public int stringWidth(String string) {
- return charsWidth(string.toCharArray(), 0, string.length());
- }
-
- /**
- * Return the width of the specified char[] in this Font.
- */
- public int charsWidth(char chars[], int offset, int length) {
- Font font = getFont();
- PlatformFont pf = ((PlatformFont) font.getPeer());
- if (pf.mightHaveMultiFontMetrics()) {
- return getMFCharsWidth(chars, offset, length, font);
- } else {
- if (widths != null) {
- int w = 0;
- for (int i = offset; i < offset + length; i++) {
- int ch = chars[i];
- if (ch < 0 || ch >= widths.length) {
- w += maxAdvance;
- } else {
- w += widths[ch];
- }
- }
- return w;
- } else {
- return maxAdvance * length;
- }
- }
- }
-
- private native int getMFCharsWidth(char chars[], int offset, int length, Font font);
-
- /**
- * Return the width of the specified byte[] in this Font.
- */
- public native int bytesWidth(byte data[], int off, int len);
-
- /**
- * Get the widths of the first 256 characters in the font.
- */
- public int[] getWidths() {
- return widths;
- }
-
- native void init();
-
- static Hashtable table = new Hashtable();
-
- static synchronized FontMetrics getFontMetrics(Font font) {
- FontMetrics fm = (FontMetrics)table.get(font);
- if (fm == null) {
- table.put(font, fm = new X11FontMetrics(font));
- }
- return fm;
- }
-}
diff --git a/jdk/src/solaris/native/sun/awt/MouseInfo.c b/jdk/src/solaris/native/sun/awt/MouseInfo.c
deleted file mode 100644
index 07262cf..0000000
--- a/jdk/src/solaris/native/sun/awt/MouseInfo.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifdef HEADLESS
- #error This file should not be included in headless library
-#endif
-
-#include "awt_p.h"
-#include "awt_Component.h"
-
-#include <jni.h>
-#include <jni_util.h>
-
-extern int awt_numScreens;
-extern AwtScreenDataPtr x11Screens;
-extern struct ComponentIDs componentIDs;
-extern struct MComponentPeerIDs mComponentPeerIDs;
-
-/*
- * Class: sun_awt_DefaultMouseInfoPeer
- * Method: fillPointWithCoords
- * Signature: (Ljava/awt/Point)I
- */
-JNIEXPORT jint JNICALL
-Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords(JNIEnv *env, jclass cls,
- jobject point)
-{
- static jclass pointClass = NULL;
- jclass pointClassLocal;
- static jfieldID xID, yID;
- Window rootWindow, childWindow;
- int i;
- int32_t xr, yr, xw, yw;
- uint32_t keys;
- Bool pointerFound;
-
- AWT_LOCK();
- if (pointClass == NULL) {
- pointClassLocal = (*env)->FindClass(env, "java/awt/Point");
- DASSERT(pointClassLocal != NULL);
- if (pointClassLocal == NULL) {
- AWT_UNLOCK();
- return (jint)0;
- }
- pointClass = (jclass)(*env)->NewGlobalRef(env, pointClassLocal);
- (*env)->DeleteLocalRef(env, pointClassLocal);
- xID = (*env)->GetFieldID(env, pointClass, "x", "I");
- yID = (*env)->GetFieldID(env, pointClass, "y", "I");
- }
-
- for (i = 0; i < awt_numScreens; i++) {
- pointerFound = XQueryPointer(awt_display, x11Screens[i].root,
- &rootWindow, &childWindow,
- &xr, &yr, &xw, &yw, &keys);
- if (pointerFound) {
- (*env)->SetIntField(env, point, xID, xr);
- (*env)->SetIntField(env, point, yID, yr);
- AWT_UNLOCK();
- return (jint)i;
- }
- }
- /* This should never happen */
- DASSERT(FALSE);
- AWT_UNLOCK();
- return (jint)0;
-}
-
-/*
- * Class: sun_awt_DefaultMouseInfoPeer
- * Method: isWindowUnderMouse
- * Signature: (Ljava/awt/Window)Z
- */
-JNIEXPORT jboolean JNICALL Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse
- (JNIEnv * env, jclass cls, jobject window)
-{
- Window rootWindow = None, parentWindow = None, siblingWindow = None;
- Window * children = NULL;
- int i = 0;
- int is_the_same_screen = 0;
- int32_t xr = 0, yr = 0, xw = 0, yw = 0;
- uint32_t keys = 0;
- uint32_t nchildren = 0;
- Bool pointerFound = 0;
- struct FrameData *wdata = NULL;
- jobject winPeer = NULL;
-
- if ((*env)->EnsureLocalCapacity(env, 1) < 0) {
- return JNI_FALSE;
- }
- winPeer = (*env)->GetObjectField(env, window, componentIDs.peer);
- if (JNU_IsNull(env, winPeer)) {
- return JNI_FALSE;
- }
-
- wdata = (struct FrameData *)
- JNU_GetLongFieldAsPtr(env, winPeer, mComponentPeerIDs.pData);
- (*env)->DeleteLocalRef(env, winPeer);
-
- if (wdata == NULL) {
- return JNI_FALSE;
- }
-
- AWT_LOCK();
-
- XQueryTree(awt_display, XtWindow(wdata->winData.comp.widget),
- &rootWindow, &parentWindow, &children, &nchildren);
-
- is_the_same_screen = XQueryPointer(awt_display, parentWindow,
- &rootWindow, &siblingWindow, &xr, &yr, &xw, &yw, &keys);
-
- if (siblingWindow == XtWindow(wdata->winData.comp.widget) && is_the_same_screen) {
- AWT_UNLOCK();
- return JNI_TRUE;
- }
-
- AWT_UNLOCK();
- return JNI_FALSE ;
-
-}
diff --git a/jdk/src/solaris/native/sun/awt/XDrawingArea.c b/jdk/src/solaris/native/sun/awt/XDrawingArea.c
deleted file mode 100644
index bd14768..0000000
--- a/jdk/src/solaris/native/sun/awt/XDrawingArea.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- */
-
-#include <X11/IntrinsicP.h>
-#include "XDrawingAreaP.h"
-#include <Xm/XmP.h>
-
-#include <stdio.h>
-#include <malloc.h>
-
-#ifdef DEBUG
-#include <jvm.h> /* To get jio_fprintf() */
-#endif
-
-/******************************************************************
- *
- * Provides Canvas widget which allows the X11 visual to be
- * changed (the Motif DrawingArea restricts the visual to that
- * of the parent widget).
- *
- ******************************************************************/
-
-
-static XmNavigability WidgetNavigable();
-static void ClassInitialize();
-
-static XmBaseClassExtRec baseClassExtRec = {
- NULL,
- NULLQUARK,
- XmBaseClassExtVersion,
- sizeof(XmBaseClassExtRec),
- NULL, /* InitializePrehook */
- NULL, /* SetValuesPrehook */
- NULL, /* InitializePosthook */
- NULL, /* SetValuesPosthook */
- NULL, /* secondaryObjectClass */
- NULL, /* secondaryCreate */
- NULL, /* getSecRes data */
- { 0 }, /* fastSubclass flags */
- NULL, /* getValuesPrehook */
- NULL, /* getValuesPosthook */
- NULL, /* classPartInitPrehook */
- NULL, /* classPartInitPosthook*/
- NULL, /* ext_resources */
- NULL, /* compiled_ext_resources*/
- 0, /* num_ext_resources */
- FALSE, /* use_sub_resources */
- WidgetNavigable, /* widgetNavigable */
- NULL /* focusChange */
-};
-
-XDrawingAreaClassRec xDrawingAreaClassRec = {
-{
- /* Core class part */
-
- /* superclass */ (WidgetClass)&xmDrawingAreaClassRec,
- /* class_name */ "XDrawingArea",
- /* widget_size */ sizeof(XDrawingAreaRec),
- /* class_initialize */ ClassInitialize,
- /* class_part_initialize*/ NULL,
- /* class_inited */ FALSE,
- /* initialize */ NULL,
- /* initialize_hook */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ NULL,
- /* num_resources */ 0,
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ FALSE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ NULL,
- /* resize */ XtInheritResize,
- /* expose */ XtInheritExpose,
- /* set_values */ NULL,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback_offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ (XtPointer)&baseClassExtRec
- },
-
- { /* composite_class fields */
- XtInheritGeometryManager, /* geometry_manager */
- XtInheritChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
- NULL, /* extension */
- },
-
- { /* constraint_class fields */
- NULL, /* resource list */
- 0, /* num resources */
- 0, /* constraint size */
- NULL, /* init proc */
- NULL, /* destroy proc */
- NULL, /* set values proc */
- NULL, /* extension */
- },
-
- { /* manager_class fields */
- XtInheritTranslations, /* translations */
- NULL, /* syn_resources */
- 0, /* num_get_resources */
- NULL, /* syn_cont_resources */
- 0, /* num_get_cont_resources */
- XmInheritParentProcess, /* parent_process */
- NULL, /* extension */
- },
-
- { /* drawingArea class */
- /* extension */ NULL
- },
-
- /* XDrawingArea class part */
- {
- /* extension */ NULL
- }
-};
-
-WidgetClass xDrawingAreaClass = (WidgetClass)&xDrawingAreaClassRec;
-
-static void ClassInitialize( void )
-{
- baseClassExtRec.record_type = XmQmotif ;
-}
-
-static XmNavigability WidgetNavigable(Widget wid)
-{
- return XmCONTROL_NAVIGABLE;
-}
diff --git a/jdk/src/solaris/native/sun/awt/XDrawingArea.h b/jdk/src/solaris/native/sun/awt/XDrawingArea.h
deleted file mode 100644
index 4cc1cbf..0000000
--- a/jdk/src/solaris/native/sun/awt/XDrawingArea.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- */
-
-#ifndef _XDrawingArea_h_
-#define _XDrawingArea_h_
-
-extern WidgetClass xDrawingAreaClass;
-
-typedef struct _XDrawingAreaClassRec *XDrawingAreaWidgetClass;
-typedef struct _XDrawingAreaRec *XDrawingAreaWidget;
-
-#endif /* !_VDrawingArea_h_ */
diff --git a/jdk/src/solaris/native/sun/awt/XDrawingAreaP.h b/jdk/src/solaris/native/sun/awt/XDrawingAreaP.h
deleted file mode 100644
index d98f7da..0000000
--- a/jdk/src/solaris/native/sun/awt/XDrawingAreaP.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- */
-
-#ifndef _XDrawingAreaP_h_
-#define _XDrawingAreaP_h_
-
-#include <Xm/DrawingAP.h>
-#include "XDrawingArea.h"
-
-
-/***************************************************************
- * VDrawingArea Widget Data Structures
- *
- *
- **************************************************************/
-
-/* Define part class structure */
-typedef struct _XDrawingAreaClass {
- XtPointer extension;
-} XDrawingAreaClassPart;
-
-/* Define the full class record */
-typedef struct _XDrawingAreaClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ConstraintClassPart constraint_class;
- XmManagerClassPart manager_class;
- XmDrawingAreaClassPart drawing_area_class;
- XDrawingAreaClassPart xdrawingarea_class;
-} XDrawingAreaClassRec;
-
-/* External definition for class record */
-extern XDrawingAreaClassRec xDrawingAreaClassRec;
-
-/****************************************************************
- *
-* Full instance record declaration
- *
- ****************************************************************/
-
-typedef struct _XDrawingAreaRec
-{
- CorePart core;
- CompositePart composite;
- ConstraintPart constraint;
- XmManagerPart manager;
- XmDrawingAreaPart drawing_area;
-} XDrawingAreaRec;
-
-
-
-#endif /* !_VDrawingAreaP_h_ */
diff --git a/jdk/src/solaris/native/sun/awt/awt_Cursor.h b/jdk/src/solaris/native/sun/awt/awt_Cursor.h
deleted file mode 100644
index b71f2ec..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_Cursor.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "jni_util.h"
-#include "awt_p.h"
-
-#define CACHE_UPDATE 0 /* cache the component and update cursor */
-#define UPDATE_ONLY 1 /* update cursor, but not cache component */
-#define CACHE_ONLY 2 /* cache the component, no cursor update */
-
-/* fieldIDs for Cursor fields that may be accessed from C */
-struct CursorIDs {
- jfieldID type;
- jmethodID mSetPData;
- jfieldID pData;
-};
-
-#ifndef HEADLESS
-Cursor getCursor(JNIEnv *env, jobject jCur);
-void updateCursor(XPointer client_data, int32_t replace);
-#endif /* !HEADLESS */
diff --git a/jdk/src/solaris/native/sun/awt/awt_KeyboardFocusManager.h b/jdk/src/solaris/native/sun/awt/awt_KeyboardFocusManager.h
deleted file mode 100644
index fc28275..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_KeyboardFocusManager.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "jni.h"
-
-struct KeyboardFocusManagerIDs {
- jclass keyboardFocusManagerCls;
- jmethodID shouldNativelyFocusHeavyweightMID;
- jmethodID heavyweightButtonDownMID;
- jmethodID heavyweightButtonDownZMID;
- jmethodID markClearGlobalFocusOwnerMID;
- jmethodID processSynchronousTransferMID;
- jfieldID isProxyActive;
-};
diff --git a/jdk/src/solaris/native/sun/awt/awt_MToolkit.c b/jdk/src/solaris/native/sun/awt/awt_MToolkit.c
deleted file mode 100644
index 3a7c117..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_MToolkit.c
+++ /dev/null
@@ -1,3430 +0,0 @@
-/*
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "awt_p.h"
-
-#include <sys/time.h>
-#include <limits.h>
-#include <locale.h>
-
-#ifndef HEADLESS
-#include <X11/cursorfont.h>
-#include <Xm/MenuShell.h>
-#include <Xm/RowColumn.h>
-#endif /* !HEADLESS */
-
-#include <jvm.h>
-#include <jni.h>
-#include <jlong.h>
-#include <jni_util.h>
-
-/* JNI headers */
-#include "java_awt_AWTEvent.h"
-#include "java_awt_Frame.h"
-#include "java_awt_SystemColor.h"
-#include "sun_awt_motif_MToolkit.h"
-
-/* JNI field and method ids */
-#include "awt_Component.h"
-//#include "awt_Cursor.h"
-#include "awt_MenuComponent.h"
-#include "awt_TopLevel.h"
-#include "canvas.h"
-#include "color.h"
-#include "awt_mgrsel.h"
-#include "awt_wm.h"
-#include "awt_DrawingSurface.h"
-#include "awt_Window.h"
-#include "awt_xembed.h"
-#include "awt_xembed_server.h"
-
-extern JavaVM *jvm;
-
-#ifndef HEADLESS
-#ifdef __linux__
-extern void statusWindowEventHandler(XEvent event);
-#endif
-#endif /* !HEADLESS */
-
-JNIEXPORT jint JNICALL
-JNI_OnLoad(JavaVM *vm, void *reserved)
-{
-#ifndef HEADLESS
- awt_util_debug_init();
-#endif /* !HEADLESS */
- jvm = vm;
- return JNI_VERSION_1_2;
-}
-
-JNIEXPORT jboolean JNICALL AWTIsHeadless() {
-#ifdef HEADLESS
- return JNI_TRUE;
-#else
- return JNI_FALSE;
-#endif
-}
-
-#ifndef HEADLESS
-static jlong awtJNI_TimeMillis(void);
-extern void awt_initialize_Xm_DnD(Display*);
-extern void awt_initialize_DataTransferer();
-
-extern Display *awt_init_Display(JNIEnv *env);
-
-extern void X11SD_LibDispose(JNIEnv *env);
-
-extern Widget drag_source = NULL;
-
-extern struct ComponentIDs componentIDs;
-extern struct MenuComponentIDs menuComponentIDs;
-extern struct MComponentPeerIDs mComponentPeerIDs;
-extern struct WindowIDs windowIDs;
-
-static Atom _XA_XSETTINGS_SETTINGS = None;
-struct xsettings_callback_cookie {
- jobject mtoolkit;
- jmethodID upcallMID;
-};
-
-static struct xsettings_callback_cookie xsettings_callback_cookie;
-
-
-static XEvent focusOutEvent;
-
-static void awt_pipe_init(void);
-static void processOneEvent(XtInputMask iMask);
-extern void waitForEvents(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe);
-#ifdef USE_SELECT
-static void performSelect(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe);
-#else
-static void performPoll(JNIEnv *env,int32_t fdXPipe, int32_t fdAWTPipe);
-#endif
-
-
-#include <X11/Intrinsic.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-
-#ifdef USE_SELECT
-#if defined(AIX)
-#include <sys/select.h>
-#endif
-#else
-#include <poll.h>
-#ifndef POLLRDNORM
-#define POLLRDNORM POLLIN
-#endif
-#endif
-
-#ifdef NDEBUG
-#undef DEBUG /* NDEBUG overrides DEBUG */
-#endif
-
-static struct WidgetInfo *awt_winfo = (struct WidgetInfo *) NULL;
-static struct MenuList* menu_list = (struct MenuList*) NULL;
-
-#ifndef bzero
-#define bzero(a,b) memset(a, 0, b)
-#endif
-
-static jboolean syncUpdated = JNI_FALSE;
-static jboolean syncFailed = JNI_FALSE;
-static jint eventNumber = 0;
-static void syncWait_eventHandler(XEvent *);
-static Atom oops_atom = None;
-static Atom wm_selection = None;
-static Atom version_atom = None;
-
-static Boolean inSyncWait = False;
-
-Widget grabbed_widget = NULL;
-
-XtAppContext awt_appContext;
-Widget awt_root_shell;
-Pixel awt_defaultBg;
-Pixel awt_defaultFg;
-int32_t awt_multiclick_time; /* milliseconds */
-uint32_t awt_MetaMask = 0;
-uint32_t awt_AltMask = 0;
-uint32_t awt_NumLockMask = 0;
-uint32_t awt_ModeSwitchMask = 0;
-Cursor awt_scrollCursor;
-Boolean awt_ModLockIsShiftLock = False;
-extern Boolean awt_UseType4Patch;
-extern Boolean awt_UseXKB;
-
-#define SPECIAL_KEY_EVENT 2
-
-/* implement a "putback queue" -- see comments on awt_put_back_event() */
-#define PUTBACK_QUEUE_MIN_INCREMENT 5 /* min size increase */
-static XEvent *putbackQueue = NULL; /* the queue -- next event is 0 */
-static int32_t putbackQueueCount = 0; /* # of events available on queue */
-static int32_t putbackQueueCapacity = 0; /* total capacity of queue */
-static XtInputMask awt_events_pending(XtAppContext appContext);
-static int32_t awt_get_next_put_back_event(XEvent *xev_out);
-
-#define AWT_FLUSH_TIMEOUT ((uint32_t)100) /* milliseconds */
-#define AWT_MIN_POLL_TIMEOUT ((uint32_t)0) /* milliseconds */
-#define AWT_MAX_POLL_TIMEOUT ((uint32_t)250) /* milliseconds */
-
-#define AWT_POLL_BUFSIZE 100
-#define AWT_READPIPE (awt_pipe_fds[0])
-#define AWT_WRITEPIPE (awt_pipe_fds[1])
-#define AWT_FLUSHOUTPUT_NOW() \
-{ \
- XFlush(awt_display); \
- awt_next_flush_time = 0LL; \
-}
-
-typedef XtIntervalId (*XTFUNC)();
-
-static jobject awt_MainThread = NULL;
-static char read_buf[AWT_POLL_BUFSIZE + 1]; /* dummy buf to empty pipe */
-static int32_t awt_pipe_fds[2]; /* fds for wkaeup pipe */
-static Boolean awt_pipe_inited = False; /* make sure pipe is initialized before write */
-static int32_t def_poll_timeout = AWT_MAX_POLL_TIMEOUT; /* default value for timeout */
-static jlong awt_next_flush_time = 0LL; /* 0 == no scheduled flush */
-static void *xt_lib = NULL;
-static XTFUNC xt_timeout = NULL;
-
-#ifdef DEBUG_AWT_LOCK
-
-int32_t awt_locked = 0;
-char *lastF = "";
-int32_t lastL = -1;
-
-#endif
-
-#ifndef NOMODALFIX
-extern Boolean awt_isModal();
-extern Boolean awt_isWidgetModal(Widget w);
-#endif
-
-Boolean keyboardGrabbed = False;
-
-static uint32_t curPollTimeout = AWT_MAX_POLL_TIMEOUT;
-
-/* Font information to feed Motif widgets. */
-static const char *motifFontList;
-static XFontSet defaultMotifFontSet;
-static XFontStruct *defaultMotifFontStruct;
-static const char *defaultMotifFont = /* a.k.a "fixed", known everywhere */
- "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1";
-
-XFontSet getMotifFontSet() {
- char **missingList;
- int32_t missingCount;
- char *defChar;
-
- return XCreateFontSet(awt_display, motifFontList,
- &missingList, &missingCount, &defChar);
-}
-
-XFontStruct *getMotifFontStruct() {
- return XLoadQueryFont(awt_display, defaultMotifFont);
-}
-
-XmFontList getMotifFontList() {
- XmFontListEntry motifFontListEntry;
- XmFontList fontlist;
-
- if (strchr(motifFontList, ',') == NULL) {
- /* If the default font is a single font. */
- if (defaultMotifFontStruct == NULL)
- defaultMotifFontStruct = getMotifFontStruct();
- motifFontListEntry = XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG,
- XmFONT_IS_FONT,
- (XtPointer)defaultMotifFontStruct);
- }
- else {
- /* If the default font is multiple fonts. */
- if (defaultMotifFontSet == NULL)
- defaultMotifFontSet = getMotifFontSet();
- motifFontListEntry = XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG,
- XmFONT_IS_FONTSET,
- (XtPointer)defaultMotifFontSet);
- }
- fontlist = XmFontListAppendEntry(NULL, motifFontListEntry);
- XmFontListEntryFree(&motifFontListEntry);
- return fontlist;
-}
-
-static void
-awt_set_poll_timeout (uint32_t newTimeout)
-{
- DTRACE_PRINTLN1("awt_set_poll_timeout(%lu)", newTimeout);
-
- newTimeout = max(AWT_MIN_POLL_TIMEOUT, newTimeout);
- newTimeout = min(AWT_MAX_POLL_TIMEOUT, newTimeout);
- newTimeout = min(newTimeout, curPollTimeout);
- curPollTimeout = newTimeout;
-
-} /* awt_set_poll_timeout */
-
-/*
- * Gets the best timeout for the next call to poll() or select().
- * If timedOut is True, we assume that our previous timeout elapsed
- * with no events/timers arriving. Therefore, we can increase the
- * next timeout slightly.
- */
-static uint32_t
-awt_get_poll_timeout( Boolean timedOut )
-{
- uint32_t timeout = AWT_MAX_POLL_TIMEOUT;
-
- DTRACE_PRINTLN2("awt_get_poll_timeout(%s), awt_next_flush_time:%ld",
- (remove?"true":"false"),
- awt_next_flush_time);
-
- if (timedOut) {
- /* add 1/16 (plus 1, in case the division truncates to 0) */
- curPollTimeout += ((curPollTimeout>>4) + 1);
- curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout);
- }
- if (awt_next_flush_time > 0) {
- int32_t flushDiff = (int32_t)(awt_next_flush_time - awtJNI_TimeMillis());
- timeout = min(curPollTimeout, flushDiff);
- } else {
- timeout = curPollTimeout;
- }
-
- return timeout;
-} /* awt_get_poll_timeout() */
-
-static jlong
-awtJNI_TimeMillis(void)
-{
- struct timeval t;
-
- gettimeofday(&t, 0);
-
- return jlong_add(jlong_mul(jint_to_jlong(t.tv_sec), jint_to_jlong(1000)),
- jint_to_jlong(t.tv_usec / 1000));
-}
-
-static int32_t
-xtError()
-{
-#ifdef DEBUG
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-
- jio_fprintf(stderr, "Xt error\n");
- JNU_ThrowNullPointerException(env, "NullPointerException");
-#endif
- return 0;
-}
-
-static int32_t
-xIOError(Display *dpy)
-{
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jclass cl = (*env)->FindClass(env, "java/lang/Thread");
-
- if (errno == EPIPE) {
- jio_fprintf(stderr, "X connection to %s host broken (explicit kill or server shutdown)\n", XDisplayName(NULL));
- }
- AWT_NOFLUSH_UNLOCK();
- JVM_RaiseSignal(JVM_SIGTERM); /* Shut down cleanly */
- if (cl != NULL) {
- JVM_Sleep(env, cl, 20000);
- }
-
- return 0; /* to keep compiler happy */
-}
-
-/* Like XKeysymToKeycode, but ensures that keysym is the primary
- * symbol on the keycode returned. Returns zero otherwise.
- */
-static int32_t
-keysym_to_keycode_if_primary(Display *dpy, KeySym sym)
-{
- KeyCode code;
- KeySym primary;
-
- code = XKeysymToKeycode(dpy, sym);
- if (code == 0) {
- return 0;
- }
-
- primary = XKeycodeToKeysym(dpy, code, 0);
- if (sym == primary) {
- return code;
- } else {
- return 0;
- }
-}
-/*
- * +kb or -kb ?
- */
-static Boolean
-isXKBenabled(Display *display) {
- int mop, beve, berr;
- /*
- * NB: TODO: hope it will return False if XkbIgnoreExtension was called!
- */
- return XQueryExtension(display, "XKEYBOARD", &mop, &beve, &berr);
-}
-
-
-/* Assign meaning - alt, meta, etc. - to X modifiers mod1 ... mod5.
- * Only consider primary symbols on keycodes attached to modifiers.
- */
-static void
-setup_modifier_map(Display *disp)
-{
- KeyCode metaL = keysym_to_keycode_if_primary(disp, XK_Meta_L);
- KeyCode metaR = keysym_to_keycode_if_primary(disp, XK_Meta_R);
- KeyCode altL = keysym_to_keycode_if_primary(disp, XK_Alt_L);
- KeyCode altR = keysym_to_keycode_if_primary(disp, XK_Alt_R);
- KeyCode numLock = keysym_to_keycode_if_primary(disp, XK_Num_Lock);
- KeyCode modeSwitch = keysym_to_keycode_if_primary(disp, XK_Mode_switch);
- KeyCode shiftLock = keysym_to_keycode_if_primary(disp, XK_Shift_Lock);
- KeyCode capsLock = keysym_to_keycode_if_primary(disp, XK_Caps_Lock);
-
- XModifierKeymap *modmap = NULL;
- int32_t nkeys, modn, i;
- char *ptr = NULL;
-
- DTRACE_PRINTLN("In setup_modifier_map");
-
- modmap = XGetModifierMapping(disp);
- nkeys = modmap->max_keypermod;
-
- for (modn = Mod1MapIndex;
- (modn <= Mod5MapIndex) &&
- (awt_MetaMask == 0 || awt_AltMask == 0 ||
- awt_NumLockMask == 0 || awt_ModeSwitchMask == 0);
- ++modn)
- {
- static const uint32_t modmask[8] = {
- ShiftMask, LockMask, ControlMask,
- Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
- };
-
-
- for (i = 0; i < nkeys; ++i) {
- /* for each keycode attached to this modifier */
- KeyCode keycode = modmap->modifiermap[modn * nkeys + i];
- if (keycode == 0) {
- continue;
- }
-
- if (awt_MetaMask == 0 && (keycode == metaL || keycode == metaR)) {
- awt_MetaMask = modmask[modn];
- DTRACE_PRINTLN2(" awt_MetaMask = %d, modn = %d", awt_MetaMask, modn);
- break;
- } else if (awt_AltMask == 0 && (keycode == altL || keycode == altR)) {
- awt_AltMask = modmask[modn];
- DTRACE_PRINTLN2(" awt_AltMask = %d, modn = %d", awt_AltMask, modn);
- break;
- } else if (awt_NumLockMask == 0 && keycode == numLock) {
- awt_NumLockMask = modmask[modn];
- DTRACE_PRINTLN2(" awt_NumLockMask = %d, modn = %d", awt_NumLockMask, modn);
- break;
- } else if (awt_ModeSwitchMask == 0 && keycode == modeSwitch) {
- awt_ModeSwitchMask = modmask[modn];
- DTRACE_PRINTLN2(" awt_ModeSwitchMask = %d, modn = %d", awt_ModeSwitchMask, modn);
- break;
- }
- }
- }
- for(i = 0; i < nkeys; i++) {
- KeyCode keycode = modmap->modifiermap[LockMapIndex * nkeys + i];
- if (keycode == 0) {
- break;
- }
- if (keycode == shiftLock) {
- awt_ModLockIsShiftLock = True;
- break;
- }
- if (keycode == capsLock) {
- break;
- }
- }
-
- DTRACE_PRINTLN1(" ShiftMask = %d", ShiftMask);
- DTRACE_PRINTLN1(" ControlMask = %d", ControlMask);
-
- XFreeModifiermap(modmap);
- ptr = getenv("_AWT_USE_TYPE4_PATCH");
- if( ptr != NULL && ptr[0] != 0 ) {
- if( strncmp("true", ptr, 4) == 0 ) {
- awt_UseType4Patch = True;
- }else if( strncmp("false", ptr, 5) == 0 ) {
- awt_UseType4Patch = False;
- }
- }
- awt_UseXKB = isXKBenabled(disp);
-
-}
-
-
-Boolean scrollBugWorkAround;
-
-
-void
-awt_output_flush()
-{
- char c = 'p';
-
- if (awt_next_flush_time == 0)
- {
- Boolean needsWakeup = False;
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- if (awt_pipe_inited && (awt_get_poll_timeout(False) > (2*AWT_FLUSH_TIMEOUT))){
- needsWakeup = True;
- }
- /* awt_next_flush_time affects awt_get_poll_timeout(), so set
- * the variable *after* calling the function.
- */
- awt_next_flush_time = awtJNI_TimeMillis() + AWT_FLUSH_TIMEOUT;
- if (needsWakeup)
- {
- /* write to the utility pipe to wake up the event
- * loop, if it's sleeping
- */
- write ( AWT_WRITEPIPE, &c, 1 );
- }
- }
-#ifdef FLUSHDEBUG
-else
-jio_fprintf(stderr, "!");
-#endif
-} /* awt_output_flush() */
-
-void
-null_event_handler(Widget w, XtPointer client_data,
- XEvent * event, Boolean * cont)
-{
- /* do nothing */
-}
-
-struct WidgetInfo *
-findWidgetInfo(Widget widget)
-{
- struct WidgetInfo *cw;
-
- for (cw = awt_winfo; cw != NULL; cw = cw->next) {
- if (cw->widget == widget || cw->origin == widget) {
- return cw;
- }
- }
- return NULL;
-}
-
-void
-awt_addWidget(Widget w, Widget origin, void *peer, jlong event_flags)
-{
- if (findWidgetInfo(w) != NULL) return;
-
- if (!XtIsSubclass(w, xmFileSelectionBoxWidgetClass)) {
- struct WidgetInfo *nw = (struct WidgetInfo *) malloc(sizeof(struct WidgetInfo));
-
- if (nw) {
- nw->widget = w;
- nw->origin = origin;
- nw->peer = peer;
- nw->event_mask = event_flags;
- nw->next = awt_winfo;
- awt_winfo = nw;
-
- if (event_flags & java_awt_AWTEvent_MOUSE_EVENT_MASK) {
- XtAddEventHandler(w,
- ButtonPressMask | ButtonReleaseMask |
- EnterWindowMask | LeaveWindowMask,
- False, null_event_handler, NULL);
- if (w != origin) {
- XtAddEventHandler(origin,
- ButtonPressMask | ButtonReleaseMask |
- EnterWindowMask | LeaveWindowMask,
- False, null_event_handler, NULL);
- }
- }
- if (event_flags & java_awt_AWTEvent_MOUSE_MOTION_EVENT_MASK) {
- XtAddEventHandler(w,
- PointerMotionMask,
- False, null_event_handler, NULL);
- if (w != origin) {
- XtAddEventHandler(origin,
- PointerMotionMask,
- False, null_event_handler, NULL);
- }
- }
- if (event_flags & java_awt_AWTEvent_KEY_EVENT_MASK) {
- XtAddEventHandler(w,
- KeyPressMask | KeyReleaseMask,
- False, null_event_handler, NULL);
- if (w != origin) {
- XtAddEventHandler(origin,
- KeyPressMask | KeyReleaseMask,
- False, null_event_handler, NULL);
- }
- }
- } else {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
- }
-
- }
-}
-
-void
-awt_delWidget(Widget w)
-{
- struct WidgetInfo *cw;
-
- if (awt_winfo != NULL) {
- if ((awt_winfo->widget == w) ||
- (awt_winfo->origin == w)) {
- cw = awt_winfo;
- awt_winfo = awt_winfo->next;
- free((void *) cw);
- } else {
- struct WidgetInfo *pw;
-
- for (pw = awt_winfo, cw = awt_winfo->next;
- cw != NULL;
- pw = cw, cw = cw->next) {
- if ((cw->widget == w) ||
- (cw->origin == w)) {
- pw->next = cw->next;
- free((void *) cw);
- break;
- }
- }
- }
- }
-}
-
-
-void *
-findPeer(Widget * pwidget)
-{
- struct WidgetInfo *cw;
- Widget widgetParent;
- void * peer;
-
- if ((cw = findWidgetInfo(*pwidget)) != NULL) {
- return cw->peer;
- }
- /* fix for 4053856, robi.khan at eng
- couldn't find peer corresponding to widget
- but the widget may be child of one with
- a peer, so recurse up the hierarchy */
- widgetParent = XtParent(*pwidget);
- if (widgetParent != NULL ) {
- peer = findPeer(&widgetParent);
- if( peer != NULL ) {
- /* found peer attached to ancestor of given
- widget, so set widget return value as well */
- *pwidget = widgetParent;
- return peer;
- }
- }
-
- return NULL;
-}
-
-Boolean
-awt_isAwtWidget(Widget widget)
-{
- return (findWidgetInfo(widget) != NULL);
-}
-
-
-static Boolean
-awt_isAwtMenuWidget(Widget wdgt) {
- struct MenuList* cur;
-
- if (!XtIsSubclass(wdgt, xmRowColumnWidgetClass)) {
- return False;
- }
- for (cur = menu_list; cur != NULL; cur = cur->next) {
- if (cur->menu == wdgt) {
- return True;
- }
- }
- return False;
-}
-
-void
-awt_addMenuWidget(Widget wdgt) {
- DASSERT(XtIsSubclass(wdgt, xmRowColumnWidgetClass));
-
- if (!awt_isAwtMenuWidget(wdgt)) {
- struct MenuList* ml = (struct MenuList*) malloc(sizeof(struct MenuList));
- if (ml != NULL) {
- ml->menu = wdgt;
- ml->next = menu_list;
- menu_list = ml;
- } else {
- JNIEnv* env = (JNIEnv*)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
- }
- }
-}
-
-void
-awt_delMenuWidget(Widget wdgt) {
- struct MenuList** pp;
- struct MenuList* p;
-
- DASSERT(XtIsSubclass(wdgt, xmRowColumnWidgetClass));
-
- for (pp = &menu_list; *pp != NULL; pp = &((*pp)->next)) {
- if ((*pp)->menu == wdgt) {
- p = *pp;
- *pp = (*pp)->next;
- free((void*)p);
- break;
- }
- }
-}
-
-
-static Widget
-getShellWidgetByPart(Widget part) {
- int i;
- for (i = 0; i < 3; i++) {
- if (part == NULL) return NULL;
- if (XtIsShell(part)) return part;
- part = XtParent(part);
- }
- return NULL;
-}
-
-static Boolean
-isTheSameShellWidget(Widget shell, Widget w) {
- Widget s1, s2;
- if (shell == NULL || w == NULL) return False;
- s1 = getShellWidgetByPart(shell);
- s2 = getShellWidgetByPart(w);
- if (s1 == s2 && s1 != NULL) {
- return True;
- } else {
- return False;
- }
-}
-
-static Boolean
-shouldDispatchToWidget(XEvent * xev)
-{
- /* If this function returns False, that means that it has not pre-posted
- this event to Java. The caller will then dispatch the event to Motif,
- and our handlers will be called to post it to Java.
- If this function returns true, then this function has posted this event
- to java before returning. The caller will not dispatch it to Motif;
- it will be dispatched to Motif via the putbackQueue after it has been
- processed by Java */
-
- Window win;
- Widget widget = NULL;
- struct WidgetInfo *winfo;
- void *peer = NULL;
- Boolean cont = FALSE;
-
- switch (xev->type) {
- case KeyPress:
- case KeyRelease:
- win = xev->xkey.window;
- break;
- case FocusIn:
- case FocusOut:
- win = xev->xfocus.window;
- break;
- case ButtonPress:
- case ButtonRelease:
- win = xev->xbutton.window;
- break;
- case MotionNotify:
- win = xev->xmotion.window;
- break;
- case EnterNotify:
- case LeaveNotify:
- win = xev->xcrossing.window;
- break;
- default:
- return False;
- }
-
- if ((widget = XtWindowToWidget(awt_display, win)) == NULL) {
- return False;
- }
-
- if (xev->type == KeyPress || xev->type == KeyRelease) {
- Widget focusWidget = XmGetFocusWidget(widget);
-
- /* Fix for 4328561 by ibd at sparc.spb.su
- If the widget is a Choice, the widget with focus is probably lying
- outside the current widget's sub-hierarchy, so we have to go up the
- hierarchy to reach it */
-
- if ((focusWidget == NULL) && XmIsMenuShell(widget)) {
- if ((widget = XtParent(widget)) != NULL) {
- focusWidget = XmGetFocusWidget(widget);
- } else {
- return False;
- }
-
- /* In this case, focus widget should be CascadeButtonGadget type,
- but we should send the events to its parent */
- if (focusWidget != NULL && XmIsCascadeButtonGadget(focusWidget)) {
- widget = XtParent(focusWidget);
- } else {
- /* If something went wrong, restore the original status */
- widget = XtWindowToWidget(awt_display, win);
- }
- }
-
- /* if focus owner is null, redirect key events to focused window */
- if (focusWidget == NULL && findWidgetInfo(widget) == NULL) {
- focusWidget = findTopLevelByShell(widget);
- }
-
- /* If we are on a non-choice widget, process events in a normal way */
- if ((focusWidget != NULL) && (focusWidget != widget)) {
- if (isTheSameShellWidget(focusWidget, widget)) {
- focusWidget = findTopLevelByShell(widget);
- }
- if (focusWidget != NULL) {
- peer = findPeer(&focusWidget);
- }
- if (peer != NULL) {
- widget = focusWidget;
- win = xev->xkey.window = XtWindow(focusWidget);
- }
- }
- }
-
- if ((winfo = findWidgetInfo(widget)) == NULL) {
- return False;
- }
-
- /*
- * Fix for bug 4145193
- *
- * If a menu is up (not just a popup menu), prevent awt components from
- * getting any events until the menu is popped down.
- * Before this fix, the fact that mouse/button events were
- * preposted to the Java event queue was causing the ButtonRelease
- * (needed to pop menu down) to be seen by the menu's parent and
- * not the menu.
- */
- if (awtMenuIsActive()) {
- Widget focusWidget = XmGetFocusWidget(widget);
-
- if (focusWidget == NULL) {
- return False;
- }
-
- /* If we are on a choice, dispatch the events to widget, but do not
- * dispatch the events if we are on popped up menu.
- */
- if (!XmIsRowColumn(widget) || !XmIsCascadeButtonGadget(focusWidget)) {
- /* Fix for 4328557 by ibd at sparc.spb.su
- * If we are dragging mouse from choice and are currently outside
- * of it, dispatch events to the choice - the source of dragging.
- */
-
- if ((drag_source != NULL) && (widget != drag_source) &&
- (peer = findPeer(&drag_source))) {
- awt_canvas_handleEvent(drag_source, peer, xev, winfo, &cont, TRUE);
- }
- return False;
- }
- }
-
- /* If the keyboard is grabbed by a popup (such as a choice) during
- a time when a focus proxy is in effect, the abovefocusIsOnMenu
- test will not detect the sitation because the focus will be on
- the proxy. But we need events to go to Motif first, so that the
- grab can be undone when appropriate. */
- if (keyboardGrabbed) {
- return False;
- }
-
- /* If it's a keyboard event, we need to find the peer associated */
- /* with the widget that has the focus rather than the widget */
- /* associated with the window in the X event. */
-
- switch (xev->type) {
- case KeyPress:
- case KeyRelease:
- if (!(winfo->event_mask & java_awt_AWTEvent_KEY_EVENT_MASK))
- return False;
- break;
- case FocusIn:
- case FocusOut:
- if (!(winfo->event_mask & java_awt_AWTEvent_FOCUS_EVENT_MASK))
- return False;
- break;
- case ButtonPress:
- case ButtonRelease:
- if (!(winfo->event_mask & java_awt_AWTEvent_MOUSE_EVENT_MASK)) {
- return False;
- }
- break;
- case EnterNotify:
- case LeaveNotify:
- /*
- * Do not post the enter/leave event if it's on a subwidget
- * within the component.
- */
- if (!(winfo->event_mask & java_awt_AWTEvent_MOUSE_EVENT_MASK) ||
- widget != winfo->origin)
- return False;
- break;
- case MotionNotify:
- if (!(winfo->event_mask & java_awt_AWTEvent_MOUSE_MOTION_EVENT_MASK))
- return False;
- break;
- default:
- return False;
- }
-
- peer = winfo->peer;
-
- /* If we found a widget and a suitable peer (either the focus
- peer above or the one associated with the widget then we
- dispatch to it. */
- if (peer == NULL) {
- return False;
- }
-
- /*
- * Fix for bug 4173714 - java.awt.button behaves differently under
- * Win32/Solaris.
- * Component should not get any events when it's disabled.
- */
- if (!XtIsSensitive(widget)) {
- if (xev->type == EnterNotify) {
- updateCursor(peer, CACHE_UPDATE);
- }
- return False;
- }
-
- awt_canvas_handleEvent(widget, peer, xev, winfo, &cont, TRUE);
- return (!cont);
-} /* shouldDispatchToWidget() */
-
-
-void set_toolkit_busy(Boolean busy) {
-
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-
- static jclass awtAutoShutdownClass = NULL;
- static jmethodID notifyBusyMethodID = NULL;
- static jmethodID notifyFreeMethodID = NULL;
-
- if (awtAutoShutdownClass == NULL) {
- jclass awtAutoShutdownClassLocal = (*env)->FindClass(env, "sun/awt/AWTAutoShutdown");
- if ((*env)->ExceptionOccurred(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->ExceptionClear(env);
- }
- DASSERT(awtAutoShutdownClassLocal != NULL);
- if (awtAutoShutdownClassLocal == NULL) {
- return;
- }
-
- awtAutoShutdownClass = (jclass)(*env)->NewGlobalRef(env, awtAutoShutdownClassLocal);
- (*env)->DeleteLocalRef(env, awtAutoShutdownClassLocal);
-
- notifyBusyMethodID = (*env)->GetStaticMethodID(env, awtAutoShutdownClass,
- "notifyToolkitThreadBusy", "()V");
- if ((*env)->ExceptionOccurred(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->ExceptionClear(env);
- }
- notifyFreeMethodID = (*env)->GetStaticMethodID(env, awtAutoShutdownClass,
- "notifyToolkitThreadFree", "()V");
- if ((*env)->ExceptionOccurred(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->ExceptionClear(env);
- }
- DASSERT(notifyBusyMethodID != NULL);
- DASSERT(notifyFreeMethodID != NULL);
- if (notifyBusyMethodID == NULL || notifyFreeMethodID == NULL) {
- return;
- }
- } /* awtAutoShutdownClass == NULL*/
-
- if (busy) {
- (*env)->CallStaticVoidMethod(env, awtAutoShutdownClass,
- notifyBusyMethodID);
- } else {
- (*env)->CallStaticVoidMethod(env, awtAutoShutdownClass,
- notifyFreeMethodID);
- }
-
- if ((*env)->ExceptionOccurred(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->ExceptionClear(env);
- }
-}
-
-#ifdef DEBUG
-static int32_t debugPrintLineCount = 0; /* limit debug output per line */
-#endif
-
-/*
- * This is the main Xt event loop for the AWT.
- *
- * Because java applications are multithreaded, but X and Xt
- * are thread-dumb, we must make special considerations to
- * make ensure that the X/Xt libraries are not entered by
- * multiple threads simultaneously.
- *
- * The biggest difference between the standard Xt loop
- * and this loop is that we go to great lengths never to block
- * in the X libraries. We poll() on the X event pipe, waiting
- * for events, rather than simply calling XtAppNextEvent() and
- * blocking. If this thread were to block in XtAppNextEvent(),
- * no other thread could enter (e.g., to perform a paint or
- * retrieve data).
- */
-/* #ifdef DEBUG */
- int32_t numEventsHandled = 0;
-/* #endif */
-static void
-awt_MToolkit_loop(JNIEnv *env)
-{
- XtInputMask iMask;
- int32_t fdXPipe = -1; /* pipe where X events arrive */
-
- /* only privileged thread should be running here */
- DASSERT(awt_currentThreadIsPrivileged(env));
-
- /* The pipe where X events arrive */
- fdXPipe = ConnectionNumber(awt_display) ;
-
- /* We execute events while locked, unlocking only when waiting
- * for an event
- */
- AWT_LOCK();
-
- /* Create the AWT utility pipe. See the comments on awt_pipe_init() */
- awt_pipe_init();
-
- /*
- * Need to flush here in case data on the connection was read
- * before we acquired the monitor.
- *
- * I don't get this, but I'm too chicken to remove it. -jethro 2Sep98
- */
- AWT_FLUSHOUTPUT_NOW();
-
- /*
- * ACTUALLY PROCESS EVENTS
- */
- while(True) {
-
- /* process all events in the queue */
-/* #ifdef DEBUG */
-/* numEventsHandled = 0; */
-/* #endif */
- while (((iMask = awt_events_pending(awt_appContext)) & XtIMAll) > 0) {
-
-/* #ifdef DEBUG */
- ++numEventsHandled;
-/* #endif */
- processOneEvent(iMask);
-
- } /* end while awt_events_pending() */
- /* At this point, we have exhausted the event queue */
-
- /* print the number of events handled in parens */
- DTRACE_PRINT1("(%d events)",(int32_t)numEventsHandled);
-#ifdef DEBUG
- if (++debugPrintLineCount > 8) {
- DTRACE_PRINTLN("");
- debugPrintLineCount = 0;
- }
-#endif
-
- AWT_NOTIFY_ALL(); /* wake up modalWait() */
-
- set_toolkit_busy(False);
-
- /* Here, we wait for X events, outside of the X libs. When
- * it's likely that an event is waiting, we process the queue
- */
- waitForEvents(env, fdXPipe, AWT_READPIPE);
-
- set_toolkit_busy(True);
-
- } /* while(True) */
-
- /* If we ever exit the loop, must unlock the toolkit */
-
-} /* awt_MToolkit_loop() */
-
-/*
- * Creates the AWT utility pipe. This pipe exists solely so that
- * we can cause the main event thread to wake up from a poll() or
- * select() by writing to this pipe.
- */
-static void
-awt_pipe_init(void) {
-
- if (awt_pipe_inited) {
- return;
- }
-
- if ( pipe ( awt_pipe_fds ) == 0 )
- {
- /*
- ** the write wakes us up from the infinite sleep, which
- ** then we cause a delay of AWT_FLUSHTIME and then we
- ** flush.
- */
- int32_t flags = 0;
- awt_set_poll_timeout (def_poll_timeout);
- /* set the pipe to be non-blocking */
- flags = fcntl ( AWT_READPIPE, F_GETFL, 0 );
- fcntl( AWT_READPIPE, F_SETFL, flags | O_NDELAY | O_NONBLOCK );
- flags = fcntl ( AWT_WRITEPIPE, F_GETFL, 0 );
- fcntl( AWT_WRITEPIPE, F_SETFL, flags | O_NDELAY | O_NONBLOCK );
- awt_pipe_inited = True;
- }
- else
- {
- AWT_READPIPE = -1;
- AWT_WRITEPIPE = -1;
- awt_pipe_inited = False;
- }
-} /* awt_pipe_init() */
-
-static Window
-proxyTopLevel(Window proxyWindow) {
- Window parent = None, root = None, *children = NULL, retvalue = None;
- uint32_t nchildren = 0;
- Status res = XQueryTree(awt_display, proxyWindow, &root, &parent,
- &children, &nchildren);
- if (res != 0) {
- if (nchildren > 0) {
- retvalue = children[0];
- }
- else retvalue = None;
- if (children != NULL) {
- XFree(children);
- }
- return retvalue;
- } else {
- return None;
- }
-}
-
-static jclass clazzF, clazzD = NULL;
-
-static Boolean
-initClazzD(JNIEnv *env) {
- jclass t_clazzD = (*env)->FindClass(env, "java/awt/Dialog");
- if ((*env)->ExceptionOccurred(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->ExceptionClear(env);
- }
- DASSERT(t_clazzD != NULL);
- if (t_clazzD == NULL) {
- return False;
- }
- clazzD = (*env)->NewGlobalRef(env, t_clazzD);
- DASSERT(clazzD != NULL);
- (*env)->DeleteLocalRef(env, t_clazzD);
- return True;
-}
-
-Boolean
-isFrameOrDialog(jobject target, JNIEnv *env) {
- if ((*env)->EnsureLocalCapacity(env, 1) < 0) {
- return False;
- }
-
- if (clazzF == NULL) {
- jclass t_clazzF = (*env)->FindClass(env, "java/awt/Frame");
- if ((*env)->ExceptionOccurred(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->ExceptionClear(env);
- }
- DASSERT(t_clazzF != NULL);
- if (t_clazzF == NULL) {
- return False;
- }
- clazzF = (*env)->NewGlobalRef(env, t_clazzF);
- DASSERT(clazzF != NULL);
- (*env)->DeleteLocalRef(env, t_clazzF);
- }
-
- if (clazzD == NULL && !initClazzD(env)) {
- return False;
- }
-
- return (*env)->IsInstanceOf(env, target, clazzF) ||
- (*env)->IsInstanceOf(env, target, clazzD);
-}
-
-Boolean
-isDialog(jobject target, JNIEnv *env) {
- if (clazzD == NULL && !initClazzD(env)) {
- return False;
- }
- return (*env)->IsInstanceOf(env, target, clazzD);
-}
-
-// Returns a local ref to a decorated owner of the target,
-// or NULL if the target is Frame or Dialog itself.
-// The local ref returned should be deleted by the caller.
-jobject
-getOwningFrameOrDialog(jobject target, JNIEnv *env) {
- jobject _target = (*env)->NewLocalRef(env, target);
- jobject parent = _target;
- Boolean isSelfFrameOrDialog = True;
-
- while (!isFrameOrDialog(parent, env)) {
- isSelfFrameOrDialog = False;
- parent = (*env)->CallObjectMethod(env, _target, componentIDs.getParent);
- (*env)->DeleteLocalRef(env, _target);
- _target = parent;
- }
-
- if (isSelfFrameOrDialog) {
- (*env)->DeleteLocalRef(env, parent);
- return NULL;
- }
- return parent;
-}
-
-Widget
-findWindowsProxy(jobject window, JNIEnv *env) {
- struct ComponentData *cdata;
- jobject tlPeer;
- jobject owner_prev = NULL, owner_new = NULL;
- /* the owner of a Window is in its parent field */
- /* we may have a chain of Windows; go up the chain till we find the
- owning Frame or Dialog */
- if ((*env)->EnsureLocalCapacity(env, 4) < 0) {
- return NULL;
- }
-
- if (window == NULL) return NULL;
-
- owner_prev = (*env)->NewLocalRef(env, window);
- while (!JNU_IsNull(env, owner_prev) && !(isFrameOrDialog(owner_prev, env))) {
- owner_new = (*env)->CallObjectMethod(env, owner_prev, componentIDs.getParent);
- (*env)->DeleteLocalRef(env, owner_prev);
- owner_prev = owner_new;
- }
-
- if (owner_prev == NULL) return NULL;
-
- tlPeer = (*env)->GetObjectField(env, owner_prev, componentIDs.peer);
- (*env)->DeleteLocalRef(env, owner_prev);
- if (tlPeer == NULL) return NULL;
-
- cdata = (struct ComponentData *)
- JNU_GetLongFieldAsPtr(env, tlPeer, mComponentPeerIDs.pData);
- (*env)->DeleteLocalRef(env, tlPeer);
-
- if (cdata == NULL) return NULL;
- return(findFocusProxy(cdata->widget));
-}
-
-jobject
-findTopLevel(jobject peer, JNIEnv *env) {
- jobject target_prev = NULL;
- static jclass clazzW = NULL;
-
- if ((*env)->EnsureLocalCapacity(env, 3) < 0) {
- return NULL;
- }
-
- if (clazzW == NULL) {
- jclass t_clazzW = (*env)->FindClass(env, "java/awt/Window");
- if ((*env)->ExceptionOccurred(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->ExceptionClear(env);
- }
- DASSERT(t_clazzW != NULL);
- if (t_clazzW == NULL) {
- return NULL;
- }
- clazzW = (*env)->NewGlobalRef(env, t_clazzW);
- DASSERT(clazzW != NULL);
- (*env)->DeleteLocalRef(env, t_clazzW);
- }
- target_prev = (*env)->GetObjectField(env, peer, mComponentPeerIDs.target);
- if (target_prev == NULL) {
- return NULL;
- }
-
- while ((target_prev != NULL)
- && !(*env)->IsInstanceOf(env, target_prev, clazzW) )
- {
- /* go up the hierarchy until we find a window */
- jobject target_new = (*env)->CallObjectMethod(env, target_prev, componentIDs.getParent);
- (*env)->DeleteLocalRef(env, target_prev);
- target_prev = target_new;
- }
- return target_prev;
-}
-
-static Window
-rootWindow(Window w) {
- Window root = None;
- Window parent = None;
- Window *children = NULL;
- uint32_t nchildren = 0;
-
- if (w != None) {
- Status res = XQueryTree(awt_display, w, &root, &parent, &children, &nchildren);
- if (res == 0) {
- return None;
- }
- if (children != NULL) {
- XFree(children);
- }
- return root;
- } else {
- return None;
- }
-}
-
-Boolean IsRootOf(Window root, Window child) {
- Window w_root = None, w_parent = None, * children = NULL;
- uint32_t c_count = 0;
- if (root == None || child == None) {
- return False;
- }
- do {
- w_root = None;
- w_parent = None;
- children = NULL;
- c_count = 0;
- if (XQueryTree(awt_display, child, &w_root, &w_parent,
- &children, &c_count)) {
- if (children != NULL) {
- XFree(children);
- }
- if (w_parent == None) {
- return False;
- }
- if (w_parent == root) {
- return True;
- }
- } else {
- return False;
- }
- child = w_parent;
- } while (True);
-}
-
-Window findShellByProxy(Window proxy) {
- Widget proxy_wid = XtWindowToWidget(awt_display, proxy);
- while (proxy_wid != NULL && !XtIsShell(proxy_wid)) {
- proxy_wid = XtParent(proxy_wid);
- }
- if (proxy_wid == NULL) {
- return None;
- }
- return XtWindow(proxy_wid);
-}
-
-// Window which contains focus owner when focus proxy is enabled
-Window trueFocusWindow = None;
-// Window which works as proxy for input events for real focus owner.
-Window focusProxyWindow = None;
-
-void clearFocusPathOnWindow(Window win) {
- if (focusProxyWindow != None && IsRootOf(win, trueFocusWindow)) {
- XEvent ev;
- memset(&ev, 0, sizeof(ev));
- ev.type = FocusOut;
- ev.xany.send_event = True;
- ev.xany.display = awt_display;
- ev.xfocus.mode = NotifyNormal;
- ev.xfocus.detail = NotifyNonlinear;
- {
- Window root = rootWindow(trueFocusWindow);
- JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
- ev.xfocus.window = trueFocusWindow;
- while (ev.xfocus.window != root &&
- ev.xfocus.window != None) {
- Widget w = XtWindowToWidget(awt_display,
- ev.xfocus.window);
- awt_put_back_event(env, &ev);
- if (w == NULL) {
- break;
- }
- if (XtParent(w) != NULL) {
- ev.xfocus.window = XtWindow(XtParent(w));
- } else {
- ev.xfocus.window = None;
- }
- }
- }
- XSetInputFocus(awt_display, findShellByProxy(focusProxyWindow), RevertToPointerRoot, CurrentTime);
- trueFocusWindow = None;
- focusProxyWindow = None;
- }
-}
-void clearFocusPath(Widget shell) {
- Window w = None;
- if (shell == NULL) {
- return;
- }
- w = XtWindow(shell);
- clearFocusPathOnWindow(w);
-}
-
-void globalClearFocusPath(Widget focusOwnerShell ) {
- if (focusProxyWindow != None) {
- Window shellWindow = findShellByProxy(trueFocusWindow);
- if (shellWindow != None) {
- Widget shell = XtWindowToWidget(awt_display, shellWindow);
- if (shell != NULL && shell != focusOwnerShell) {
- clearFocusPath(shell);
- }
- }
- }
-}
-
-static void
-focusEventForProxy(XEvent xev,
- JNIEnv *env,
- Window *trueFocusWindow,
- Window *focusProxyWindow) {
-
- DASSERT (trueFocusWindow != NULL && focusProxyWindow != NULL);
- if (xev.type == FocusOut) {
- if (xev.xfocus.window == *focusProxyWindow) {
- if (*trueFocusWindow != None) {
- Window root = rootWindow(*trueFocusWindow);
- focusOutEvent.xfocus.window = *trueFocusWindow;
-#ifdef DEBUG_FOCUS
- printf(" nulling out proxy; putting back event"
- "\n");
-#endif
-
- while (focusOutEvent.xfocus.window != root &&
- focusOutEvent.xfocus.window != None) {
- Widget w = XtWindowToWidget(awt_display,
- focusOutEvent.xfocus.window);
- awt_put_back_event(env, &focusOutEvent);
- if (w != NULL && XtParent(w) != NULL) {
- focusOutEvent.xfocus.window = XtWindow(XtParent(w));
- } else {
- focusOutEvent.xfocus.window = None;
- }
- }
- *trueFocusWindow = None;
- *focusProxyWindow = None;
- return;
- } else {
-#ifdef DEBUG_FOCUS
- printf("\n");
-#endif
- return;
- }
- } else {
-#ifdef DEBUG_FOCUS
- printf("\n");
-#endif
- return;
- }
- }
-}
-
-static void
-focusEventForFrame(XEvent xev, Window focusProxyWindow) {
- if (xev.type == FocusIn) {
- if (focusProxyWindow != None) {
- /* eat it */
- return;
- } else /* FocusIn on Frame or Dialog */ {
- XtDispatchEvent(&xev);
- }
- } else /* FocusOut on Frame or Dialog */{
- XtDispatchEvent(&xev);
- }
-}
-
-static void
-focusEventForWindow(XEvent xev, JNIEnv *env, Window *trueFocusWindow,
- Window *focusProxyWindow, jobject target) {
- XEvent pev;
- if (xev.type == FocusIn && xev.xfocus.mode == NotifyNormal) {
- /* If it's a FocusIn, allow it to process, then set
- focus to focus proxy */
- Widget focusProxy;
- focusProxy = findWindowsProxy(target, env);
- if (focusProxy != NULL) {
- XtDispatchEvent(&xev);
- *focusProxyWindow = XtWindow(focusProxy);
-
- XSetInputFocus(awt_display, *focusProxyWindow,
- RevertToParent,
- CurrentTime);
-
- XPeekEvent(awt_display, &pev);
- while (pev.type == FocusIn) {
- XNextEvent(awt_display, &xev);
- XPeekEvent(awt_display, &pev);
- }
- *trueFocusWindow = xev.xany.window;
-
- } /* otherwise error */
- } else /* FocusOut */ {
- /* If it's a FocusOut on a Window, discard it unless
- it's an event generated by us. */
- if (xev.xany.send_event) {
- XtDispatchEvent(&xev);
- }
- }
-}
-
-Boolean
-isAncestor(Window ancestor, Window child) {
- Window *children;
- uint32_t nchildren;
- Boolean retvalue = False;
-
- while (child != ancestor) {
- Window parent, root;
- Status status;
-
- status = XQueryTree(awt_display, child, &root, &parent,
- &children, &nchildren);
- if (status == 0) return False; /* should be an error of some sort? */
-
- if (parent == root) {
- if (child != ancestor) {
- retvalue = False;
- break;
- } else {
- retvalue = True;
- break;
- }
- }
- if (parent == ancestor) { retvalue = True; break; }
- if (nchildren > 0) XFree(children);
- child = parent;
- }
- if (nchildren > 0) XFree(children);
- return retvalue;
-}
-
-/**
- * Returns focusability of the corresponding Java Window object
- */
-Boolean
-isFocusableWindow(Window w) {
- Widget wid = NULL;
- JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
-
- wid = XtWindowToWidget(awt_display, w);
- while (wid != NULL && !XtIsShell(wid)) {
- wid = XtParent(wid);
- }
-
- // If the window doesn't have shell consider it focusable as all windows
- // are focusable by default
- if (wid == NULL) return True;
-
- return isFocusableWindowByShell(env, wid);
-}
-
-void postUngrabEvent(Widget shell) {
- JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
- Widget canvas = findTopLevelByShell(shell);
- if (canvas != NULL) {
- jobject peer = findPeer(&canvas);
- if (peer != NULL) {
- JNU_CallMethodByName(env, NULL, peer, "postUngrabEvent", "()V", NULL);
- }
- }
-}
-
-Boolean eventInsideGrabbed(XEvent * ev) {
- if (grabbed_widget == NULL) {
- return False;
- }
-
- switch (ev->xany.type) {
- case LeaveNotify:
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- case EnterNotify:
- {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- Widget grab = findTopLevelByShell(grabbed_widget);
- if (grab != NULL) {
- jobject peer = findPeer(&grab);
- Widget target = XtWindowToWidget(awt_display, ev->xbutton.window);
- jobject targetPeer = findPeer(&target);
- if (peer != NULL) {
- return JNU_CallMethodByName(env, NULL, peer, "processUngrabMouseEvent", "(Lsun/awt/motif/MComponentPeer;III)Z",
- targetPeer, ev->xbutton.x_root, ev->xbutton.y_root,
- ev->xany.type, NULL).z;
- }
- }
- return False;
- }
- case FocusOut:
- if (ev->xfocus.window == XtWindow(grabbed_widget) ||
- isAncestor(XtWindow(grabbed_widget), ev->xfocus.window))
- {
- postUngrabEvent(grabbed_widget);
- return True;
- }
- default:
- return True;
- }
-}
-
-/**
- * Processes and removes one X/Xt event from the Xt event queue.
- * Handles events pushed back via awt_put_back_event() FIRST,
- * then new events on the X queue
- */
-static void
-processOneEvent(XtInputMask iMask) {
- XEvent xev;
- Boolean haveEvent = False;
- if (putbackQueueCount > 0) {
- // There is a pushed-back event - handle it first
- if (awt_get_next_put_back_event(&xev) == 0) {
- if (xev.xany.send_event != SPECIAL_KEY_EVENT) {
-#ifdef DEBUG_FOCUS
- if (xev.type == FocusOut) {
- printf("putback FocusOut on window %d, mode %d, "
- "detail %d, send_event %d\n",
- xev.xfocus.window, xev.xfocus.mode,
- xev.xfocus.detail, xev.xfocus.send_event);
- }
-#endif
- eventNumber++;
- XtDispatchEvent(&xev);
- return;
- } else {
- haveEvent = True;
- }
- }
- }
-
- if (haveEvent || XtAppPeekEvent(awt_appContext, &xev)) {
- /*
- * Fix for BugTraq ID 4041235, 4100167:
- * First check that the event still has a widget, because
- * the widget may have been destroyed by another thread.
- */
- Widget widget=XtWindowToWidget(awt_display, xev.xany.window);
- eventNumber++;
-#ifdef __linux__
- statusWindowEventHandler(xev);
-#endif
- xembed_eventHandler(&xev);
- xembed_serverEventHandler(&xev);
- syncWait_eventHandler(&xev);
-
- if (!haveEvent && awt_dnd_process_event(&xev)) {
- return;
- }
-
- if ((widget == NULL) || (!XtIsObject(widget)) ||
- (widget->core.being_destroyed)) {
- /*
- * if we get here, the event could be one of
- * the following:
- * - notification that a "container" of
- * any of our embedded frame has been moved
- * - event understandable by XFilterEvent
- * - for one of our old widget which has gone away
- */
- XNextEvent(awt_display, &xev);
-
- if (widget == NULL) {
- /* an embedded frame container has been moved? */
- if (awt_util_processEventForEmbeddedFrame(&xev)) {
- return;
- }
-
- /* manager selections related event? */
- if (awt_mgrsel_processEvent(&xev)) {
- return;
- }
- }
-
- /*
- * Fix for BugTraq ID 4196573:
- * Call XFilterEvent() to give a chance to X Input
- * Method to process this event before being
- * discarded.
- */
- (void) XFilterEvent(&xev, NULL);
- return;
- }
-
- /* There is an X event on the queue. */
- switch (xev.type) {
- case KeyPress:
- case KeyRelease:
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- case EnterNotify:
- case LeaveNotify:
- /* Fix for BugTraq ID 4048060. Dispatch scrolling events
- immediately to the ScrollBar widget to prevent spurious
- continuous scrolling. Otherwise, if the application is busy,
- the ButtonRelease event is not dispatched in time to prevent
- a ScrollBar timeout from expiring, and restarting the
- continuous scrolling timer.
- */
- if ((xev.type == ButtonPress ||
- xev.type == ButtonRelease ||
- (xev.type == MotionNotify &&
- (xev.xmotion.state == Button1Mask ||
- xev.xmotion.state == Button2Mask ||
- xev.xmotion.state == Button3Mask))) &&
- (XtIsSubclass(widget, xmScrollBarWidgetClass))) {
- /* Use XNextEvent instead of XtAppNextEvent, because
- XtAppNextEvent processes timers before getting the next X
- event, causing a race condition, since the TimerEvent
- callback in the ScrollBar widget restarts the continuous
- scrolling timer.
- */
- XNextEvent(awt_display, &xev);
-
- XtDispatchEvent(&xev);
- XSync(awt_display, False);
-
- // This is the event on scrollbar. Key, Motion,
- // Enter/Leave dispatch as usual, Button should
- // generate Ungrab after Java mouse event
- if (xev.type == ButtonPress && grabbed_widget != NULL) {
- eventInsideGrabbed(&xev);
- }
- }
- else {
- if (!haveEvent) XtAppNextEvent(awt_appContext, &xev);
-
- // This is an event on one of our widgets. Key,
- // Motion, Enter/Leave dispatch as usual, Button
- // should generate Ungrab after Java mouse event
-/* if (grabbed_widget != NULL && !eventInsideGrabbed(&xev)) { */
-/* return; */
-/* } */
-
- if (xev.type == ButtonPress) {
- Window window = findShellByProxy(xev.xbutton.window);
- if (window != None) {
- XWindowAttributes winAttr;
- memset(&winAttr, 0, sizeof(XWindowAttributes));
- XGetWindowAttributes(awt_display, window, &winAttr);
- if (winAttr.override_redirect == TRUE && isFocusableWindow(window)) {
- XSetInputFocus(awt_display, window, RevertToPointerRoot, CurrentTime);
- }
- }
- }
- if(xev.type == KeyPress) {
-#ifdef DEBUG_FOCUS
- printf("KeyPress on window %d\n", xev.xany.window);
-#endif
- }
-
- /* this could be moved to shouldDispatchToWidget */
- /* if there is a proxy in effect, dispatch key events
- through the proxy */
- if ((xev.type == KeyPress || xev.type == KeyRelease) &&
- !keyboardGrabbed && !haveEvent) {
- if (focusProxyWindow != None) {
- Widget widget;
- struct WidgetInfo *winfo;
- Boolean cont;
- /* Key event should be posted to the top-level
- widget of the proxy */
- xev.xany.window = proxyTopLevel(focusProxyWindow);
- widget = XtWindowToWidget(awt_display,
- xev.xany.window);
- if (widget == NULL) return;
- if ((winfo = findWidgetInfo(widget)) == NULL) {
- return;
- }
- awt_canvas_handleEvent(widget, winfo->peer, &xev,
- winfo, &cont, TRUE);
- return;
- }
- }
- if (!shouldDispatchToWidget(&xev)) {
- XtDispatchEvent(&xev);
- }
-
- // See comment above - "after time" is here.
- if (grabbed_widget != NULL && xev.type == ButtonPress) {
- eventInsideGrabbed(&xev);
- }
- }
-
-
- break;
-
- case FocusIn:
- case FocusOut: {
- void *peer;
- jobject target;
-
- JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
-
-#ifdef DEBUG_FOCUS
- if (xev.type == FocusIn) {
-
- fprintf(stderr, "FocusIn on window %x, mode %d, detail %d, "
- "send_event %d\n", xev.xfocus.window,
- xev.xfocus.mode, xev.xfocus.detail,
- xev.xfocus.send_event);
- } else {
- fprintf(stderr, "FocusOut on window %x, mode %d, detail %d, "
- "send_event %d\n", xev.xfocus.window,
- xev.xfocus.mode, xev.xfocus.detail,
- xev.xfocus.send_event);
- }
-#endif
- XtAppNextEvent(awt_appContext, &xev);
-
- if (xev.xfocus.detail == NotifyVirtual ||
- xev.xfocus.detail == NotifyNonlinearVirtual) {
-#ifdef DEBUG_FOCUS
- printf("discarding\n");
-#endif
- return;
- }
-
- // Check for xembed on this window. If it is active and this is not XEmbed focus
- // event(send_event = 0) then we should skip it
- if (isXEmbedActiveByWindow(xev.xfocus.window) && !xev.xfocus.send_event) {
- return;
- }
-
- /* In general, we need to to block out focus events
- that are caused by keybaord grabs initiated by
- dragging the title bar or the scrollbar. But we
- need to let through the ones that are aimed at
- choice boxes or menus. So we keep track of when
- the keyboard is grabbed by a popup. */
-
- if (awt_isAwtMenuWidget(widget)) {
- if (xev.type == FocusIn &&
- xev.xfocus.mode == NotifyGrab) {
- extern Boolean poppingDown;
- if (!poppingDown) {
- keyboardGrabbed = True;
- }
- } else /* FocusOut */ {
- if (xev.type == FocusOut &&
- xev.xfocus.mode == NotifyUngrab) {
- keyboardGrabbed = False;
- }
- }
- }
-
- if (focusProxyWindow != None) {
-#ifdef DEBUG_FOCUS
- printf("non-null proxy; proxy = %d ", focusProxyWindow);
-#endif
- if (trueFocusWindow != None) {
- /* trueFocusWindow should never be None here, but if
- things ever get skewed, we want to be able to
- recover rather than crash */
- focusEventForProxy(xev, env, &trueFocusWindow,
- &focusProxyWindow);
- return;
- } else {
- /* beartrap -- remove before shipping */
- /* printf("trueFocusWindow None in processOneEvent;\n"); */
- /* printf("Please file a bug\n"); */
- }
- }
-
- peer = findPeer(&widget);
- if (peer == NULL) {
-#ifdef DEBUG_FOCUS
- printf("null peer -- shouldn't see in java handler\n");
-#endif
- XtDispatchEvent(&xev);
- return;
- }
-
- /* Find the top-level component */
-
- if ((*env)->EnsureLocalCapacity(env, 1) < 0) {
- return;
- }
- target = findTopLevel(peer, env);
- if (target == NULL) {
- JNU_ThrowNullPointerException(env, "component without a "
- "window");
- return;
- }
-
- if (isFrameOrDialog(target, env)) {
-#ifdef DEBUG_FOCUS
- printf("Focus event directed at a frame; frame = %d\n",
- xev.xany.window);
-#endif
- focusEventForFrame(xev, focusProxyWindow);
- (*env)->DeleteLocalRef(env, target);
- return;
- } else {
-#ifdef DEBUG_FOCUS
- printf("Focus event directed at a window; window = %d\n",
- xev.xany.window);
-#endif
- focusEventForWindow(xev, env, &trueFocusWindow,
- &focusProxyWindow, target);
- (*env)->DeleteLocalRef(env, target);
- return;
- }
- }
-
- case UnmapNotify:
-#ifdef DEBUG_FOCUS
- printf("Unmap on window %d\n", xev.xany.window);
- printf("True focus window is %d\n", trueFocusWindow);
-#endif
- clearFocusPathOnWindow(xev.xunmap.window);
-
- default:
- XtAppProcessEvent(awt_appContext, iMask);
- break;
- }
- }
- else {
- /* There must be a timer, alternate input, or signal event. */
- XtAppProcessEvent(awt_appContext, iMask & ~XtIMXEvent);
- }
-
-} /* processOneEvent() */
-
-/*
- * Waits for X/Xt events to appear on the pipe. Returns only when
- * it is likely (but not definite) that there are events waiting to
- * be processed.
- *
- * This routine also flushes the outgoing X queue, when the
- * awt_next_flush_time has been reached.
- *
- * If fdAWTPipe is greater or equal than zero the routine also
- * checks if there are events pending on the putback queue.
- */
-void
-waitForEvents(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe) {
-
- while ((fdAWTPipe >= 0 && awt_events_pending(awt_appContext) == 0) ||
- (fdAWTPipe < 0 && XtAppPending(awt_appContext) == 0)) {
-#ifdef USE_SELECT
- performSelect(env,fdXPipe,fdAWTPipe);
-#else
- performPoll(env,fdXPipe,fdAWTPipe);
-#endif
- if ((awt_next_flush_time > 0) &&
- (awtJNI_TimeMillis() > awt_next_flush_time)) {
- AWT_FLUSHOUTPUT_NOW();
- }
- } /* end while awt_events_pending() == 0 */
-} /* waitForEvents() */
-
-/*************************************************************************
- ** **
- ** WE USE EITHER select() OR poll(), DEPENDING ON THE USE_SELECT **
- ** COMPILE-TIME CONSTANT. **
- ** **
- *************************************************************************/
-
-#ifdef USE_SELECT
-
-static struct fd_set rdset;
-struct timeval sel_time;
-
-/*
- * Performs select() on both the X pipe and our AWT utility pipe.
- * Returns when data arrives or the operation times out.
- *
- * Not all Xt events come across the X pipe (e.g., timers
- * and alternate inputs), so we must time out every now and
- * then to check the Xt event queue.
- *
- * The fdAWTPipe will be empty when this returns.
- */
-static void
-performSelect(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe) {
-
- int32_t result;
- int32_t count;
- int32_t nfds = 1;
- uint32_t timeout = awt_get_poll_timeout(False);
-
- /* Fixed 4250354 7/28/99 ssi at sparc.spb.su
- * Cleaning up Global Refs in case of No Events
- */
- awtJNI_CleanupGlobalRefs();
-
- FD_ZERO( &rdset );
- FD_SET(fdXPipe, &rdset);
- if (fdAWTPipe >= 0) {
- nfds++;
- FD_SET(fdAWTPipe, &rdset);
- }
- if (timeout == 0) {
- // be sure other threads get a chance
- awtJNI_ThreadYield(env);
- }
- // set the appropriate time values. The DASSERT() in
- // MToolkit_run() makes sure that this will not overflow
- sel_time.tv_sec = (timeout * 1000) / (1000 * 1000);
- sel_time.tv_usec = (timeout * 1000) % (1000 * 1000);
- AWT_NOFLUSH_UNLOCK();
- result = select(nfds, &rdset, 0, 0, &sel_time);
- AWT_LOCK();
-
- /* reset tick if this was not a time out */
- if (result == 0) {
- /* select() timed out -- update timeout value */
- awt_get_poll_timeout(True);
- }
- if (fdAWTPipe >= 0 && FD_ISSET ( fdAWTPipe, &rdset ) )
- {
- /* There is data on the AWT pipe - empty it */
- do {
- count = read(fdAWTPipe, read_buf, AWT_POLL_BUFSIZE );
- } while (count == AWT_POLL_BUFSIZE );
- }
-} /* performSelect() */
-
-#else /* !USE_SELECT */
-
-/*
- * Polls both the X pipe and our AWT utility pipe. Returns
- * when there is data on one of the pipes, or the operation times
- * out.
- *
- * Not all Xt events come across the X pipe (e.g., timers
- * and alternate inputs), so we must time out every now and
- * then to check the Xt event queue.
- *
- * The fdAWTPipe will be empty when this returns.
- */
-static void
-performPoll(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe) {
-
- static struct pollfd pollFds[2];
- uint32_t timeout = awt_get_poll_timeout(False);
- int32_t result;
- int32_t count;
-
- /* Fixed 4250354 7/28/99 ssi at sparc.spb.su
- * Cleaning up Global Refs in case of No Events
- */
- awtJNI_CleanupGlobalRefs();
-
- pollFds[0].fd = fdXPipe;
- pollFds[0].events = POLLRDNORM;
- pollFds[0].revents = 0;
-
- pollFds[1].fd = fdAWTPipe;
- pollFds[1].events = POLLRDNORM;
- pollFds[1].revents = 0;
-
- AWT_NOFLUSH_UNLOCK();
-
- /* print the poll timeout time in brackets */
- DTRACE_PRINT1("[%dms]",(int32_t)timeout);
-#ifdef DEBUG
- if (++debugPrintLineCount > 8) {
- DTRACE_PRINTLN("");
- debugPrintLineCount = 0;
- }
-#endif
- /* ACTUALLY DO THE POLL() */
- if (timeout == 0) {
- // be sure other threads get a chance
- awtJNI_ThreadYield(env);
- }
- result = poll( pollFds, 2, (int32_t) timeout );
-
-#ifdef DEBUG
- DTRACE_PRINT1("[poll()->%d]", result);
- if (++debugPrintLineCount > 8) {
- DTRACE_PRINTLN("");
- debugPrintLineCount = 0;
- }
-#endif
- AWT_LOCK();
- if (result == 0) {
- /* poll() timed out -- update timeout value */
- awt_get_poll_timeout(True);
- }
- if ( pollFds[1].revents )
- {
- /* There is data on the AWT pipe - empty it */
- do {
- count = read(AWT_READPIPE, read_buf, AWT_POLL_BUFSIZE );
- } while (count == AWT_POLL_BUFSIZE );
- DTRACE_PRINTLN1("wokeup on AWTPIPE, timeout:%d", timeout);
- }
- return;
-
-} /* performPoll() */
-
-#endif /* !USE_SELECT */
-
-/*
- * Pushes an X event back on the queue to be handled
- * later.
- *
- * Ignores the request if event is NULL
- */
-void
-awt_put_back_event(JNIEnv *env, XEvent *event) {
-
- Boolean addIt = True;
- if (putbackQueueCount >= putbackQueueCapacity) {
- /* not enough room - alloc 50% more space */
- int32_t newCapacity;
- XEvent *newQueue;
- newCapacity = putbackQueueCapacity * 3 / 2;
- if ((newCapacity - putbackQueueCapacity)
- < PUTBACK_QUEUE_MIN_INCREMENT) {
- /* always increase by at least min increment */
- newCapacity = putbackQueueCapacity + PUTBACK_QUEUE_MIN_INCREMENT;
- }
- newQueue = (XEvent*)realloc(
- putbackQueue, newCapacity*(sizeof(XEvent)));
- if (newQueue == NULL) {
- JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
- addIt = False;
- } else {
- putbackQueue = newQueue;
- putbackQueueCapacity = newCapacity;
- }
- }
- if (addIt) {
- char oneChar = 'p';
- memcpy(&(putbackQueue[putbackQueueCount]), event, sizeof(XEvent));
- putbackQueueCount++;
-
- // wake up the event loop, if it's sleeping
- write (AWT_WRITEPIPE, &oneChar, 1);
- }
-
- return;
-} /* awt_put_back_event() */
-
-/*
- * Gets the next event that has been pushed back onto the queue.
- * Returns 0 and fills in xev_out if successful
- */
-static int32_t
-awt_get_next_put_back_event(XEvent *xev_out) {
-
- Boolean err = False;
- if (putbackQueueCount < 1) {
- err = True;
- } else {
- memcpy(xev_out, &(putbackQueue[0]), sizeof(XEvent));
- }
- if (!err) {
- /* remove it from the queue */
- if (putbackQueueCount == 1) {
-
- // queue is now empty
- if (putbackQueueCapacity > PUTBACK_QUEUE_MIN_INCREMENT) {
-
- /* Too much space -- delete it and rebuild later */
- free(putbackQueue);
- putbackQueue = NULL;
- putbackQueueCapacity = 0;
- }
- } else {
- /* more than 1 event in queue - shift all events to the left */
- /* We don't free the allocated memory until the queue
- becomes empty, just 'cause it's easier that way. */
- /* NOTE: use memmove(), because the memory blocks overlap */
- memmove(&(putbackQueue[0]), &(putbackQueue[1]),
- (putbackQueueCount-1)*sizeof(XEvent));
- }
- --putbackQueueCount;
- }
- DASSERT(putbackQueueCount >= 0);
-
- return (err? -1:0);
-
-} /* awt_get_next_put_back_event() */
-
-/**
- * Determines whether or not there are X or Xt events pending.
- * Looks at the putbackQueue.
- */
-static XtInputMask
-awt_events_pending(XtAppContext appContext) {
- XtInputMask imask = 0L;
- imask = XtAppPending(appContext);
- if (putbackQueueCount > 0) {
- imask |= XtIMXEvent;
- }
- return imask;
-}
-
-
-#ifndef NOMODALFIX
-#define WIDGET_ARRAY_SIZE 5;
-static int32_t arraySize = 0;
-static int32_t arrayIndx = 0;
-static Widget *dShells = NULL;
-
-void
-awt_shellPoppedUp(Widget shell,
- XtPointer modal,
- XtPointer call_data)
-{
- if (arrayIndx == arraySize ) {
- /* if we have not allocate an array, do it first */
- if (arraySize == 0) {
- arraySize += WIDGET_ARRAY_SIZE;
- dShells = (Widget *) malloc(sizeof(Widget) * arraySize);
- } else {
- arraySize += WIDGET_ARRAY_SIZE;
- dShells = (Widget *) realloc((void *)dShells, sizeof(Widget) * arraySize);
- }
- }
-
- dShells[arrayIndx] = shell;
- arrayIndx++;
-}
-
-void
-awt_shellPoppedDown(Widget shell,
- XtPointer modal,
- XtPointer call_data)
-{
- arrayIndx--;
-
- if (dShells[arrayIndx] == shell) {
- dShells[arrayIndx] = NULL;
- return;
- } else {
- int32_t i;
-
- /* find the position of the shell in the array */
- for (i = arrayIndx; i >= 0; i--) {
- if (dShells[i] == shell) {
- break;
- }
- }
-
- /* remove the found element */
- while (i <= arrayIndx-1) {
- dShells[i] = dShells[i+1];
- i++;
- }
- }
-}
-
-Boolean
-awt_isWidgetModal(Widget widget)
-{
- Widget w;
-
- for (w = widget; !XtIsShell(w); w = XtParent(w)) { }
-
- while (w != NULL) {
- if (w == dShells[arrayIndx-1]) {
- return True;
- }
- w = XtParent(w);
- }
- return False;
-}
-
-Boolean
-awt_isModal()
-{
- return (arrayIndx > 0);
-}
-#endif // NOMODALFIX
-
-
-/*
- * Simply waits for terminateFn() to return True. Waits on the
- * awt lock and is notified to check its state by the main event
- * loop whenever the Xt event queue is empty.
- *
- * NOTE: when you use this routine check if it can be called on the event
- * dispatch thread during drag-n-drop operation and update
- * secondary_loop_event() predicate to prevent deadlock.
- */
-void
-awt_MToolkit_modalWait(int32_t (*terminateFn) (void *data), void *data )
-{
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-
- AWT_LOCK();
- AWT_FLUSHOUTPUT_NOW();
- while ((*terminateFn) (data) == 0) {
- AWT_WAIT(AWT_MAX_POLL_TIMEOUT);
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionClear(env);
- break;
- }
- }
- AWT_NOTIFY_ALL();
- AWT_UNLOCK();
-}
-
-static uint32_t
-colorToRGB(XColor * color)
-{
- int32_t rgb = 0;
-
- rgb |= ((color->red >> 8) << 16);
- rgb |= ((color->green >> 8) << 8);
- rgb |= ((color->blue >> 8) << 0);
-
- return rgb;
-}
-
-/*
- * fix for bug #4088106 - ugly text boxes and grayed out looking text
- */
-
-XmColorProc oldColorProc;
-
-void
-ColorProc(XColor* bg_color,
- XColor* fg_color,
- XColor* sel_color,
- XColor* ts_color,
- XColor* bs_color)
-{
- unsigned long plane_masks[1];
- unsigned long colors[5];
-
- AwtGraphicsConfigDataPtr defaultConfig =
- getDefaultConfig(DefaultScreen(awt_display));
-
- /* use the default procedure to calculate colors */
- oldColorProc(bg_color, fg_color, sel_color, ts_color, bs_color);
-
- /* check if there is enought free color cells */
- if (XAllocColorCells(awt_display, defaultConfig->awt_cmap, False,
- plane_masks, 0, colors, 5)) {
- XFreeColors(awt_display, defaultConfig->awt_cmap, colors, 5, 0);
- return;
- }
-
- /* find the closest matches currently available */
- fg_color->pixel = defaultConfig->AwtColorMatch(fg_color->red >> 8,
- fg_color->green >> 8,
- fg_color->blue >> 8,
- defaultConfig);
- fg_color->flags = DoRed | DoGreen | DoBlue;
- XQueryColor(awt_display, defaultConfig->awt_cmap, fg_color);
- sel_color->pixel = defaultConfig->AwtColorMatch(sel_color->red >> 8,
- sel_color->green >> 8,
- sel_color->blue >> 8,
- defaultConfig);
- sel_color->flags = DoRed | DoGreen | DoBlue;
- XQueryColor(awt_display, defaultConfig->awt_cmap, sel_color);
- ts_color->pixel = defaultConfig->AwtColorMatch(ts_color->red >> 8,
- ts_color->green >> 8,
- ts_color->blue >> 8,
- defaultConfig);
- ts_color->flags = DoRed | DoGreen | DoBlue;
- XQueryColor(awt_display, defaultConfig->awt_cmap, ts_color);
- bs_color->pixel = defaultConfig->AwtColorMatch(bs_color->red >> 8,
- bs_color->green >> 8,
- bs_color->blue >> 8,
- defaultConfig);
- bs_color->flags = DoRed | DoGreen | DoBlue;
- XQueryColor(awt_display, defaultConfig->awt_cmap, bs_color);
-}
-
-
-/*
- * Read _XSETTINGS_SETTINGS property from _XSETTINGS selection owner
- * and pass its value to the java world for processing.
- */
-/*static*/ void
-awt_xsettings_update(int scr, Window owner, void *cookie)
-{
- Display *dpy = awt_display;
- int status;
-
- JNIEnv *env;
- jobject mtoolkit;
- jmethodID upcall;
- jbyteArray array;
-
- struct xsettings_callback_cookie *upcall_cookie = cookie;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- unsigned char *xsettings;
-
- DTRACE_PRINTLN2("XS: update screen %d, owner 0x%08lx",
- scr, owner);
-
-#if 1 /* XXX: kludge */
- /*
- * As toolkit cannot yet cope with per-screen desktop properties,
- * only report XSETTINGS changes on the default screen. This
- * should be "good enough" for most cases.
- */
- if (scr != DefaultScreen(dpy)) {
- DTRACE_PRINTLN2("XS: XXX: default screen is %d, update is for %d, ignoring", DefaultScreen(dpy), scr);
- return;
- }
-#endif /* kludge */
-
- env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- DASSERT(env != NULL);
-
- DASSERT(upcall_cookie != NULL);
- mtoolkit = upcall_cookie->mtoolkit;
- upcall = upcall_cookie->upcallMID;
-
- DASSERT(!JNU_IsNull(env, mtoolkit));
- DASSERT(upcall != NULL);
-
- /*
- * XXX: move awt_getPropertyFOO from awt_wm.c to awt_util.c and
- * use the appropriate one.
- */
- status = XGetWindowProperty(dpy, owner,
- _XA_XSETTINGS_SETTINGS, 0, 0xFFFF, False,
- _XA_XSETTINGS_SETTINGS,
- &actual_type, &actual_format, &nitems, &bytes_after,
- &xsettings);
-
- if (status != Success) {
- DTRACE_PRINTLN("XS: unable to read _XSETTINGS");
- return;
- }
-
- if (xsettings == NULL) {
- DTRACE_PRINTLN("XS: reading _XSETTINGS, got NULL");
- return;
- }
-
- if (actual_type != _XA_XSETTINGS_SETTINGS) {
- XFree(xsettings); /* NULL data already catched above */
- DTRACE_PRINTLN("XS: _XSETTINGS_SETTINGS is not of type _XSETTINGS_SETTINGS");
- return;
- }
-
- DTRACE_PRINTLN1("XS: read %lu bytes of _XSETTINGS_SETTINGS",
- nitems);
-
- /* ok, propagate xsettings to the toolkit for processing */
- if ((*env)->EnsureLocalCapacity(env, 1) < 0) {
- DTRACE_PRINTLN("XS: EnsureLocalCapacity failed");
- XFree(xsettings);
- return;
- }
-
- array = (*env)->NewByteArray(env, (jint)nitems);
- if (JNU_IsNull(env, array)) {
- DTRACE_PRINTLN("awt_xsettings_update: NewByteArray failed");
- XFree(xsettings);
- return;
- }
-
- (*env)->SetByteArrayRegion(env, array, 0, (jint)nitems,
- (jbyte *)xsettings);
- XFree(xsettings);
-
- (*env)->CallVoidMethod(env, mtoolkit, upcall, (jint)scr, array);
- (*env)->DeleteLocalRef(env, array);
-}
-
-
-/*
- * Event handler for events on XSETTINGS selection owner.
- * We are interested in PropertyNotify only.
- */
-static void
-awt_xsettings_callback(int scr, XEvent *xev, void *cookie)
-{
- Display *dpy = awt_display; /* xev->xany.display */
- XPropertyEvent *ev;
-
- if (xev->type != PropertyNotify) {
- DTRACE_PRINTLN2("XS: awt_xsettings_callback(%d) event %d ignored",
- scr, xev->type);
- return;
- }
-
- ev = &xev->xproperty;
-
- if (ev->atom == None) {
- DTRACE_PRINTLN("XS: awt_xsettings_callback(%d) atom == None");
- return;
- }
-
-#ifdef DEBUG
- {
- char *name;
-
- DTRACE_PRINT2("XS: awt_xsettings_callback(%d) 0x%08lx ",
- scr, ev->window);
- name = XGetAtomName(dpy, ev->atom);
- if (name == NULL) {
- DTRACE_PRINT1("atom #%d", ev->atom);
- } else {
- DTRACE_PRINT1("%s", name);
- XFree(name);
- }
- DTRACE_PRINTLN1(" %s", ev->state == PropertyNewValue ?
- "changed" : "deleted");
- }
-#endif
-
- if (ev->atom != _XA_XSETTINGS_SETTINGS) {
- DTRACE_PRINTLN("XS: property != _XSETTINGS_SETTINGS ... ignoring");
- return;
- }
-
-
- if (ev->state == PropertyDelete) {
- /* XXX: notify toolkit to reset to "defaults"? */
- return;
- }
-
- awt_xsettings_update(scr, ev->window, cookie);
-}
-
-
-/*
- * Owner of XSETTINGS selection changed on the given screen.
- */
-static void
-awt_xsettings_owner_callback(int scr, Window owner, long *data_unused,
- void *cookie)
-{
- if (owner == None) {
- DTRACE_PRINTLN("XS: awt_xsettings_owner_callback: owner = None");
- /* XXX: reset to defaults??? */
- return;
- }
-
- DTRACE_PRINTLN1("XS: awt_xsettings_owner_callback: owner = 0x%08lx",
- owner);
-
- awt_xsettings_update(scr, owner, cookie);
-}
-
-/*
- * Returns a reference to the class java.awt.Component.
- */
-jclass
-getComponentClass(JNIEnv *env)
-{
- static jclass componentCls = NULL;
-
- // get global reference of java/awt/Component class (run only once)
- if (componentCls == NULL) {
- jclass componentClsLocal = (*env)->FindClass(env, "java/awt/Component");
- DASSERT(componentClsLocal != NULL);
- if (componentClsLocal == NULL) {
- /* exception already thrown */
- return NULL;
- }
- componentCls = (jclass)(*env)->NewGlobalRef(env, componentClsLocal);
- (*env)->DeleteLocalRef(env, componentClsLocal);
- }
- return componentCls;
-}
-
-
-/*
- * Returns a reference to the class java.awt.MenuComponent.
- */
-jclass
-getMenuComponentClass(JNIEnv *env)
-{
- static jclass menuComponentCls = NULL;
-
- // get global reference of java/awt/MenuComponent class (run only once)
- if (menuComponentCls == NULL) {
- jclass menuComponentClsLocal = (*env)->FindClass(env, "java/awt/MenuComponent");
- DASSERT(menuComponentClsLocal != NULL);
- if (menuComponentClsLocal == NULL) {
- /* exception already thrown */
- return NULL;
- }
- menuComponentCls = (jclass)(*env)->NewGlobalRef(env, menuComponentClsLocal);
- (*env)->DeleteLocalRef(env, menuComponentClsLocal);
- }
- return menuComponentCls;
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: init
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MToolkit_init(JNIEnv *env, jobject this,
- jstring mainClassName)
-{
- char *appName = NULL;
- char *mainChars = NULL;
-
- int32_t argc = 0;
- char *argv[10] = { NULL };
-
- /*
- * Note: The MToolkit object depends on the static initializer
- * of X11GraphicsEnvironment to initialize the connection to
- * the X11 server.
- */
- XFontStruct *xfont;
- XmFontListEntry tmpFontListEntry;
- char *multiclick_time_query;
- AwtGraphicsConfigDataPtr defaultConfig =
- getDefaultConfig(DefaultScreen(awt_display));
- AwtScreenDataPtr defaultScreen =
- getScreenData(DefaultScreen(awt_display));
-
- static String fallback_resources[] =
- {
- "*enableThinThickness: True",
- "*XmFileSelectionBox.fileFilterStyle: XmFILTER_HIDDEN_FILES",
- "*XmFileSelectionBox.pathMode: XmPATH_MODE_RELATIVE",
- "*XmFileSelectionBox.resizePolicy: XmRESIZE_GROW",
- "*XmFileSelectionBox*dirTextLabelString: Enter path or folder name:",
- "*XmFileSelectionBox*applyLabelString: Update",
- "*XmFileSelectionBox*selectionLabelString: Enter file name:",
- "*XmFileSelectionBox*dirListLabelString: Folders",
- NULL /* Must be NULL terminated */
- };
-
- focusOutEvent.type = FocusOut;
- focusOutEvent.xfocus.send_event = True;
- focusOutEvent.xfocus.display = awt_display;
- focusOutEvent.xfocus.mode = NotifyNormal;
- focusOutEvent.xfocus.detail = NotifyNonlinear;
-
- /* Need to make sure this is deleted someplace! */
- AWT_LOCK();
-
- XSetIOErrorHandler(xIOError);
-
- if (!XSupportsLocale()) {
- jio_fprintf(stderr,
- "current locale is not supported in X11, locale is set to C");
- setlocale(LC_ALL, "C");
- }
- if (!XSetLocaleModifiers("")) {
- jio_fprintf(stderr, "X locale modifiers are not supported, using default");
- }
-#ifdef NETSCAPE
- if (awt_init_xt) {
- XtToolkitInitialize();
- }
-#else
- XtToolkitInitialize();
-#endif
-
- {
- jclass fontConfigClass;
- jmethodID methID;
- jstring jFontList;
- char *cFontRsrc;
- char *cFontRsrc2;
-
- fontConfigClass = (*env)->FindClass(env, "sun/awt/motif/MFontConfiguration");
- methID = (*env)->GetStaticMethodID(env, fontConfigClass,
- "getDefaultMotifFontSet",
- "()Ljava/lang/String;");
- jFontList = (*env)->CallStaticObjectMethod(env, fontConfigClass, methID);
- if (jFontList == NULL) {
- motifFontList =
- "-monotype-arial-regular-r-normal--*-140-*-*-p-*-iso8859-1";
- } else {
- motifFontList = JNU_GetStringPlatformChars(env, jFontList, NULL);
- }
-
- /* fprintf(stderr, "motifFontList: %s\n", motifFontList); */
-
- cFontRsrc = malloc(strlen(motifFontList) + 20);
- strcpy(cFontRsrc, "*fontList: ");
- strcat(cFontRsrc, motifFontList);
- cFontRsrc2 = malloc(strlen(motifFontList) + 20);
- strcpy(cFontRsrc2, "*labelFontList: ");
- strcat(cFontRsrc2, motifFontList);
-
- argc = 1;
- argv[argc++] = "-xrm";
- argv[argc++] = cFontRsrc;
- argv[argc++] = "-xrm";
- argv[argc++] = cFontRsrc2;
- argv[argc++] = "-font";
- argv[argc++] = (char *)defaultMotifFont;
- }
-
- awt_appContext = XtCreateApplicationContext();
- XtAppSetErrorHandler(awt_appContext, (XtErrorHandler) xtError);
- XtAppSetFallbackResources(awt_appContext, fallback_resources);
-
- appName = NULL;
- mainChars = NULL;
- if (!JNU_IsNull(env, mainClassName)) {
- mainChars = (char *)JNU_GetStringPlatformChars(env, mainClassName, NULL);
- appName = mainChars;
- }
- if (appName == NULL || appName[0] == '\0') {
- appName = "AWT";
- }
-
- XtDisplayInitialize(awt_appContext, awt_display,
- appName, /* application name */
- appName, /* application class */
- NULL, 0, &argc, argv);
-
- /* Root shell widget that serves as a parent for all AWT top-levels. */
- awt_root_shell = XtVaAppCreateShell(appName, /* application name */
- appName, /* application class */
- applicationShellWidgetClass,
- awt_display,
- /* va_list */
- XmNmappedWhenManaged, False,
- NULL);
- XtRealizeWidget(awt_root_shell);
-
- if (mainChars != NULL) {
- JNU_ReleaseStringPlatformChars(env, mainClassName, mainChars);
- }
-
- awt_mgrsel_init();
- awt_wm_init();
- init_xembed();
-
- /*
- * Find the correct awt_multiclick_time to use. We normally
- * would call XtMultiClickTime() and wouldn't have to do
- * anything special, but because OpenWindows defines its own
- * version (OpenWindows.MultiClickTimeout), we need to
- * determine out which resource to use.
- *
- * We do this by searching in order for:
- *
- * 1) an explicit definition of multiClickTime
- * (this is the resource that XtGetMultiClickTime uses)
- *
- * if that fails, search for:
- *
- * 2) an explicit definition of Openwindows.MultiClickTimeout
- *
- * if both searches fail:
- *
- * 3) use the fallback provided by XtGetMultiClickTime()
- * (which is 200 milliseconds... I looked at the source :-)
- *
- */
- multiclick_time_query = XGetDefault(awt_display, "*", "multiClickTime");
- if (multiclick_time_query) {
- awt_multiclick_time = XtGetMultiClickTime(awt_display);
- } else {
- multiclick_time_query = XGetDefault(awt_display,
- "OpenWindows", "MultiClickTimeout");
- if (multiclick_time_query) {
- /* Note: OpenWindows.MultiClickTimeout is in tenths of
- a second, so we need to multiply by 100 to convert to
- milliseconds */
- awt_multiclick_time = atoi(multiclick_time_query) * 100;
- } else {
- awt_multiclick_time = XtGetMultiClickTime(awt_display);
- }
- }
-
- scrollBugWorkAround = TRUE;
-
- /*
- * Create the cursor for TextArea scrollbars...
- */
- awt_scrollCursor = XCreateFontCursor(awt_display, XC_left_ptr);
-
- awt_defaultBg = defaultConfig->AwtColorMatch(200, 200, 200, defaultConfig);
- awt_defaultFg = defaultScreen->blackpixel;
- setup_modifier_map(awt_display);
-
- awt_initialize_DataTransferer();
- awt_initialize_Xm_DnD(awt_display);
-
- /*
- * fix for bug #4088106 - ugly text boxes and grayed out looking text
- */
- oldColorProc = XmGetColorCalculation();
- XmSetColorCalculation(ColorProc);
-
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: run
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_run
- (JNIEnv *env, jobject this)
-{
- /*
- * in performSelect(), we multiply the timeout by 1000. Make sure
- * that the maximum value will not cause an overflow.
- */
- DASSERT(AWT_MAX_POLL_TIMEOUT <= (ULONG_MAX/1000));
-
- awt_MainThread = (*env)->NewGlobalRef(env, awtJNI_GetCurrentThread(env));
- awt_MToolkit_loop(env); /* never returns */
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: makeColorModel
- * Signature: ()Ljava/awt/image/ColorModel;
- */
-JNIEXPORT jobject JNICALL Java_sun_awt_motif_MToolkit_makeColorModel
- (JNIEnv *env, jclass this)
-{
- AwtGraphicsConfigDataPtr defaultConfig =
- getDefaultConfig(DefaultScreen(awt_display));
-
- return awtJNI_GetColorModel(env, defaultConfig);
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: getScreenResolution
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getScreenResolution
- (JNIEnv *env, jobject this)
-{
- return (jint) ((DisplayWidth(awt_display, DefaultScreen(awt_display))
- * 25.4) /
- DisplayWidthMM(awt_display, DefaultScreen(awt_display)));
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: getScreenWidth
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getScreenWidth
- (JNIEnv *env, jobject this)
-{
- return DisplayWidth(awt_display, DefaultScreen(awt_display));
-}
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: getScreenHeight
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getScreenHeight
- (JNIEnv *env, jobject this)
-{
- return DisplayHeight(awt_display, DefaultScreen(awt_display));
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: beep
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_beep
- (JNIEnv *env, jobject this)
-{
- AWT_LOCK();
- XBell(awt_display, 0);
- AWT_FLUSH_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: shutdown
- * Signature: ()V
- */
-
-JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_shutdown
- (JNIEnv *env, jobject this)
-{
- X11SD_LibDispose(env);
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: getLockingKeyStateNative
- * Signature: (I)B
- */
-JNIEXPORT jboolean JNICALL Java_sun_awt_motif_MToolkit_getLockingKeyStateNative
- (JNIEnv *env, jobject this, jint awtKey)
-{
- KeySym sym;
- KeyCode keyCode;
- uint32_t byteIndex;
- uint32_t bitIndex;
- char keyVector[32];
-
- AWT_LOCK();
-
- sym = awt_getX11KeySym(awtKey);
- keyCode = XKeysymToKeycode(awt_display, sym);
- if (sym == NoSymbol || keyCode == 0) {
- JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "Keyboard doesn't have requested key");
- AWT_UNLOCK();
- return False;
- }
-
- byteIndex = (keyCode/8);
- bitIndex = keyCode & 7;
- XQueryKeymap(awt_display, keyVector);
-
- AWT_UNLOCK();
-
- return (1 & (keyVector[byteIndex] >> bitIndex));
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: loadSystemColors
- * Signature: ([I)V
- */
-JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_loadSystemColors
- (JNIEnv *env, jobject this, jintArray systemColors)
-{
- Widget frame, panel, control, menu, text, scrollbar;
- Colormap cmap;
- Pixel bg, fg, highlight, shadow;
- Pixel pixels[java_awt_SystemColor_NUM_COLORS];
- XColor *colorsPtr;
- jint rgbColors[java_awt_SystemColor_NUM_COLORS];
- int32_t count = 0;
- int32_t i, j;
- Arg args[10];
- int32_t argc;
- AwtGraphicsConfigDataPtr defaultConfig =
- getDefaultConfig(DefaultScreen(awt_display));
-
- AWT_LOCK();
-
- /*
- * initialize array of pixels
- */
- for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) {
- pixels[i] = -1;
- }
-
- /*
- * Create phantom widgets in order to determine the default
- * colors; this is somewhat inelegant, however it is the simplest
- * and most reliable way to determine the system's default colors
- * for objects.
- */
- argc = 0;
- XtSetArg(args[argc], XmNbuttonFontList, getMotifFontList()); argc++;
- XtSetArg(args[argc], XmNlabelFontList, getMotifFontList()); argc++;
- XtSetArg(args[argc], XmNtextFontList, getMotifFontList()); argc++;
- frame = XtAppCreateShell("AWTColors", "XApplication",
- vendorShellWidgetClass,
- awt_display,
- args, argc);
- /*
- XtSetMappedWhenManaged(frame, False);
- XtRealizeWidget(frame);
- */
- panel = XmCreateDrawingArea(frame, "awtPanelColor", NULL, 0);
- argc = 0;
- XtSetArg(args[argc], XmNfontList, getMotifFontList()); argc++;
- control = XmCreatePushButton(panel, "awtControlColor", args, argc);
- argc = 0;
- XtSetArg(args[argc], XmNlabelFontList, getMotifFontList()); argc++;
- XtSetArg(args[argc], XmNbuttonFontList, getMotifFontList()); argc++;
- menu = XmCreatePulldownMenu(control, "awtColorMenu", args, argc);
- argc = 0;
- XtSetArg(args[argc], XmNfontList, getMotifFontList()); argc++;
- text = XmCreateText(panel, "awtTextColor", args, argc);
- scrollbar = XmCreateScrollBar(panel, "awtScrollbarColor", NULL, 0);
-
- XtVaGetValues(panel,
- XmNbackground, &bg,
- XmNforeground, &fg,
- XmNcolormap, &cmap,
- NULL);
-
- pixels[java_awt_SystemColor_WINDOW] = bg;
- count++;
- pixels[java_awt_SystemColor_INFO] = bg;
- count++;
- pixels[java_awt_SystemColor_WINDOW_TEXT] = fg;
- count++;
- pixels[java_awt_SystemColor_INFO_TEXT] = fg;
- count++;
-
- XtVaGetValues(menu,
- XmNbackground, &bg,
- XmNforeground, &fg,
- NULL);
-
- pixels[java_awt_SystemColor_MENU] = bg;
- count++;
- pixels[java_awt_SystemColor_MENU_TEXT] = fg;
- count++;
-
- XtVaGetValues(text,
- XmNbackground, &bg,
- XmNforeground, &fg,
- NULL);
-
- pixels[java_awt_SystemColor_TEXT] = bg;
- count++;
- pixels[java_awt_SystemColor_TEXT_TEXT] = fg;
- count++;
- pixels[java_awt_SystemColor_TEXT_HIGHLIGHT] = fg;
- count++;
- pixels[java_awt_SystemColor_TEXT_HIGHLIGHT_TEXT] = bg;
- count++;
-
- XtVaGetValues(control,
- XmNbackground, &bg,
- XmNforeground, &fg,
- XmNtopShadowColor, &highlight,
- XmNbottomShadowColor, &shadow,
- NULL);
-
- pixels[java_awt_SystemColor_CONTROL] = bg;
- count++;
- pixels[java_awt_SystemColor_CONTROL_TEXT] = fg;
- count++;
- pixels[java_awt_SystemColor_CONTROL_HIGHLIGHT] = highlight;
- count++;
- pixels[java_awt_SystemColor_CONTROL_LT_HIGHLIGHT] = highlight;
- count++;
- pixels[java_awt_SystemColor_CONTROL_SHADOW] = shadow;
- count++;
- pixels[java_awt_SystemColor_CONTROL_DK_SHADOW] = shadow;
- count++;
-
- XtVaGetValues(scrollbar,
- XmNbackground, &bg,
- NULL);
- pixels[java_awt_SystemColor_SCROLLBAR] = bg;
- count++;
-
- /*
- * Convert pixel values to RGB
- */
- colorsPtr = (XColor *) malloc(count * sizeof(XColor));
- j = 0;
- for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) {
- if (pixels[i] != -1) {
- colorsPtr[j++].pixel = pixels[i];
- }
- }
- XQueryColors(awt_display, cmap, colorsPtr, count);
-
- /* Get current System Colors */
-
- (*env)->GetIntArrayRegion (env, systemColors, 0,
- java_awt_SystemColor_NUM_COLORS,
- rgbColors);
-
- /*
- * Fill systemColor array with new rgb values
- */
-
- j = 0;
- for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) {
- if (pixels[i] != -1) {
- uint32_t rgb = colorToRGB(&colorsPtr[j++]);
-
- /*
- printf("SystemColor[%d] = %x\n", i, rgb);
- */
- rgbColors[i] = (rgb | 0xFF000000);
- }
- }
-
- (*env)->SetIntArrayRegion(env,
- systemColors,
- 0,
- java_awt_SystemColor_NUM_COLORS,
- rgbColors);
-
- /* Duplicate system colors. If color allocation is unsuccessful,
- system colors will be approximated with matched colors */
- if (defaultConfig->awt_depth == 8)
- awt_allocate_systemcolors(colorsPtr, count, defaultConfig);
-
- /*
- * Cleanup
- */
- XtDestroyWidget(frame);
- free(colorsPtr);
-
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: isDynamicLayoutSupportedNative
- * Signature: ()Z
- *
- * Note: there doesn't seem to be a protocol for querying the WM
- * about its opaque resize settings, so this function just returns
- * whether there is a solid resize option available for that WM.
- */
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_motif_MToolkit_isDynamicLayoutSupportedNative(JNIEnv *env, jobject this)
-{
- enum wmgr_t wm;
-
- AWT_LOCK();
- wm = awt_wm_getRunningWM();
- AWT_UNLOCK();
-
- switch (wm) {
- case ENLIGHTEN_WM:
- case KDE2_WM:
- case SAWFISH_WM:
- case ICE_WM:
- case METACITY_WM:
- return JNI_TRUE;
- case OPENLOOK_WM:
- case MOTIF_WM:
- case CDE_WM:
- return JNI_FALSE;
- default:
- return JNI_FALSE;
- }
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: isFrameStateSupported
- * Signature: (I)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_motif_MToolkit_isFrameStateSupported(JNIEnv *env, jobject this,
- jint state)
-{
- if (state == java_awt_Frame_NORMAL || state == java_awt_Frame_ICONIFIED) {
- return JNI_TRUE;
- } else {
- return awt_wm_supportsExtendedState(state) ? JNI_TRUE : JNI_FALSE;
- }
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: getMulticlickTime
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getMulticlickTime
- (JNIEnv *env, jobject this)
-{
- return awt_multiclick_time;
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: loadXSettings
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MToolkit_loadXSettings(JNIEnv *env, jobject this)
-{
- static Boolean registered = False;
-
- jclass mtoolkitCLS;
- Display *dpy = awt_display;
- const Window *owners;
- int scr;
-
- AWT_LOCK();
-
- if (registered) {
- AWT_UNLOCK();
- return;
- }
-
- if (_XA_XSETTINGS_SETTINGS == None) {
- _XA_XSETTINGS_SETTINGS = XInternAtom(dpy, "_XSETTINGS_SETTINGS", False);
- if (_XA_XSETTINGS_SETTINGS == None) {
- JNU_ThrowNullPointerException(env,
- "unable to intern _XSETTINGS_SETTINGS");
- AWT_UNLOCK();
- return;
- }
- }
-
- mtoolkitCLS = (*env)->GetObjectClass(env, this);
-
- xsettings_callback_cookie.mtoolkit =
- (*env)->NewGlobalRef(env, this);
- xsettings_callback_cookie.upcallMID =
- (*env)->GetMethodID(env, mtoolkitCLS,
- "parseXSettings", "(I[B)V");
-
- if (JNU_IsNull(env, xsettings_callback_cookie.upcallMID)) {
- JNU_ThrowNoSuchMethodException(env,
- "sun.awt.motif.MToolkit.parseXSettings");
- AWT_UNLOCK();
- return;
- }
-
- owners = awt_mgrsel_select("_XSETTINGS", PropertyChangeMask,
- &xsettings_callback_cookie,
- awt_xsettings_callback,
- awt_xsettings_owner_callback);
- if (owners == NULL) {
- JNU_ThrowNullPointerException(env,
- "unable to regiser _XSETTINGS with mgrsel");
- AWT_UNLOCK();
- return;
- }
-
- registered = True;
-
- for (scr = 0; scr < ScreenCount(dpy); ++scr) {
- if (owners[scr] == None) {
- DTRACE_PRINTLN1("XS: MToolkit.loadXSettings: none on screen %d",
- scr);
- continue;
- }
-
- awt_xsettings_update(scr, owners[scr], &xsettings_callback_cookie);
- }
-
- AWT_UNLOCK();
-}
-
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_motif_MToolkit_isAlwaysOnTopSupported(JNIEnv *env, jobject toolkit) {
- Boolean res;
- AWT_LOCK();
- res = awt_wm_supportsAlwaysOnTop();
- AWT_UNLOCK();
- return res;
-}
-
-/*
- * Returns true if the current thread is privileged. Currently,
- * only the main event loop thread is considered to be privileged.
- */
-Boolean
-awt_currentThreadIsPrivileged(JNIEnv *env) {
- return (*env)->IsSameObject(env,
- awt_MainThread, awtJNI_GetCurrentThread(env));
-}
-
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_motif_MToolkit_isSyncUpdated(JNIEnv *env, jobject toolkit) {
- return syncUpdated;
-}
-
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_motif_MToolkit_isSyncFailed(JNIEnv *env, jobject toolkit) {
- return syncFailed;
-}
-
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MToolkit_updateSyncSelection(JNIEnv *env, jobject toolkit) {
-
- // AWT_LOCK is held by calling function
- if (wm_selection == None) {
- wm_selection = XInternAtom(awt_display, "WM_S0", False);
- }
- if (version_atom == None) {
- version_atom = XInternAtom(awt_display, "VERSION", False);
- }
- if (oops_atom == None) {
- oops_atom = XInternAtom(awt_display, "OOPS", False);
- }
- syncUpdated = False;
- syncFailed = False;
- XConvertSelection(awt_display, wm_selection, version_atom, oops_atom, XtWindow(awt_root_shell), CurrentTime);
- XSync(awt_display, False);
- inSyncWait = True; // Protect from spurious events
- // Calling function will call AWT_LOCK_WAIT instead of AWT_UNLOCK
-}
-
-JNIEXPORT jint JNICALL
-Java_sun_awt_motif_MToolkit_getEventNumber(JNIEnv *env, jobject toolkit) {
- // AWT_LOCK must be held by the calling method
- return eventNumber;
-}
-
-static void
-syncWait_eventHandler(XEvent * event) {
- static jmethodID syncNotifyMID = NULL;
- if (event != NULL && event->xany.type == SelectionNotify &&
- event->xselection.requestor == XtWindow(awt_root_shell) &&
- event->xselection.property == oops_atom &&
- inSyncWait)
- {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- syncUpdated = True;
- inSyncWait = False;
- AWT_NOTIFY_ALL();
- } else if (event != NULL && event->xany.type == SelectionNotify &&
- event->xselection.requestor == XtWindow(awt_root_shell) &&
- event->xselection.target == version_atom &&
- event->xselection.property == None &&
- XGetSelectionOwner(awt_display, wm_selection) == None &&
- event->xselection.selection == wm_selection)
- {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- syncFailed = True;
- inSyncWait = False;
- AWT_NOTIFY_ALL();
- }
-}
-
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MToolkit_nativeGrab(JNIEnv *env, jobject toolkit, jobject window) {
- struct FrameData *wdata;
- static Cursor cursor = None;
- int grab_result;
-
- AWT_LOCK();
-
- wdata = (struct FrameData *)
- JNU_GetLongFieldAsPtr(env, window, mComponentPeerIDs.pData);
-
- if (wdata == NULL ||
- wdata->winData.comp.widget == NULL ||
- wdata->winData.shell == NULL)
- {
- AWT_UNLOCK();
- return;
- }
- if (None == cursor) {
- cursor = XCreateFontCursor(awt_display, XC_hand2);
- }
- grabbed_widget = wdata->winData.shell;
- grab_result = XGrabPointer(awt_display, XtWindow(wdata->winData.shell),
- True, (ButtonPressMask | ButtonReleaseMask
- | EnterWindowMask | LeaveWindowMask | PointerMotionMask
- | ButtonMotionMask),
- GrabModeAsync, GrabModeAsync, None,
- cursor, CurrentTime);
- if (GrabSuccess != grab_result) {
- XUngrabPointer(awt_display, CurrentTime);
- AWT_UNLOCK();
- DTRACE_PRINTLN1("XGrabPointer() failed, result %d", grab_result);
- return;
- }
- grab_result = XGrabKeyboard(awt_display, XtWindow(wdata->winData.shell),
- True,
- GrabModeAsync, GrabModeAsync, CurrentTime);
- if (GrabSuccess != grab_result) {
- XUngrabKeyboard(awt_display, CurrentTime);
- XUngrabPointer(awt_display, CurrentTime);
- DTRACE_PRINTLN1("XGrabKeyboard() failed, result %d", grab_result);
- }
- AWT_UNLOCK();
-}
-
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MToolkit_nativeUnGrab(JNIEnv *env, jobject toolkit, jobject window) {
- struct FrameData *wdata;
-
- AWT_LOCK();
-
- wdata = (struct FrameData *)
- JNU_GetLongFieldAsPtr(env, window, mComponentPeerIDs.pData);
-
- if (wdata == NULL ||
- wdata->winData.comp.widget == NULL ||
- wdata->winData.shell == NULL)
- {
- AWT_UNLOCK();
- return;
- }
-
- XUngrabPointer(awt_display, CurrentTime);
- XUngrabKeyboard(awt_display, CurrentTime);
- grabbed_widget = NULL;
- AWT_FLUSHOUTPUT_NOW();
-
- AWT_UNLOCK();
-
-}
-
-/*
- * Class: sun_awt_motif_MToolkit
- * Method: getWMName
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_sun_awt_motif_MToolkit_getWMName(JNIEnv *env, jclass this)
-{
- enum wmgr_t wm;
-
- AWT_LOCK();
- wm = awt_wm_getRunningWM();
- AWT_UNLOCK();
-
- switch (wm) {
- case NO_WM:
- return (*env)->NewStringUTF(env, "NO_WM");
- case OTHER_WM:
- return (*env)->NewStringUTF(env, "OTHER_WM");
- case ENLIGHTEN_WM:
- return (*env)->NewStringUTF(env, "ENLIGHTEN_WM");
- case KDE2_WM:
- return (*env)->NewStringUTF(env, "KDE2_WM");
- case SAWFISH_WM:
- return (*env)->NewStringUTF(env, "SAWFISH_WM");
- case ICE_WM:
- return (*env)->NewStringUTF(env, "ICE_WM");
- case METACITY_WM:
- return (*env)->NewStringUTF(env, "METACITY_WM");
- case OPENLOOK_WM:
- return (*env)->NewStringUTF(env, "OPENLOOK_WM");
- case MOTIF_WM:
- return (*env)->NewStringUTF(env, "MOTIF_WM");
- case CDE_WM:
- return (*env)->NewStringUTF(env, "CDE_WM");
- }
- return (*env)->NewStringUTF(env, "UNDETERMINED_WM");
-}
-
-
-#endif /* !HEADLESS */
diff --git a/jdk/src/solaris/native/sun/awt/awt_MToolkit.h b/jdk/src/solaris/native/sun/awt/awt_MToolkit.h
deleted file mode 100644
index 4288e0b..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_MToolkit.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-#ifndef _MTOOLKIT_H_
-#define _MTOOLKIT_H_
-#ifndef HEADLESS
-extern void *findPeer(Widget * pwidget);
-extern Widget findWindowsProxy(jobject window, JNIEnv *env);
-extern struct WidgetInfo *findWidgetInfo(Widget widget);
-extern Boolean isAncestor(Window ancestor, Window child);
-extern void clearFocusPath(Widget shell);
-extern void globalClearFocusPath(Widget focusOwnerShell);
-extern Boolean isFrameOrDialog(jobject target, JNIEnv * env);
-extern jobject getOwningFrameOrDialog(jobject target, JNIEnv *env);
-
-#define SPECIAL_KEY_EVENT 2
-
-#endif /* !HEADLESS */
-#endif /* _MTOOLKIT_H_ */
diff --git a/jdk/src/solaris/native/sun/awt/awt_MenuItem.h b/jdk/src/solaris/native/sun/awt/awt_MenuItem.h
deleted file mode 100644
index ed7f909..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_MenuItem.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <jni_util.h>
-
-/* fieldIDs for MenuItem fields that may be accessed from C */
-struct MenuItemIDs {
- jfieldID label;
- jfieldID enabled;
- jfieldID shortcut;
-};
-
-/* fieldIDs for MMenuItemPeer fields that may be accessed from C */
-struct MMenuItemPeerIDs {
- jfieldID target;
- jfieldID pData;
- jfieldID isCheckbox;
- jfieldID jniGlobalRef;
-};
diff --git a/jdk/src/solaris/native/sun/awt/awt_PopupMenu.h b/jdk/src/solaris/native/sun/awt/awt_PopupMenu.h
deleted file mode 100644
index 3a6d0b7..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_PopupMenu.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* methodsIDs for MPopupMenuPeer methods that may be accessed from C */
-struct MPopupMenuPeerIDs {
- jmethodID destroyNativeWidgetAfterGettingTreeLock;
-};
diff --git a/jdk/src/solaris/native/sun/awt/awt_TopLevel.h b/jdk/src/solaris/native/sun/awt/awt_TopLevel.h
deleted file mode 100644
index 1d8107f..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_TopLevel.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- */
-#ifndef _TOPLEVEL_H_
-#define _TOPLEVEL_H_
-#ifndef HEADLESS
-
-extern Widget findFocusProxy(Widget widget);
-extern Widget findTopLevelByShell(Widget widget);
-extern jobject findTopLevel(jobject peer, JNIEnv *env);
-extern void shellEH(Widget w, XtPointer data, XEvent *event, Boolean *continueToDispatch);
-extern Boolean isFocusableWindowByShell(JNIEnv * env, Widget shell);
-extern Boolean isFocusableWindowByPeer(JNIEnv * env, jobject peer);
-extern Widget getShellWidget(Widget child);
-extern Boolean isFocusableComponentTopLevelByWidget(JNIEnv * env, Widget child);
-#endif /* !HEADLESS */
-#endif /* _TOPLEVEL_H_ */
diff --git a/jdk/src/solaris/native/sun/awt/awt_Window.h b/jdk/src/solaris/native/sun/awt/awt_Window.h
deleted file mode 100644
index b816d41..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_Window.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <jni_util.h>
-
-/* fieldIDs for Window fields that may be accessed from C */
-struct WindowIDs {
- jfieldID warningString;
- jfieldID locationByPlatform;
- jfieldID isAutoRequestFocus;
-};
-
-/* fieldIDs for MWindowPeer fields that may be accessed from C */
-struct MWindowPeerIDs {
- jfieldID insets;
- jfieldID iconWidth;
- jfieldID iconHeight;
- jfieldID winAttr;
- jmethodID handleWindowFocusIn;
- jmethodID handleWindowFocusOut;
- jmethodID handleIconify;
- jmethodID handleDeiconify;
- jmethodID handleStateChange;
- jmethodID draggedToScreenMID;
-};
diff --git a/jdk/src/solaris/native/sun/awt/awt_mgrsel.c b/jdk/src/solaris/native/sun/awt/awt_mgrsel.c
deleted file mode 100644
index b033227..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_mgrsel.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifdef HEADLESS
- #error This file should not be included in headless library
-#endif
-
-#include "awt_mgrsel.h"
-
-static Atom XA_MANAGER = None;
-
-/*
- * Structures that describes the manager selection AWT listens to with
- * callabacks to the subsytems interested in the selection. (We only
- * listen to a couple of selections, so linear search is enough).
- */
-struct AwtMgrsel {
- char *selname; /* base name of selection atoms */
- Atom *per_scr_atoms; /* per-screen selection atoms (ICCCM 1.2.6) */
- Atom *per_scr_owners; /* windows currently owning the selection */
- long extra_mask; /* extra events to listen to on owners */
- void *cookie;
- void (*callback_event)(int, XEvent *, void *); /* extra_mask events */
- void (*callback_owner)(int, Window, long *, void *); /* owner changes */
- struct AwtMgrsel *next;
-};
-
-static struct AwtMgrsel *mgrsel_list = NULL;
-
-
-static int awt_mgrsel_screen(Window w);
-static Window awt_mgrsel_select_per_screen(Atom, long);
-static int awt_mgrsel_managed(XClientMessageEvent *mgrown);
-static int awt_mgrsel_unmanaged(XDestroyWindowEvent *ev);
-
-#ifdef DEBUG
-static void awt_mgrsel_dtraceManaged(XClientMessageEvent *mgrown);
-#endif
-
-
-
-/*
- * Find which screen the window W is the root of.
- * Returns the screen number, or -1 if W is not a root.
- */
-static int
-awt_mgrsel_screen(Window w)
-{
- Display *dpy = awt_display;
- int scr;
-
- for (scr = 0; scr < ScreenCount(dpy); ++scr) {
- if (w == RootWindow(dpy, scr)) {
- return (scr);
- }
- }
-
- return (-1);
-}
-
-
-/************************************************************************
- * For every one that asketh receiveth; and he that seeketh findeth;
- * and to him that knocketh it shall be opened. (Luke 11:10).
- */
-
-
-/*
- * A method for a subsytem to express its interest in a certain
- * manager selection.
- *
- * If owner changes, the callback_owner will be called with the screen
- * number and the new owning window when onwership is established, or
- * None if the owner is gone.
- *
- * Events in extra_mask are selected for on owning windows (exsiting
- * ones and on new owners when established) and callback_event will be
- * called with the screen number and an event.
- *
- * The function returns an array of current owners. The size of the
- * array is ScreenCount(awt_display). The array is "owned" by this
- * module and should be considered by the caller as read-only.
- */
-const Window *
-awt_mgrsel_select(const char *selname, long extra_mask,
- void *cookie,
- void (*callback_event)(int, XEvent *, void *),
- void (*callback_owner)(int, Window, long *, void *))
-{
- Display *dpy = awt_display;
- struct AwtMgrsel *mgrsel;
- Atom *per_scr_atoms;
- Window *per_scr_owners;
- char *namesbuf;
- char **names;
- int per_scr_sz;
- int nscreens = ScreenCount(dpy);
- int scr;
- Status status;
-
- DASSERT(selname != NULL);
- DTRACE_PRINTLN1("MG: select: %s", selname);
-
- /* buffer size for one per-screen atom name */
- per_scr_sz = strlen(selname) + /* "_S" */ 2 + /* %2d */ + 2 /* '\0' */+ 1;
-
- namesbuf = malloc(per_scr_sz * nscreens); /* actual storage for names */
- names = malloc(sizeof(char *) * nscreens); /* pointers to names */
- per_scr_atoms = malloc(sizeof(Atom) * nscreens);
- per_scr_owners = malloc(sizeof(Window) * nscreens);
- mgrsel = malloc(sizeof(struct AwtMgrsel));
-
- if (namesbuf == NULL || names == NULL || per_scr_atoms == NULL
- || per_scr_owners == NULL || mgrsel == NULL)
- {
- DTRACE_PRINTLN("MG: select: unable to allocate memory");
- if (namesbuf != NULL) free(namesbuf);
- if (names != NULL) free(names);
- if (per_scr_atoms != NULL) free(per_scr_atoms);
- if (per_scr_owners != NULL) free(per_scr_owners);
- if (mgrsel != NULL) free(mgrsel);
- return (NULL);
- }
-
-
- for (scr = 0; scr < nscreens; ++scr) {
- size_t sz;
-
- names[scr] = &namesbuf[per_scr_sz * scr];
- sz = snprintf(names[scr], per_scr_sz, "%s_S%-d", selname, scr);
- DASSERT(sz < per_scr_sz);
- }
-
- status = XInternAtoms(dpy, names, nscreens, False, per_scr_atoms);
-
- free(names);
- free(namesbuf);
-
- if (status == 0) {
- DTRACE_PRINTLN("MG: select: XInternAtoms failed");
- free(per_scr_atoms);
- free(per_scr_owners);
- return (NULL);
- }
-
- mgrsel->selname = strdup(selname);
- mgrsel->per_scr_atoms = per_scr_atoms;
- mgrsel->per_scr_owners = per_scr_owners;
- mgrsel->extra_mask = extra_mask;
- mgrsel->cookie = cookie;
- mgrsel->callback_event = callback_event;
- mgrsel->callback_owner = callback_owner;
-
- for (scr = 0; scr < nscreens; ++scr) {
- Window owner;
-
- owner = awt_mgrsel_select_per_screen(per_scr_atoms[scr], extra_mask);
- mgrsel->per_scr_owners[scr] = owner;
-#ifdef DEBUG
- if (owner == None) {
- DTRACE_PRINTLN1("MG: screen %d - None", scr);
- } else {
- DTRACE_PRINTLN2("MG: screen %d - 0x%08lx", scr, owner);
- }
-#endif
- }
-
- mgrsel->next = mgrsel_list;
- mgrsel_list = mgrsel;
-
- return (per_scr_owners);
-}
-
-
-static Window
-awt_mgrsel_select_per_screen(Atom selection, long extra_mask)
-{
- Display *dpy = awt_display;
- Window owner;
-
- XGrabServer(dpy);
-
- owner = XGetSelectionOwner(dpy, selection);
- if (owner == None) {
- /* we'll get notified later if one arrives */
- XUngrabServer(dpy);
- /* Workaround for bug 5039226 */
- XSync(dpy, False);
- return (None);
- }
-
- /*
- * Select for StructureNotifyMask to get DestroyNotify when owner
- * is gone. Also select for any additional events caller is
- * interested in (e.g. PropertyChangeMask). Caller will be
- * notifed of these events via ... XXX ...
- */
- XSelectInput(dpy, owner, StructureNotifyMask | extra_mask);
-
- XUngrabServer(dpy);
- /* Workaround for bug 5039226 */
- XSync(dpy, False);
- return (owner);
-}
-
-
-/************************************************************************
- * And so I saw the wicked buried, who had come and gone from the
- * place of the holy, and they were forgotten in the city where they
- * had so done: this is also vanity. (Eccl 8:10)
- */
-
-#ifdef DEBUG
-/*
- * Print the message from the new manager that announces it acquired
- * ownership.
- */
-static void
-awt_mgrsel_dtraceManaged(XClientMessageEvent *mgrown)
-{
- Display *dpy = awt_display;
- Atom selection;
- char *selname, *print_selname;
- int scr;
-
- scr = awt_mgrsel_screen(mgrown->window);
-
- selection = mgrown->data.l[1];
- print_selname = selname = XGetAtomName(dpy, selection);
- if (selname == NULL) {
- if (selection == None) {
- print_selname = "<None>";
- } else {
- print_selname = "<Unknown>";
- }
- }
-
- DTRACE_PRINTLN4("MG: new MANAGER for %s: screen %d, owner 0x%08lx (@%lu)",
- print_selname, scr,
- mgrown->data.l[2], /* the window owning the selection */
- mgrown->data.l[0]); /* timestamp */
- DTRACE_PRINTLN4("MG: %ld %ld / 0x%lx 0x%lx", /* extra data */
- mgrown->data.l[3], mgrown->data.l[4],
- mgrown->data.l[3], mgrown->data.l[4]);
-
- if (selname != NULL) {
- XFree(selname);
- }
-}
-#endif /* DEBUG */
-
-
-static int
-awt_mgrsel_managed(XClientMessageEvent *mgrown)
-{
- Display *dpy = awt_display;
- struct AwtMgrsel *mgrsel;
- int scr;
-
- long timestamp;
- Atom selection;
- Window owner;
- long *data;
-
- if (mgrown->message_type != XA_MANAGER) {
- DTRACE_PRINTLN("MG: ClientMessage type != MANAGER, ignoring");
- return (0);
- }
-
- scr = awt_mgrsel_screen(mgrown->window);
-
-#ifdef DEBUG
- awt_mgrsel_dtraceManaged(mgrown);
-#endif
-
- if (scr < 0) {
- DTRACE_PRINTLN("MG: MANAGER ClientMessage with a non-root window!");
- return (0);
- }
-
- timestamp = mgrown->data.l[0];
- selection = mgrown->data.l[1];
- owner = mgrown->data.l[2];
- data = &mgrown->data.l[3]; /* long[2], selection specific */
-
- /* is this a selection we are intrested in? */
- for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) {
- if (selection == mgrsel->per_scr_atoms[scr])
- break;
- }
-
- if (mgrsel == NULL) {
- DTRACE_PRINTLN("MG: not interested in this selection, ignoring");
- return (0);
- }
-
-
- mgrsel->per_scr_owners[scr] = owner;
-
- XSelectInput(dpy, owner, StructureNotifyMask | mgrsel->extra_mask);
-
- /* notify the listener */
- if (mgrsel->callback_owner != NULL) {
- (*mgrsel->callback_owner)(scr, owner, data, mgrsel->cookie);
- }
-
- return (1);
-}
-
-
-static int
-awt_mgrsel_unmanaged(XDestroyWindowEvent *ev)
-{
- Display *dpy = awt_display;
- struct AwtMgrsel *mgrsel;
- Window exowner;
- int scr;
-
- exowner = ev->window; /* selection owner that's gone */
-
- /* is this a selection we are intrested in? */
- for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) {
- for (scr = 0; scr < ScreenCount(dpy); ++scr) {
- if (exowner == mgrsel->per_scr_owners[scr]) {
- /* can one window own selections for more than one screen? */
- goto out; /* XXX??? */
- }
- }
- }
- out:
- if (mgrsel == NULL) {
- DTRACE_PRINTLN1("MG: DestroyNotify for 0x%08lx ignored", exowner);
- return (0);
- }
-
- DTRACE_PRINTLN3("MG: DestroyNotify for 0x%08lx, owner of %s at screen %d",
- exowner, mgrsel->selname, scr);
-
- /* notify the listener (pass exowner as data???) */
- if (mgrsel->callback_owner != NULL) {
- (*mgrsel->callback_owner)(scr, None, NULL, mgrsel->cookie);
- }
-
- return (1);
-}
-
-
-/*
- * Hook to be called from toolkit event loop.
- */
-int
-awt_mgrsel_processEvent(XEvent *ev)
-{
- Display *dpy = awt_display;
- struct AwtMgrsel *mgrsel;
- int scr;
-
- if (ev->type == ClientMessage) { /* new manager announces ownership? */
- if (awt_mgrsel_managed(&ev->xclient))
- return (1);
- }
-
- if (ev->type == DestroyNotify) { /* manager gives up selection? */
- if (awt_mgrsel_unmanaged(&ev->xdestroywindow))
- return (1);
- }
-
- /* is this an event selected on one of selection owners? */
- for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) {
- for (scr = 0; scr < ScreenCount(dpy); ++scr) {
- if (ev->xany.window == mgrsel->per_scr_owners[scr]) {
- /* can one window own selections for more than one screen? */
- goto out; /* XXX??? */
- }
- }
- }
- out:
- DTRACE_PRINT2("MG: screen %d, event %d ... ",
- scr, ev->xany.type);
- if (mgrsel == NULL) {
- DTRACE_PRINTLN("ignored");
- return (0); /* not interested */
- }
-
- DTRACE_PRINT1("%s ... ", mgrsel->selname);
- if (mgrsel->callback_event != NULL) {
- DTRACE_PRINTLN("dispatching");
- (*mgrsel->callback_event)(scr, ev, mgrsel->cookie);
- }
-#ifdef DEBUG
- else {
- DTRACE_PRINTLN("no callback");
- }
-#endif
-
- return (1);
-}
-
-
-void
-awt_mgrsel_init(void)
-{
- static Boolean inited = False;
-
- Display *dpy = awt_display;
- int scr;
-
- if (inited) {
- return;
- }
-
- XA_MANAGER = XInternAtom(dpy, "MANAGER", False);
- DASSERT(XA_MANAGER != None);
-
-
- /*
- * Listen for ClientMessage's on each screen's root. We hook into
- * the message loop in the toolkit (with awt_mgrsel_processEvent)
- * to get the events processed. We need this for notifications of
- * new manager acquiring ownership of the manager selection.
- */
- for (scr = 0; scr < ScreenCount(dpy); ++scr) {
- XSelectInput(dpy, RootWindow(dpy, scr), StructureNotifyMask);
- }
-
- inited = True;
-}
diff --git a/jdk/src/solaris/native/sun/awt/awt_mgrsel.h b/jdk/src/solaris/native/sun/awt/awt_mgrsel.h
deleted file mode 100644
index fdb9bfa..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_mgrsel.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef _AWT_MGRSEL_H_
-#define _AWT_MGRSEL_H_
-
-#ifndef HEADLESS
-
-#include "awt_p.h"
-
-extern void awt_mgrsel_init(void);
-extern int awt_mgrsel_processEvent(XEvent *);
-
-extern const Window * awt_mgrsel_select(const char *, long,
- void *,
- void (*)(int, XEvent *, void *),
- void (*)(int, Window, long *, void *));
-
-#endif /* !HEADLESS */
-#endif /* _AWT_MGRSEL_H_ */
diff --git a/jdk/src/solaris/native/sun/awt/awt_motif.h b/jdk/src/solaris/native/sun/awt/awt_motif.h
deleted file mode 100644
index 011a8dc..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_motif.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef _SWITCHXM_P_H_
-#define _SWITCHXM_P_H_
-
-#include <sun_awt_motif_MComponentPeer.h>
-
-#include "gdefs.h"
-#include <X11/Xlib.h>
-#include <X11/Intrinsic.h>
-
-#define MOTIF_NA sun_awt_motif_MComponentPeer_MOTIF_NA
-#define MOTIF_V1 sun_awt_motif_MComponentPeer_MOTIF_V1
-#define MOTIF_V2 sun_awt_motif_MComponentPeer_MOTIF_V2
-
-
-extern int32_t awt_motif_getIMStatusHeight(Widget w, jobject tc);
-extern XVaNestedList awt_motif_getXICStatusAreaList(Widget w, jobject tc);
-extern void awt_motif_Scrollbar_ButtonReleaseHandler (Widget,
- XtPointer,
- XEvent *,
- Boolean *) ;
-
- /* This function causes an UnsatisfiedLinkError on Linux.
- * It's a no-op for Motif 2.1.
- * Since Linux only links against Motif 2.1, we can safely remove
- * this function altogether from the Linux build.
- * bchristi 1/22/2001
- */
-#ifdef __solaris__
-extern void awt_motif_adjustDragTriggerEvent(XEvent* xevent);
-#endif
-
-void awt_motif_enableSingleDragInitiator(Widget w);
-
-#endif /* _SWITCHXM_P_H_ */
diff --git a/jdk/src/solaris/native/sun/awt/awt_wm.c b/jdk/src/solaris/native/sun/awt/awt_wm.c
deleted file mode 100644
index d1da64f..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_wm.c
+++ /dev/null
@@ -1,2869 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifdef HEADLESS
- #error This file should not be included in headless library
-#endif
-
-/*
- * Some SCIENCE stuff happens, and it is CONFUSING
- */
-
-#include "awt_p.h"
-
-#include <X11/Xproto.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <Xm/MwmUtil.h>
-
-/* JNI headers */
-#include "java_awt_Frame.h" /* for frame state constants */
-
-#include "awt_wm.h"
-#include "awt_util.h" /* for X11 error handling macros */
-
-/*
- * NB: 64 bit awareness.
- *
- * Since this code reads/writes window properties heavily, one thing
- * should be noted well. Xlib uses C type 'long' for properties of
- * format 32. Fortunately, typedef for Atom is 'long' as well, so
- * passing property data as or casting returned property data to
- * arrays of atoms is safe.
- */
-
-
-/*
- * Atoms used to communicate with window manager(s).
- * Naming convention:
- * o for atom "FOO" the variable is "XA_FOO"
- * o for atom "_BAR" the variable is "_XA_BAR"
- * Don't forget to add initialization to awt_wm_initAtoms below.
- */
-
-/*
- * Before WM rototill JDK used to check for running WM by just testing
- * if certain atom is interned or not. We'd better not confuse older
- * JDK by interning these atoms. Use awt_wm_atomInterned() to intern
- * them lazily.
- *
- * ENLIGHTENMENT_COMMS
- * _ICEWM_WINOPTHINT
- * _SAWMILL_TIMESTAMP
- * _DT_SM_WINDOW_INFO
- * _MOTIF_WM_INFO
- * _SUN_WM_PROTOCOLS
- */
-
-/* Good old ICCCM */
-static Atom XA_WM_STATE;
-
-/* New "netwm" spec from www.freedesktop.org */
-static Atom XA_UTF8_STRING; /* like STRING but encoding is UTF-8 */
-static Atom _XA_NET_SUPPORTING_WM_CHECK;
-static Atom _XA_NET_SUPPORTED; /* list of protocols (property of root) */
-static Atom _XA_NET_WM_NAME; /* window property */
-static Atom _XA_NET_WM_STATE; /* both window property and request */
-
-/*
- * _NET_WM_STATE is a list of atoms.
- * NB: Standard spelling is "HORZ" (yes, without an 'I'), but KDE2
- * uses misspelled "HORIZ" (see KDE bug #20229). This was fixed in
- * KDE 2.2. Under earlier versions of KDE2 horizontal and full
- * maximization doesn't work .
- */
-static Atom _XA_NET_WM_STATE_MAXIMIZED_HORZ;
-static Atom _XA_NET_WM_STATE_MAXIMIZED_VERT;
-static Atom _XA_NET_WM_STATE_SHADED;
-static Atom _XA_NET_WM_STATE_ABOVE;
-static Atom _XA_NET_WM_STATE_BELOW;
-static Atom _XA_NET_WM_STATE_HIDDEN;
-
-/* Currently we only care about max_v and max_h in _NET_WM_STATE */
-#define AWT_NET_N_KNOWN_STATES 2
-
-/* Gnome WM spec (superseded by "netwm" above, but still in use) */
-static Atom _XA_WIN_SUPPORTING_WM_CHECK;
-static Atom _XA_WIN_PROTOCOLS;
-static Atom _XA_WIN_STATE;
-static Atom _XA_WIN_LAYER;
-
-/* Enlightenment */
-static Atom _XA_E_FRAME_SIZE;
-
-/* KWin (KDE2) */
-static Atom _XA_KDE_NET_WM_FRAME_STRUT;
-
-/* KWM (KDE 1.x) OBSOLETE??? */
-static Atom XA_KWM_WIN_ICONIFIED;
-static Atom XA_KWM_WIN_MAXIMIZED;
-
-/* OpenLook */
-static Atom _XA_OL_DECOR_DEL;
-static Atom _XA_OL_DECOR_HEADER;
-static Atom _XA_OL_DECOR_RESIZE;
-static Atom _XA_OL_DECOR_PIN;
-static Atom _XA_OL_DECOR_CLOSE;
-
-/* For _NET_WM_STATE ClientMessage requests */
-#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
-#define _NET_WM_STATE_ADD 1 /* add/set property */
-#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
-
-/* _WIN_STATE bits */
-#define WIN_STATE_STICKY (1<<0) /* everyone knows sticky */
-#define WIN_STATE_MINIMIZED (1<<1) /* Reserved - definition is unclear */
-#define WIN_STATE_MAXIMIZED_VERT (1<<2) /* window in maximized V state */
-#define WIN_STATE_MAXIMIZED_HORIZ (1<<3) /* window in maximized H state */
-#define WIN_STATE_HIDDEN (1<<4) /* not on taskbar but window visible*/
-#define WIN_STATE_SHADED (1<<5) /* shaded (MacOS / Afterstep style) */
-#define WIN_LAYER_ONTOP 6
-#define WIN_LAYER_NORMAL 4
-
-#define URGENCY_HINT (1<<8)
-#define LAYER_ALWAYS_ON_TOP 1
-#define LAYER_NORMAL 0
-
-
-/*
- * Intern a bunch of atoms we are going use.
- */
-static void
-awt_wm_initAtoms(void)
-{
- /* Minimize X traffic by creating atoms en mass... This requires
- slightly more code but reduces number of server requests. */
- struct atominit {
- Atom *atomptr;
- const char *name;
- };
-
- /* Just add new atoms to this list */
- static struct atominit atom_list[] = {
- { &XA_WM_STATE, "WM_STATE" },
-
- { &XA_UTF8_STRING, "UTF8_STRING" },
-
- { &_XA_NET_SUPPORTING_WM_CHECK, "_NET_SUPPORTING_WM_CHECK" },
- { &_XA_NET_SUPPORTED, "_NET_SUPPORTED" },
- { &_XA_NET_WM_STATE, "_NET_WM_STATE" },
- { &_XA_NET_WM_STATE_MAXIMIZED_VERT, "_NET_WM_STATE_MAXIMIZED_VERT" },
- { &_XA_NET_WM_STATE_MAXIMIZED_HORZ, "_NET_WM_STATE_MAXIMIZED_HORZ" },
- { &_XA_NET_WM_STATE_SHADED, "_NET_WM_STATE_SHADED" },
- { &_XA_NET_WM_STATE_ABOVE, "_NET_WM_STATE_ABOVE" },
- { &_XA_NET_WM_STATE_BELOW, "_NET_WM_STATE_BELOW" },
- { &_XA_NET_WM_STATE_HIDDEN, "_NET_WM_STATE_HIDDEN" },
- { &_XA_NET_WM_NAME, "_NET_WM_NAME" },
-
- { &_XA_WIN_SUPPORTING_WM_CHECK, "_WIN_SUPPORTING_WM_CHECK" },
- { &_XA_WIN_PROTOCOLS, "_WIN_PROTOCOLS" },
- { &_XA_WIN_STATE, "_WIN_STATE" },
- { &_XA_WIN_LAYER, "_WIN_LAYER" },
-
- { &_XA_KDE_NET_WM_FRAME_STRUT, "_KDE_NET_WM_FRAME_STRUT" },
-
- { &_XA_E_FRAME_SIZE, "_E_FRAME_SIZE" },
-
- { &XA_KWM_WIN_ICONIFIED, "KWM_WIN_ICONIFIED" },
- { &XA_KWM_WIN_MAXIMIZED, "KWM_WIN_MAXIMIZED" },
-
- { &_XA_OL_DECOR_DEL, "_OL_DECOR_DEL" },
- { &_XA_OL_DECOR_HEADER, "_OL_DECOR_HEADER" },
- { &_XA_OL_DECOR_RESIZE, "_OL_DECOR_RESIZE" },
- { &_XA_OL_DECOR_PIN, "_OL_DECOR_PIN" },
- { &_XA_OL_DECOR_CLOSE, "_OL_DECOR_CLOSE" }
- };
-#define ATOM_LIST_LENGTH (sizeof(atom_list)/sizeof(atom_list[0]))
-
- const char *names[ATOM_LIST_LENGTH];
- Atom atoms[ATOM_LIST_LENGTH];
- Status status;
- size_t i;
-
- /* Fill the array of atom names */
- for (i = 0; i < ATOM_LIST_LENGTH; ++i) {
- names[i] = atom_list[i].name;
- }
-
- DTRACE_PRINT("WM: initializing atoms ... ");
- status = XInternAtoms(awt_display, (char**)names, ATOM_LIST_LENGTH,
- False, atoms);
- if (status == 0) {
- DTRACE_PRINTLN("failed");
- return;
- }
-
- /* Store returned atoms into corresponding global variables */
- DTRACE_PRINTLN("ok");
- for (i = 0; i < ATOM_LIST_LENGTH; ++i) {
- *atom_list[i].atomptr = atoms[i];
- }
-#undef ATOM_LIST_LENGTH
-}
-
-
-/*
- * When checking for various WMs don't intern certain atoms we use to
- * distinguish those WMs. Rather check if the atom is interned first.
- * If it's not, further tests are not necessary anyway.
- * This also saves older JDK a great deal of confusion (4487993).
- */
-static Boolean
-awt_wm_atomInterned(Atom *pa, const char *name)
-{
- DASSERT(pa != NULL);
- if (*pa == None) {
- DASSERT(name != NULL);
- *pa = XInternAtom(awt_display, name, True);
- if (*pa == None) {
- DTRACE_PRINTLN1("\"%s\" is not interned", name);
- return False;
- } else {
- return True;
- }
- } else {
- return True;
- }
-}
-
-
-
-/*****************************************************************************\
- *
- * DTRACE utils for various states ...
- *
-\*****************************************************************************/
-
-
-static void
-awt_wm_dtraceWMState(uint32_t wm_state)
-{
-#ifdef DEBUG
- DTRACE_PRINT("WM_STATE = ");
- switch (wm_state) {
- case WithdrawnState:
- DTRACE_PRINTLN("Withdrawn");
- break;
- case NormalState:
- DTRACE_PRINTLN("Normal");
- break;
- case IconicState:
- DTRACE_PRINTLN("Iconic");
- break;
- default:
- DTRACE_PRINTLN1("unknown state %d", wm_state);
- break;
- }
-#endif /* DEBUG */
-}
-
-static void
-awt_wm_dtraceStateNet(Atom *net_wm_state, unsigned long nitems)
-{
-#ifdef DEBUG
- unsigned long i;
-
- DTRACE_PRINT("_NET_WM_STATE = {");
- for (i = 0; i < nitems; ++i) {
- char *name, *print_name;
- name = XGetAtomName(awt_display, net_wm_state[i]);
- if (name == NULL) {
- print_name = "???";
- } else if (strncmp(name, "_NET_WM_STATE", 13) == 0) {
- print_name = name + 13; /* skip common prefix to reduce noice */
- } else {
- print_name = name;
- }
- DTRACE_PRINT1(" %s", print_name);
- if (name) {
- XFree(name);
- }
- }
- DTRACE_PRINTLN(" }");
-#endif
-}
-
-
-static void
-awt_wm_dtraceStateWin(uint32_t win_state)
-{
-#ifdef DEBUG
- DTRACE_PRINT("_WIN_STATE = {");
- if (win_state & WIN_STATE_STICKY) {
- DTRACE_PRINT(" STICKY");
- }
- if (win_state & WIN_STATE_MINIMIZED) {
- DTRACE_PRINT(" MINIMIZED");
- }
- if (win_state & WIN_STATE_MAXIMIZED_VERT) {
- DTRACE_PRINT(" MAXIMIZED_VERT");
- }
- if (win_state & WIN_STATE_MAXIMIZED_HORIZ) {
- DTRACE_PRINT(" MAXIMIZED_HORIZ");
- }
- if (win_state & WIN_STATE_HIDDEN) {
- DTRACE_PRINT(" HIDDEN");
- }
- if (win_state & WIN_STATE_SHADED) {
- DTRACE_PRINT(" SHADED");
- }
- DTRACE_PRINTLN(" }");
-#endif
-}
-
-
-static void
-awt_wm_dtraceStateJava(jint java_state)
-{
-#ifdef DEBUG
- DTRACE_PRINT("java state = ");
- if (java_state == java_awt_Frame_NORMAL) {
- DTRACE_PRINTLN("NORMAL");
- }
- else {
- DTRACE_PRINT("{");
- if (java_state & java_awt_Frame_ICONIFIED) {
- DTRACE_PRINT(" ICONIFIED");
- }
- if ((java_state & java_awt_Frame_MAXIMIZED_BOTH)
- == java_awt_Frame_MAXIMIZED_BOTH)
- {
- DTRACE_PRINT(" MAXIMIZED_BOTH");
- }
- else if (java_state & java_awt_Frame_MAXIMIZED_HORIZ) {
- DTRACE_PRINT(" MAXIMIZED_HORIZ");
- }
- else if (java_state & java_awt_Frame_MAXIMIZED_VERT) {
- DTRACE_PRINT(" MAXIMIZED_VERT");
- }
- DTRACE_PRINTLN(" }");
- }
-#endif /* DEBUG */
-}
-
-
-
-/*****************************************************************************\
- *
- * Utility functions ...
- *
-\*****************************************************************************/
-
-/*
- * Instead of validating window id, we simply call XGetWindowProperty,
- * but temporary install this function as the error handler to ignore
- * BadWindow error.
- */
-int /* but ingored */
-xerror_ignore_bad_window(Display *dpy, XErrorEvent *err)
-{
- XERROR_SAVE(err);
- if (err->error_code == BadWindow) {
- DTRACE_PRINTLN("IGNORING BadWindow");
- return 0; /* ok to fail */
- }
- else {
- return (*xerror_saved_handler)(dpy, err);
- }
-}
-
-
-/*
- * Convenience wrapper for XGetWindowProperty for XA_ATOM properties.
- * E.g. WM_PROTOCOLS, _NET_WM_STATE, _OL_DECOR_DEL.
- * It's up to caller to XFree returned value.
- * Number of items returned is stored to nitems_ptr (if non-null).
- */
-static Atom *
-awt_getAtomListProperty(Window w, Atom property, unsigned long *nitems_ptr)
-{
- /* Request status */
- int status;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems_stub;
- unsigned long bytes_after;
- Atom *list;
-
- if (nitems_ptr == NULL) {
- /* Caller is not interested in the number of items,
- provide a stub for XGetWindowProperty */
- nitems_ptr = &nitems_stub;
- }
-
- status = XGetWindowProperty(awt_display, w,
- property, 0, 0xFFFF, False, XA_ATOM,
- &actual_type, &actual_format, nitems_ptr, &bytes_after,
- (unsigned char **)&list);
-
- if (status != Success || list == NULL) {
- *nitems_ptr = 0;
- return NULL;
- }
-
- if (actual_type != XA_ATOM || actual_format != 32) {
- XFree(list);
- *nitems_ptr = 0;
- return NULL;
- }
-
- if (*nitems_ptr == 0) {
- XFree(list);
- return NULL;
- }
-
- return list;
-}
-
-
-/*
- * Auxiliary function that returns the value of 'property' of type
- * 'property_type' on window 'w'. Format of the property must be 8.
- * Terminating zero added by XGetWindowProperty is preserved.
- * It's up to caller to XFree the result.
- */
-static unsigned char *
-awt_getProperty8(Window w, Atom property, Atom property_type)
-{
- /* Request status */
- int status;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- unsigned char *string;
-
- /* BadWindow is ok and will be blocked by our special handler */
- WITH_XERROR_HANDLER(xerror_ignore_bad_window);
- {
- status = XGetWindowProperty(awt_display, w,
- property, 0, 0xFFFF, False, property_type,
- &actual_type, &actual_format, &nitems, &bytes_after,
- &string);
- }
- RESTORE_XERROR_HANDLER;
-
- if (status != Success || string == NULL) {
- return NULL;
- }
-
- if (actual_type != property_type || actual_format != 8) {
- XFree(string);
- return NULL;
- }
-
- /* XGetWindowProperty kindly supplies terminating zero */
- return string;
-}
-
-
-/*
- * Auxiliary function that returns the value of 'property' of type
- * 'property_type' on window 'w'. Format of the property must be 32.
- */
-static int32_t
-awt_getProperty32(Window w, Atom property, Atom property_type)
-{
- /* Property value*/
- int32_t value;
-
- /* Request status */
- int status;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- long *data; /* NB: 64 bit: Format 32 props are 'long' */
-
- /* BadWindow is ok and will be blocked by our special handler */
- WITH_XERROR_HANDLER(xerror_ignore_bad_window);
- {
- status = XGetWindowProperty(awt_display, w,
- property, 0, 1, False, property_type,
- &actual_type, &actual_format, &nitems, &bytes_after,
- (unsigned char **)&data);
- }
- RESTORE_XERROR_HANDLER;
-
- if (status != Success || data == NULL) {
- return 0;
- }
-
- if (actual_type != property_type || actual_format != 32) {
- XFree(data); /* NULL data already catched above */
- return 0;
- }
-
- value = (int32_t)*data;
- XFree(data);
-
- return value;
-}
-
-
-
-/*****************************************************************************\
- *
- * Detecting WM ...
- *
-\*****************************************************************************/
-
-
-
-/*
- * Check for anchor_prop(anchor_type) on root, take the value as the
- * window id and check if that window exists and has anchor_prop(anchor_type)
- * with the same value (i.e. pointing back to self).
- *
- * Returns the anchor window, as some WM may put interesting stuff in
- * its properties (e.g. sawfish).
- */
-static Window
-awt_wm_checkAnchor(Atom anchor_prop, Atom anchor_type)
-{
- Window root_xref;
- Window self_xref;
-
- root_xref = (Window)awt_getProperty32(DefaultRootWindow(awt_display),
- anchor_prop, anchor_type);
- if (root_xref == None) {
- DTRACE_PRINTLN("no");
- return None;
- }
-
- DTRACE_PRINT1("0x%x ... ", (unsigned int)root_xref);
- self_xref = (Window)awt_getProperty32(root_xref,
- anchor_prop, anchor_type);
- if (self_xref != root_xref) {
- DTRACE_PRINTLN("stale");
- return None;
- }
-
- DTRACE_PRINTLN("ok");
- return self_xref;
-}
-
-
-/*
- * New WM spec: KDE 2.0.1, sawfish 0.3x, ...
- * <http://www.freedesktop.org/standards/wm-spec.html>
- */
-static Window
-awt_wm_isNetSupporting(void)
-{
- static Boolean checked = False;
- static Window isNetSupporting = None;
-
- if (checked) {
- return isNetSupporting;
- }
-
- DTRACE_PRINT("WM: checking for _NET_SUPPORTING ... ");
- isNetSupporting = awt_wm_checkAnchor(_XA_NET_SUPPORTING_WM_CHECK,
- XA_WINDOW);
- checked = True;
- return isNetSupporting;
-}
-
-
-/*
- * Old Gnome WM spec: WindowMaker, Enlightenment, IceWM ...
- * <http://developer.gnome.org/doc/standards/wm/book1.html>
- */
-static Window
-awt_wm_isWinSupporting(void)
-{
- static Boolean checked = False;
- static Window isWinSupporting = None;
-
- if (checked) {
- return isWinSupporting;
- }
-
- DTRACE_PRINT("WM: checking for _WIN_SUPPORTING ... ");
- isWinSupporting = awt_wm_checkAnchor(_XA_WIN_SUPPORTING_WM_CHECK,
- XA_CARDINAL);
- checked = True;
- return isWinSupporting;
-}
-
-
-/*
- * Check that that the list of protocols specified by WM in property
- * named LIST_NAME on the root window contains protocol PROTO.
- */
-static Boolean
-awt_wm_checkProtocol(Atom list_name, Atom proto)
-{
- Atom *protocols;
- unsigned long nproto;
- Boolean found;
- unsigned long i;
-
- protocols = awt_getAtomListProperty(DefaultRootWindow(awt_display),
- list_name, &nproto);
- if (protocols == NULL) {
- return False;
- }
-
- found = False;
- for (i = 0; i < nproto; ++i) {
- if (protocols[i] == proto) {
- found = True;
- break;
- }
- }
-
- if (protocols != NULL) {
- XFree(protocols);
- }
- return found;
-}
-
-static Boolean
-awt_wm_doStateProtocolNet(void)
-{
- static Boolean checked = False;
- static Boolean supported = False;
-
- if (checked) {
- return supported;
- }
-
- if (awt_wm_isNetSupporting()) {
- DTRACE_PRINT("WM: checking for _NET_WM_STATE in _NET_SUPPORTED ... ");
- supported = awt_wm_checkProtocol(_XA_NET_SUPPORTED, _XA_NET_WM_STATE);
- DTRACE_PRINTLN1("%s", supported ? "yes" : "no");
- }
-
- checked = True;
- return supported;
-}
-
-static Boolean
-awt_wm_doStateProtocolWin(void)
-{
- static Boolean checked = False;
- static Boolean supported = False;
-
- if (checked) {
- return supported;
- }
-
- if (awt_wm_isWinSupporting()) {
- DTRACE_PRINT("WM: checking for _WIN_STATE in _WIN_PROTOCOLS ... ");
- supported = awt_wm_checkProtocol(_XA_WIN_PROTOCOLS, _XA_WIN_STATE);
- DTRACE_PRINTLN1("%s", supported ? "yes" : "no");
- }
- checked = True;
- return supported;
-}
-
-
-
-/*
- * Helper function for awt_wm_isEnlightenment.
- * Enlightenment uses STRING property for its comms window id. Gaaa!
- * The property is ENLIGHTENMENT_COMMS, STRING/8 and the string format
- * is "WINID %8x". Gee, I haven't been using scanf for *ages*... :-)
- */
-static Window
-awt_getECommsWindowIDProperty(Window w)
-{
- static Atom XA_ENLIGHTENMENT_COMMS = None;
-
- /* Property value*/
- Window value;
-
- /* Request status */
- int status;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- unsigned char *data;
-
- if (!awt_wm_atomInterned(&XA_ENLIGHTENMENT_COMMS, "ENLIGHTENMENT_COMMS")) {
- return False;
- }
-
- /* BadWindow is ok and will be blocked by our special handler */
- WITH_XERROR_HANDLER(xerror_ignore_bad_window);
- {
- status = XGetWindowProperty(awt_display, w,
- XA_ENLIGHTENMENT_COMMS, 0, 14, False, XA_STRING,
- &actual_type, &actual_format, &nitems, &bytes_after,
- &data);
- }
- RESTORE_XERROR_HANDLER;
-
- if (status != Success || data == NULL) {
- DTRACE_PRINTLN("no ENLIGHTENMENT_COMMS");
- return None;
- }
-
- if (actual_type != XA_STRING || actual_format != 8
- || nitems != 14 || bytes_after != 0)
- {
- DTRACE_PRINTLN("malformed ENLIGHTENMENT_COMMS");
- XFree(data); /* NULL data already catched above */
- return None;
- }
-
- value = None;
- sscanf((char *)data, "WINID %8lx", &value); /* NB: 64 bit: XID is long */
- XFree(data);
-
- return value;
-}
-
-
-/*
- * Is Enlightenment WM running? Congruent to awt_wm_checkAnchor, but
- * uses STRING property peculiar to Enlightenment.
- */
-static Boolean
-awt_wm_isEnlightenment(void)
-{
- Window root_xref;
- Window self_xref;
-
- DTRACE_PRINT("WM: checking for Enlightenment ... ");
- root_xref = awt_getECommsWindowIDProperty(DefaultRootWindow(awt_display));
- if (root_xref == None) {
- return False;
- }
-
- DTRACE_PRINT1("0x%x ... ", root_xref);
- self_xref = awt_getECommsWindowIDProperty(root_xref);
- if (self_xref != root_xref) {
- return False;
- }
-
- DTRACE_PRINTLN("ok");
- return True;
-}
-
-
-/*
- * Is CDE running?
- *
- * XXX: This is hairy... CDE is MWM as well. It seems we simply test
- * for default setup and will be bitten if user changes things...
- *
- * Check for _DT_SM_WINDOW_INFO(_DT_SM_WINDOW_INFO) on root. Take the
- * second element of the property and check for presence of
- * _DT_SM_STATE_INFO(_DT_SM_STATE_INFO) on that window.
- *
- * XXX: Any header that defines this structures???
- */
-static Boolean
-awt_wm_isCDE(void)
-{
- static Atom _XA_DT_SM_WINDOW_INFO = None;
- static Atom _XA_DT_SM_STATE_INFO = None;
-
- /* Property value*/
- Window wmwin;
-
- /* Request status */
- int status;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- long *data; /* NB: 64 bit: Format 32 props are 'long' */
-
- DTRACE_PRINT("WM: checking for CDE ... ");
-
- if (!awt_wm_atomInterned(&_XA_DT_SM_WINDOW_INFO, "_DT_SM_WINDOW_INFO")) {
- return False;
- }
-
- status = XGetWindowProperty(awt_display, DefaultRootWindow(awt_display),
- _XA_DT_SM_WINDOW_INFO, 0, 2, False, _XA_DT_SM_WINDOW_INFO,
- &actual_type, &actual_format, &nitems, &bytes_after,
- (unsigned char **)&data);
-
- if (status != Success || data == NULL) {
- DTRACE_PRINTLN("no _DT_SM_WINDOW_INFO on root");
- return False;
- }
-
- if (actual_type != _XA_DT_SM_WINDOW_INFO || actual_format != 32
- || nitems != 2 || bytes_after != 0)
- {
- DTRACE_PRINTLN("malformed _DT_SM_WINDOW_INFO on root");
- XFree(data); /* NULL data already catched above */
- return False;
- }
-
- wmwin = (Window)data[1];
- XFree(data);
-
- /* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */
-
- if (!awt_wm_atomInterned(&_XA_DT_SM_STATE_INFO, "_DT_SM_STATE_INFO")) {
- return False;
- }
-
- /* BadWindow is ok and will be blocked by our special handler */
- WITH_XERROR_HANDLER(xerror_ignore_bad_window);
- {
- status = XGetWindowProperty(awt_display, wmwin,
- _XA_DT_SM_STATE_INFO, 0, 1, False, _XA_DT_SM_STATE_INFO,
- &actual_type, &actual_format, &nitems, &bytes_after,
- (unsigned char **)&data);
- }
- RESTORE_XERROR_HANDLER;
-
- if (status != Success || data == NULL) {
- DTRACE_PRINTLN("no _DT_SM_STATE_INFO");
- return False;
- }
-
- if (actual_type != _XA_DT_SM_STATE_INFO || actual_format != 32) {
- DTRACE_PRINTLN("malformed _DT_SM_STATE_INFO");
- XFree(data); /* NULL data already catched above */
- return False;
- }
-
- DTRACE_PRINTLN("yes");
- XFree(data);
- return True;
-}
-
-/*
- * Is MWM running? (Note that CDE will test positive as well).
- *
- * Check for _MOTIF_WM_INFO(_MOTIF_WM_INFO) on root. Take the
- * second element of the property and check for presence of
- * _DT_SM_STATE_INFO(_DT_SM_STATE_INFO) on that window.
- */
-static Boolean
-awt_wm_isMotif(void)
-{
- /*
- * Grr. Motif just had to be different, ain't it!? Everyone use
- * "XA" for things of type Atom, but motif folks chose to define
- * _XA_MOTIF_* to be atom *names*. How pathetic...
- */
-#undef _XA_MOTIF_WM_INFO
- static Atom _XA_MOTIF_WM_INFO = None;
- static Atom _XA_DT_WORKSPACE_CURRENT = None;
-
- /* Property value */
- Window wmwin;
- Atom *curws;
-
- /* Request status */
- int status;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- long *data; /* NB: 64 bit: Format 32 props are 'long' */
-
- DTRACE_PRINT("WM: checking for MWM ... ");
-
- if (!awt_wm_atomInterned(&_XA_MOTIF_WM_INFO, "_MOTIF_WM_INFO")
- || !awt_wm_atomInterned(&_XA_DT_WORKSPACE_CURRENT, "_DT_WORKSPACE_CURRENT"))
- {
- return False;
- }
-
-
- status = XGetWindowProperty(awt_display, DefaultRootWindow(awt_display),
- _XA_MOTIF_WM_INFO, 0, PROP_MOTIF_WM_INFO_ELEMENTS, False,
- _XA_MOTIF_WM_INFO, &actual_type,
- &actual_format, &nitems, &bytes_after,
- (unsigned char **)&data);
-
- if (status != Success || data == NULL) {
- DTRACE_PRINTLN("no _MOTIF_WM_INFO on root");
- return False;
- }
-
- if (actual_type != _XA_MOTIF_WM_INFO || actual_format != 32
- || nitems != PROP_MOTIF_WM_INFO_ELEMENTS || bytes_after != 0)
- {
- DTRACE_PRINTLN("malformed _MOTIF_WM_INFO on root");
- XFree(data); /* NULL data already catched above */
- return False;
- }
-
- /* NB: 64 bit: Cannot cast data to MotifWmInfo */
- wmwin = (Window)data[1];
- XFree(data);
-
- /* Now check that this window has _DT_WORKSPACE_CURRENT */
- curws = awt_getAtomListProperty(wmwin, _XA_DT_WORKSPACE_CURRENT, NULL);
- if (curws == NULL) {
- DTRACE_PRINTLN("no _DT_WORKSPACE_CURRENT");
- return False;
- }
-
- DTRACE_PRINTLN("yes");
- XFree(curws);
- return True;
-}
-
-
-static Boolean
-awt_wm_isNetWMName(char *name)
-{
- Window anchor;
- unsigned char *net_wm_name;
- Boolean matched;
-
- anchor = awt_wm_isNetSupporting();
- if (anchor == None) {
- return False;
- }
-
- DTRACE_PRINT1("WM: checking for %s by _NET_WM_NAME ... ", name);
-
- /*
- * Check both UTF8_STRING and STRING. We only call this function
- * with ASCII names and UTF8 preserves ASCII bit-wise. wm-spec
- * mandates UTF8_STRING for _NET_WM_NAME but at least sawfish-1.0
- * still uses STRING. (mmm, moving targets...).
- */
- net_wm_name = awt_getProperty8(anchor, _XA_NET_WM_NAME, XA_UTF8_STRING);
- if (net_wm_name == NULL) {
- net_wm_name = awt_getProperty8(anchor, _XA_NET_WM_NAME, XA_STRING);
- }
-
- if (net_wm_name == NULL) {
- DTRACE_PRINTLN("no (missing _NET_WM_NAME)");
- return False;
- }
-
- matched = (strcmp((char *)net_wm_name, name) == 0);
- if (matched) {
- DTRACE_PRINTLN("yes");
- } else {
- DTRACE_PRINTLN1("no (_NET_WM_NAME = \"%s\")", net_wm_name);
- }
- XFree(net_wm_name);
- return matched;
-}
-
-/*
- * Is Sawfish running?
- */
-static Boolean
-awt_wm_isSawfish(void)
-{
- return awt_wm_isNetWMName("Sawfish");
-}
-
-/*
- * Is KDE2 (KWin) running?
- */
-static Boolean
-awt_wm_isKDE2(void)
-{
- return awt_wm_isNetWMName("KWin");
-}
-
-
-/*
- * Is Metacity running?
- */
-static Boolean
-awt_wm_isMetacity(void)
-{
- return awt_wm_isNetWMName("Metacity");
-}
-
-
-/*
- * Temporary error handler that ensures that we know if
- * XChangeProperty succeeded or not.
- */
-static int /* but ignored */
-xerror_verify_change_property(Display *dpy, XErrorEvent *err)
-{
- XERROR_SAVE(err);
- if (err->request_code == X_ChangeProperty) {
- return 0;
- }
- else {
- return (*xerror_saved_handler)(dpy, err);
- }
-}
-
-
-/*
- * Prepare IceWM check.
- *
- * The only way to detect IceWM, seems to be by setting
- * _ICEWM_WINOPTHINT(_ICEWM_WINOPTHINT/8) on root and checking if it
- * was immediately deleted by IceWM.
- *
- * But messing with PropertyNotify here is way too much trouble, so
- * approximate the check by setting the property in this function and
- * checking if it still exists later on.
- *
- * Gaa, dirty dances...
- */
-static Boolean
-awt_wm_prepareIsIceWM(void)
-{
- static Atom _XA_ICEWM_WINOPTHINT = None;
-
- /*
- * Choose something innocuous: "AWT_ICEWM_TEST allWorkspaces 0".
- * IceWM expects "class\0option\0arg\0" with zero bytes as delimiters.
- */
- static unsigned char opt[] = {
- 'A','W','T','_','I','C','E','W','M','_','T','E','S','T','\0',
- 'a','l','l','W','o','r','k','s','p','a','c','e','s','\0',
- '0','\0'
- };
-
- DTRACE_PRINT("WM: scheduling check for IceWM ... ");
-
- if (!awt_wm_atomInterned(&_XA_ICEWM_WINOPTHINT, "_ICEWM_WINOPTHINT")) {
- return False;
- }
-
- WITH_XERROR_HANDLER(xerror_verify_change_property);
- {
- XChangeProperty(awt_display, DefaultRootWindow(awt_display),
- _XA_ICEWM_WINOPTHINT, _XA_ICEWM_WINOPTHINT, 8,
- PropModeReplace, opt, sizeof(opt));
- }
- RESTORE_XERROR_HANDLER;
-
- if (xerror_code != Success) {
- DTRACE_PRINTLN1("can't set _ICEWM_WINOPTHINT, error = %d",
- xerror_code);
- return False;
- }
- else {
- DTRACE_PRINTLN("scheduled");
- return True;
- }
-}
-
-/*
- * Is IceWM running?
- *
- * Note well: Only call this if awt_wm_prepareIsIceWM succeeded, or a
- * false positive will be reported.
- */
-static Boolean
-awt_wm_isIceWM(void)
-{
- static Atom _XA_ICEWM_WINOPTHINT = None;
-
- /* Request status */
- int status;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- unsigned char *data;
-
- DTRACE_PRINT("WM: checking for IceWM ... ");
-
- if (!awt_wm_atomInterned(&_XA_ICEWM_WINOPTHINT, "_ICEWM_WINOPTHINT")) {
- return False;
- }
-
- XGetWindowProperty(awt_display, DefaultRootWindow(awt_display),
- _XA_ICEWM_WINOPTHINT, 0, 0xFFFF, True, /* NB: deleting! */
- _XA_ICEWM_WINOPTHINT, &actual_type,
- &actual_format, &nitems, &bytes_after,
- &data);
-
- if (data != NULL) {
- XFree(data);
- }
-
- if (actual_type == None) {
- DTRACE_PRINTLN("yes");
- return True;
- }
- else {
- DTRACE_PRINTLN("no");
- return False;
- }
-}
-
-/*
- * Is OpenLook WM running?
- *
- * This one is pretty lame, but the only property peculiar to OLWM is
- * _SUN_WM_PROTOCOLS(ATOM[]). Fortunately, olwm deletes it on exit.
- */
-static Boolean
-awt_wm_isOpenLook(void)
-{
- static Atom _XA_SUN_WM_PROTOCOLS = None;
- Atom *list;
-
- DTRACE_PRINT("WM: checking for OpenLook WM ... ");
-
- if (!awt_wm_atomInterned(&_XA_SUN_WM_PROTOCOLS, "_SUN_WM_PROTOCOLS")) {
- return False;
- }
-
- list = awt_getAtomListProperty(DefaultRootWindow(awt_display),
- _XA_SUN_WM_PROTOCOLS, NULL);
- if (list == NULL) {
- DTRACE_PRINTLN("no _SUN_WM_PROTOCOLS on root");
- return False;
- }
-
- DTRACE_PRINTLN("yes");
- XFree(list);
- return True;
-}
-
-
-
-static Boolean winmgr_running = False;
-
-/*
- * Temporary error handler that checks if selecting for
- * SubstructureRedirect failed.
- */
-static int /* but ignored */
-xerror_detect_wm(Display *dpy, XErrorEvent *err)
-{
- XERROR_SAVE(err);
- if (err->request_code == X_ChangeWindowAttributes
- && err->error_code == BadAccess)
- {
- DTRACE_PRINTLN("some WM is running (hmm, we'll see)");
- winmgr_running = True;
- return 0;
- }
- else {
- return (*xerror_saved_handler)(dpy, err);
- }
-}
-
-
-/*
- * Make an educated guess about running window manager.
- * XXX: ideally, we should detect wm restart.
- */
-enum wmgr_t
-awt_wm_getRunningWM(void)
-{
- /*
- * Ideally, we should support cases when a different WM is started
- * during a Java app lifetime.
- */
- static enum wmgr_t awt_wmgr = UNDETERMINED_WM;
-
- XSetWindowAttributes substruct;
- const char *vendor_string;
- Boolean doIsIceWM;
-
- if (awt_wmgr != UNDETERMINED_WM) {
- return awt_wmgr;
- }
-
- /*
- * Quick checks for specific servers.
- */
- vendor_string = ServerVendor(awt_display);
- if (strstr(vendor_string, "eXcursion") != NULL) {
- /*
- * Use NO_WM since in all other aspects eXcursion is like not
- * having a window manager running. I.e. it does not reparent
- * top level shells.
- */
- DTRACE_PRINTLN("WM: eXcursion detected - treating as NO_WM");
- awt_wmgr = NO_WM;
- return awt_wmgr;
- }
-
- /*
- * If *any* window manager is running?
- *
- * Try selecting for SubstructureRedirect, that only one client
- * can select for, and if the request fails, than some other WM is
- * already running.
- */
- winmgr_running = 0;
- substruct.event_mask = SubstructureRedirectMask;
-
- DTRACE_PRINT("WM: trying SubstructureRedirect ... ");
- WITH_XERROR_HANDLER(xerror_detect_wm);
- {
- XChangeWindowAttributes(awt_display, DefaultRootWindow(awt_display),
- CWEventMask, &substruct);
- }
- RESTORE_XERROR_HANDLER;
-
- /*
- * If no WM is running than our selection for SubstructureRedirect
- * succeeded and needs to be undone (hey we are *not* a WM ;-).
- */
- if (!winmgr_running) {
- DTRACE_PRINTLN("no WM is running");
- awt_wmgr = NO_WM;
- substruct.event_mask = 0;
- XChangeWindowAttributes(awt_display, DefaultRootWindow(awt_display),
- CWEventMask, &substruct);
- return NO_WM;
- }
-
- /* actual check for IceWM to follow below */
- doIsIceWM = awt_wm_prepareIsIceWM(); /* and let IceWM to act */
-
- if (awt_wm_isNetSupporting()) {
- awt_wm_doStateProtocolNet();
- }
- if (awt_wm_isWinSupporting()) {
- awt_wm_doStateProtocolWin();
- }
-
- /*
- * Ok, some WM is out there. Check which one by testing for
- * "distinguishing" atoms.
- */
- if (doIsIceWM && awt_wm_isIceWM()) {
- awt_wmgr = ICE_WM;
- }
- else if (awt_wm_isEnlightenment()) {
- awt_wmgr = ENLIGHTEN_WM;
- }
- else if (awt_wm_isMetacity()) {
- awt_wmgr = METACITY_WM;
- }
- else if (awt_wm_isSawfish()) {
- awt_wmgr = SAWFISH_WM;
- }
- else if (awt_wm_isKDE2()) {
- awt_wmgr = KDE2_WM;
- }
- /*
- * We don't check for legacy WM when we already know that WM
- * supports WIN or _NET wm spec.
- */
- else if (awt_wm_isNetSupporting()) {
- DTRACE_PRINTLN("WM: other WM (supports _NET)");
- awt_wmgr = OTHER_WM;
- }
- else if (awt_wm_isWinSupporting()) {
- DTRACE_PRINTLN("WM: other WM (supports _WIN)");
- awt_wmgr = OTHER_WM;
- }
- /*
- * Check for legacy WMs.
- */
- else if (awt_wm_isCDE()) { /* XXX: must come before isMotif */
- awt_wmgr = CDE_WM;
- }
- else if (awt_wm_isMotif()) {
- awt_wmgr = MOTIF_WM;
- }
- else if (awt_wm_isOpenLook()) {
- awt_wmgr = OPENLOOK_WM;
- }
- else {
- DTRACE_PRINTLN("WM: some other legacy WM");
- awt_wmgr = OTHER_WM;
- }
-
- return awt_wmgr;
-}
-
-
-/*
- * Some buggy WMs ignore window gravity when processing
- * ConfigureRequest and position window as if the gravity is Static.
- * We work around this in MWindowPeer.pReshape().
- */
-Boolean
-awt_wm_configureGravityBuggy(void)
-{
- static int env_not_checked = 1;
- static int env_buggy = 0;
-
- if (env_not_checked) {
- DTRACE_PRINT("WM: checking for _JAVA_AWT_WM_STATIC_GRAVITY in environment ... ");
- if (getenv("_JAVA_AWT_WM_STATIC_GRAVITY") != NULL) {
- DTRACE_PRINTLN("set");
- env_buggy = 1;
- } else {
- DTRACE_PRINTLN("no");
- }
- env_not_checked = 0;
- }
-
- if (env_buggy) {
- return True;
- }
-
- switch (awt_wm_getRunningWM()) {
- case ICE_WM:
- /*
- * See bug #228981 at IceWM's SourceForge pages.
- * Latest stable version 1.0.8-6 still has this problem.
- */
- return True;
-
- case ENLIGHTEN_WM:
- /* At least E16 is buggy. */
- return True;
-
- default:
- return False;
- }
-}
-
-/**
- * Check if state is supported.
- * Note that a compound state is always reported as not supported.
- * Note also that MAXIMIZED_BOTH is considered not a compound state.
- * Therefore, a compound state is just ICONIFIED | anything else.
- *
- */
-Boolean
-awt_wm_supportsExtendedState(jint state)
-{
- switch (state) {
- case java_awt_Frame_MAXIMIZED_VERT:
- case java_awt_Frame_MAXIMIZED_HORIZ:
- /*
- * WMs that talk NET/WIN protocol, but do not support
- * unidirectional maximization.
- */
- if (awt_wm_getRunningWM() == METACITY_WM) {
- /* "This is a deliberate policy decision." -hp */
- return JNI_FALSE;
- }
- /* FALLTROUGH */
- case java_awt_Frame_MAXIMIZED_BOTH:
- return (awt_wm_doStateProtocolNet() || awt_wm_doStateProtocolWin());
- default:
- return JNI_FALSE;
- }
-}
-
-
-
-
-/*****************************************************************************\
- *
- * Size and decoration hints ...
- *
-\*****************************************************************************/
-
-
-/*
- * Remove size hints specified by the mask.
- * XXX: Why do we need this in the first place???
- */
-void
-awt_wm_removeSizeHints(Widget shell, long mask)
-{
- Display *dpy = XtDisplay(shell);
- Window shell_win = XtWindow(shell);
- XSizeHints *hints = XAllocSizeHints();
- long ignore = 0;
-
- if (hints == NULL) {
- DTRACE_PRINTLN("WM: removeSizeHints FAILED to allocate XSizeHints");
- return;
- }
-
- /* sanitize the mask, only do these hints */
- mask &= (PMaxSize|PMinSize|USPosition|PPosition);
-
- XGetWMNormalHints(dpy, shell_win, hints, &ignore);
- if ((hints->flags & mask) == 0) {
- XFree(hints);
- return;
- }
-
-#ifdef DEBUG
- DTRACE_PRINT("WM: removing hints");
-
- if (mask & PMaxSize) {
- DTRACE_PRINT(" Max = ");
- if (hints->flags & PMaxSize) {
- DTRACE_PRINT2("%d x %d;", hints->max_width, hints->max_height);
- } else {
- DTRACE_PRINT("none;");
- }
- }
-
- if (mask & PMinSize) {
- DTRACE_PRINT(" Min = ");
- if (hints->flags & PMinSize) {
- DTRACE_PRINT2("%d x %d;", hints->min_width, hints->min_height);
- } else {
- DTRACE_PRINT("none;");
- }
- }
-
- DTRACE_PRINTLN("");
-#endif
-
- hints->flags &= ~mask;
- XSetWMNormalHints(dpy, shell_win, hints);
- XFree(hints);
-}
-
-/*
- *
- *
- */
-static void
-awt_wm_proclaimUrgency(struct FrameData *wdata)
-{
- Display *dpy = XtDisplay(wdata->winData.shell);
- Window shell_win = XtWindow(wdata->winData.shell);
-
- XWMHints *hints = XGetWMHints(dpy, shell_win);
- if( hints == NULL ) {
- /* For now just */ return;
- }
- if ((hints->flags & URGENCY_HINT) != 0) {
- /* it's here already */
- XFree(hints);
- return;
- }
- hints->flags |= URGENCY_HINT;
- XSetWMHints(dpy, shell_win, hints);
- XFree(hints);
-}
-
-/*
- * If MWM_DECOR_ALL bit is set, then the rest of the bit-mask is taken
- * to be subtracted from the decorations. Normalize decoration spec
- * so that we can map motif decor to something else bit-by-bit in the
- * rest of the code.
- */
-static int
-awt_wm_normalizeMotifDecor(int decorations)
-{
- int d;
-
- if (!(decorations & MWM_DECOR_ALL))
- return decorations; /* already normalized */
-
- d = MWM_DECOR_BORDER |MWM_DECOR_RESIZEH | MWM_DECOR_TITLE
- | MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE;
- d &= ~decorations;
- return d;
-}
-
-
-/*
- * Infer OL properties from MWM decorations.
- * Use _OL_DECOR_DEL(ATOM[]) to remove unwanted ones.
- */
-static void
-awt_wm_setOLDecor(struct FrameData *wdata, Boolean resizable, int decorations)
-{
- Window shell_win = XtWindow(wdata->winData.shell);
- Atom decorDel[3];
- int nitems;
-
- if (shell_win == None) {
- DTRACE_PRINTLN("WM: setOLDecor - no window, returning");
- return;
- }
-
- decorations = awt_wm_normalizeMotifDecor(decorations);
- DTRACE_PRINT("WM: _OL_DECOR_DEL = {");
-
- nitems = 0;
- if (!(decorations & MWM_DECOR_TITLE)) {
- DTRACE_PRINT(" _OL_DECOR_HEADER");
- decorDel[nitems++] = _XA_OL_DECOR_HEADER;
- }
- if (!(decorations & (MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE))) {
- DTRACE_PRINT(" _OL_DECOR_RESIZE");
- decorDel[nitems++] = _XA_OL_DECOR_RESIZE;
- }
- if (!(decorations & (MWM_DECOR_MENU | MWM_DECOR_MAXIMIZE
- | MWM_DECOR_MINIMIZE)))
- {
- DTRACE_PRINT(" _OL_DECOR_CLOSE");
- decorDel[nitems++] = _XA_OL_DECOR_CLOSE;
- }
- DTRACE_PRINT(" }");
-
- if (nitems == 0) {
- DTRACE_PRINTLN(" ... removing");
- XDeleteProperty(awt_display, shell_win, _XA_OL_DECOR_DEL);
- }
- else {
- DTRACE_PRINTLN(" ... setting");
- XChangeProperty(awt_display, shell_win,
- _XA_OL_DECOR_DEL, XA_ATOM, 32,
- PropModeReplace, (unsigned char *)decorDel, nitems);
- }
-}
-
-/*
- * Set MWM decorations. Infer MWM functions from decorations.
- */
-static void
-awt_wm_setMotifDecor(struct FrameData *wdata, Boolean resizable, int decorations)
-{
- int functions;
-
- /* Apparently some WMs don't implement MWM_*_ALL semantic correctly */
- if ((decorations & MWM_DECOR_ALL) && (decorations != MWM_DECOR_ALL)) {
- decorations = awt_wm_normalizeMotifDecor(decorations);
- DTRACE_PRINTLN1("WM: setMotifDecor normalize exclusions, decor = 0x%X",
- decorations);
- }
-
- DTRACE_PRINT("WM: setMotifDecor functions = {");
- functions = 0;
-
- if (decorations & MWM_DECOR_ALL) {
- DTRACE_PRINT(" ALL");
- functions |= MWM_FUNC_ALL;
- }
- else {
- /*
- * Functions we always want to be enabled as mwm(1) and
- * descendants not only hide disabled functions away from
- * user, but also ignore corresponding requests from the
- * program itself (e.g. 4442047).
- */
- DTRACE_PRINT(" CLOSE MOVE MINIMIZE");
- functions |= (MWM_FUNC_CLOSE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE);
-
- if (resizable) {
- DTRACE_PRINT(" RESIZE MAXIMIZE");
- functions |= MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE;
- }
- }
-
- DTRACE_PRINTLN(" }");
-
- XtVaSetValues(wdata->winData.shell,
- XmNmwmDecorations, decorations,
- XmNmwmFunctions, functions,
- NULL);
-}
-
-
-/*
- * Under some window managers if shell is already mapped, we MUST
- * unmap and later remap in order to effect the changes we make in the
- * window manager decorations.
- *
- * N.B. This unmapping / remapping of the shell exposes a bug in
- * X/Motif or the Motif Window Manager. When you attempt to map a
- * widget which is positioned (partially) off-screen, the window is
- * relocated to be entirely on screen. Good idea. But if both the x
- * and the y coordinates are less than the origin (0,0), the first
- * (re)map will move the window to the origin, and any subsequent
- * (re)map will relocate the window at some other point on the screen.
- * I have written a short Motif test program to discover this bug.
- * This should occur infrequently and it does not cause any real
- * problem. So for now we'll let it be.
- */
-static Boolean
-awt_wm_needRemap()
-{
- switch (awt_wm_getRunningWM()) {
-#if 0 /* XXX */
- case OPENLOOK_WM:
- case MOTIF_WM:
- case CDE_WM:
- case ICE_WM:
- case ENLIGHTEN_WM:
- return True;
-#endif
- default:
- return True;
- }
-}
-
-/*
- * Set decoration hints on the shell to wdata->decor adjusted
- * appropriately if not resizable.
- */
-void
-awt_wm_setShellDecor(struct FrameData *wdata, Boolean resizable)
-{
- int decorations = wdata->decor;
-
- DTRACE_PRINTLN3("WM: setShellDecor(0x%x/0x%x, %s)",
- wdata->winData.shell, XtWindow(wdata->winData.shell),
- resizable ? "resizable" : "not resizable");
-
- if (!resizable) {
- if (decorations & MWM_DECOR_ALL) {
- decorations |= (MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE);
- }
- else {
- decorations &= ~(MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE);
- }
- }
-
- DTRACE_PRINTLN1("WM: decorations = 0x%X", decorations);
- awt_wm_setMotifDecor(wdata, resizable, decorations);
- awt_wm_setOLDecor(wdata, resizable, decorations);
-
- /* Some WMs need remap to redecorate the window */
- if (wdata->isShowing && awt_wm_needRemap()) {
- /*
- * Do the re/mapping at the Xlib level. Since we essentially
- * work around a WM bug we don't want this hack to be exposed
- * to Intrinsics (i.e. don't mess with grabs, callbacks etc).
- */
- Display *dpy = XtDisplay(wdata->winData.shell);
- Window shell_win = XtWindow(wdata->winData.shell);
-
- DTRACE_PRINT("WM: setShellDecor REMAPPING ... ");
- XUnmapWindow(dpy, shell_win);
- XSync(dpy, False); /* give WM a chance to catch up */
- XMapWindow(dpy, shell_win);
- DTRACE_PRINTLN("done");
- }
-}
-
-
-/*
- * Make specified shell resizable.
- */
-void
-awt_wm_setShellResizable(struct FrameData *wdata)
-{
- DTRACE_PRINTLN2("WM: setShellResizable(0x%x/0x%x)",
- wdata->winData.shell, XtWindow(wdata->winData.shell));
-
- XtVaSetValues(wdata->winData.shell,
- XmNallowShellResize, True,
- XmNminWidth, XtUnspecifiedShellInt,
- XmNminHeight, XtUnspecifiedShellInt,
- XmNmaxWidth, XtUnspecifiedShellInt,
- XmNmaxHeight, XtUnspecifiedShellInt,
- NULL);
-
- /* REMINDER: will need to revisit when setExtendedStateBounds is added */
- awt_wm_removeSizeHints(wdata->winData.shell, PMinSize|PMaxSize);
-
- /* Restore decorations */
- awt_wm_setShellDecor(wdata, True);
-}
-
-
-/*
- * Make specified shell non-resizable.
- * If justChangeSize is false, update decorations as well.
- */
-void
-awt_wm_setShellNotResizable(struct FrameData *wdata,
- int32_t width, int32_t height,
- Boolean justChangeSize)
-{
- DTRACE_PRINTLN5("WM: setShellNotResizable(0x%x/0x%x, %d, %d, %s)",
- wdata->winData.shell, XtWindow(wdata->winData.shell),
- width, height,
- justChangeSize ? "size only" : "redecorate");
-
- /* Fix min/max size hints at the specified values */
- if ((width > 0) && (height > 0)) {
- XtVaSetValues(wdata->winData.shell,
- XmNwidth, (XtArgVal)width,
- XmNheight, (XtArgVal)height,
- XmNminWidth, (XtArgVal)width,
- XmNminHeight, (XtArgVal)height,
- XmNmaxWidth, (XtArgVal)width,
- XmNmaxHeight, (XtArgVal)height,
- NULL);
- }
-
- if (!justChangeSize) { /* update decorations */
- awt_wm_setShellDecor(wdata, False);
- }
-}
-
-
-/*
- * Helper function for awt_wm_getInsetsFromProp.
- * Read property of type CARDINAL[4] = { left, right, top, bottom }
- */
-static Boolean
-awt_wm_readInsetsArray(Window shell_win, Atom insets_property,
- int32_t *top, int32_t *left, int32_t *bottom, int32_t *right)
-{
- /* Request status */
- int status;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- long *insets = NULL; /* NB: 64 bit: Format 32 props are 'long' */
-
- status = XGetWindowProperty (awt_display, shell_win,
- insets_property, 0, 4, False, XA_CARDINAL,
- &actual_type, &actual_format, &nitems, &bytes_after,
- (unsigned char **)&insets);
-
- if (status != Success || insets == NULL) {
- DTRACE_PRINTLN("failed");
- return False;
- }
-
- if (actual_type != XA_CARDINAL || actual_format != 32) {
- DTRACE_PRINTLN("type/format mismatch");
- XFree(insets);
- return False;
- }
-
- *left = (int32_t)insets[0];
- *right = (int32_t)insets[1];
- *top = (int32_t)insets[2];
- *bottom = (int32_t)insets[3];
- XFree(insets);
-
- /* Order is that of java.awt.Insets.toString */
- DTRACE_PRINTLN4("[top=%d,left=%d,bottom=%d,right=%d]",
- *top, *left, *bottom, *right);
- return True;
-}
-
-/*
- * If WM implements the insets property - fill insets with values
- * specified in that property.
- */
-Boolean
-awt_wm_getInsetsFromProp(Window shell_win,
- int32_t *top, int32_t *left, int32_t *bottom, int32_t *right)
-{
- switch (awt_wm_getRunningWM()) {
-
- case ENLIGHTEN_WM:
- DTRACE_PRINT("WM: reading _E_FRAME_SIZE ... ");
- return awt_wm_readInsetsArray(shell_win, _XA_E_FRAME_SIZE,
- top, left, bottom, right);
-
-#if 0
- /*
- * uwe: disabled for now, as KDE seems to supply bogus values
- * when we maximize iconified frame. Need to verify with KDE2.1.
- * NB: Also note, that "external" handles (e.g. in laptop decor)
- * are also included in the frame strut, which is probably not
- * what we want.
- */
- case KDE2_WM:
- DTRACE_PRINT("WM: reading _KDE_NET_WM_FRAME_STRUT ... ");
- return awt_wm_readInsetsArray(shell_win, _XA_KDE_NET_WM_FRAME_STRUT,
- top, left, bottom, right);
-#endif
-
- default:
- return False;
- }
-}
-
-/*
- * XmNiconic and Map/UnmapNotify (that XmNiconic relies on) are
- * unreliable, since mapping changes can happen for a virtual desktop
- * switch or MacOS style shading that became quite popular under X as
- * well. Yes, it probably should not be this way, as it violates
- * ICCCM, but reality is that quite a lot of window managers abuse
- * mapping state.
- */
-int
-awt_wm_getWMState(Window shell_win)
-{
- /* Request status */
- int status;
-
- /* Returns of XGetWindowProperty */
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- long *data; /* NB: 64 bit: Format 32 props are 'long' */
-
- int wm_state;
-
- status = XGetWindowProperty(awt_display, shell_win,
- XA_WM_STATE, 0, 1, False, XA_WM_STATE,
- &actual_type, &actual_format, &nitems, &bytes_after,
- (unsigned char **)&data);
-
- if (status != Success || data == NULL) {
- return WithdrawnState;
- }
-
- if (actual_type != XA_WM_STATE) {
- DTRACE_PRINTLN1("WM: WM_STATE(0x%x) - wrong type", shell_win);
- XFree(data);
- return WithdrawnState;
- }
-
- wm_state = (int)*data;
- XFree(data);
- return wm_state;
-}
-
-
-
-/*****************************************************************************\
- *
- * Reading state from properties WM puts on our window ...
- *
-\*****************************************************************************/
-
-/*
- * New "NET" WM spec: _NET_WM_STATE/Atom[]
- */
-static jint
-awt_wm_getStateNet(Window shell_win)
-{
- Atom *net_wm_state;
- jint java_state;
- unsigned long nitems;
- unsigned long i;
-
- net_wm_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
- if (nitems == 0) {
- DTRACE_PRINTLN("WM: _NET_WM_STATE = { }");
- if (net_wm_state) {
- XFree(net_wm_state);
- }
- return java_awt_Frame_NORMAL;
- }
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateNet(net_wm_state, nitems);
-#endif
-
- java_state = java_awt_Frame_NORMAL;
- for (i = 0; i < nitems; ++i) {
- if (net_wm_state[i] == _XA_NET_WM_STATE_MAXIMIZED_VERT) {
- java_state |= java_awt_Frame_MAXIMIZED_VERT;
- }
- else if (net_wm_state[i] == _XA_NET_WM_STATE_MAXIMIZED_HORZ) {
- java_state |= java_awt_Frame_MAXIMIZED_HORIZ;
- }
- }
- XFree(net_wm_state);
- return java_state;
-}
-
-Boolean
-awt_wm_isStateNetHidden(Window shell_win)
-{
- Atom *net_wm_state;
- Boolean result = False;
- unsigned long nitems;
- unsigned long i;
-
- net_wm_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
- if (nitems == 0) {
- DTRACE_PRINTLN("WM: _NET_WM_STATE = { }");
- if (net_wm_state) {
- XFree(net_wm_state);
- }
- return False;
- }
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateNet(net_wm_state, nitems);
-#endif
-
- for (i = 0; i < nitems; ++i) {
- if (net_wm_state[i] == _XA_NET_WM_STATE_HIDDEN) {
- result = True;
- }
- }
- XFree(net_wm_state);
- return result;
-}
-
-/*
- * Similar code to getStateNet, to get layer state.
- */
-static int
-awt_wm_getLayerNet(Window shell_win)
-{
- Atom *net_wm_state;
- int java_state;
- unsigned long nitems;
- unsigned long i;
-
- net_wm_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
- if (nitems == 0) {
- DTRACE_PRINTLN("WM: _NET_WM_STATE = { }");
- if (net_wm_state) {
- XFree(net_wm_state);
- }
- return LAYER_NORMAL;
- }
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateNet(net_wm_state, nitems);
-#endif
-
- java_state = LAYER_NORMAL;
- for (i = 0; i < nitems; ++i) {
- if (net_wm_state[i] == _XA_NET_WM_STATE_ABOVE) {
- java_state = LAYER_ALWAYS_ON_TOP;
- }
- }
- XFree(net_wm_state);
- return java_state;
-}
-
-/*
- * Old Gnome spec: _WIN_STATE/CARDINAL
- */
-static jint
-awt_wm_getStateWin(Window shell_win)
-{
- long win_state;
- jint java_state;
-
- win_state = awt_getProperty32(shell_win, _XA_WIN_STATE, XA_CARDINAL);
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateWin(win_state);
-#endif
-
- java_state = java_awt_Frame_NORMAL;
- if (win_state & WIN_STATE_MAXIMIZED_VERT) {
- java_state |= java_awt_Frame_MAXIMIZED_VERT;
- }
- if (win_state & WIN_STATE_MAXIMIZED_HORIZ) {
- java_state |= java_awt_Frame_MAXIMIZED_HORIZ;
- }
- return java_state;
-}
-
-/*
- * Code similar to getStateWin, to get layer state.
- */
-static int
-awt_wm_getLayerWin(Window shell_win)
-{
- long win_state;
- jint java_state;
-
- win_state = awt_getProperty32(shell_win, _XA_WIN_LAYER, XA_CARDINAL);
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateWin(win_state);
-#endif
-
- java_state = LAYER_NORMAL;
- if (win_state == WIN_LAYER_ONTOP) {
- java_state = LAYER_ALWAYS_ON_TOP;
- }
- return java_state;
-}
-
-
-static jint
-awt_wm_getExtendedState(Window shell_win)
-{
- if (awt_wm_doStateProtocolNet()) {
- return awt_wm_getStateNet(shell_win);
- }
- else if (awt_wm_doStateProtocolWin()) {
- return awt_wm_getStateWin(shell_win);
- }
- else {
- return java_awt_Frame_NORMAL;
- }
-}
-
-jint
-awt_wm_getState(struct FrameData *wdata)
-{
- Window shell_win = XtWindow(wdata->winData.shell);
- jint java_state;
-
- DTRACE_PRINTLN2("WM: getState(0x%x/0x%x)",
- wdata->winData.shell, shell_win);
-
- if (shell_win == None) {
- DTRACE_PRINTLN("WM: no window, use wdata");
- java_state = wdata->state;
- }
- else {
- int wm_state = awt_wm_getWMState(shell_win);
- if (wm_state == WithdrawnState) {
- DTRACE_PRINTLN("WM: window withdrawn, use wdata");
- java_state = wdata->state;
- }
- else {
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceWMState(wm_state);
-#endif
- if (wm_state == IconicState) {
- java_state = java_awt_Frame_ICONIFIED;
- } else {
- java_state = java_awt_Frame_NORMAL;
- }
- java_state |= awt_wm_getExtendedState(shell_win);
- }
- }
-
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateJava(java_state);
-#endif
-
- return java_state;
-}
-
-
-
-/*****************************************************************************\
- *
- * Notice window state change when WM changes a property on the window ...
- *
-\*****************************************************************************/
-
-
-/*
- * Check if property change is a window state protocol message.
- * If it is - return True and return the new state in *pstate.
- */
-Boolean
-awt_wm_isStateChange(struct FrameData *wdata, XPropertyEvent *e, jint *pstate)
-{
- Window shell_win = XtWindow(wdata->winData.shell);
- Boolean is_state_change = False;
- int wm_state;
-
- if (!wdata->isShowing) {
- return False;
- }
-
- wm_state = awt_wm_getWMState(shell_win);
- if (wm_state == WithdrawnState) {
- return False;
- }
-
- if (e->atom == XA_WM_STATE) {
- is_state_change = True;
- }
- else if (e->atom == _XA_NET_WM_STATE) {
- is_state_change = awt_wm_doStateProtocolNet();
- }
- else if (e->atom == _XA_WIN_STATE) {
- is_state_change = awt_wm_doStateProtocolWin();
- }
-
- if (is_state_change) {
-#ifdef DEBUG
- Widget shell = wdata->winData.shell;
- char *name = XGetAtomName(XtDisplay(shell), e->atom);
- DTRACE_PRINTLN4("WM: PropertyNotify(0x%x/0x%x) %s %s",
- shell, XtWindow(shell),
- name != NULL ? name : "???",
- e->state == PropertyNewValue ? "changed" : "deleted");
- if (name != NULL) {
- XFree(name);
- }
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceWMState(wm_state);
-#endif
- if (wm_state == IconicState) {
- *pstate = java_awt_Frame_ICONIFIED;
- } else {
- *pstate = java_awt_Frame_NORMAL;
- }
- *pstate |= awt_wm_getExtendedState(shell_win);
-
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateJava(*pstate);
-#endif
- }
-
- return is_state_change;
-}
-
-
-
-
-/*****************************************************************************\
- *
- * Setting/changing window state ...
- *
-\*****************************************************************************/
-
-/*
- * Request a state transition from a _NET supporting WM by sending
- * _NET_WM_STATE ClientMessage to root window.
- */
-static void
-awt_wm_requestStateNet(struct FrameData *wdata, jint state)
-{
- Widget shell = wdata->winData.shell;
- Window shell_win = XtWindow(shell);
- XClientMessageEvent req;
- jint old_net_state;
- jint max_changed;
-
- /* must use awt_wm_setInitialStateNet for withdrawn windows */
- DASSERT(wdata->isShowing);
-
- /*
- * We have to use toggle for maximization because of transitions
- * from maximization in one direction only to maximization in the
- * other direction only.
- */
- old_net_state = awt_wm_getStateNet(shell_win);
- max_changed = (state ^ old_net_state) & java_awt_Frame_MAXIMIZED_BOTH;
-
- switch (max_changed) {
- case 0:
- DTRACE_PRINTLN("WM: requestStateNet - maximization unchanged");
- return;
-
- case java_awt_Frame_MAXIMIZED_HORIZ:
- DTRACE_PRINTLN("WM: requestStateNet - toggling MAX_HORZ");
- req.data.l[1] = _XA_NET_WM_STATE_MAXIMIZED_HORZ;
- req.data.l[2] = 0;
- break;
-
- case java_awt_Frame_MAXIMIZED_VERT:
- DTRACE_PRINTLN("WM: requestStateNet - toggling MAX_VERT");
- req.data.l[1] = _XA_NET_WM_STATE_MAXIMIZED_VERT;
- req.data.l[2] = 0;
- break;
-
- default: /* both */
- DTRACE_PRINTLN("WM: requestStateNet - toggling HORZ + VERT");
- req.data.l[1] = _XA_NET_WM_STATE_MAXIMIZED_HORZ;
- req.data.l[2] = _XA_NET_WM_STATE_MAXIMIZED_VERT;
- break;
- }
-
- req.type = ClientMessage;
- req.window = XtWindow(shell);
- req.message_type = _XA_NET_WM_STATE;
- req.format = 32;
- req.data.l[0] = _NET_WM_STATE_TOGGLE;
-
- XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False,
- (SubstructureRedirectMask | SubstructureNotifyMask),
- (XEvent *)&req);
-}
-
-
-/*
- * Request state transition from a Gnome WM (_WIN protocol) by sending
- * _WIN_STATE ClientMessage to root window.
- */
-static void
-awt_wm_requestStateWin(struct FrameData *wdata, jint state)
-{
- Widget shell = wdata->winData.shell;
- XClientMessageEvent req;
- long win_state; /* typeof(XClientMessageEvent.data.l) */
-
- /* must use awt_wm_setInitialStateWin for withdrawn windows */
- DASSERT(wdata->isShowing);
-
- win_state = 0;
- if (state & java_awt_Frame_MAXIMIZED_VERT) {
- win_state |= WIN_STATE_MAXIMIZED_VERT;
- }
- if (state & java_awt_Frame_MAXIMIZED_HORIZ) {
- win_state |= WIN_STATE_MAXIMIZED_HORIZ;
- }
-
- req.type = ClientMessage;
- req.window = XtWindow(shell);
- req.message_type = _XA_WIN_STATE;
- req.format = 32;
- req.data.l[0] = (WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT);
- req.data.l[1] = win_state;
-
- XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False,
- (SubstructureRedirectMask | SubstructureNotifyMask),
- (XEvent *)&req);
-}
-
-
-/*
- * Specify initial state for _NET supporting WM by setting
- * _NET_WM_STATE property on the window to the desired state before
- * mapping it.
- */
-static void
-awt_wm_setInitialStateNet(struct FrameData *wdata, jint state)
-{
- Widget shell = wdata->winData.shell;
- Window shell_win = XtWindow(shell);
- Display *dpy = XtDisplay(shell);
-
- Atom *old_state;
- unsigned long nitems;
-
- /* must use awt_wm_requestStateNet for managed windows */
- DASSERT(!wdata->isShowing);
-
- /* Be careful to not wipe out state bits we don't understand */
- old_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
-
- if (nitems == 0) {
- /*
- * Empty or absent _NET_WM_STATE - set a new one if necessary.
- */
- Atom net_wm_state[AWT_NET_N_KNOWN_STATES];
-
- if (old_state != NULL) {
- XFree(old_state);
- }
-
- if (state & java_awt_Frame_MAXIMIZED_VERT) {
- net_wm_state[nitems++] = _XA_NET_WM_STATE_MAXIMIZED_VERT;
- }
- if (state & java_awt_Frame_MAXIMIZED_HORIZ) {
- net_wm_state[nitems++] = _XA_NET_WM_STATE_MAXIMIZED_HORZ;
- }
- DASSERT(nitems <= AWT_NET_N_KNOWN_STATES);
-
- if (nitems == 0) {
- DTRACE_PRINTLN("WM: initial _NET_WM_STATE not necessary");
- return;
- }
-
-#ifdef DEBUG
- DTRACE_PRINT("WM: setting initial ");
- awt_wm_dtraceStateNet(net_wm_state, nitems);
-#endif
- XChangeProperty(dpy, shell_win,
- _XA_NET_WM_STATE, XA_ATOM, 32, PropModeReplace,
- (unsigned char *)net_wm_state, nitems);
- }
- else {
- /*
- * Tweak existing _NET_WM_STATE, preserving bits we don't use.
- */
- jint want= state /* which flags we want */
- & (java_awt_Frame_MAXIMIZED_HORIZ | java_awt_Frame_MAXIMIZED_VERT);
-
- jint has = 0; /* which flags the window already has */
- int mode; /* property mode: replace/append */
-
- Atom *new_state; /* new _net_wm_state value */
- int new_nitems;
- unsigned long i;
-
-#ifdef DEBUG
- DTRACE_PRINT("WM: already has ");
- awt_wm_dtraceStateNet(old_state, nitems);
-#endif
-
- for (i = 0; i < nitems; ++i) {
- if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_HORZ) {
- has |= java_awt_Frame_MAXIMIZED_HORIZ;
- }
- else if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_VERT) {
- has |= java_awt_Frame_MAXIMIZED_VERT;
- }
- }
-
- if ((has ^ want) == 0) {
- DTRACE_PRINTLN("WM: no changes to _NET_WM_STATE necessary");
- XFree(old_state);
- return;
- }
-
- new_nitems = 0;
- if (has == 0) { /* only adding flags */
- new_state = calloc(AWT_NET_N_KNOWN_STATES, sizeof(Atom));
- mode = PropModeAppend;
- }
- else {
- new_state = calloc(nitems + AWT_NET_N_KNOWN_STATES, sizeof(Atom));
- mode = PropModeReplace;
- }
-
- if (has != 0) { /* copy existing flags */
- DTRACE_PRINT("WM: ");
- for (i = 0; i < nitems; ++i) {
- if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_HORZ) {
- if (want & java_awt_Frame_MAXIMIZED_HORIZ) {
- DTRACE_PRINT(" keep _HORZ");
- } else {
- DTRACE_PRINT(" drop _HORZ");
- continue;
- }
- }
- else if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_VERT) {
- if (want & java_awt_Frame_MAXIMIZED_VERT) {
- DTRACE_PRINT(" keep _VERT");
- } else {
- DTRACE_PRINT(" drop _VERT");
- continue;
- }
- }
- new_state[new_nitems++] = old_state[i];
- }
- }
-
- /* Add missing flags */
- if ((want & java_awt_Frame_MAXIMIZED_HORIZ)
- && !(has & java_awt_Frame_MAXIMIZED_HORIZ))
- {
- DTRACE_PRINT(" add _HORZ");
- new_state[new_nitems] = _XA_NET_WM_STATE_MAXIMIZED_HORZ;
- ++new_nitems;
- }
- if ((want & java_awt_Frame_MAXIMIZED_VERT)
- && !(has & java_awt_Frame_MAXIMIZED_VERT))
- {
- DTRACE_PRINT(" add _VERT");
- new_state[new_nitems] = _XA_NET_WM_STATE_MAXIMIZED_VERT;
- ++new_nitems;
- }
-
- DTRACE_PRINTLN(mode == PropModeReplace ?
- " ... replacing" : " ... appending");
- XChangeProperty(dpy, shell_win,
- _XA_NET_WM_STATE, XA_ATOM, 32, mode,
- (unsigned char *)new_state, new_nitems);
- XFree(old_state);
- XFree(new_state);
- }
-}
-
-
-/*
- * Specify initial state for a Gnome WM (_WIN protocol) by setting
- * WIN_STATE property on the window to the desired state before
- * mapping it.
- */
-static void
-awt_wm_setInitialStateWin(struct FrameData *wdata, jint state)
-{
- Display *dpy = XtDisplay(wdata->winData.shell);
- Window shell_win = XtWindow(wdata->winData.shell);
- long win_state, old_win_state;
-
- /* must use awt_wm_requestStateWin for managed windows */
- DASSERT(!wdata->isShowing);
-
- /* Be careful to not wipe out state bits we don't understand */
- win_state = awt_getProperty32(shell_win, _XA_WIN_STATE, XA_CARDINAL);
- old_win_state = win_state;
-#ifdef DEBUG
- if (win_state != 0) {
- DTRACE_PRINT("WM: already has ");
- awt_wm_dtraceStateWin(win_state);
- }
-#endif
-
- /*
- * In their stupid quest of reinventing every wheel, Gnome WM spec
- * have its own "minimized" hint (instead of using initial state
- * and WM_STATE hints). This is bogus, but, apparently, some WMs
- * pay attention.
- */
- if (state & java_awt_Frame_ICONIFIED) {
- win_state |= WIN_STATE_MINIMIZED;
- } else {
- win_state &= ~WIN_STATE_MINIMIZED;
- }
-
- if (state & java_awt_Frame_MAXIMIZED_VERT) {
- win_state |= WIN_STATE_MAXIMIZED_VERT;
- } else {
- win_state &= ~WIN_STATE_MAXIMIZED_VERT;
- }
-
- if (state & java_awt_Frame_MAXIMIZED_HORIZ) {
- win_state |= WIN_STATE_MAXIMIZED_HORIZ;
- } else {
- win_state &= ~WIN_STATE_MAXIMIZED_HORIZ;
- }
-
- if (old_win_state ^ win_state) {
-#ifdef DEBUG
- DTRACE_PRINT("WM: setting initial ");
- awt_wm_dtraceStateWin(win_state);
-#endif
- XChangeProperty(dpy, shell_win,
- _XA_WIN_STATE, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)&win_state, 1);
- }
-#ifdef DEBUG
- else {
- DTRACE_PRINTLN("WM: no changes to _WIN_STATE necessary");
- }
-#endif
-}
-
-/*
- * Request a layer change from a _NET supporting WM by sending
- * _NET_WM_STATE ClientMessage to root window.
- */
-static void
-awt_wm_requestLayerNet(struct FrameData *wdata, int state)
-{
- Widget shell = wdata->winData.shell;
- Window shell_win = XtWindow(shell);
- XClientMessageEvent req;
- int currentLayer;
- long cmd;
-
- /* must use awt_wm_setInitialLayerNet for withdrawn windows */
- DASSERT(wdata->isShowing);
-
- currentLayer = awt_wm_getLayerNet(shell_win);
- if(state == currentLayer) {
- return;
- }
- cmd = currentLayer == LAYER_ALWAYS_ON_TOP && state == LAYER_NORMAL ?
- _NET_WM_STATE_REMOVE :
- currentLayer == LAYER_NORMAL && state == LAYER_ALWAYS_ON_TOP ?
- _NET_WM_STATE_ADD :
- _NET_WM_STATE_ADD;
- req.type = ClientMessage;
- req.window = XtWindow(shell);
- req.message_type = _XA_NET_WM_STATE;
- req.format = 32;
- req.data.l[0] = cmd;
- req.data.l[1] = _XA_NET_WM_STATE_ABOVE;
- req.data.l[2] = 0L;
-
- XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False,
- (SubstructureRedirectMask | SubstructureNotifyMask),
- (XEvent *)&req);
-}
-
-/*
- * Request a layer change from a Gnome WM (_WIN protocol) by sending
- * _WIN_LAYER ClientMessage to root window.
- */
-static void
-awt_wm_requestLayerWin(struct FrameData *wdata, int state)
-{
- Widget shell = wdata->winData.shell;
- XClientMessageEvent req;
- Display *dpy = XtDisplay(shell);
-
- /* must use awt_wm_setInitialLayerWin for withdrawn windows */
- DASSERT(wdata->isShowing);
-
- req.type = ClientMessage;
- req.window = XtWindow(shell);
- req.message_type = _XA_WIN_LAYER;
- req.format = 32;
- req.data.l[0] = state == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP;
- req.data.l[1] = 0L;
- req.data.l[2] = 0L;
-
- XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False,
- /*(SubstructureRedirectMask |*/
- SubstructureNotifyMask,
- (XEvent *)&req);
-}
-/*
- * Specify initial layer for _NET supporting WM by setting
- * _NET_WM_STATE property on the window to the desired state before
- * mapping it.
- * NB: looks like it doesn't have any effect.
- */
-static void
-awt_wm_setInitialLayerNet(struct FrameData *wdata, int state)
-{
- Widget shell = wdata->winData.shell;
- Window shell_win = XtWindow(shell);
- Display *dpy = XtDisplay(shell);
-
- Atom *old_state;
- unsigned long nitems;
- Atom new_state = _XA_NET_WM_STATE_ABOVE;
-
- /* must use awt_wm_requestLayerNet for managed windows */
- DASSERT(!wdata->isShowing);
-
- /* Be careful to not wipe out state bits we don't understand */
- old_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
-
- if (nitems == 0 && state != LAYER_ALWAYS_ON_TOP) {
- if (old_state != NULL) {
- XFree(old_state);
- }
- return;
- }else if( nitems == 0 && state == LAYER_ALWAYS_ON_TOP) {
- unsigned long data[2];
- /* create new state */
- if (old_state != NULL) {
- XFree(old_state);
- }
- nitems = 1;
- data[0] = new_state;
- data[1] = 0;
- XChangeProperty(dpy, shell_win,
- _XA_NET_WM_STATE, XA_ATOM, 32, PropModeReplace,
- (unsigned char *)data, nitems);
- XSync(dpy, False);
- }else { /* nitems > 0 */
- unsigned long i;
- Boolean bShift = False;
- int mode;
- for(i = 0; i < nitems; i++) {
- if( bShift ) {
- old_state[i-1] = old_state[i];
- }else if( old_state[i] == _XA_NET_WM_STATE_ABOVE ) {
- if(state == LAYER_ALWAYS_ON_TOP) {
- /* no change necessary */
- XFree(old_state);
- return;
- }else{
- /* wipe off this atom */
- bShift = True;
- }
- }
- }
-
- if( bShift ) {
- /* atom was found and removed: change property */
- mode = PropModeReplace;
- nitems--;
- }else if( state != LAYER_ALWAYS_ON_TOP ) {
- /* atom was not found and not needed */
- XFree( old_state);
- return;
- }else {
- /* must add new atom */
- mode = PropModeAppend;
- nitems = 1;
- }
-
- XChangeProperty(dpy, shell_win,
- _XA_NET_WM_STATE, XA_ATOM, 32, mode,
- mode == PropModeAppend ?
- (unsigned char *)(&new_state) :
- (unsigned char *)old_state, nitems);
- XFree(old_state);
- XSync(dpy, False);
- }
-}
-
-/*
- * Specify initial layer for a Gnome WM (_WIN protocol) by setting
- * WIN_LAYER property on the window to the desired state before
- * mapping it.
- */
-static void
-awt_wm_setInitialLayerWin(struct FrameData *wdata, int state)
-{
- Display *dpy = XtDisplay(wdata->winData.shell);
- Window shell_win = XtWindow(wdata->winData.shell);
- long win_state, old_win_state;
- int currentLayer;
-
- /* must use awt_wm_requestLayerWin for managed windows */
- DASSERT(!wdata->isShowing);
-
- currentLayer = awt_wm_getLayerWin(shell_win);
- if( currentLayer == state ) {
- /* no change necessary */
- return;
- }
- if( state == LAYER_ALWAYS_ON_TOP ) {
- win_state = WIN_LAYER_ONTOP;
- }else {
- win_state = WIN_LAYER_NORMAL;
- }
-
- XChangeProperty(dpy, shell_win,
- _XA_WIN_LAYER, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)&win_state, 1);
-}
-
-void
-awt_wm_setExtendedState(struct FrameData *wdata, jint state)
-{
- Display *dpy = XtDisplay(wdata->winData.shell);
- Window shell_win = XtWindow(wdata->winData.shell);
-
-#ifdef DEBUG
- DTRACE_PRINT2("WM: setExtendedState(0x%x/0x%x) ",
- wdata->winData.shell, shell_win);
- awt_wm_dtraceStateJava(state);
-#endif
-
- if (wdata->isShowing) {
- /*
- * If the window is managed by WM, we should send
- * ClientMessage requests.
- */
- if (awt_wm_doStateProtocolNet()) {
- awt_wm_requestStateNet(wdata, state);
- }
- else if (awt_wm_doStateProtocolWin()) {
- awt_wm_requestStateWin(wdata, state);
- }
- XSync(dpy, False);
- }
- else {
- /*
- * If the window is withdrawn we should set necessary
- * properties directly to the window before mapping it.
- */
- if (awt_wm_doStateProtocolNet()) {
- awt_wm_setInitialStateNet(wdata, state);
- }
- else if (awt_wm_doStateProtocolWin()) {
- awt_wm_setInitialStateWin(wdata, state);
- }
-#if 1
- /*
- * Purge KWM bits.
- * Not really tested with KWM, only with WindowMaker.
- */
- XDeleteProperty(dpy, shell_win, XA_KWM_WIN_ICONIFIED);
- XDeleteProperty(dpy, shell_win, XA_KWM_WIN_MAXIMIZED);
-#endif /* 1 */
- }
-}
-
-static Boolean
-awt_wm_supportsLayersNet() {
- Boolean supported = awt_wm_doStateProtocolNet();
-
- /*
- In fact, WM may report this not supported but do support.
- */
- supported &= awt_wm_checkProtocol(_XA_NET_SUPPORTED, _XA_NET_WM_STATE_ABOVE);
- return supported;
-}
-
-static Boolean
-awt_wm_supportsLayersWin() {
- Boolean supported = awt_wm_doStateProtocolWin();
- /*
- * In fact, WM may report this supported but do not support.
- */
- supported &= awt_wm_checkProtocol(_XA_WIN_PROTOCOLS, _XA_WIN_LAYER);
- return supported;
-}
-
-void
-awt_wm_updateAlwaysOnTop(struct FrameData *wdata, jboolean bLayerState) {
- Display *dpy = XtDisplay(wdata->winData.shell);
- Window shell_win = XtWindow(wdata->winData.shell);
- int layerState = bLayerState ? LAYER_ALWAYS_ON_TOP : LAYER_NORMAL;
-
- if (wdata->isShowing) {
- /**
- We don't believe anyone, and now send both ClientMessage requests.
- And eg Metacity under RH 6.1 required both to work.
- **/
- awt_wm_requestLayerNet(wdata, layerState);
- awt_wm_requestLayerWin(wdata, layerState);
- } else {
- /**
- We don't believe anyone, and now set both atoms.
- And eg Metacity under RH 6.1 required both to work.
- **/
- awt_wm_setInitialLayerNet(wdata, layerState);
- awt_wm_setInitialLayerWin(wdata, layerState);
- }
- XSync(dpy, False);
-}
-
-/*
- * Work around for 4775545. _NET version.
- */
-static void
-awt_wm_unshadeKludgeNet(struct FrameData *wdata)
-{
- Display *dpy = XtDisplay(wdata->winData.shell);
- Window shell_win = XtWindow(wdata->winData.shell);
- Atom *net_wm_state;
- Boolean shaded;
- unsigned long nitems;
- unsigned long i;
-
- net_wm_state = awt_getAtomListProperty(shell_win,
- _XA_NET_WM_STATE, &nitems);
- if (nitems == 0) {
- DTRACE_PRINTLN("WM: _NET_WM_STATE = { }");
- if (net_wm_state) {
- XFree(net_wm_state);
- }
- return;
- }
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateNet(net_wm_state, nitems);
-#endif
-
- shaded = False;
- for (i = 0; i < nitems; ++i) {
- if (net_wm_state[i] == _XA_NET_WM_STATE_SHADED) {
- shaded = True;
- break;
- }
- }
-
- if (!shaded) {
- DTRACE_PRINTLN("WM: not _SHADED, no workaround necessary");
- return;
- }
-
- DTRACE_PRINTLN("WM: removing _SHADED");
- ++i; /* skip _SHADED */
- while (i < nitems) { /* copy the rest */
- net_wm_state[i-1] = net_wm_state[i];
- ++i;
- }
- --nitems; /* _SHADED has been removed */
-
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateNet(net_wm_state, nitems);
-#endif
-
- WITH_XERROR_HANDLER(xerror_verify_change_property);
- {
- XChangeProperty(dpy, shell_win,
- _XA_NET_WM_STATE, XA_ATOM, 32, PropModeReplace,
- (unsigned char *)net_wm_state, nitems);
- }
- RESTORE_XERROR_HANDLER;
-
- if (xerror_code != Success) {
- DTRACE_PRINTLN1("WM: XChangeProperty failed, error = %d",
- xerror_code);
- }
-
- XFree(net_wm_state);
-}
-
-
-/*
- * Work around for 4775545. _WIN version.
- */
-static void
-awt_wm_unshadeKludgeWin(struct FrameData *wdata)
-{
- Display *dpy = XtDisplay(wdata->winData.shell);
- Window shell_win = XtWindow(wdata->winData.shell);
- long win_state;
-
- win_state = awt_getProperty32(shell_win, _XA_WIN_STATE, XA_CARDINAL);
-#ifdef DEBUG
- DTRACE_PRINT("WM: ");
- awt_wm_dtraceStateWin(win_state);
-#endif
-
- if ((win_state & WIN_STATE_SHADED) == 0) {
- DTRACE_PRINTLN("WM: not _SHADED, no workaround necessary");
- return;
- }
-
- win_state &= ~WIN_STATE_SHADED;
- XChangeProperty(dpy, shell_win,
- _XA_WIN_STATE, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)&win_state, 1);
-}
-
-
-/*
- * Work around for 4775545.
- *
- * If WM exits while the top-level is shaded, the shaded hint remains
- * on the top-level properties. When WM restarts and sees the shaded
- * window it can reparent it into a "pre-shaded" decoration frame
- * (Metacity does), and our insets logic will go crazy, b/c it will
- * see a huge nagative bottom inset. There's no clean solution for
- * this, so let's just be weasels and drop the shaded hint if we
- * detect that WM exited. NB: we are in for a race condition with WM
- * restart here. NB2: e.g. WindowMaker saves the state in a private
- * property that this code knows nothing about, so this workaround is
- * not effective; other WMs might play similar tricks.
- */
-void
-awt_wm_unshadeKludge(struct FrameData *wdata)
-{
- DTRACE_PRINTLN("WM: unshade kludge");
- DASSERT(wdata->isShowing);
-
- if (awt_wm_doStateProtocolNet()) {
- awt_wm_unshadeKludgeNet(wdata);
- }
- else if (awt_wm_doStateProtocolWin()) {
- awt_wm_unshadeKludgeWin(wdata);
- }
-#ifdef DEBUG
- else {
- DTRACE_PRINTLN("WM: not a _NET or _WIN supporting WM");
- }
-#endif
-
- XSync(XtDisplay(wdata->winData.shell), False);
-}
-
-
-void
-awt_wm_init(void)
-{
- static Boolean inited = False;
- if (inited) {
- return;
- }
-
- awt_wm_initAtoms();
- awt_wm_getRunningWM();
- inited = True;
-}
-
-Boolean awt_wm_supportsAlwaysOnTop() {
- return awt_wm_supportsLayersNet() || awt_wm_supportsLayersWin();
-}
diff --git a/jdk/src/solaris/native/sun/awt/awt_wm.h b/jdk/src/solaris/native/sun/awt/awt_wm.h
deleted file mode 100644
index 6656e2b..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_wm.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef _AWT_WM_H_
-#define _AWT_WM_H_
-
-#ifndef HEADLESS
-
-#include "awt_p.h"
-
-/*
- * Window Managers we care to distinguish.
- * See awt_wm_getRunningWM()
- */
-enum wmgr_t {
- UNDETERMINED_WM,
- NO_WM,
- OTHER_WM,
- OPENLOOK_WM,
- MOTIF_WM,
- CDE_WM,
- ENLIGHTEN_WM,
- KDE2_WM,
- SAWFISH_WM,
- ICE_WM,
- METACITY_WM
-};
-
-extern void awt_wm_init(void);
-
-extern enum wmgr_t awt_wm_getRunningWM(void);
-extern Boolean awt_wm_configureGravityBuggy(void);
-extern Boolean awt_wm_supportsExtendedState(jint state);
-
-/* XWMHints.flags is declared long, so 'mask' argument is declared long too */
-extern void awt_wm_removeSizeHints(Widget shell, long mask);
-
-extern void awt_wm_setShellDecor(struct FrameData *wdata, Boolean resizable);
-extern void awt_wm_setShellResizable(struct FrameData *wdata);
-extern void awt_wm_setShellNotResizable(struct FrameData *wdata,
- int32_t width, int32_t height,
- Boolean justChangeSize);
-
-extern Boolean awt_wm_getInsetsFromProp(Window w,
- int32_t *top, int32_t *left, int32_t *bottom, int32_t *right);
-
-/*
- * WM_STATE: WithdrawnState, NormalState, IconicState.
- * Absence of WM_STATE is treated as WithdrawnState.
- */
-extern int awt_wm_getWMState(Window w);
-
-extern void awt_wm_setExtendedState(struct FrameData *wdata, jint state);
-extern Boolean awt_wm_isStateChange(struct FrameData *wdata, XPropertyEvent *e,
- jint *pstate);
-
-extern void awt_wm_unshadeKludge(struct FrameData *wdata);
-extern void awt_wm_updateAlwaysOnTop(struct FrameData *wdata, jboolean bLayerState);
-extern Boolean awt_wm_supportsAlwaysOnTop();
-
-#endif /* !HEADLESS */
-#endif /* _AWT_WM_H_ */
diff --git a/jdk/src/solaris/native/sun/awt/awt_xembed.h b/jdk/src/solaris/native/sun/awt/awt_xembed.h
deleted file mode 100644
index 42b9955..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_xembed.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef _AWT_XEMBED_H_
-#define _AWT_XEMBED_H_
-
-#ifndef HEADLESS
-
-#include "awt_p.h"
-
-#define XEMBED_VERSION 0
-#define XEMBED_MAPPED (1 << 0)
-/* XEMBED messages */
-#define XEMBED_EMBEDDED_NOTIFY 0
-#define XEMBED_WINDOW_ACTIVATE 1
-#define XEMBED_WINDOW_DEACTIVATE 2
-#define XEMBED_REQUEST_FOCUS 3
-#define XEMBED_FOCUS_IN 4
-#define XEMBED_FOCUS_OUT 5
-#define XEMBED_FOCUS_NEXT 6
-#define XEMBED_FOCUS_PREV 7
-/* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */
-#define XEMBED_MODALITY_ON 10
-#define XEMBED_MODALITY_OFF 11
-#define XEMBED_REGISTER_ACCELERATOR 12
-#define XEMBED_UNREGISTER_ACCELERATOR 13
-#define XEMBED_ACTIVATE_ACCELERATOR 14
-
-#define XEMBED_LAST_MSG XEMBED_ACTIVATE_ACCELERATOR
-
-#define NON_STANDARD_XEMBED_GTK_GRAB_KEY 108
-#define NON_STANDARD_XEMBED_GTK_UNGRAB_KEY 109
-
-// Sun internal special message, to resolve start race condition
-#define _SUN_XEMBED_START 1119
-
-
-// A detail code is required for XEMBED_FOCUS_IN. The following values are valid:
-/* Details for XEMBED_FOCUS_IN: */
-#define XEMBED_FOCUS_CURRENT 0
-#define XEMBED_FOCUS_FIRST 1
-#define XEMBED_FOCUS_LAST 2
-
-
-extern void init_xembed();
-extern void xembed_eventHandler(XEvent *event);
-extern void requestXEmbedFocus(struct FrameData * wdata);
-extern void install_xembed(Widget client, struct FrameData* wdata);
-extern void deinstall_xembed(struct FrameData* wdata);
-extern Boolean isXEmbedActive(struct FrameData * wdata);
-extern Boolean isXEmbedActiveByWindow(Window client);
-extern Boolean isXEmbedApplicationActive(struct FrameData * wdata);
-extern void sendMessageHelper(Window window, int message, long detail,
- long data1, long data2);
-extern void sendMessage(Window window, int message);
-extern void xembed_traverse_out(struct FrameData * wdata, jboolean);
-#endif
-#endif
diff --git a/jdk/src/solaris/native/sun/awt/awt_xembed_server.c b/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
deleted file mode 100644
index d4eb5ea..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
+++ /dev/null
@@ -1,969 +0,0 @@
-/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// TODO: Propogate applicationActive from Java
-
-#ifdef HEADLESS
- #error This file should not be included in headless library
-#endif
-
-#include "awt_p.h"
-
-#include <X11/Xproto.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <Xm/MwmUtil.h>
-#ifdef __linux__
-#include <execinfo.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-
-/* JNI headers */
-#include "java_awt_Frame.h" /* for frame state constants */
-#include "java_awt_event_KeyEvent.h"
-#include "awt_wm.h"
-#include "awt_util.h" /* for X11 error handling macros */
-#include "awt_xembed.h"
-#include "awt_Component.h"
-#include "awt_AWTEvent.h"
-#include "canvas.h"
-#include "sun_awt_motif_MEmbedCanvasPeer.h"
-
-#ifdef DOTRACE
-#define MTRACE(param) fprintf(stderr, param)
-#define MTRACEP1(format, p1) fprintf(stderr, format, p1)
-#define MTRACEP2(format, p1, p2) fprintf(stderr, format, p1, p2)
-#define MTRACEP3(format, p1, p2, p3) fprintf(stderr, format, p1, p2, p3)
-#define MTRACEP4(format, p1, p2, p3, p4) fprintf(stderr, format, p1, p2, p3, p4)
-#define MTRACEP5(format, p1, p2, p3, p4, p5) fprintf(stderr, format, p1, p2, p3, p4, p5)
-#define MTRACEP6(format, p1, p2, p3, p4, p5, p6) fprintf(stderr, format, p1, p2, p3, p4, p5, p6)
-#define MTRACEP7(format, p1, p2, p3, p4, p5, p6, p7) fprintf(stderr, format, p1, p2, p3, p4, p5, p6, p7)
-#else
-#define MTRACE(param)
-#define MTRACEP1(format, p1)
-#define MTRACEP2(format, p1, p2)
-#define MTRACEP3(format, p1, p2, p3)
-#define MTRACEP4(format, p1, p2, p3, p4)
-#define MTRACEP5(format, p1, p2, p3, p4, p5)
-#define MTRACEP6(format, p1, p2, p3, p4, p5, p6)
-#define MTRACEP7(format, p1, p2, p3, p4, p5, p6, p7)
-#endif
-
-/**************************** XEmbed server DnD support ***********************/
-extern Atom XA_XdndAware;
-extern Boolean
-register_xembed_drop_site(JNIEnv* env, Display* dpy, jobject server,
- Window serverHandle, Window clientHandle);
-extern Boolean
-unregister_xembed_drop_site(JNIEnv* env, Display* dpy, jobject server,
- Window serverHandle, Window clientHandle);
-extern void
-forward_event_to_embedded(Window embedded, jlong ctxt, jint eventID);
-
-extern const char * msg_to_str(int msg);
-
-void
-set_xembed_drop_target(JNIEnv* env, jobject server);
-void
-remove_xembed_drop_target(JNIEnv* env, jobject server);
-Boolean
-is_xembed_client(Window window);
-/******************************************************************************/
-extern struct MComponentPeerIDs mComponentPeerIDs;
-static jobject createRectangle(JNIEnv* env, int x, int y, int width, int height);
-static jobject createDimension(JNIEnv* env, int width, int height);
-static void processXEmbedInfo(JNIEnv* env, jobject this);
-static Atom XA_XEmbedInfo;
-static Atom XA_XEmbed;
-static jmethodID requestXEmbedFocusMID, focusNextMID, focusPrevMID,
- registerAcceleratorMID, unregisterAcceleratorMID,
- grabKeyMID, ungrabKeyMID, childResizedMID,
- setXEmbedDropTargetMID, removeXEmbedDropTargetMID;
-static jfieldID keysymFID, modifiersFID, applicationActiveFID;
-
-typedef struct _xembed_server_data {
- Window handle; // pointer to plugin intermediate widget, XEmbed client
- Window serverHandle;
- Widget serverWidget;
- Boolean dispatching; // whether we dispatch messages for handle
- int version;
- jobject server;
- struct _xembed_server_data * next;
-} xembed_server_data, * pxembed_server_data;
-
-static pxembed_server_data xembed_list = NULL;
-
-static pxembed_server_data
-getData(Window handle) {
- pxembed_server_data temp = xembed_list;
- while (temp != NULL) {
- if (temp->handle == handle) {
- return temp;
- }
- temp = temp->next;
- }
- return NULL;
-}
-
-static pxembed_server_data
-getDataByEmbedder(jobject server) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- pxembed_server_data temp = xembed_list;
- DASSERT(server != NULL);
- while (temp != NULL) {
- if ((*env)->IsSameObject(env, temp->server, server)) {
- return temp;
- }
- temp = temp->next;
- }
- return NULL;
-}
-
-static pxembed_server_data
-getDataByServerHandle(Window serverHandle) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- pxembed_server_data temp = xembed_list;
- Widget serverWidget = NULL;
- if (serverHandle == None) {
- return NULL;
- }
- serverWidget = XtWindowToWidget(awt_display, serverHandle);
- while (temp != NULL) {
- if (temp->serverHandle == serverHandle || temp->serverWidget == serverWidget) {
- temp->serverHandle = serverWidget;
- return temp;
- }
- temp = temp->next;
- }
- return NULL;
-}
-
-static pxembed_server_data
-addData(jobject server) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- struct ComponentData *cdata;
- xembed_server_data * data = malloc(sizeof(xembed_server_data));
- DASSERT(server != NULL);
- memset(data, 0, sizeof(xembed_server_data));
- data->server = server;
- cdata = (struct ComponentData *)
- JNU_GetLongFieldAsPtr(env, server, mComponentPeerIDs.pData);
- DASSERT(cdata != NULL);
- data->serverHandle = XtWindow(cdata->widget);
- data->serverWidget = cdata->widget;
- data->next = xembed_list;
- xembed_list = data;
- return data;
-}
-
-static void
-removeData(jobject server) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- pxembed_server_data * temp = &xembed_list;
- DASSERT(server != NULL);
- while (*temp != NULL) {
- if ((*env)->IsSameObject(env, (*temp)->server, server)) {
- xembed_server_data * data = *temp;
- *temp = (*temp)->next;
- DASSERT(data->server != NULL);
- (*env)->DeleteGlobalRef(env, data->server);
- free(data);
- return;
- }
- temp = &(*temp)->next;
- }
-}
-
-void
-initXEmbedServerData() {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jclass clazz;
- MTRACE("initXEmbedServerData\n");
- XA_XEmbedInfo = XInternAtom(awt_display, "_XEMBED_INFO", False);
- XA_XEmbed = XInternAtom(awt_display, "_XEMBED", False);
-
- clazz = (*env)->FindClass(env, "sun/awt/motif/MEmbedCanvasPeer");
- DASSERT(clazz != NULL);
- requestXEmbedFocusMID = (*env)->GetMethodID(env, clazz, "requestXEmbedFocus", "()V");
- DASSERT(requestXEmbedFocusMID != NULL);
- focusNextMID = (*env)->GetMethodID(env, clazz, "focusNext", "()V");
- DASSERT(focusNextMID != NULL);
- focusPrevMID = (*env)->GetMethodID(env, clazz, "focusPrev", "()V");
- DASSERT(focusPrevMID != NULL);
- registerAcceleratorMID = (*env)->GetMethodID(env, clazz, "registerAccelerator", "(JJJ)V");
- DASSERT(registerAcceleratorMID != NULL);
- unregisterAcceleratorMID = (*env)->GetMethodID(env, clazz, "unregisterAccelerator", "(J)V");
- DASSERT(unregisterAcceleratorMID != NULL);
- grabKeyMID = (*env)->GetMethodID(env, clazz, "grabKey", "(JJ)V");
- DASSERT(grabKeyMID != NULL);
- ungrabKeyMID = (*env)->GetMethodID(env, clazz, "ungrabKey", "(JJ)V");
- DASSERT(ungrabKeyMID != NULL);
- childResizedMID = (*env)->GetMethodID(env, clazz, "childResized", "()V");
- DASSERT(childResizedMID != NULL);
- setXEmbedDropTargetMID =
- (*env)->GetMethodID(env, clazz, "setXEmbedDropTarget", "()V");
- DASSERT(setXEmbedDropTargetMID != NULL);
- removeXEmbedDropTargetMID =
- (*env)->GetMethodID(env, clazz, "removeXEmbedDropTarget", "()V");
- DASSERT(removeXEmbedDropTargetMID != NULL);
-
- applicationActiveFID = (*env)->GetFieldID(env, clazz, "applicationActive", "Z");
- DASSERT(applicationActiveFID != NULL);
- (*env)->DeleteLocalRef(env, clazz);
-
- clazz = (*env)->FindClass(env, "sun/awt/motif/GrabbedKey");
- DASSERT(clazz != NULL);
- keysymFID = (*env)->GetFieldID(env, clazz, "keysym", "J");
- DASSERT(keysymFID != NULL);
- modifiersFID = (*env)->GetFieldID(env, clazz, "modifiers", "J");
- DASSERT(modifiersFID != NULL);
- (*env)->DeleteLocalRef(env, clazz);
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: initXEmbedServer
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_initXEmbedServer(JNIEnv *env, jobject this) {
- struct ComponentData *cdata;
- AWT_LOCK();
- MTRACE("initXEmbedServer\n");
- addData((*env)->NewGlobalRef(env, this));
- if (XA_XEmbedInfo == None) {
- initXEmbedServerData();
- }
- cdata = (struct ComponentData *)
- JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.pData);
-/* XSelectInput(awt_display, XtWindow(cdata->widget), SubstructureNotifyMask); */
- XtAddEventHandler(cdata->widget,
- SubstructureNotifyMask,
- False, null_event_handler, NULL);
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: destroyXEmbedServer
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_destroyXEmbedServer(JNIEnv *env, jobject this) {
- AWT_LOCK();
- MTRACE("destroyXEmbedServer\n");
- removeData(this);
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: isXEmbedActive
- * Signature: ()Z
- */
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive(JNIEnv *env, jobject this) {
- pxembed_server_data sdata;
- jboolean res = JNI_FALSE;
- AWT_LOCK();
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- res = (sdata->handle != None)?JNI_TRUE:JNI_FALSE;
- }
- AWT_UNLOCK();
- return res;
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: initDispatching
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching (JNIEnv *env, jobject this) {
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACE("initDispatching\n");
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- XSelectInput(awt_display, sdata->handle, StructureNotifyMask | PropertyChangeMask);
- sdata->dispatching = True;
- register_xembed_drop_site(env, awt_display, sdata->server,
- sdata->serverHandle, sdata->handle);
- }
- processXEmbedInfo(env, this);
- Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded(env, this);
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: endDispatching
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching (JNIEnv *env, jobject this) {
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACE("endDispatching\n");
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- unregister_xembed_drop_site(env, awt_display, sdata->server,
- sdata->serverHandle, sdata->handle);
- sdata->dispatching = False;
- }
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: embedChild
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_embedChild (JNIEnv * env, jobject this, jlong handle) {
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACE("embedChild\n");
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- if (sdata->handle != None) {
- Java_sun_awt_motif_MEmbedCanvasPeer_detachChild(env, this);
- }
- sdata->handle = (Window)handle;
- Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching(env, this);
- }
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: childDestroyed
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed (JNIEnv *env, jobject this) {
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACE("childDestroyed\n");
- Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching(env, this);
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- sdata->handle = None;
- }
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: getEmbedPreferredSize
- * Signature: ()Ljava/awt/Dimension;
- */
-JNIEXPORT jobject JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedPreferredSize (JNIEnv *env, jobject this) {
- pxembed_server_data sdata;
- jobject res = NULL;
- XSizeHints * hints;
- long dummy;
- AWT_LOCK();
- MTRACE("getPreferredSize\n");
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- hints = XAllocSizeHints();
- DASSERT(hints != NULL);
- DASSERT(sdata->handle != None);
- if (XGetWMNormalHints(awt_display, sdata->handle, hints, &dummy) == Success) {
- res = createDimension(env, hints->width, hints->height);
- }
- XFree(hints);
- }
- AWT_UNLOCK();
- return res;
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: getEmbedMinimumSize
- * Signature: ()Ljava/awt/Dimension;
- */
-JNIEXPORT jobject JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedMinimumSize (JNIEnv *env, jobject this) {
- pxembed_server_data sdata;
- jobject res = NULL;
- XSizeHints * hints;
- long dummy;
- AWT_LOCK();
- MTRACE("getMinimumSize\n");
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- hints = XAllocSizeHints();
- DASSERT(hints != NULL);
- DASSERT(sdata->handle != None);
- if (XGetWMNormalHints(awt_display, sdata->handle, hints, &dummy) == Success) {
- res = createDimension(env, hints->min_width, hints->min_height);
- }
- XFree(hints);
- }
- AWT_UNLOCK();
- return res;
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: getClientBounds
- * Signature: ()Ljava/awt/Rectangle;
- */
-JNIEXPORT jobject JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_getClientBounds (JNIEnv *env, jobject this) {
- pxembed_server_data sdata;
- jobject res = NULL;
- AWT_LOCK();
- MTRACE("getClientBounds\n");
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- XWindowAttributes attrs;
- DASSERT(sdata->handle != None);
- if (XGetWindowAttributes(awt_display, sdata->handle, &attrs) == Success) {
- res = createRectangle(env, attrs.x, attrs.y, attrs.width, attrs.height);
- }
- }
- AWT_UNLOCK();
- return res;
-}
-
-Boolean
-isApplicationActive(JNIEnv * env, jobject this) {
- return (*env)->GetBooleanField(env, this, applicationActiveFID);
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: notifyChildEmbedded
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded (JNIEnv *env, jobject this) {
- struct ComponentData *cdata;
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACE("notifyChildEmbedded\n");
- cdata = (struct ComponentData *)
- JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.pData);
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- DASSERT(sdata->handle != None);
- DASSERT(cdata != NULL);
- DASSERT(XtWindow(cdata->widget) != None);
- sendMessageHelper(sdata->handle, XEMBED_EMBEDDED_NOTIFY, XtWindow(cdata->widget), min(sdata->version, XEMBED_VERSION), 0);
- if (isApplicationActive(env, this)) {
- sendMessage(sdata->handle, XEMBED_WINDOW_ACTIVATE);
- }
- }
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: detachChild
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_detachChild (JNIEnv *env, jobject this) {
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACE("detachChild\n");
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- /**
- * XEmbed specification:
- * "The embedder can unmap the client and reparent the client window to the root window. If the
- * client receives an ReparentNotify event, it should check the parent field of the XReparentEvent
- * structure. If this is the root window of the window's screen, then the protocol is finished and
- * there is no further interaction. If it is a window other than the root window, then the protocol
- * continues with the new parent acting as the embedder window."
- */
- DASSERT(sdata->handle != None);
- XUnmapWindow(awt_display, sdata->handle);
- XReparentWindow(awt_display, sdata->handle, DefaultRootWindow(awt_display), 0, 0);
- Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching(env, this);
- sdata->handle = None;
- }
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: forwardKeyEvent
- * Signature: (Ljava/awt/event/KeyEvent;)V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_forwardKeyEvent (JNIEnv *env, jobject this, jobject event) {
- pxembed_server_data sdata;
- jbyteArray array;
- XEvent *xevent;
- AWT_LOCK();
- MTRACE("forwardKeyEvent\n");
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- DASSERT(sdata->handle != None);
- array = (jbyteArray)(*env)->GetObjectField(env, event, awtEventIDs.bdata);
- if (array == NULL) {
- MTRACE("array is null\n");
- AWT_UNLOCK();
- return;
- }
-
- xevent = (XEvent *)(*env)->GetByteArrayElements(env, array, NULL);
- if (xevent == NULL) {
- (*env)->DeleteLocalRef(env, array);
- MTRACE("xevent is null\n");
- AWT_UNLOCK();
- return;
- }
- xevent->xany.window = sdata->handle;
- XSendEvent(awt_display, sdata->handle, False, NoEventMask, xevent);
- (*env)->DeleteLocalRef(env, array);
- }
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: getAWTKeyCodeForKeySym
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_getAWTKeyCodeForKeySym (JNIEnv *env, jobject this, jint keysym) {
- jint keycode = java_awt_event_KeyEvent_VK_UNDEFINED;
- Boolean mapsToUnicodeChar;
- jint keyLocation;
- keysymToAWTKeyCode(keysym, &keycode, &mapsToUnicodeChar, &keyLocation);
- return keycode;
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: sendMessage
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__I (JNIEnv *env, jobject this, jint msg) {
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACEP2("sendMessage %d(%s)\n", msg, msg_to_str(msg));
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- DASSERT(sdata->handle != None);
- sendMessage(sdata->handle, msg);
- }
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: sendMessage
- * Signature: (IJJJ)V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__IJJJ (JNIEnv *env, jobject this, jint msg, jlong detail, jlong data1, jlong data2) {
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACEP5("sendMessage2 msg %d(%s) detail %d data: %d %d\n", msg, msg_to_str(msg), detail, data1, data2);
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- DASSERT(sdata->handle != None);
- sendMessageHelper(sdata->handle, msg, detail, data1, data2);
- }
- AWT_UNLOCK();
-}
-
-static jobject
-createRectangle(JNIEnv* env, int x, int y, int width, int height) {
- static jclass clazz;
- static jmethodID mid;
- jobject rect = NULL;
- if (mid == 0) {
- jclass l_clazz = (*env)->FindClass(env, "java/awt/Rectangle");
- DASSERT(l_clazz != NULL);
- mid = (*env)->GetMethodID(env, clazz, "<init>", "(IIII)V");
- DASSERT(mid != NULL);
- clazz = (*env)->NewGlobalRef(env, l_clazz);
- (*env)->DeleteLocalRef(env, l_clazz);
- }
- if (mid != NULL) {
- rect = (*env)->NewObject(env, clazz, mid, x, y, width, height);
- if ((*env)->ExceptionOccurred(env)) {
- return NULL;
- }
- }
- return rect;
-}
-
-static jobject
-createDimension(JNIEnv* env, int width, int height) {
- static jclass clazz;
- static jmethodID mid;
- jobject dim = NULL;
- if (mid == 0) {
- jclass l_clazz = (*env)->FindClass(env, "java/awt/Dimension");
- DASSERT(l_clazz != NULL);
- mid = (*env)->GetMethodID(env, clazz, "<init>", "(II)V");
- DASSERT(mid != NULL);
- clazz = (*env)->NewGlobalRef(env, l_clazz);
- (*env)->DeleteLocalRef(env, l_clazz);
- }
- if (mid != NULL) {
- dim = (*env)->NewObject(env, clazz, mid, width, height);
- if ((*env)->ExceptionOccurred(env)) {
- return NULL;
- }
- }
- return dim;
-}
-
-Boolean isMapped(Window w) {
- XWindowAttributes attr;
- Status status = 0;
- WITH_XERROR_HANDLER(xerror_ignore_bad_window);
- status = XGetWindowAttributes(awt_display, w, &attr);
- RESTORE_XERROR_HANDLER;
- if (status == 0 || xerror_code != Success) {
- return False;
- }
- return !(attr.map_state == IsUnmapped);
-}
-
-static void
-processXEmbedInfo(JNIEnv * env, jobject this) {
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACE("processXEmbedInfo\n");
- sdata = getDataByEmbedder(this);
- if (Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive(env, this)) {
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- CARD32 * data = NULL;
- DASSERT(sdata->handle != None);
- if (XGetWindowProperty(awt_display, sdata->handle, XA_XEmbedInfo,
- 0, 2, False, XA_XEmbedInfo, &actual_type,
- &actual_format, &nitems, &bytes_after,
- (unsigned char**)&data) != Success)
- {
- AWT_UNLOCK();
- return;
- }
- if (actual_type == XA_XEmbedInfo && actual_format == 32
- && nitems == 2)
- {
- CARD32 flags;
- Boolean new_mapped, currently_mapped;
- sdata->version = *data;
- flags = *(data+1);
- new_mapped = (flags & XEMBED_MAPPED) != 0;
- currently_mapped = isMapped(sdata->handle);
- if (new_mapped != currently_mapped) {
- if (new_mapped) {
- XMapWindow(awt_display, sdata->handle);
- } else {
- XUnmapWindow(awt_display, sdata->handle);
- }
- }
- }
- if (data != NULL) {
- XFree(data);
- }
- }
- AWT_UNLOCK();
-}
-
-/**
- * Handles client message on embedder
- */
-static void
-handleClientMessage(JNIEnv* env, jobject this, XClientMessageEvent * ev) {
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACEP5("handleClientMessage: 0=%ld 1=%ld 2=%ld 3=%ld 4=%ld\n",
- ev->data.l[0], ev->data.l[1], ev->data.l[2], ev->data.l[3], ev->data.l[4]);
- sdata = getDataByEmbedder(this);
- if (sdata != NULL && sdata->handle != None) {
- switch ((int)ev->data.l[1]) {
- case XEMBED_REQUEST_FOCUS:
- MTRACE("REQUEST_FOCUS\n");
- (*env)->CallVoidMethod(env, this, requestXEmbedFocusMID);
- break;
- case XEMBED_FOCUS_NEXT:
- MTRACE("FOCUS_NEXT\n");
- (*env)->CallVoidMethod(env, this, focusNextMID);
- break;
- case XEMBED_FOCUS_PREV:
- MTRACE("FOCUS_PREV\n");
- (*env)->CallVoidMethod(env, this, focusPrevMID);
- break;
- case XEMBED_REGISTER_ACCELERATOR:
- MTRACE("REGISTER_ACCEL\n");
- (*env)->CallVoidMethod(env, this, registerAcceleratorMID,
- (jlong)ev->data.l[2],
- (jlong)ev->data.l[3],
- (jlong)ev->data.l[4]);
- break;
- case XEMBED_UNREGISTER_ACCELERATOR:
- MTRACE("UNREGISTER_ACCEL\n");
- (*env)->CallVoidMethod(env, this, unregisterAcceleratorMID,
- (jlong)ev->data.l[2]);
- break;
- case NON_STANDARD_XEMBED_GTK_GRAB_KEY:
- MTRACE("GRAB_KEY\n");
- (*env)->CallVoidMethod(env, this, grabKeyMID,
- (jlong)ev->data.l[3],
- (jlong)ev->data.l[4]);
- break;
- case NON_STANDARD_XEMBED_GTK_UNGRAB_KEY:
- MTRACE("UNGRAB_KEY\n");
- (*env)->CallVoidMethod(env, this, ungrabKeyMID,
- (jlong)ev->data.l[3],
- (jlong)ev->data.l[4]);
- case _SUN_XEMBED_START:
- MTRACE("XEMBED_START\n");
- processXEmbedInfo(env, this);
- Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded(env, this);
- break;
- }
- }
- AWT_UNLOCK();
-}
-
-/**
- * Handles property changes on xembed client
- */
-static void
-handlePropertyNotify(XPropertyEvent * ev) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACE("handlePropertyNotify\n");
- sdata = getData(ev->window);
- if (sdata != NULL) {
- if (ev->atom == XA_WM_NORMAL_HINTS) {
- DASSERT(sdata->server != NULL);
- (*env)->CallVoidMethod(env, sdata->server, childResizedMID);
- MTRACE("NORMAL_HINTS have changed\n");
- } else if (ev->atom == XA_XdndAware) {
- unregister_xembed_drop_site(env, awt_display, sdata->server,
- sdata->serverHandle, sdata->handle);
- if (ev->state == PropertyNewValue) {
- register_xembed_drop_site(env, awt_display, sdata->server,
- sdata->serverHandle, sdata->handle);
- }
- } else if (ev->atom == XA_XEmbedInfo) {
- DASSERT(sdata->server != NULL);
- MTRACE("XEMBED_INFO has changed\n");
- processXEmbedInfo(env, sdata->server);
- }
- }
- AWT_UNLOCK();
-}
-
-static void
-handleConfigureNotify(XConfigureEvent * ev) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- pxembed_server_data sdata;
- AWT_LOCK();
- MTRACE("handleConfigureNotify\n");
- sdata = getData(ev->window);
- if (sdata != NULL) {
- DASSERT(sdata->server != NULL);
- (*env)->CallVoidMethod(env, sdata->server, childResizedMID);
- }
- AWT_UNLOCK();
-}
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: sendMessage
- * Signature: (IJJJ)V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_GrabbedKey_initKeySymAndModifiers (JNIEnv *env, jobject this, jobject keyevent) {
- jbyteArray array;
- XEvent *xevent;
- int keysym, modifiers;
- int keycode;
- AWT_LOCK();
- array = (jbyteArray)(*env)->GetObjectField(env, keyevent, awtEventIDs.bdata);
- if (array == NULL) {
- AWT_UNLOCK();
- return;
- }
- xevent = (XEvent *)(*env)->GetByteArrayElements(env, array, NULL);
- if (xevent == NULL) {
- (*env)->DeleteLocalRef(env, array);
- AWT_UNLOCK();
- return;
- }
- keycode = (*env)->GetIntField(env, keyevent, keyEventIDs.keyCode);
- keysym = awt_getX11KeySym(keycode);
- modifiers = xevent->xkey.state;
- (*env)->SetLongField(env, this, keysymFID, (jlong)keysym);
- (*env)->SetLongField(env, this, modifiersFID, (jlong)modifiers);
- (*env)->DeleteLocalRef(env, array);
- AWT_UNLOCK();
-}
-
-#ifdef __linux__
-void
-print_stack (void)
-{
- void *array[10];
- size_t size;
- char **strings;
- size_t i;
-
- size = backtrace (array, 10);
- strings = backtrace_symbols (array, size);
-
- fprintf (stderr, "Obtained %zd stack frames.\n", size);
-
- for (i = 0; i < size; i++)
- fprintf (stderr, "%s\n", strings[i]);
-
- free (strings);
-}
-#endif
-
-extern int32_t numEventsHandled;
-
-XCreateWindowEvent cr;
-
-void
-dispatchEmbedderEvent(jobject server, XEvent * ev) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- DASSERT(server != NULL);
- DASSERT(ev != NULL);
- AWT_LOCK();
-/* MTRACE("dispatchEmebddedEvent\n"); */
- switch (ev->type) {
- case CreateNotify:
-
- MTRACEP3("CreateNotify for %x, serial %d, num events %d\n", (ev->xcreatewindow.window), (ev->xany.serial), (numEventsHandled));
- Java_sun_awt_motif_MEmbedCanvasPeer_embedChild(env, server, ev->xcreatewindow.window);
- break;
- case DestroyNotify:
- MTRACE("DestroyNotify\n");
- Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed(env, server);
- break;
- case ReparentNotify:
- MTRACEP2("ReparentNotify for %x, parent %x\n", (ev->xreparent.window), (ev->xreparent.parent));
- Java_sun_awt_motif_MEmbedCanvasPeer_embedChild(env, server, ev->xreparent.window);
- break;
- case ClientMessage:
- MTRACE("ClientMessage\n");
- handleClientMessage(env, server, &ev->xclient);
- break;
- }
- AWT_UNLOCK();
-}
-
-void
-dispatchEmbeddingClientEvent(XEvent * ev) {
- DASSERT(ev != NULL);
- MTRACE("dispatchEmbeddingClientEvent\n");
- switch (ev->type) {
- case PropertyNotify:
- handlePropertyNotify(&ev->xproperty);
- break;
- case ConfigureNotify:
- handleConfigureNotify(&ev->xconfigure);
- break;
- }
-}
-
-void
-xembed_serverEventHandler(XEvent * ev) {
- pxembed_server_data sdata;
- sdata = getData(ev->xany.window);
- if (sdata != NULL) { // Event on client
- dispatchEmbeddingClientEvent(ev);
- } else {
- sdata = getDataByServerHandle(ev->xany.window);
- if (sdata != NULL) {
- DASSERT(sdata->server != NULL);
- dispatchEmbedderEvent(sdata->server, ev);
- }
- }
-}
-
-/**************************** XEmbed server DnD support ***********************/
-void
-set_xembed_drop_target(JNIEnv* env, jobject server) {
-
- (*env)->CallVoidMethod(env, server, setXEmbedDropTargetMID);
-}
-
-void
-remove_xembed_drop_target(JNIEnv* env, jobject server) {
- (*env)->CallVoidMethod(env, server, removeXEmbedDropTargetMID);
-}
-
-Boolean
-is_xembed_client(Window window) {
- return getData(window) != NULL;
-}
-/******************************************************************************/
-
-/*
- * Class: sun_awt_motif_MEmbedCanvasPeer
- * Method: getWindow
- * Signature: ()V
- */
-JNIEXPORT jlong JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_getWindow(JNIEnv *env, jobject this) {
- struct ComponentData *cdata;
- Window res = None;
- AWT_LOCK();
- cdata = (struct ComponentData *)
- JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.pData);
- DASSERT(cdata != NULL);
- res = XtWindow(cdata->widget);
- AWT_UNLOCK();
- return (jlong)res;
-}
-
-JNIEXPORT void JNICALL
-Java_sun_awt_motif_MEmbedCanvasPeer_forwardEventToEmbedded(JNIEnv *env,
- jobject this,
- jlong ctxt,
- jint eventID){
- pxembed_server_data sdata;
- AWT_LOCK();
- sdata = getDataByEmbedder(this);
- if (sdata != NULL) {
- forward_event_to_embedded(sdata->handle, ctxt, eventID);
- }
- AWT_UNLOCK();
-}
diff --git a/jdk/src/solaris/native/sun/awt/awt_xembed_server.h b/jdk/src/solaris/native/sun/awt/awt_xembed_server.h
deleted file mode 100644
index b74b999..0000000
--- a/jdk/src/solaris/native/sun/awt/awt_xembed_server.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef _AWT_XEMBED_SERVER_H_
-#define _AWT_XEMBED_SERVER_H_
-
-#ifndef HEADLESS
-
-#include "awt_p.h"
-
-extern void xembed_serverEventHandler(XEvent *);
-
-#endif
-#endif
diff --git a/jdk/test/java/io/File/BlockIsDirectory.java b/jdk/test/java/io/File/BlockIsDirectory.java
deleted file mode 100644
index 40d1635..0000000
--- a/jdk/test/java/io/File/BlockIsDirectory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
- @bug 4113217
- @summary Test File.isDirectory on block device
- */
-
-import java.io.*;
-import java.util.*;
-
-public class BlockIsDirectory {
- public static void main( String args[] ) throws Exception {
- String osname = System.getProperty("os.name");
- if (osname.equals("SunOS")) {
- File dir = new File("/dev/dsk");
- String dirList[] = dir.list();
-
- File aFile = new File( "/dev/dsk/" + dirList[0] );
-
- boolean result = aFile.isDirectory();
- if (result == true)
- throw new RuntimeException(
- "IsDirectory returns true for block device.");
- }
- if (osname.equals("Linux")) {
- File dir = new File("/dev/ide0");
- if (dir.exists()) {
- boolean result = dir.isDirectory();
- if (result == true)
- throw new RuntimeException(
- "IsDirectory returns true for block device.");
- }
- dir = new File("/dev/scd0");
- if (dir.exists()) {
- boolean result = dir.isDirectory();
- if (result == true)
- throw new RuntimeException(
- "IsDirectory returns true for block device.");
- }
- }
- }
-}
diff --git a/jdk/test/java/io/FileDescriptor/FileChannelFDTest.java b/jdk/test/java/io/FileDescriptor/FileChannelFDTest.java
deleted file mode 100644
index 8a44859..0000000
--- a/jdk/test/java/io/FileDescriptor/FileChannelFDTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- *
- * @test
- * @bug 6322678
- * @summary Test for making sure that fd is closed during
- * finalization of a stream, when an associated
- * file channel is not available
- */
-
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-
-public class FileChannelFDTest {
-
- static byte data[] = new byte[] {48, 49, 50, 51, 52, 53, 54, 55, 56, 57,};
- static String inFileName = "fd-in-test.txt";
- static String outFileName = "fd-out-test.txt";
- static File inFile;
- static File outFile;
-
- private static void writeToInFile() throws IOException {
- FileOutputStream out = new FileOutputStream(inFile);
- out.write(data);
- out.close();
- }
-
- public static void main(String[] args)
- throws Exception {
-
- inFile= new File(System.getProperty("test.dir", "."),
- inFileName);
- inFile.createNewFile();
- inFile.deleteOnExit();
- writeToInFile();
-
- outFile = new File(System.getProperty("test.dir", "."),
- outFileName);
- outFile.createNewFile();
- outFile.deleteOnExit();
-
- doFileChannel();
- }
-
- private static void doFileChannel() throws Exception {
-
- FileInputStream fis = new FileInputStream(inFile);
- FileDescriptor fd = fis.getFD();
- FileChannel fc = fis.getChannel();
- System.out.println("Created fis:" + fis);
-
- /**
- * Encourage the GC
- */
- fis = null;
- fc = null;
- System.gc();
- Thread.sleep(500);
-
- if (fd.valid()) {
- throw new Exception("Finalizer either didn't run --" +
- "try increasing the Thread's sleep time after System.gc();" +
- "or the finalizer didn't close the file");
- }
-
- System.out.println("File Closed successfully");
- System.out.println();
- }
-}
diff --git a/jdk/test/java/io/etc/FileDescriptorSharing.java b/jdk/test/java/io/etc/FileDescriptorSharing.java
deleted file mode 100644
index d46f61a..0000000
--- a/jdk/test/java/io/etc/FileDescriptorSharing.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6322678 7082769
- * @summary FileInputStream/FileOutputStream/RandomAccessFile allow file descriptor
- * to be closed while still in use.
- * @run main/othervm FileDescriptorSharing
- */
-
-import java.io.*;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
-import java.util.concurrent.CountDownLatch;
-
-public class FileDescriptorSharing {
-
- final static int numFiles = 10;
- volatile static boolean fail;
-
- public static void main(String[] args) throws Exception {
- TestFinalizer();
- TestMultipleFD();
- TestIsValid();
- MultiThreadedFD();
- }
-
- /**
- * We shouldn't discard a file descriptor until all streams have
- * finished with it
- */
- private static void TestFinalizer() throws Exception {
- FileDescriptor fd = null;
- File tempFile = new File("TestFinalizer1.txt");
- tempFile.deleteOnExit();
- try (Writer writer = new FileWriter(tempFile)) {
- for (int i=0; i<5; i++) {
- writer.write("test file content test file content");
- }
- }
-
- FileInputStream fis1 = new FileInputStream(tempFile);
- fd = fis1.getFD();
- // Create a new FIS based on the existing FD (so the two FIS's share the same native fd)
- try (FileInputStream fis2 = new FileInputStream(fd)) {
- // allow fis1 to be gc'ed
- fis1 = null;
- int ret = 0;
- while(ret >= 0) {
- // encourage gc
- System.gc();
- // read from fis2 - when fis1 is gc'ed and finalizer is run, read will fail
- System.out.print(".");
- ret = fis2.read();
- }
- }
-
- // variation of above. Use RandomAccessFile to obtain a filedescriptor
- File testFinalizerFile = new File("TestFinalizer");
- RandomAccessFile raf = new RandomAccessFile(testFinalizerFile, "rw");
- raf.writeBytes("test file content test file content");
- raf.seek(0L);
- fd = raf.getFD();
- try (FileInputStream fis3 = new FileInputStream(fd)) {
- // allow raf to be gc'ed
- raf = null;
- int ret = 0;
- while (ret >= 0) {
- // encourage gc
- System.gc();
- /*
- * read from fis3 - when raf is gc'ed and finalizer is run,
- * fd should still be valid.
- */
- System.out.print(".");
- ret = fis3.read();
- }
- if(!fd.valid()) {
- throw new RuntimeException("TestFinalizer() : FileDescriptor should be valid");
- }
- } finally {
- testFinalizerFile.delete();
- }
- }
-
- /**
- * Exercise FileDispatcher close()/preClose()
- */
- private static void TestMultipleFD() throws Exception {
- RandomAccessFile raf = null;
- FileOutputStream fos = null;
- FileInputStream fis = null;
- FileChannel fc = null;
- FileLock fileLock = null;
-
- File test1 = new File("test1");
- try {
- raf = new RandomAccessFile(test1, "rw");
- fos = new FileOutputStream(raf.getFD());
- fis = new FileInputStream(raf.getFD());
- fc = raf.getChannel();
- fileLock = fc.lock();
- raf.setLength(0L);
- fos.flush();
- fos.write("TEST".getBytes());
- } finally {
- if (fileLock != null) fileLock.release();
- if (fis != null) fis.close();
- if (fos != null) fos.close();
- if (raf != null) raf.close();
- test1.delete();
- }
-
- /*
- * Close out in different order to ensure FD is not
- * closed out too early
- */
- File test2 = new File("test2");
- try {
- raf = new RandomAccessFile(test2, "rw");
- fos = new FileOutputStream(raf.getFD());
- fis = new FileInputStream(raf.getFD());
- fc = raf.getChannel();
- fileLock = fc.lock();
- raf.setLength(0L);
- fos.flush();
- fos.write("TEST".getBytes());
- } finally {
- if (fileLock != null) fileLock.release();
- if (raf != null) raf.close();
- if (fos != null) fos.close();
- if (fis != null) fis.close();
- test2.delete();
- }
-
- // one more time, fos first this time
- File test3 = new File("test3");
- try {
- raf = new RandomAccessFile(test3, "rw");
- fos = new FileOutputStream(raf.getFD());
- fis = new FileInputStream(raf.getFD());
- fc = raf.getChannel();
- fileLock = fc.lock();
- raf.setLength(0L);
- fos.flush();
- fos.write("TEST".getBytes());
- } finally {
- if (fileLock != null) fileLock.release();
- if (fos != null) fos.close();
- if (raf != null) raf.close();
- if (fis != null) fis.close();
- test3.delete();
- }
- }
-
- /**
- * Similar to TestMultipleFD() but this time we
- * just get and use FileDescriptor.valid() for testing.
- */
- private static void TestIsValid() throws Exception {
- FileDescriptor fd = null;
- RandomAccessFile raf = null;
- FileOutputStream fos = null;
- FileInputStream fis = null;
- FileChannel fc = null;
-
- File test1 = new File("test1");
- try {
- raf = new RandomAccessFile(test1, "rw");
- fd = raf.getFD();
- fos = new FileOutputStream(fd);
- fis = new FileInputStream(fd);
- } finally {
- try {
- if (fis != null) fis.close();
- if (fos != null) fos.close();
- if (!fd.valid()) {
- throw new RuntimeException("FileDescriptor should be valid");
- }
- if (raf != null) raf.close();
- if (fd.valid()) {
- throw new RuntimeException("close() called and FileDescriptor still valid");
- }
- } finally {
- if (raf != null) raf.close();
- test1.delete();
- }
- }
-
- /*
- * Close out in different order to ensure FD is not
- * closed out too early
- */
- File test2 = new File("test2");
- try {
- raf = new RandomAccessFile(test2, "rw");
- fd = raf.getFD();
- fos = new FileOutputStream(fd);
- fis = new FileInputStream(fd);
- } finally {
- try {
- if (raf != null) raf.close();
- if (fos != null) fos.close();
- if (!fd.valid()) {
- throw new RuntimeException("FileDescriptor should be valid");
- }
- if (fis != null) fis.close();
- if (fd.valid()) {
- throw new RuntimeException("close() called and FileDescriptor still valid");
- }
- } finally {
- test2.delete();
- }
- }
-
- // one more time, fos first this time
- File test3 = new File("test3");
- try {
- raf = new RandomAccessFile(test3, "rw");
- fd = raf.getFD();
- fos = new FileOutputStream(fd);
- fis = new FileInputStream(fd);
- } finally {
- try {
- if (fos != null) fos.close();
- if (raf != null) raf.close();
- if (!fd.valid()) {
- throw new RuntimeException("FileDescriptor should be valid");
- }
- if (fis != null) fis.close();
- if (fd.valid()) {
- throw new RuntimeException("close() called and FileDescriptor still valid");
- }
- } finally {
- test3.delete();
- }
- }
- }
-
- /**
- * Test concurrent access to the same fd.useCount field
- */
- private static void MultiThreadedFD() throws Exception {
- RandomAccessFile raf = null;
- FileDescriptor fd = null;
- int numThreads = 2;
- CountDownLatch done = new CountDownLatch(numThreads);
- OpenClose[] fileOpenClose = new OpenClose[numThreads];
- File MultipleThreadedFD = new File("MultipleThreadedFD");
- try {
- raf = new RandomAccessFile(MultipleThreadedFD, "rw");
- fd = raf.getFD();
- for(int count=0;count<numThreads;count++) {
- fileOpenClose[count] = new OpenClose(fd, done);
- fileOpenClose[count].start();
- }
- done.await();
- } finally {
- try {
- if(raf != null) raf.close();
- // fd should now no longer be valid
- if(fd.valid()) {
- throw new RuntimeException("FileDescriptor should not be valid");
- }
- // OpenClose thread tests failed
- if(fail) {
- throw new RuntimeException("OpenClose thread tests failed.");
- }
- } finally {
- MultipleThreadedFD.delete();
- }
- }
- }
-
- /**
- * A thread which will open and close a number of FileInputStreams and
- * FileOutputStreams referencing the same native file descriptor.
- */
- private static class OpenClose extends Thread {
- private FileDescriptor fd = null;
- private CountDownLatch done;
- FileInputStream[] fisArray = new FileInputStream[numFiles];
- FileOutputStream[] fosArray = new FileOutputStream[numFiles];
-
- OpenClose(FileDescriptor filedescriptor, CountDownLatch done) {
- this.fd = filedescriptor;
- this.done = done;
- }
-
- public void run() {
- try {
- for(int i=0;i<numFiles;i++) {
- fisArray[i] = new FileInputStream(fd);
- fosArray[i] = new FileOutputStream(fd);
- }
-
- // Now close out
- for(int i=0;i<numFiles;i++) {
- if(fisArray[i] != null) fisArray[i].close();
- if(fosArray[i] != null) fosArray[i].close();
- }
-
- } catch(IOException ioe) {
- System.out.println("OpenClose encountered IO issue :" + ioe);
- fail = true;
- } finally {
- if (!fd.valid()) { // fd should still be valid given RAF reference
- System.out.println("OpenClose: FileDescriptor should be valid");
- fail = true;
- }
- done.countDown();
- }
- }
- }
-}
diff --git a/jdk/test/java/lang/module/ModuleAnnotationTest.java b/jdk/test/java/lang/module/ModuleAnnotationTest.java
deleted file mode 100644
index d424fd6..0000000
--- a/jdk/test/java/lang/module/ModuleAnnotationTest.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.lang.module.*;
-import java.io.*;
-import java.lang.annotation.Annotation;
-import java.util.*;
-import com.foo.ArrayTypes;
-import com.foo.ArrayTypesWithDefault;
-import com.foo.Stooge;
-import org.bar.ScalarTypes;
-import org.bar.ScalarTypesWithDefault;
-import org.bar.Point;
-
-/*
- * @summary Test reading of annotations from the input module-info.class
- * This references test/java/lang/annotation/UnitTest.java.
- *
- */
-public class ModuleAnnotationTest {
- private static ModuleSystem ms = ModuleSystem.base();
- private static int failCount = 0;
- private static void fail(String test) {
- System.out.println("Failure: " + test);
- failCount++;
- }
-
- public static void main(String[] argv) throws Exception {
- for (String s : argv) {
- File f = new File(s);
- FileInputStream in = new FileInputStream(f);
- byte[] info = new byte[(int) f.length()];
- in.read(info);
- checkModuleInfo(info);
- }
-
- if (failCount > 0) {
- throw new RuntimeException("Test failed: " + failCount);
- }
- }
-
- static void checkModuleInfo(byte[] info) throws Exception {
- if (ms == null)
- throw new RuntimeException("null ModuleSystem");
- ModuleInfo mi = ms.parseModuleInfo(info);
- System.out.format("%s%n", mi.toString());
- if (mi.isAnnotationPresent(ScalarTypes.class) && mi.isAnnotationPresent(ArrayTypes.class)) {
- checkScalarTypes(mi.getAnnotation(ScalarTypes.class), mi);
- checkArrayTypes(mi.getAnnotation(ArrayTypes.class), mi);
- } else if (mi.isAnnotationPresent(ScalarTypesWithDefault.class) &&
- mi.isAnnotationPresent(ArrayTypesWithDefault.class)) {
- checkScalarTypes(mi.getAnnotation(ScalarTypesWithDefault.class), mi);
- checkArrayTypes(mi.getAnnotation(ArrayTypesWithDefault.class), mi);
- } else {
- throw new RuntimeException("Expected annotation is missing in " + mi.id());
- }
- }
-
- static void checkScalarTypes(ScalarTypes st, ModuleInfo mi) {
- if (!(st.b() == 1 &&
- st.s() == 2 &&
- st.i() == 3 &&
- st.l() == 4L &&
- st.c() == '5' &&
- st.f() == 6.0f &&
- st.d() == 7.0 &&
- st.bool() == true &&
- st.str().equals("custom") &&
- st.e() == Stooge.MOE &&
- st.a().x() == 1 && st.a().y() == 2))
- fail(mi.id() + ": unexpected ScalarTypes");
-
- try {
- Class<?> cls = st.cls();
- fail(mi.id() + ": ScalarTypes.cls() is not supposed to return" + cls);
- } catch (UnsupportedElementTypeException e) {
- List<String> list = e.getClassNames();
- if (!(list.size() == 1 &&
- list.get(0).equals("java.util.Map")))
- fail(mi.id() + ": ScalarTypes.cls() returns unexpected value " + list);
- }
- }
-
- static void checkScalarTypes(ScalarTypesWithDefault st, ModuleInfo mi) {
- if (!(st.b() == 11 &&
- st.s() == 12 &&
- st.i() == 13 &&
- st.l() == 14L &&
- st.c() == 'V' &&
- st.f() == 16.0f &&
- st.d() == 17.0 &&
- st.bool() == false &&
- st.str().equals("default") &&
- st.e() == Stooge.LARRY &&
- st.a().x() == 11 && st.a().y() == 12))
- fail(mi.id() + ": unexpected ScalarTypesWithDefault");
-
- try {
- Class<?> cls = st.cls();
- fail(mi.id() + ": ScalarTypesWithDefault.cls() is not supposed to return " + cls);
- } catch (UnsupportedElementTypeException e) {
- List<String> list = e.getClassNames();
- if (!(list.size() == 1 &&
- list.get(0).equals("java.util.Deque")))
- fail(mi.id() + ": ScalarTypesWithDefaults.cls() returns unexpected value " + list);
- }
- }
-
- static void checkArrayTypes(ArrayTypes at, ModuleInfo mi) {
- if (!(at.b()[0] == 1 && at.b()[1] == 2 &&
- at.s()[0] == 2 && at.s()[1] == 3 &&
- at.i()[0] == 3 && at.i()[1] == 4 &&
- at.l()[0] == 4L && at.l()[1] == 5L &&
- at.c()[0] == '5' && at.c()[1] == '6' &&
- at.f()[0] == 6.0f && at.f()[1] == 7.0f &&
- at.d()[0] == 7.0 && at.d()[1] == 8.0 &&
- at.bool()[0] == true && at.bool()[1] == false &&
- at.str()[0].equals("custom") && at.str()[1].equals("paint") &&
- at.e()[0] == Stooge.MOE && at.e()[1] == Stooge.CURLY &&
- at.a()[0].x() == 1 && at.a()[0].y() == 2 && at.a()[1].x() == 3 && at.a()[1].y() == 4 &&
- at.b().length==2 && at.s().length==2 && at.i().length==2 &&
- at.l().length==2 && at.c().length==2 && at.d().length==2 &&
- at.bool().length==2 && at.str().length==2 && at.a().length==2))
- fail(mi.id() + ": unexpected ArrayTypes");
-
- try {
- Class<?>[] cls = at.cls();
- fail(mi.id() + ": ArrayTypes.cls() is not supposed to return" + Arrays.toString(cls));
- } catch (UnsupportedElementTypeException e) {
- List<String> list = e.getClassNames();
- if (!(list.size() == 2 &&
- list.get(0).equals("java.util.Map") &&
- list.get(1).equals("java.util.Set")))
- fail(mi.id() + ": ArrayTypes.cls() returns unexpected value " + list);
- }
- }
-
- static void checkArrayTypes(ArrayTypesWithDefault at, ModuleInfo mi) {
- if (!(at.b()[0] == 11 &&
- at.s()[0] == 12 &&
- at.i()[0] == 13 &&
- at.l()[0] == 14L &&
- at.c()[0] == 'V' &&
- at.f()[0] == 16.0f &&
- at.d()[0] == 17.0 &&
- at.bool()[0] == false &&
- at.str()[0].equals("default") &&
- at.e()[0] == Stooge.LARRY &&
- at.a()[0].x() == 11 && at.a()[0].y() == 12 &&
- at.b().length==1 && at.s().length==1 && at.i().length==1 &&
- at.l().length==1 && at.c().length==1 && at.d().length==1 &&
- at.bool().length==1 && at.str().length==1))
- fail(mi.id() + ": unexpected ArrayTypesWithDefault");
- try {
- Class<?>[] cls = at.cls();
- fail(mi.id() + ": ArrayTypesWithDefault.cls() is not supposed to return" + Arrays.toString(cls));
- } catch (UnsupportedElementTypeException e) {
- List<String> list = e.getClassNames();
- if (!(list.size() == 2 &&
- list.get(0).equals("java.util.Deque") &&
- list.get(1).equals("java.util.Queue")))
- fail(mi.id() + ": ArrayTypesWithDefault.cls() returns unexpected value " + list);
- }
- }
-}
diff --git a/jdk/test/java/lang/module/module-info-annotation.sh b/jdk/test/java/lang/module/module-info-annotation.sh
deleted file mode 100644
index c3a902e..0000000
--- a/jdk/test/java/lang/module/module-info-annotation.sh
+++ /dev/null
@@ -1,239 +0,0 @@
-#! /bin/bash
-
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-
-# @test
-# @summary java.lang.module.ModuleInfoReader unit test
-# @key modules
-
-set -e
-
-BIN=${TESTJAVA:-../../../../build}/bin
-SRC=${TESTSRC:-.}
-
-rm -rf z.*
-mk() {
- d=`dirname $1`
- if [ ! -d $d ]; then mkdir -p $d; fi
- cat - >$1
-}
-
-
-mk z.src.v1/test.foo.bar/module-info.java <<EOF
- at org.bar.ScalarTypesWithDefault (
-)
- at com.foo.ArrayTypesWithDefault (
-)
-module test.foo.bar @ 1 {
- requires foo;
- requires bar;
-}
-EOF
-
-mk z.src.v2/test.foo.bar/module-info.java <<EOF
-import java.util.*;
-import com.foo.*;
-import org.bar.*;
- at org.bar.ScalarTypes (
- b = 1,
- s = 2,
- i = 3,
- l = 4L,
- c = '5',
- f = 6.0f,
- d = 7.0,
- bool = true,
- str = "custom",
- cls = Map.class,
- e = Stooge.MOE,
- a = @Point(x = 1, y = 2)
-)
- at com.foo.ArrayTypes (
- b = { 1, 2 },
- s = { 2, 3 },
- i = { 3, 4 },
- l = { 4L, 5L },
- c = { '5', '6' },
- f = { 6.0f, 7.0f },
- d = { 7.0, 8.0 },
- bool = { true, false },
- str = { "custom", "paint" },
- cls = { Map.class, Set.class },
- e = { Stooge.MOE, Stooge.CURLY },
- a = { @Point(x = 1, y = 2), @Point(x = 3, y = 4) }
-)
-module test.foo.bar @ 2 {
- requires foo;
- requires bar;
-}
-EOF
-
-mk z.src/foo/module-info.java <<EOF
-module foo @ 1 {
- requires bar @ 1;
- class com.foo.Foo;
-}
-EOF
-
-mk z.src/foo/com/foo/Stooge.java <<EOF
-package com.foo;
-public enum Stooge { LARRY, MOE, CURLY }
-EOF
-
-mk z.src/foo/com/foo/ArrayTypes.java <<EOF
-package com.foo;
-import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.*;
-import org.bar.Point;
- at Retention(RUNTIME)
-public @interface ArrayTypes {
- byte[] b();
- short[] s();
- int[] i();
- long[] l();
- char[] c();
- float[] f();
- double[] d();
- boolean[] bool();
- String[] str();
- Class[] cls();
- Stooge[] e();
- Point[] a();
-}
-EOF
-
-mk z.src/foo/com/foo/Foo.java <<EOF
-package com.foo;
-public class Foo {
- public static void main(String[] args) {
- for (Stooge s : Stooge.class.getEnumConstants()) {
- System.out.println(s);
- }
- }
-}
-EOF
-
-mk z.src/foo/com/foo/ArrayTypesWithDefault.java <<EOF
-package com.foo;
-import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.*;
-import org.bar.Point;
-import java.util.*;
- at Retention(RUNTIME)
-public @interface ArrayTypesWithDefault {
- byte[] b() default { 11 };
- short[] s() default { 12 };
- int[] i() default { 13 };
- long[] l() default { 14L };
- char[] c() default { 'V' };
- float[] f() default { 16.0f };
- double[] d() default { 17.0 };
- boolean[] bool() default { false };
- String[] str() default { "default" };
- Class[] cls() default { Deque.class, Queue.class };
- Stooge[] e() default { Stooge.LARRY };
- Point[] a() default { @Point(x = 11, y = 12) };
-}
-EOF
-
-mk z.src/bar/module-info.java <<EOF
-module bar @ 1 { }
-EOF
-
-mk z.src/bar/org/bar/Point.java <<EOF
-package org.bar;
-import java.lang.annotation.*;
- at Target({})
-public @interface Point { int x(); int y(); }
-EOF
-
-mk z.src/bar/org/bar/ScalarTypes.java <<EOF
-package org.bar;
-import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.*;
-import com.foo.Stooge;
- at Retention(RUNTIME)
-public @interface ScalarTypes {
- byte b();
- short s();
- int i();
- long l();
- char c();
- float f();
- double d();
- boolean bool();
- String str();
- Class cls();
- Stooge e();
- Point a();
-}
-EOF
-
-mk z.src/bar/org/bar/ScalarTypesWithDefault.java <<EOF
-package org.bar;
-import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.*;
-import com.foo.Stooge;
-import java.util.*;
- at Retention(RUNTIME)
-public @interface ScalarTypesWithDefault {
- byte b() default 11;
- short s() default 12;
- int i() default 13;
- long l() default 14;
- char c() default 'V';
- float f() default 16.0f;
- double d() default 17.0;
- boolean bool() default false;
- String str() default "default";
- Class cls() default Deque.class;
- Stooge e() default Stooge.LARRY;
- Point a() default @Point(x = 11, y = 12);
-}
-EOF
-
-mkdir z.modules z.classes
-
-$BIN/javac -d z.classes $SRC/ModuleAnnotationTest.java \
- `find z.src/foo/com/foo -name '*.java'` \
- `find z.src/bar/org/bar -name '*.java'`
-$BIN/javac -d z.modules -modulepath z.modules \
- `find z.src -name '*.java'`
-
-$BIN/jmod -L z.lib create
-$BIN/jmod -L z.lib install z.modules foo bar
-$BIN/java -L z.lib -m foo
-
-run() {
- ver=$1
- $BIN/javac -d z.modules -modulepath z.modules \
- z.src.$ver/test.foo.bar/module-info.java
- $BIN/java -cp z.classes ModuleAnnotationTest z.modules/test.foo.bar/module-info.class
-}
-
-# Test ScalarTypes and ArrayTypes with default values
-run v1
-
-# Test ScalarTypes and ArrayTypes with override values
-run v2
-
-exit 0
diff --git a/jdk/test/java/lang/reflect/Module/ModuleAnnotationTest.java b/jdk/test/java/lang/reflect/Module/ModuleAnnotationTest.java
deleted file mode 100644
index cebe424..0000000
--- a/jdk/test/java/lang/reflect/Module/ModuleAnnotationTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package test;
-
-import java.lang.annotation.Annotation;
-import java.lang.module.*;
-import java.lang.reflect.Module;
-import java.io.*;
-import java.util.*;
-import com.foo.ArrayTypes;
-import com.foo.ArrayTypesWithDefault;
-import com.foo.Stooge;
-import org.bar.ScalarTypes;
-import org.bar.ScalarTypesWithDefault;
-import org.bar.Point;
-import org.openjdk.jigsaw.*;
-
-/*
- * @summary Test reading of annotations from the input module-info.class
- * This references test/java/lang/annotation/UnitTest.java.
- *
- */
-public class ModuleAnnotationTest {
- private static JigsawModuleSystem ms = JigsawModuleSystem.instance();
- private static int failCount = 0;
- private static void fail(String test) {
- System.out.println("Failure: " + test);
- failCount++;
- }
-
- public static void main(String[] argv) throws Exception {
- File libPath = new File(argv[0]);
- Library lb = SimpleLibrary.open(libPath);
-
- List<ModuleId> mids = lb.findModuleIds("test.foo.bar");
- if (mids.size() != 1)
- throw new RuntimeException("Installed modules: " + mids);
-
- System.out.println("Installed module : " + mids);
-
- for (ModuleId mid : mids) {
- loadModule(lb, mid);
- }
-
- if (failCount > 0) {
- throw new RuntimeException("Test failed: " + failCount);
- }
- }
-
- static void loadModule(Library lb, ModuleId mid) throws Exception {
- ModuleInfo mi = lb.readModuleInfo(mid);
- if (mi == null)
- throw new RuntimeException(mi + ": Can't read module-info");
-
- System.out.format("Module %s%n", mi.toString());
- Class<?> cls = Class.forName("foo.bar.Main");
- Module module = cls.getModule();
- System.out.format("Class %s from %s%n", cls, module.getModuleId());
- checkModule(module);
- }
-
- static void checkModule(Module module) throws Exception {
- if (module.isAnnotationPresent(ScalarTypes.class) &&
- module.isAnnotationPresent(ArrayTypes.class)) {
- checkScalarTypes(module.getAnnotation(ScalarTypes.class), module);
- checkArrayTypes(module.getAnnotation(ArrayTypes.class), module);
- } else if (module.isAnnotationPresent(ScalarTypesWithDefault.class) &&
- module.isAnnotationPresent(ArrayTypesWithDefault.class)) {
- checkScalarTypes(module.getAnnotation(ScalarTypesWithDefault.class), module);
- checkArrayTypes(module.getAnnotation(ArrayTypesWithDefault.class), module);
- } else {
- throw new RuntimeException("Expected annotation is missing in " + module.getModuleId());
- }
- }
-
- static void checkScalarTypes(ScalarTypes st, Module m) {
- if (!(st.b() == 1 &&
- st.s() == 2 &&
- st.i() == 3 &&
- st.l() == 4L &&
- st.c() == '5' &&
- st.f() == 6.0f &&
- st.d() == 7.0 &&
- st.bool() == true &&
- st.str().equals("custom") &&
- st.e() == Stooge.MOE &&
- st.a().x() == 1 && st.a().y() == 2))
- fail(m.getModuleId() + ": unexpected ScalarTypes");
-
- Class<?> cls = st.cls();
- if (cls != java.util.Map.class) {
- fail(m.getModuleId() + ": ScalarTypes.cls() returns unexpected value " + cls);
- }
- }
-
- static void checkScalarTypes(ScalarTypesWithDefault st, Module m) {
- if (!(st.b() == 11 &&
- st.s() == 12 &&
- st.i() == 13 &&
- st.l() == 14L &&
- st.c() == 'V' &&
- st.f() == 16.0f &&
- st.d() == 17.0 &&
- st.bool() == false &&
- st.str().equals("default") &&
- st.e() == Stooge.LARRY &&
- st.a().x() == 11 && st.a().y() == 12))
- fail(m.getModuleId() + ": unexpected ScalarTypesWithDefault");
-
- Class<?> cls = st.cls();
- if (cls != java.util.Deque.class) {
- fail(m.getModuleId() + ": ScalarTypesWithDefault.cls() returns unexpected value " + cls);
- }
- }
-
- static void checkArrayTypes(ArrayTypes at, Module m) {
- if (!(at.b()[0] == 1 && at.b()[1] == 2 &&
- at.s()[0] == 2 && at.s()[1] == 3 &&
- at.i()[0] == 3 && at.i()[1] == 4 &&
- at.l()[0] == 4L && at.l()[1] == 5L &&
- at.c()[0] == '5' && at.c()[1] == '6' &&
- at.f()[0] == 6.0f && at.f()[1] == 7.0f &&
- at.d()[0] == 7.0 && at.d()[1] == 8.0 &&
- at.bool()[0] == true && at.bool()[1] == false &&
- at.str()[0].equals("custom") && at.str()[1].equals("paint") &&
- at.e()[0] == Stooge.MOE && at.e()[1] == Stooge.CURLY &&
- at.a()[0].x() == 1 && at.a()[0].y() == 2 && at.a()[1].x() == 3 && at.a()[1].y() == 4 &&
- at.b().length==2 && at.s().length==2 && at.i().length==2 &&
- at.l().length==2 && at.c().length==2 && at.d().length==2 &&
- at.bool().length==2 && at.str().length==2 && at.a().length==2))
- fail(m.getModuleId() + ": unexpected ArrayTypes");
-
- Class<?>[] cls = at.cls();
- if (!(cls.length == 2 &&
- cls[0] == java.util.Map.class &&
- cls[1] == java.util.Set.class))
- fail(m.getModuleId() + ": ArrayTypes.cls() returns " + Arrays.toString(cls));
- }
-
- static void checkArrayTypes(ArrayTypesWithDefault at, Module m) {
- if (!(at.b()[0] == 11 &&
- at.s()[0] == 12 &&
- at.i()[0] == 13 &&
- at.l()[0] == 14L &&
- at.c()[0] == 'V' &&
- at.f()[0] == 16.0f &&
- at.d()[0] == 17.0 &&
- at.bool()[0] == false &&
- at.str()[0].equals("default") &&
- at.e()[0] == Stooge.LARRY &&
- at.a()[0].x() == 11 && at.a()[0].y() == 12 &&
- at.b().length==1 && at.s().length==1 && at.i().length==1 &&
- at.l().length==1 && at.c().length==1 && at.d().length==1 &&
- at.bool().length==1 && at.str().length==1))
- fail(m.getModuleId() + ": unexpected ArrayTypesWithDefault");
-
- Class<?>[] cls = at.cls();
- if (!(cls.length == 2 &&
- cls[0] == java.util.Deque.class &&
- cls[1] == java.util.Queue.class))
- fail(m.getModuleId() + ": ArrayTypesWithDefault.cls() returns " + Arrays.toString(cls));
- }
-}
diff --git a/jdk/test/java/lang/reflect/Module/module-annotation.sh b/jdk/test/java/lang/reflect/Module/module-annotation.sh
deleted file mode 100644
index 0850a11..0000000
--- a/jdk/test/java/lang/reflect/Module/module-annotation.sh
+++ /dev/null
@@ -1,299 +0,0 @@
-#! /bin/bash
-
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-
-# @test
-# @summary Test to access annotations in java.lang.reflect.Module
-# @key modules
-
-set -e
-
-BIN=${TESTJAVA:-../../../../build}/bin
-SRC=${TESTSRC:-.}
-
-rm -rf z.*
-mk() {
- d=`dirname $1`
- if [ ! -d $d ]; then mkdir -p $d; fi
- cat - >$1
-}
-
-mk z.src.v1/test.foo.bar/module-info.java <<EOF
- at org.bar.ScalarTypesWithDefault (
-)
- at com.foo.ArrayTypesWithDefault (
-)
-module test.foo.bar @ 1 {
- requires foo;
- requires bar;
-}
-EOF
-
-mk z.src.v1/test.foo.bar/foo/bar/Main.java <<EOF
-package foo.bar;
-public class Main {};
-EOF
-
-mk z.src.v2/test.foo.bar/module-info.java <<EOF
-import java.util.*;
-import com.foo.*;
-import org.bar.*;
- at org.bar.ScalarTypes (
- b = 1,
- s = 2,
- i = 3,
- l = 4L,
- c = '5',
- f = 6.0f,
- d = 7.0,
- bool = true,
- str = "custom",
- cls = Map.class,
- e = Stooge.MOE,
- a = @Point(x = 1, y = 2)
-)
- at com.foo.ArrayTypes (
- b = { 1, 2 },
- s = { 2, 3 },
- i = { 3, 4 },
- l = { 4L, 5L },
- c = { '5', '6' },
- f = { 6.0f, 7.0f },
- d = { 7.0, 8.0 },
- bool = { true, false },
- str = { "custom", "paint" },
- cls = { Map.class, Set.class },
- e = { Stooge.MOE, Stooge.CURLY },
- a = { @Point(x = 1, y = 2), @Point(x = 3, y = 4) }
-)
-module test.foo.bar @ 2 {
- requires foo;
- requires bar;
-}
-EOF
-
-mk z.src.v2/test.foo.bar/foo/bar/Main.java <<EOF
-package foo.bar;
-public class Main {};
-EOF
-
-mk z.src/foo/module-info.java <<EOF
-module foo @ 1 {
- requires bar @ 1;
- class com.foo.Foo;
-}
-EOF
-
-mk z.src/foo/com/foo/Stooge.java <<EOF
-package com.foo;
-public enum Stooge { LARRY, MOE, CURLY }
-EOF
-
-mk z.src/foo/com/foo/ArrayTypes.java <<EOF
-package com.foo;
-import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.*;
-import org.bar.Point;
- at Retention(RUNTIME)
-public @interface ArrayTypes {
- byte[] b();
- short[] s();
- int[] i();
- long[] l();
- char[] c();
- float[] f();
- double[] d();
- boolean[] bool();
- String[] str();
- Class[] cls();
- Stooge[] e();
- Point[] a();
-}
-EOF
-
-mk z.src/foo/com/foo/Foo.java <<EOF
-package com.foo;
-public class Foo {
- public static void main(String[] args) {
- for (Stooge s : Stooge.class.getEnumConstants()) {
- System.out.println(s);
- }
- }
-}
-EOF
-
-mk z.src/foo/com/foo/ArrayTypesWithDefault.java <<EOF
-package com.foo;
-import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.*;
-import org.bar.Point;
-import java.util.*;
- at Retention(RUNTIME)
-public @interface ArrayTypesWithDefault {
- byte[] b() default { 11 };
- short[] s() default { 12 };
- int[] i() default { 13 };
- long[] l() default { 14L };
- char[] c() default { 'V' };
- float[] f() default { 16.0f };
- double[] d() default { 17.0 };
- boolean[] bool() default { false };
- String[] str() default { "default" };
- Class[] cls() default { Deque.class, Queue.class };
- Stooge[] e() default { Stooge.LARRY };
- Point[] a() default { @Point(x = 11, y = 12) };
-}
-EOF
-
-mk z.src/bar/module-info.java <<EOF
-module bar @ 1 {
- requires foo;
-}
-EOF
-
-mk z.src/bar/org/bar/Point.java <<EOF
-package org.bar;
-import java.lang.annotation.*;
- at Target({})
-public @interface Point { int x(); int y(); }
-EOF
-
-mk z.src/bar/org/bar/ScalarTypes.java <<EOF
-package org.bar;
-import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.*;
-import com.foo.Stooge;
- at Retention(RUNTIME)
-public @interface ScalarTypes {
- byte b();
- short s();
- int i();
- long l();
- char c();
- float f();
- double d();
- boolean bool();
- String str();
- Class cls();
- Stooge e();
- Point a();
-}
-EOF
-
-mk z.src/bar/org/bar/ScalarTypesWithDefault.java <<EOF
-package org.bar;
-import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.*;
-import com.foo.Stooge;
-import java.util.*;
- at Retention(RUNTIME)
-public @interface ScalarTypesWithDefault {
- byte b() default 11;
- short s() default 12;
- int i() default 13;
- long l() default 14;
- char c() default 'V';
- float f() default 16.0f;
- double d() default 17.0;
- boolean bool() default false;
- String str() default "default";
- Class cls() default Deque.class;
- Stooge e() default Stooge.LARRY;
- Point a() default @Point(x = 11, y = 12);
-}
-EOF
-
-mk z.src/test/module-info.java <<EOF
-module test @ 1 {
- requires foo;
- requires bar;
- requires test.foo.bar;
- class test.ModuleAnnotationTest;
-}
-EOF
-
-mk z.src/test/test/ModuleAnnotationTest.java <<EOF
-package test;
-public class ModuleAnnotationTest {
- // content to be copied from the test source
-}
-EOF
-cp -f $SRC/ModuleAnnotationTest.java z.src/test/test
-
-mkdir z.modules
-
-OS=`uname -s`
-case "$OS" in
- SunOS )
- PS=":"
- FS="/"
- ;;
- Linux )
- PS=":"
- FS="/"
- ;;
- Windows* )
- PS=";"
- FS="\\"
- ;;
- CYGWIN* )
- PS=";"
- FS="\\"
- isCygwin=true
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-run() {
- ver=$1
- lib=z.lib.$1
- mkdir z.modules.$ver
-
- $BIN/javac -d z.modules.$ver -modulepath z.modules.$ver -L z.lib \
- `find z.src.$ver -name '*.java'` \
- `find z.src/test -name '*.java'`
-
- $BIN/jmod -L $lib -P z.lib create
- $BIN/jmod -L $lib install z.modules.$ver test.foo.bar test
- $BIN/java -L $lib -m test $lib
-}
-
-#
-# Create z.lib with foo and bar modules
-$BIN/javac -d z.modules -modulepath z.modules \
- `find z.src/bar -name '*.java'` \
- `find z.src/foo -name '*.java'`
-
-$BIN/jmod -L z.lib create
-$BIN/jmod -L z.lib install z.modules foo bar
-$BIN/java -L z.lib -m foo
-
-# Test ScalarTypes and ArrayTypes with default values
-run v1
-
-# Test ScalarTypes and ArrayTypes with override values
-run v2
-
-exit 0
diff --git a/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.java b/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.java
deleted file mode 100644
index bdaf7db..0000000
--- a/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- *
- */
-
-/*
- * This class is used by ExpirationTest.sh. See the timing information in
- * the shell script.
- */
-
-import java.util.*;
-
-public class ExpirationTest {
- static final Locale AUSTRIA = new Locale("de", "AT");
- static String format;
- static String fileType;
-
- public static void main(String[] args) {
- // If -latency is specified, try sleeping for 3 seconds 3
- // times to see its latency. If the latency is too large, then
- // the program exits with 2. (See sleep())
- if ("-latency".equals(args[0])) {
- System.out.print("Checking latency... ");
- for (int i = 0; i < 3; i++) {
- sleep(3);
- }
- System.out.println("done");
- System.exit(0);
- }
-
- format = args[0];
- fileType = args[1];
-
- Locale loc = Locale.getDefault();
- try {
- Locale.setDefault(Locale.JAPAN);
- ResourceBundle.Control control = new TestControl();
- ResourceBundle rb = ResourceBundle.getBundle("ExpirationData", Locale.GERMAN,
- control);
- check(rb.getString("data"), "German");
-
- rb = ResourceBundle.getBundle("ExpirationData", AUSTRIA, control);
- check(rb.getString("january"), "Januar");
-
- // Wait until the instance gets expired in the cache in 7 seconds.
- sleep(7);
-
- // At this point, it should be determined that reloading is not needed.
- rb = ResourceBundle.getBundle("ExpirationData", Locale.GERMAN, control);
- check(rb.getString("data"), "German");
-
- rb = ResourceBundle.getBundle("ExpirationData", AUSTRIA, control);
- check(rb.getString("january"), "Januar");
-
- // Wait until the instance in the cache gets expired again and
- // ExpirationData_de gets updated.
- // 33 = 40 - 7 (See the timing chart in ExpirationTest.sh)
- sleep(33);
-
- // At this point, getBundle must reload the updated
- // ExpirationData_de and ExpirationData_de_AT must be
- // avaible.
-
- rb = ResourceBundle.getBundle("ExpirationData", Locale.GERMAN, control);
- try {
- check(rb.getString("data"), "Deutsch");
- } catch (RuntimeException e) {
- if (format.equals("class")) {
- // Class loader doesn't load updated classes.
- System.out.println("Known class limitation: " + e.getMessage());
- }
- }
-
- rb = ResourceBundle.getBundle("ExpirationData", AUSTRIA, control);
- try {
- check(rb.getString("january"), "J\u00e4nner");
- } catch (RuntimeException e) {
- if (fileType.equals("jar")) {
- // Jar doesn't load new entries.
- System.out.println("Known jar limitation: " + e.getMessage());
- } else {
- throw e;
- }
- }
- } finally {
- Locale.setDefault(loc);
- }
- }
-
- private static void check(String s, String expected) {
- String time = getTime();
- if (!s.equals(expected)) {
- throw new RuntimeException("got '" + s + "', expected '" + expected + "' at "
- + time);
- }
- System.out.println("ExpirationTest: got '" + s + "' at " + time);
- }
-
- private static void sleep(int seconds) {
- long millis = seconds * 1000;
- long start = System.currentTimeMillis();
- try {
- Thread.sleep(millis);
- } catch (InterruptedException e) {
- }
- long end = System.currentTimeMillis();
- long latency = end - start - millis;
- // If the latecy is more than 1% of the requested sleep time,
- // then give up the testing.
- if (latency > millis/100) {
- System.err.printf("Latency is too large: slept for %d [ms], "
- + "expected %d [ms] latency rate: %+.2f%% (expected not more than 1%%)%n"
- + "exiting...%n",
- end - start, millis, (double)latency*100.0/millis);
- System.exit(2);
- }
- }
-
- private static final String getTime() {
- return new Date().toString().substring(11, 19);
- }
-
- private static class TestControl extends ResourceBundle.Control {
- @Override
- public long getTimeToLive(String name, Locale loc) {
- return 5000; // 5 seconds
- }
-
- @Override
- public ResourceBundle newBundle(String name, Locale loc,
- String fmt, ClassLoader cl, boolean reload)
- throws IllegalAccessException, InstantiationException, java.io.IOException {
- ResourceBundle bundle = super.newBundle(name, loc, fmt, cl, reload);
- if (bundle != null) {
- System.out.println("newBundle: " + (reload ? "**re" : "")
- + "loaded '" + toName(name, loc , fmt) + "' at " + getTime());
- }
- return bundle;
- }
-
- @Override
- public boolean needsReload(String name, Locale loc,
- String fmt, ClassLoader cl,
- ResourceBundle rb, long time) {
- boolean b = super.needsReload(name, loc, fmt, cl, rb, time);
- System.out.println("needsReload: '" + b + "' for " + toName(name, loc, fmt)
- + " at " + getTime());
- return b;
- }
-
- private String toName(String name, Locale loc, String fmt) {
- return toResourceName(toBundleName(name, loc), fmt.substring(5));
- }
- }
-}
diff --git a/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.sh b/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.sh
deleted file mode 100644
index e798bf9..0000000
--- a/jdk/test/java/util/ResourceBundle/Control/ExpirationTest.sh
+++ /dev/null
@@ -1,331 +0,0 @@
-#
-# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-# @test
-# @bug 4212439 5102289 6272156
-# @summary Tests for expiration control and reloading expired resource bundles.
-# @build ExpirationTest
-# @run shell/timeout=300 ExpirationTest.sh
-
-#
-# Timings of the test sequence
-#
-# 0 5 7 10 20 40 [seconds]
-# +---------+----+------+------//------+------//------+--
-# g X g X U g [event]
-#
-# 0 g - java starts; the first getBundle call gets "German";
-# sleep for 7 sec
-# 5 X - the bundle expires (every 5 seconds)
-# 7 g - java wakes up; the second getBundle call still gets "German";
-# sleep for 33 sec
-# 10 X - the bundle expires in the cache
-# 20 U - shell script updates DE and add AT
-# 40 g - java wakes up; third getBundle call; gets "Deutsch"
-#
-# event: g - getBundle, X - eXpire, U - Update
-#
-#
-# ExpirationTest.java uses 3 exit values.
-# 0 - passed
-# 1 - failed
-# 2 - can't proceed due to slow platform
-#
-
-# Check environment variables
-if [ "x$TESTJAVA" = "x" ]; then
- 1>&2 echo "No TESTJAVA defined. exiting..."
- exit 1
-fi
-
-# Make sure that this test is run in C locale
-LANG=C
-export LANG
-LC_ALL=
-export LC_ALL
-
-: ${TESTCLASSES:=.}
-
-# YES if the platform has %s support in date
-HAS_S=NO
-
-case "`uname`" in
-Windows* | CYGWIN* )
- DEL=";"
- ;;
-SunOS)
- DEL=":"
- ;;
-Linux)
- DEL=":"
- HAS_S=YES
- ;;
-esac
-
-# Interval until resources are updated
-INTERVAL=20
-
-DATA=ExpirationData
-
-ROOT=${DATA}.properties
-JA=${DATA}_ja.properties
-DE=${DATA}_de.properties
-AT=${DATA}_de_AT.properties
-
-JARFILE=data.jar
-
-createProperties() {
- rm -f ${DATA}*.properties
- echo "data: English" > $ROOT
- (echo "data: Japanese"; echo "january: 1gatsu") > $JA
- (echo "data: German"; echo "january: Januar") > $DE
- echo "Properties files have been created at `date +%T`"
-}
-
-createJar() {
- if [ "$FORMAT" = "properties" ]; then
- createProperties
- F="${DATA}*.properties"
- else
- createClasses
- F="-C classes ${ROOT}.class -C classes ${JA}.class -C classes ${DE}.class"
- fi
- ${TESTJAVA}/bin/jar cf $JARFILE $F
- ${TESTJAVA}/bin/jar tvf $JARFILE
- rm -f ${DATA}*.properties
- echo "Jar created at `date +%T`"
-}
-
-createClasses() {
- rm -f ${DATA}*.java
- rm -rf classes
- mkdir classes
- createJava $ROOT English
- createJava $JA Japanese
- createJava $DE German Januar
- ${TESTJAVA}/bin/javac -d classes ${ROOT}.java ${JA}.java ${DE}.java
- echo "Created" classes/*.class "at `date +%T`"
-}
-
-createJava() {
- (echo "
-import java.util.*;
-
-public class $1 extends ListResourceBundle {
- public Object[][] getContents() {
- return new Object[][] {
- { \"data\", \"$2\" },"
- if [ "x$3" != "x" ]; then
- echo " { \"january\", \"$3\" },"
- fi
-echo " };
- }
-}") >$1.java
-}
-
-updateDEaddAT() {
- rm -f $DE
- (echo "data=Deutsch"; echo "january=Januar") > $DE
- # add de_AT
- echo "january=J\u00e4nner" > $AT
- echo "Updated '"${DE}"' and added '"${AT}"' at `date +%T`"
-}
-
-updateClassDEaddClassAT() {
- rm -f $DE.java classes/$DE.class
- createJava $DE Deutsch Januar
- ${TESTJAVA}/bin/javac -d classes ${DE}.java
- createJava $AT Deutsch "J\\u00e4nner"
- ${TESTJAVA}/bin/javac -d classes ${AT}.java
- echo "Updated '"${DE}"' class and added '"${AT}"' class at `date +%T`"
-}
-
-updateJar() {
- if [ "$FORMAT" = "properties" ]; then
- updateDEaddAT
- F="$DE $AT"
- else
- updateClassDEaddClassAT
- F="-C classes ${DE}.class -C classes ${AT}.class"
- fi
- ${TESTJAVA}/bin/jar uf $JARFILE $F
- rm -f $DE $AT
- echo "Updated '"${JARFILE}"' at `date +%T`"
- ${TESTJAVA}/bin/jar tvf $JARFILE
-}
-
-getSeconds() {
- if [ "$HAS_S" = "YES" ]; then
- date '+%s'
- else
- # Returns an approximation of the offset from the Epoch in
- # seconds.
- date -u '+%Y %j %H %M %S' | \
- awk '{d=($1-1970)*365.2425; print int(((((((d+$2-1)*24)+$3)*60)+$3)*60)+$5);}'
- fi
-}
-
-#
-# Execute $1 and check how long it takes
-#
-timedExec() {
- S=`getSeconds`
- eval $1
- E=`getSeconds`
- D=`expr $E - $S`
- #
- # If this machine is too slow, give up the further testing.
- #
- if [ "$D" -gt $2 ]; then
- 1>&2 echo "This machine took $D seconds to prepare test data," \
- "which is too slow to proceed. Exiting..."
- exit 0
- fi
- unset S
- unset E
- unset D
-}
-
-checkStatus() {
- if [ $1 = 0 ]; then
- echo "$2: PASSED"
- elif [ $1 != 2 ]; then
- echo "$2: FAILED"
- exit 1
- else
- # Just we should't proceed to avoid timing issues.
- exit 0
- fi
-}
-
-#
-# Before starting tests, check the latency with Thread.sleep().
-#
-${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}." ExpirationTest -latency
-STATUS=$?
-if [ $STATUS = 2 ]; then
- exit 0
-fi
-
-#
-# Tests for properties
-#
-FORMAT=properties
-
-#
-# Test with plain files (properties)
-#
-echo "Starting test with properties files at `date +%T`"
-
-#
-# Creates properties files
-#
-timedExec createProperties 10
-
-#
-# Execute a child process which will update files in $INTERVAL seconds.
-#
-(sleep $INTERVAL; updateDEaddAT; exit 0) &
-
-${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}." ExpirationTest properties file
-STATUS=$?
-wait
-checkStatus $STATUS "Test with properties files"
-
-#
-# Test with jar file if jar is available (properties)
-#
-if [ -x ${TESTJAVA}/bin/jar ] || [ -x ${TESTJAVA}/bin/jar.exe ]; then
- HASJAR=YES
-else
- HASJAR=NO
-fi
-
-if [ $HASJAR = YES ]; then
- echo ""
- echo "Starting test with a jar file (properties) at `date +%T`"
-
- #
- # Create a jar files with properties
- #
- timedExec createJar 10
-
- (sleep $INTERVAL; updateJar; exit 0) &
- ${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}${JARFILE}" ExpirationTest properties jar
- STATUS=$?
- wait
- checkStatus $STATUS "Test with a jar file (properties)"
-fi
-
-#
-# Test for classes
-#
-
-# Note: class-based resource bundles can't be reloaded due to the
-# cache support in class loaders. So the results of the test cases
-# below are not checked. (Test cases always pass.)
-
-# If there's no javac available, then give up the test with
-# class-based properties.
-if [ ! -x ${TESTJAVA}/bin/javac ] && [ ! -x ${TESTJAVA}/bin/javac.exe ]; then
- exit 0
-fi
-
-rm -f ${DATA}*.properties $JARFILE
-
-FORMAT=class
-ROOT=`basename $ROOT .properties`
-JA=`basename $JA .properties`
-DE=`basename $DE .properties`
-AT=`basename $AT .properties`
-
-echo ""
-echo "Starting test with class files at `date +%T`"
-
-#
-# Create class files
-#
-timedExec createClasses 10
-
-(sleep $INTERVAL; updateClassDEaddClassAT; exit 0) &
-${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}classes" ExpirationTest class file
-STATUS=$?
-wait
-checkStatus $STATUS "Test with class files"
-
-if [ $HASJAR = YES ]; then
- echo ""
- echo "Starting test with a jar file (class) at `date +%T`"
-
- #
- # Create a jar file with class files
- #
- timedExec createJar 10
-
- (sleep $INTERVAL; updateJar; exit 0) &
- ${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}${JARFILE}" ExpirationTest class jar
- STATUS=$?
- wait
- checkStatus $STATUS "Test with a jar file (class)"
-fi
-
-exit 0
diff --git a/jdk/test/org/openjdk/jigsaw/cli/ModuleFormatTest01.java b/jdk/test/org/openjdk/jigsaw/cli/ModuleFormatTest01.java
deleted file mode 100644
index d2481f6..0000000
--- a/jdk/test/org/openjdk/jigsaw/cli/ModuleFormatTest01.java
+++ /dev/null
@@ -1,651 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @see ModuleFormatTest01.sh
- * @summary test module format writing/reading
- */
-
-import java.io.*;
-import java.security.CodeSigner;
-import java.security.cert.*;
-import java.util.*;
-import java.util.zip.*;
-import org.openjdk.jigsaw.cli.*;
-import org.openjdk.jigsaw.*;
-import static org.openjdk.jigsaw.FileConstants.ModuleFile.*;
-
-public class ModuleFormatTest01 {
- final String MNAME = "hello";
- final String MVER = "0.1";
- String moduleinfo = "module " + MNAME + " @ " + MVER + " {}";
- String code = "public class World {}";
- String code2 = "public class Another {}";
- String resource = "Yo!";
- String resource2 = "Hey!";
-
- public static void main(String[] args) throws Exception {
- new ModuleFormatTest01().run();
- }
-
- void run() throws Exception {
- try {
- test();
- } catch (Throwable t) {
- t.printStackTrace();
- errors++;
- }
- if (errors == 0)
- System.out.println(count + " tests passed");
- else
- throw new Exception(errors + "/" + count + " tests failed");
- }
-
- void testEmptyModule() throws Exception {
- System.err.println("\nTest: Empty module");
- doTestEmptyModule(false);
- }
-
- void testSignEmptyModule() throws Exception {
- System.err.println("\nTest: Signed empty module");
- doTestEmptyModule(true);
- }
-
- void doTestEmptyModule(boolean sign) throws Exception {
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- compile(files);
- if (sign) {
- compress(MNAME, false, false, false, false);
- sign(MNAME, MVER);
- } else {
- compress(MNAME);
- extract(MNAME, MVER);
- compare(MNAME);
- }
- }
-
- void testSingleClassModule() throws Exception {
- System.err.println("\nTest: Single class module");
- doTestSingleClassModule(false);
- }
-
- void testSignSingleClassModule() throws Exception {
- System.err.println("\nTest: Signed single class module");
- doTestSingleClassModule(true);
- }
-
- void doTestSingleClassModule(boolean sign) throws Exception {
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- addFile(files, createFile("World.java", code));
- compile(files);
- if (sign) {
- compress(MNAME, false, false, false, false);
- sign(MNAME, MVER);
- } else {
- compress(MNAME);
- extract(MNAME, MVER);
- compare(MNAME);
- }
- }
-
- void testMultiClassModule() throws Exception {
- System.err.println("\nTest: Multiple class module");
- doTestMultiClassModule(false);
- }
-
- void testSignMultiClassModule() throws Exception {
- System.err.println("\nTest: Signed multiple class module");
- doTestMultiClassModule(true);
- }
-
- void doTestMultiClassModule(boolean sign) throws Exception {
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- addFile(files, createFile("World.java", code));
- addFile(files, createFile("Another.java", code2));
- compile(files);
- if (sign) {
- compress(MNAME, false, false, false, false);
- sign(MNAME, MVER);
- } else {
- compress(MNAME);
- extract(MNAME, MVER);
- compare(MNAME);
- }
- }
-
- void testSingleResourceModule() throws Exception {
- System.err.println("\nTest: Single resource module");
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- addFile(files, createFile("World.java", code));
- addFile(files, createFile("Another.java", code2));
- compile(files);
- createFile("resources" + File.separator + "yo", resource);
- compress(MNAME, true);
- extract(MNAME, MVER);
- compare(MNAME);
- }
-
- void testMultiResourceModule() throws Exception {
- System.err.println("\nTest: Multiple resource module");
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- addFile(files, createFile("World.java", code));
- addFile(files, createFile("Another.java", code2));
- compile(files);
- createFile("resources" + File.separator + "yo", resource);
- createFile("resources" + File.separator + "hey", resource2);
- compress(MNAME, true);
- extract(MNAME, MVER);
- compare(MNAME);
- }
-
- void testSingleNatLibModule() throws Exception {
- System.err.println("\nTest: Single native library module");
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- compile(files);
- createFile("natlib" + File.separator + "yo.so", resource);
- compress(MNAME, false, true);
- extract(MNAME, MVER);
- compare(MNAME);
- }
-
- void testMultiNatLibModule() throws Exception {
- System.err.println("\nTest: Multiple native library module");
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- compile(files);
- createFile("natlib" + File.separator + "yo.so", resource);
- createFile("natlib" + File.separator + "yo.dll", resource);
- compress(MNAME, false, true);
- extract(MNAME, MVER);
- compare(MNAME);
- }
-
- void testSingleNatCmdModule() throws Exception {
- System.err.println("\nTest: Single native command module");
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- compile(files);
- createFile("natcmd" + File.separator + "yo", resource);
- compress(MNAME, false, false, true);
- extract(MNAME, MVER);
- compare(MNAME);
- }
-
- void testMultiNatCmdModule() throws Exception {
- System.err.println("\nTest: Multi native command module");
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- compile(files);
- createFile("natcmd" + File.separator + "yo", resource);
- createFile("natcmd" + File.separator + "yo.exe", resource);
- compress(MNAME, false, false, true);
- extract(MNAME, MVER);
- compare(MNAME);
- }
-
- void testSingleConfigModule() throws Exception {
- System.err.println("\nTest: Single config module");
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- compile(files);
- createFile("config" + File.separator + "yo", resource);
- compress(MNAME, false, false, false, true);
- extract(MNAME, MVER);
- compare(MNAME);
- }
-
- void testMultiConfigModule() throws Exception {
- System.err.println("\nTest: Multi config module");
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- compile(files);
- createFile("config" + File.separator + "yo", resource);
- createFile("config" + File.separator + "hey", resource);
- compress(MNAME, false, false, false, true);
- extract(MNAME, MVER);
- compare(MNAME);
- }
-
- void testBloatedModule() throws Exception {
- System.err.println("\nTest: Bloated module");
- doTestBloatedModule(false);
- }
-
- void testSignBloatedModule() throws Exception {
- System.err.println("\nTest: Signed bloated module");
- doTestBloatedModule(true);
- }
-
- void doTestBloatedModule(boolean sign) throws Exception {
- count++;
- reset();
- List<File> files = new ArrayList<>();
- addFile(files, createFile("module-info.java", moduleinfo));
- addFile(files, createFile("World.java", code));
- addFile(files, createFile("Another.java", code2));
- compile(files);
- String largefile = "0";
- for (int i = 0; i < 10000; i++) {
- largefile += i;
- }
- createFile("resources" + File.separator + "yo", largefile);
- createFile("resources" + File.separator + "hey", largefile);
- createFile("natlib" + File.separator + "yo.so", largefile);
- createFile("natlib" + File.separator + "yo.dll", largefile);
- createFile("natcmd" + File.separator + "yo", largefile);
- createFile("natcmd" + File.separator + "yo.exe", largefile);
- createFile("config" + File.separator + "yo", largefile);
- createFile("config" + File.separator + "hey", largefile);
-
- if (sign) {
- compress(MNAME, true, true, true, true);
- sign(MNAME, MVER);
- } else {
- compress(MNAME, true, true, true, true);
- extract(MNAME, MVER);
- compare(MNAME);
- }
- }
-
- void test() throws Exception {
- testEmptyModule();
- testSingleClassModule();
- testMultiClassModule();
- testSingleResourceModule();
- testMultiResourceModule();
- testSingleNatLibModule();
- testMultiNatLibModule();
- testSingleNatCmdModule();
- testMultiNatCmdModule();
- testSingleConfigModule();
- testMultiConfigModule();
- testBloatedModule();
- testSignEmptyModule();
- testSignSingleClassModule();
- testSignMultiClassModule();
- testSignBloatedModule();
- }
-
- void checkSignature(String name, File signedModuleFile) throws Exception {
- try (FileInputStream fis = new FileInputStream(signedModuleFile);
- DataInputStream dis = new DataInputStream(fis);
- ModuleFileFormat.Reader reader = new ModuleFileFormat.Reader(dis))
- {
- if (reader.hasSignature()) {
- if (reader.getSignatureType() == SignatureType.PKCS7.value()) {
-
- ModuleFileVerifier verifier
- = new SignedModule.PKCS7Verifier(reader);
- ModuleFileVerifier.Parameters verifierParams
- = new SignedModule.VerifierParameters();
- int i = 1;
- System.out.println("Module '" + name + "' is signed by:");
- for (CodeSigner signer :
- verifier.verifySignature(verifierParams)) {
- X509Certificate signerCert =
- (X509Certificate)
- signer.getSignerCertPath().getCertificates().get(0);
- System.out.println(" [" + (i++) + "] " +
- signerCert.getSubjectX500Principal().getName());
- }
- System.out.println();
- } else {
- throw new Exception("Unsupported signature format");
- }
- } else {
- throw new Exception("Module '" + name + "' is unsigned");
- }
- }
- }
-
- /**
- * Check if files are executable.
- */
- void checkIfExecutable(String [] fnames, File dir, SectionType type)
- throws IOException {
-
- for (String fname : fnames) {
- File file = new File(dir, fname);
- if (file.exists()
- && (type == SectionType.NATIVE_CMDS
- || (type == SectionType.NATIVE_LIBS
- && System.getProperty("os.name").startsWith("Windows")))
- && !file.canExecute())
- throw new IOException("file not marked executable " + file);
- }
- }
-
- /**
- * Compare an extracted module with original.
- */
- void compare(String [] fnames, File origDir, File copyDir)
- throws IOException {
- for (String fname : fnames) {
- File file = new File(origDir, fname);
- File copy = null;
-
- // Module-info class is extracted into info file.
- if (fname.equals("module-info.class"))
- copy = new File(copyDir, "info");
- else
- copy = new File(copyDir, fname);
-
- if (file.exists()) {
- // System.out.println("Comparing " + file.toString());
- compare(file, copy);
- }
- }
- }
-
- void compare(String [] fnames, File origDir, ZipFile content)
- throws IOException
- {
- for (String fname : fnames) {
- File file = new File(origDir, fname);
- if (file.exists()) {
- ZipEntry ze = content.getEntry(fname);
- if (ze == null)
- throw new FileNotFoundException(fname);
- compare(file, content.getInputStream(ze));
- }
- }
- }
-
- void compare(String module, String [] fnames, SectionType type,
- ZipFile content)
- throws IOException
- {
- File extractedDir = new File(module);
- String sectionDir = ModuleFileFormat.getSubdirOfSection(type);
- File copyDir = new File(extractedDir, sectionDir);
-
- switch(type) {
- case MODULE_INFO:
- compare(fnames, classesDir, copyDir);
- break;
- case CLASSES:
- compare(fnames, classesDir, content);
- break;
- case RESOURCES:
- compare(fnames, resourceDir, content);
- break;
- case NATIVE_LIBS:
- compare(fnames, natlibDir, copyDir);
- checkIfExecutable(fnames, copyDir, type);
- break;
- case NATIVE_CMDS:
- compare(fnames, natcmdDir, copyDir);
- checkIfExecutable(fnames, copyDir, type);
- break;
- case CONFIG:
- compare(fnames, configDir, copyDir);
- break;
- }
- }
-
- void compare(String module) throws IOException {
- ZipFile content = new ZipFile(new File(module, "classes"));
- compare(module, new String [] {"module-info.class"},
- SectionType.MODULE_INFO, content);
- compare(module, new String [] {"World.class", "Another.class"},
- SectionType.CLASSES, content);
- compare(module, new String [] {"yo", "hey"},
- SectionType.RESOURCES, content);
- compare(module, new String [] {"yo.so", "yo.dll"},
- SectionType.NATIVE_LIBS, content);
- compare(module, new String [] {"yo", "yo.exe"},
- SectionType.NATIVE_CMDS, content);
- compare(module, new String [] {"yo", "hey"},
- SectionType.CONFIG, content);
- content.close();
- }
-
- /**
- * Compare two files for identity.
- */
-
- static void compare (File f1, InputStream i2) throws IOException {
- // For class files, only compare the ClassFile header as
- // the class file is modified after being compressed by pack200.
- long numBytes = f1.getName().endsWith(".class") ? 10 : f1.length();
- int count = 0;
- int c1,c2;
- try (FileInputStream fis = new FileInputStream(f1);
- InputStream i1 = new BufferedInputStream(fis))
- {
- while ((c1=i1.read()) != -1 && count < numBytes) {
- count++;
- c2 = i2.read();
- if (c1 != c2) {
- throw new RuntimeException ("file compare failed 1");
- }
- }
- if (c1 == -1 && i2.read() != -1) {
- throw new RuntimeException ("file compare failed 2");
- }
- } finally {
- i2.close();
- }
- }
-
- static void compare (File f1, File f2) throws IOException {
- compare(f1, new BufferedInputStream (new FileInputStream(f2)));
- }
-
- /**
- * Extract a module.
- */
- void extract(String name, String version) throws Exception {
- File module = new File(moduleDir, name + "@" + version + ".jmod");
- String [] args = {"extract", module.getAbsolutePath(), "-v"};
- System.err.println(" jmod arguments: " + Arrays.toString(args));
- Librarian.main(args);
- }
-
- /**
- * Compress a module.
- */
- void compress(String name) throws Exception {
- compress(name, false);
- }
-
- void compress(String name, boolean haveResources) throws Exception {
- compress(name, haveResources, false);
- }
-
- void compress(String name, boolean haveResources, boolean haveNatLibs)
- throws Exception {
- compress(name, haveResources, haveNatLibs, false);
- }
-
- void compress(String name, boolean haveResources, boolean haveNatLibs,
- boolean haveNatCmds) throws Exception {
- compress(name, haveResources, haveNatLibs, haveNatCmds, false);
- }
-
- void compress(String name, boolean haveResources, boolean haveNatLibs,
- boolean haveNatCmds, boolean haveConfig) throws Exception {
- List<String> args = new ArrayList<>();
- args.add("-m");
- args.add(classesDir.getAbsolutePath());
- args.add("-d");
- args.add(moduleDir.getAbsolutePath());
- if (haveResources) {
- args.add("-r");
- args.add(resourceDir.toString());
- }
- if (haveNatLibs) {
- args.add("--natlib");
- args.add(natlibDir.toString());
- }
- if (haveNatCmds) {
- args.add("--natcmd");
- args.add(natcmdDir.toString());
- }
- if (haveConfig) {
- args.add("--config");
- args.add(configDir.toString());
- }
- args.add("jmod");
- args.add("hello");
- System.err.println(" jpkg arguments: " + args);
- Packager.main(args.toArray(new String[0]));
- }
-
- void sign(String name, String version) throws Exception {
- File moduleFile = new File(moduleDir, name + "@" + version + ".jmod");
- List<String> args = new ArrayList<>();
- args.add("--keystore");
- args.add("keystore.jks");
- args.add(moduleFile.getAbsolutePath());
- args.add("signer");
- args.add("-v");
- System.err.println(" jsign arguments: " + args);
- Signer.main(args.toArray(new String[0]));
- checkSignature(name, moduleFile);
- }
-
- /**
- * Compile a list of files.
- */
- void compile(List<File> files) {
- List<String> options = new ArrayList<>();
- options.addAll(Arrays.asList("-source", "7", "-d", classesDir.getPath()));
- for (File f: files)
- options.add(f.getPath());
-
- String[] opts = options.toArray(new String[options.size()]);
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- int rc = com.sun.tools.javac.Main.compile(opts, pw);
- pw.close();
-
- String out = sw.toString();
- if (out.trim().length() > 0)
- System.err.println(out);
- if (rc != 0)
- throw new Error("compilation failed: rc=" + rc);
- }
-
- /**
- * Add a file to a list if the file is not null.
- */
- void addFile(List<File> files, File file) {
- if (file != null)
- files.add(file);
- }
-
-
- /**
- * Create a test file with given content if the content is not null.
- */
- File createFile(String path, String body) throws IOException {
- if (body == null)
- return null;
- File file = new File(srcDir, path);
- file.getAbsoluteFile().getParentFile().mkdirs();
- FileWriter out = new FileWriter(file);
- out.write(body);
- out.close();
- return file;
- }
-
- /**
- * Set up empty src and classes directories for a test.
- */
- void reset() {
- resetDir(srcDir);
- resetDir(classesDir);
- resetDir(moduleDir);
- resetDir(new File(MNAME));
- }
-
- /**
- * Set up an empty directory.
- */
- void resetDir(File dir) {
- if (dir.exists())
- deleteAll(dir);
- dir.mkdirs();
- }
-
- /**
- * Delete a file or a directory (including all its contents).
- */
- boolean deleteAll(File file) {
- if (file.isDirectory()) {
- for (File f: file.listFiles())
- deleteAll(f);
- }
- return file.delete();
- }
-
- /**
- * Report an error.
- */
- void error(String msg, String... more) {
- System.err.println("error: " + msg);
- for (String s: more)
- System.err.println(s);
- errors++;
- }
-
- int count;
- int errors;
- File srcDir = new File("tmp", "src"); // use "tmp" to help avoid accidents
- File classesDir = new File("tmp", "classes");
- File moduleDir = new File("tmp", "modules");
- File resourceDir = new File(srcDir, "resources");
- File natlibDir = new File(srcDir, "natlib");
- File natcmdDir = new File(srcDir, "natcmd");
- File configDir = new File(srcDir, "config");
- String baseDir = System.getProperty("test.src", ".");
-}
diff --git a/jdk/test/org/openjdk/jigsaw/cli/ModuleFormatTest01.sh b/jdk/test/org/openjdk/jigsaw/cli/ModuleFormatTest01.sh
deleted file mode 100755
index c93d611..0000000
--- a/jdk/test/org/openjdk/jigsaw/cli/ModuleFormatTest01.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#! /bin/sh
-
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-
-# @test
-# @run shell ModuleFormatTest01.sh
-# @summary Unit test for jpkg command
-
-set -e
-
-SRC=${TESTSRC:-.}
-BIN=${TESTJAVA:-../../../../../build}/bin
-
-rm -rf keystore.jks
-
-# Create the keystore file and import the root CA cert
-$BIN/keytool -import -keystore keystore.jks -file ${TESTSRC}/ca-cert.pem \
- -noprompt -storepass test123 -alias ca-cert
-
-# Import the signer's private key and cert
-$BIN/javac -source 7 -d . ${TESTSRC}/ImportPrivateKey.java
-$BIN/java -Dtest.src=${TESTSRC} ImportPrivateKey signer \
- signer-prikey.pem RSA signer-cert.pem
-
-$BIN/javac -source 7 -d . ${TESTSRC}/ModuleFormatTest01.java
-$BIN/java -Dorg.openjdk.system.security.cacerts=keystore.jks \
- -Dtest.src=${TESTSRC} ModuleFormatTest01 < ${TESTSRC}/keystore.pw
diff --git a/jdk/test/sun/nio/cs/TestISCII91.java b/jdk/test/sun/nio/cs/TestISCII91.java
deleted file mode 100644
index e043862..0000000
--- a/jdk/test/sun/nio/cs/TestISCII91.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
- @bug 6431650
- @summary Check charset ISCII91 and C2B/B2CISCII91 yield same encoding/decoding result
- */
-
-
-import java.nio.*;
-import java.nio.charset.*;
-import sun.io.*;
-
-public class TestISCII91 {
- public static void main(String[] args) throws Throwable{
- CharToByteConverter c2b = new CharToByteISCII91();
- ByteToCharConverter b2c = new ByteToCharISCII91();
- Charset cs = Charset.forName("ISCII91");
- String charsToEncode = getCharsForEncoding("ISCII91");
-
- byte [] c2bBytes = c2b.convertAll(charsToEncode.toCharArray());
- byte [] csBytes = cs.encode(charsToEncode).array();
- for (int i = 0; i < c2bBytes.length; ++i) {
- if (c2bBytes[i] != csBytes[i])
- throw new RuntimeException("ISCII91 encoding failed!");
- }
-
- char[] c2bChars = b2c.convertAll(c2bBytes);
- char[] csChars = cs.decode(ByteBuffer.wrap(csBytes)).array();
- for (int i = 0; i < c2bChars.length; ++i) {
- if (c2bChars[i] != csChars[i])
- throw new RuntimeException("ISCII91 decoding failed!");
- }
- }
-
-
- static String getCharsForEncoding(String encodingName)
- throws CharacterCodingException{
- Charset set = Charset.forName(encodingName);
- CharBuffer chars = CharBuffer.allocate(300);
- CharsetEncoder encoder = set.newEncoder();
- for (int c = 0; chars.remaining() > 0 && c < Character.MAX_VALUE; ++c) {
- if (Character.isDefined((char) c) && !Character.isISOControl((char) c) && encoder.canEncode((char) c)) {
- chars.put((char) c);
- }
- }
- chars.limit(chars.position());
- chars.rewind();
- return chars.toString();
- }
-}
diff --git a/jdk/test/sun/security/util/BigInt/BigIntEqualsHashCode.java b/jdk/test/sun/security/util/BigInt/BigIntEqualsHashCode.java
deleted file mode 100644
index 5da5752..0000000
--- a/jdk/test/sun/security/util/BigInt/BigIntEqualsHashCode.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @author Gary Ellison
- * @bug 4170635
- * @summary Verify equals()/hashCode() contract honored
- */
-
-import java.io.*;
-import sun.security.util.*;
-
-
-public class BigIntEqualsHashCode {
- public static void main(String[] args) throws Exception {
- BigInt bi1 = new BigInt(12345678);
- BigInt bi2 = new BigInt(12345678);
-
- if ( (bi1.equals(bi2)) == (bi1.hashCode()==bi2.hashCode()) )
- System.out.println("PASSED");
- else
- throw new Exception ("FAILED equals()/hashCode() contract");
-
- }
-}
diff --git a/jdk/test/tools/launcher/DefaultLocaleTest.sh b/jdk/test/tools/launcher/DefaultLocaleTest.sh
deleted file mode 100644
index fdb9de8..0000000
--- a/jdk/test/tools/launcher/DefaultLocaleTest.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4958170 4891531 4989534
-# @summary Test to see if default java locale settings are identical
-# when launch jvm from java and javaw respectively. Test
-# should be run on Windows with different user locale and
-# system locale setting in ControlPanel's RegionSetting.
-# Following 2 testing scenarios are recommended
-# (1)systemLocale=Japanese, userLocale=English
-# (2)systemLocale=English, userLocale=Japanese
-# @run shell DefaultLocaleTest.sh
-#
-# Verify directory context variables are set
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-
-OS=`uname`
-
-case "$OS" in
- Windows* )
- JAVAC="${TESTJAVA}/bin/javac -d . "
- JAVA="${TESTJAVA}/bin/java -classpath . "
- JAVAW="${TESTJAVA}/bin/javaw -classpath . "
-
- ${JAVAC} ${TESTSRC}/DefaultLocaleTest.java
- props=`${JAVA} DefaultLocaleTest`
- ${JAVAW} DefaultLocaleTest $props
- if [ $? -ne 0 ]
- then
- echo "Test fails"
- exit 1
- fi
- echo "Test passes"
- exit 0
- ;;
- CYGWIN* )
- JAVAC="${TESTJAVA}/bin/javac -d . "
- JAVA="${TESTJAVA}/bin/java -classpath . "
- JAVAW="${TESTJAVA}/bin/javaw -classpath . "
-
- ${JAVAC} ${TESTSRC}/DefaultLocaleTest.java
- ${JAVA} DefaultLocaleTest | sed -e s@\\r@@g > x.out
- ${JAVAW} DefaultLocaleTest `cat x.out`
- if [ $? -ne 0 ]
- then
- echo "Test fails"
- exit 1
- fi
- echo "Test passes"
- exit 0
- ;;
- * )
- echo "Non-windows environment; test vacuously succeeds."
- exit 0;
- ;;
-esac
-
-
-
diff --git a/langtools/src/share/classes/com/sun/source/tree/ModuleClassTree.java b/langtools/src/share/classes/com/sun/source/tree/ModuleClassTree.java
deleted file mode 100644
index e1524aa..0000000
--- a/langtools/src/share/classes/com/sun/source/tree/ModuleClassTree.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.source.tree;
-
-import java.util.List;
-import javax.lang.model.element.Name;
-
-public interface ModuleClassTree extends Tree {
- List<? extends Name> getFlags();
- Tree getClassName();
-}
diff --git a/langtools/src/share/classes/com/sun/source/tree/ModuleExportTree.java b/langtools/src/share/classes/com/sun/source/tree/ModuleExportTree.java
deleted file mode 100644
index 1f64cd8..0000000
--- a/langtools/src/share/classes/com/sun/source/tree/ModuleExportTree.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.source.tree;
-
-import java.util.List;
-import javax.lang.model.element.Name;
-
-public interface ModuleExportTree extends Tree {
- List<? extends Name> getFlags();
- Tree getExportName();
-}
diff --git a/langtools/src/share/classes/com/sun/source/tree/ModulePermitsTree.java b/langtools/src/share/classes/com/sun/source/tree/ModulePermitsTree.java
deleted file mode 100644
index 56b6af7..0000000
--- a/langtools/src/share/classes/com/sun/source/tree/ModulePermitsTree.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.source.tree;
-
-import java.util.List;
-
-public interface ModulePermitsTree extends Tree {
- List<? extends ExpressionTree> getModuleNames();
-}
diff --git a/langtools/src/share/classes/com/sun/source/tree/ModuleRequiresTree.java b/langtools/src/share/classes/com/sun/source/tree/ModuleRequiresTree.java
deleted file mode 100644
index 7c4660c..0000000
--- a/langtools/src/share/classes/com/sun/source/tree/ModuleRequiresTree.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.source.tree;
-
-import java.util.List;
-import javax.lang.model.element.Name;
-
-public interface ModuleRequiresTree extends Tree {
- List<? extends Name> getFlags();
- List<? extends ModuleIdTree> getModuleIds();
-}
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/ModuleClass_attribute.java b/langtools/src/share/classes/com/sun/tools/classfile/ModuleClass_attribute.java
deleted file mode 100644
index 493b993..0000000
--- a/langtools/src/share/classes/com/sun/tools/classfile/ModuleClass_attribute.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-import com.sun.tools.classfile.ConstantPool.*;
-
-/**
- * See JSR 294.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ModuleClass_attribute extends Attribute {
- ModuleClass_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- class_index = cr.readUnsignedShort();
- attributes_length = cr.readUnsignedShort();
- attributes = new int[attributes_length];
- for (int i = 0; i < attributes.length; i++)
- attributes[i] = cr.readUnsignedShort();
- }
-
- public ModuleClass_attribute(ConstantPool constant_pool, int class_index, int[] attributes)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.ModuleRequires), class_index, attributes);
- }
-
- public ModuleClass_attribute(int name_index, int class_index, int[] attributes) {
- super(name_index, 2 + attributes.length * 2);
- this.class_index = class_index;
- this.attributes_length = attributes.length;
- this.attributes = attributes;
- }
-
- public CONSTANT_Class_info getClassInfo(ConstantPool constant_pool) throws ConstantPoolException {
- if (class_index == 0)
- return null;
- return constant_pool.getClassInfo(class_index);
- }
-
- public String getClassName(ConstantPool constant_pool) throws ConstantPoolException {
- if (class_index == 0)
- return null;
- return constant_pool.getClassInfo(class_index).getName();
- }
-
- public String[] getClassAttributes(ConstantPool constant_pool) throws ConstantPoolException {
- String[] attrs = new String[attributes.length];
- for (int i = 0; i < attrs.length; i++)
- attrs[i] = constant_pool.getUTF8Value(attributes[i]);
- return attrs;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitModuleClass(this, data);
- }
-
- public final int class_index;
- public final int attributes_length;
- public final int[] attributes;
-}
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/ModuleExport_attribute.java b/langtools/src/share/classes/com/sun/tools/classfile/ModuleExport_attribute.java
deleted file mode 100644
index 978957f..0000000
--- a/langtools/src/share/classes/com/sun/tools/classfile/ModuleExport_attribute.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 294.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ModuleExport_attribute extends Attribute {
- ModuleExport_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- export_length = cr.readUnsignedShort();
- export_table = new Entry[export_length];
- for (int i = 0; i < export_length; i++)
- export_table[i] = new Entry(cr);
- }
-
- public ModuleExport_attribute(ConstantPool constant_pool, Entry[] export_table)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.ModuleExport), export_table);
- }
-
- public ModuleExport_attribute(int name_index, Entry[] export_table) {
- super(name_index, 2 + length(export_table));
- this.export_length = export_table.length;
- this.export_table = export_table;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitModuleExport(this, data);
- }
-
- public final int export_length;
- public final Entry[] export_table;
-
- private static int length(Entry[] export_table) {
- return 2 + export_table.length * Entry.length();
- }
-
- public static class Entry {
- Entry(ClassReader cr) throws IOException {
- export_index = cr.readUnsignedShort();
- flags = cr.readUnsignedByte();
- }
-
- public Entry(int e, int f) {
- export_index = e;
- flags = f;
- }
-
- public static int length() {
- return 3;
- }
-
- public final int export_index;
- public final int flags;
- }
-}
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/ModulePermits_attribute.java b/langtools/src/share/classes/com/sun/tools/classfile/ModulePermits_attribute.java
deleted file mode 100644
index 989e5ae..0000000
--- a/langtools/src/share/classes/com/sun/tools/classfile/ModulePermits_attribute.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 294.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ModulePermits_attribute extends Attribute {
- ModulePermits_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- permits_length = cr.readUnsignedShort();
- permits_table = new int[permits_length];
- for (int i = 0; i < permits_length; i++)
- permits_table[i] = cr.readUnsignedShort();
- }
-
- public ModulePermits_attribute(ConstantPool constant_pool, int[] provides_table)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.ModulePermits), provides_table);
- }
-
- public ModulePermits_attribute(int name_index, int[] permits_table) {
- super(name_index, 2 + 2 * permits_table.length);
- this.permits_length = permits_table.length;
- this.permits_table = permits_table;
- }
-
- public String getPermits(int index, ConstantPool constant_pool) throws ConstantPoolException {
- int permits_index = permits_table[index];
- return constant_pool.getUTF8Value(permits_index);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitModulePermits(this, data);
- }
-
- public final int permits_length;
- public final int[] permits_table;
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/Launcher.java b/langtools/src/share/classes/com/sun/tools/javac/Launcher.java
deleted file mode 100644
index 8c17804..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/Launcher.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac;
-
-import java.io.File;
-import java.util.prefs.Preferences;
-import javax.swing.JFileChooser;
-import javax.tools.JavaCompiler;
-import javax.tools.ToolProvider;
-
-
-/**
- * <b>Unsupported</b> entry point for starting javac from an IDE.
- *
- * <p><b>Note:</b> this class is not available in the JDK. It is not
- * compiled by default and will not be in tools.jar. It is designed
- * to be useful when editing the compiler sources in an IDE (as part
- * of a <em>project</em>). Simply ensure that this class is added to
- * the project and make it the main class of the project.</p>
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- *
- * @author Peter von der Ahé
- * @since 1.6
- */
-class Launcher {
- public static void main(String... args) {
- JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
- JFileChooser fileChooser;
- Preferences prefs = Preferences.userNodeForPackage(Launcher.class);
- if (args.length > 0)
- fileChooser = new JFileChooser(args[0]);
- else {
- String fileName = prefs.get("recent.file", null);
- fileChooser = new JFileChooser();
- if (fileName != null) {
- fileChooser = new JFileChooser();
- fileChooser.setSelectedFile(new File(fileName));
- }
- }
- if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
- String fileName = fileChooser.getSelectedFile().getPath();
- prefs.put("recent.file", fileName);
- javac.run(System.in, null, null, "-d", "/tmp", fileName);
- }
- }
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java b/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java
deleted file mode 100644
index c916e84..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java
+++ /dev/null
@@ -1,769 +0,0 @@
-/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.file;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.LinkedHashSet;
-import java.util.StringTokenizer;
-import java.util.zip.ZipFile;
-import javax.tools.JavaFileManager.Location;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.code.Lint;
-import com.sun.tools.javac.main.OptionName;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Options;
-
-import static javax.tools.StandardLocation.*;
-import static com.sun.tools.javac.main.OptionName.*;
-
-/**
- * This class converts command line arguments, environment variables
- * and system properties (in File.pathSeparator-separated String form)
- * into a boot class path, user class path, and source path (in
- * Collection<PathEntry> form).
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Paths {
-
- /** The context key for the todo list */
- protected static final Context.Key<Paths> pathsKey =
- new Context.Key<Paths>();
-
- /** Get the Paths instance for this context.
- * @param context the context
- * @return the Paths instance for this context
- */
- public static Paths instance(Context context) {
- Paths instance = context.get(pathsKey);
- if (instance == null)
- instance = new Paths(context);
- return instance;
- }
-
- /** The log to use for warning output */
- private Log log;
-
- /** Collection of command-line options */
- private Options options;
-
- /** Handler for -Xlint options */
- private Lint lint;
-
- /** Access to (possibly cached) file info */
- private FSInfo fsInfo;
-
- protected Paths(Context context) {
- context.put(pathsKey, this);
- pathsForLocation = new HashMap<Location,Path>(16);
- setContext(context);
- }
-
- void setContext(Context context) {
- log = Log.instance(context);
- options = Options.instance(context);
- lint = Lint.instance(context);
- fsInfo = FSInfo.instance(context);
- }
-
- /** Whether to warn about non-existent path elements */
- private boolean warn;
-
- private Map<Location, Path> pathsForLocation;
-
- private boolean inited = false; // TODO? caching bad?
-
- /**
- * rt.jar as found on the default bootclass path. If the user specified a
- * bootclasspath, null is used.
- */
- private File defaultBootClassPathRtJar = null;
-
- /**
- * Is bootclasspath the default?
- */
- private boolean isDefaultBootClassPath;
-
- Path getPathForLocation(Location location) {
- Path path = pathsForLocation.get(location);
- if (path == null)
- setPathForLocation(location, null);
- return pathsForLocation.get(location);
- }
-
- void setPathForLocation(Location location, Iterable<? extends File> path) {
- // TODO? if (inited) throw new IllegalStateException
- // TODO: otherwise reset sourceSearchPath, classSearchPath as needed
- Path p;
- if (path == null) {
- if (location == CLASS_PATH)
- p = computeUserClassPath();
- else if (location == PLATFORM_CLASS_PATH)
- p = computeBootClassPath(); // sets isDefaultBootClassPath
- else if (location == ANNOTATION_PROCESSOR_PATH)
- p = computeAnnotationProcessorPath();
- else if (location == SOURCE_PATH)
- p = computeSourcePath();
- else if (location == MODULE_PATH)
- p = computeModulePath();
- else
- // no defaults for other paths
- p = null;
- } else {
- if (location == PLATFORM_CLASS_PATH) {
- defaultBootClassPathRtJar = null;
- isDefaultBootClassPath = false;
- }
- p = new Path();
- for (File f: path)
- p.addFile(f, warn); // TODO: is use of warn appropriate?
- }
- pathsForLocation.put(location, p);
- }
-
- public boolean isDefaultBootClassPath() {
- lazy();
- return isDefaultBootClassPath;
- }
-
- protected void lazy() {
- if (!inited) {
- warn = lint.isEnabled(Lint.LintCategory.PATH);
-
- pathsForLocation.put(PLATFORM_CLASS_PATH, computeBootClassPath());
- pathsForLocation.put(CLASS_PATH, computeUserClassPath());
- pathsForLocation.put(SOURCE_PATH, computeSourcePath());
-
- inited = true;
- }
- }
-
- public Collection<File> bootClassPath() {
- lazy();
- return getPathForLocation(PLATFORM_CLASS_PATH).toFiles();
- }
-
- public Collection<File> userClassPath() {
- lazy();
- return getPathForLocation(CLASS_PATH).toFiles();
- }
-
- public Collection<File> sourcePath() {
- lazy();
- Path p = getPathForLocation(SOURCE_PATH);
- return (p == null || p.size() == 0 ? null : p.toFiles());
- }
-
- boolean isDefaultBootClassPathRtJar(File file) {
- return file.equals(defaultBootClassPathRtJar);
- }
-
- /**
- * Split a path into its elements. Empty path elements will be ignored.
- * @param path The path to be split
- * @return The elements of the path
- */
- private static Iterable<File> getPathEntries(String path) {
- return getPathEntries(path, null);
- }
-
- /**
- * Split a path into its elements. If emptyPathDefault is not null, all
- * empty elements in the path, including empty elements at either end of
- * the path, will be replaced with the value of emptyPathDefault.
- * @param path The path to be split
- * @param emptyPathDefault The value to substitute for empty path elements,
- * or null, to ignore empty path elements
- * @return The elements of the path
- */
- private static Iterable<File> getPathEntries(String path, File emptyPathDefault) {
- ListBuffer<File> entries = new ListBuffer<File>();
- int start = 0;
- while (start <= path.length()) {
- int sep = path.indexOf(File.pathSeparatorChar, start);
- if (sep == -1)
- sep = path.length();
- if (start < sep)
- entries.add(new File(path.substring(start, sep)));
- else if (emptyPathDefault != null)
- entries.add(emptyPathDefault);
- start = sep + 1;
- }
- return entries;
- }
-
- static class PathLocation implements Location {
- final Path path;
- final String name;
- static int count;
-
- PathLocation(Path p) {
- path = p;
- //name = "pathLocation#" + (count++) + p;
- name = "pathLocation#" + (count++) + "(path=" + p + ")";
- }
-
- PathLocation(Path p, String name) {
- path = p;
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isOutputLocation() {
- return false;
- }
-
- @Override
- public String toString() {
- return getName();
- }
- }
-
- class PathEntry {
- PathEntry(File file) {
- this(file, allKinds);
- }
-
- PathEntry(File file, Set<JavaFileObject.Kind> kinds) {
- file.getClass(); // null check
- kinds.getClass(); // null check
- this.file = file;
- this.canonFile = fsInfo.getCanonicalFile(file);
- this.kinds = kinds;
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other)
- return true;
- if (!(other instanceof PathEntry))
- return false;
- PathEntry o = (PathEntry) other;
- return canonFile.equals(o.canonFile) && kinds.equals(o.kinds);
- }
-
- @Override
- public int hashCode() {
- return canonFile.hashCode() + kinds.hashCode();
- }
-
- @Override
- public String toString() {
- if (kinds.equals(allKinds))
- return file.getPath();
- else
- return "" + file + kinds;
- }
-
- final File file;
- final File canonFile;
- final Set<JavaFileObject.Kind> kinds;
- }
-
- private static final Set<JavaFileObject.Kind> allKinds =
- EnumSet.allOf(JavaFileObject.Kind.class);
-
- class Path extends LinkedHashSet<PathEntry> {
- private static final long serialVersionUID = 0;
-
- private boolean expandJarClassPaths = false;
- private Set<File> canonicalValues = new HashSet<File>();
-
- public Path expandJarClassPaths(boolean x) {
- expandJarClassPaths = x;
- return this;
- }
-
- /** What to use when path element is the empty string */
- private File emptyPathDefault = null;
-
- public Path emptyPathDefault(File x) {
- emptyPathDefault = x;
- return this;
- }
-
- /** Notional set of acceptable file kinds for this type of path. */
- private Set<JavaFileObject.Kind> acceptedKinds = EnumSet.allOf(JavaFileObject.Kind.class);
-
- public Path acceptKinds(Set<JavaFileObject.Kind> kinds) {
- acceptedKinds = kinds;
- return this;
- }
-
- /** Add all the jar files found in one or more directories.
- * @param dirs one or more directories separated by path separator char
- * @param whether to generate a warning if a given directory does not exist
- */
- public Path addDirectories(String dirs, boolean warn) {
- boolean prev = expandJarClassPaths;
- expandJarClassPaths = true;
- try {
- if (dirs != null)
- for (File dir : getPathEntries(dirs))
- addDirectory(dir, warn);
- return this;
- } finally {
- expandJarClassPaths = prev;
- }
- }
-
- /** Add all the jar files found in one or more directories.
- * Warnings about non-existent directories are given iff Paths.warn is set.
- * @param dirs one or more directories separated by path separator char
- */
- public Path addDirectories(String dirs) {
- return addDirectories(dirs, warn);
- }
-
- /** Add all the jar files found in a directory.
- * @param dirs one or more directories separated by path separator char
- * @param whether to generate a warning if a given directory does not exist
- */
- private void addDirectory(File dir, boolean warn) {
- if (!dir.isDirectory()) {
- if (warn)
- log.warning(Lint.LintCategory.PATH,
- "dir.path.element.not.found", dir);
- return;
- }
-
- File[] files = dir.listFiles();
- if (files == null)
- return;
-
- for (File direntry : files) {
- if (isArchive(direntry))
- addFile(direntry, warn);
- }
- }
-
- /** Add directories and archive files.
- * @param files one or more directories and archive files separated by path separator char
- * @param whether to generate a warning if a given entry does not exist
- */
- public Path addFiles(String files, boolean warn) {
- if (files != null) {
- for (File file : getPathEntries(files, emptyPathDefault))
- addFile(file, warn);
- }
- return this;
- }
-
- /** Add directories and archive files.
- * Warnings about non-existent directories are given iff Paths.warn is set.
- * @param files one or more directories and archive files separated by path separator char
- */
- public Path addFiles(String files) {
- return addFiles(files, warn);
- }
-
- /** Add a directory or archive file.
- * @param directory or archive file to be added
- * @param whether to generate a warning if the file does not exist
- */
- public void addFile(File file, boolean warn) {
- PathEntry entry = new PathEntry(file, acceptedKinds);
- if (contains(entry)) {
- /* Discard duplicates and avoid infinite recursion */
- return;
- }
-
- if (! fsInfo.exists(file)) {
- /* No such file or directory exists */
- if (warn) {
- log.warning(Lint.LintCategory.PATH,
- "path.element.not.found", file);
- }
- super.add(entry);
- return;
- }
-
- File canonFile = fsInfo.getCanonicalFile(file);
- if (canonicalValues.contains(canonFile)) {
- /* Discard duplicates and avoid infinite recursion */
- return;
- }
-
- if (fsInfo.isFile(file)) {
- /* File is an ordinary file. */
- if (!isArchive(file)) {
- /* Not a recognized extension; open it to see if
- it looks like a valid zip file. */
- try {
- ZipFile z = new ZipFile(file);
- z.close();
- if (warn) {
- log.warning(Lint.LintCategory.PATH,
- "unexpected.archive.file", file);
- }
- } catch (IOException e) {
- // FIXME: include e.getLocalizedMessage in warning
- if (warn) {
- log.warning(Lint.LintCategory.PATH,
- "invalid.archive.file", file);
- }
- return;
- }
- }
- }
-
- /* Now what we have left is either a directory or a file name
- conforming to archive naming convention */
- super.add(entry);
- canonicalValues.add(canonFile);
-
- if (expandJarClassPaths && fsInfo.isFile(file))
- addJarClassPath(file, warn);
- }
-
- // Adds referenced classpath elements from a jar's Class-Path
- // Manifest entry. In some future release, we may want to
- // update this code to recognize URLs rather than simple
- // filenames, but if we do, we should redo all path-related code.
- private void addJarClassPath(File jarFile, boolean warn) {
- try {
- for (File f: fsInfo.getJarClassPath(jarFile)) {
- addFile(f, warn);
- }
- } catch (IOException e) {
- log.error("error.reading.file", jarFile, JavacFileManager.getMessage(e));
- }
- }
-
- void addAll(Iterable<PathEntry> entries, Set<JavaFileObject.Kind> kinds) {
- for (PathEntry e: entries) {
- if (kinds.containsAll(e.kinds))
- add(e);
- else {
- Set<JavaFileObject.Kind> k = EnumSet.copyOf(kinds);
- k.retainAll(e.kinds);
- if (!k.isEmpty())
- add(new PathEntry(e.file, k));
- }
- }
- }
-
- Collection<File> toFiles() {
- List<File> files = List.nil();
- for (PathEntry e: this)
- files = files.prepend(e.file);
- return files.reverse();
- }
-
- // DEBUG
- @Override
- public String toString() {
- return "Path(" + super.toString() + ")";
- }
- }
-
- private Path computeBootClassPath() {
- defaultBootClassPathRtJar = null;
- Path path = new Path();
-
- String bootclasspathOpt = options.get(BOOTCLASSPATH);
- String endorseddirsOpt = options.get(ENDORSEDDIRS);
- String extdirsOpt = options.get(EXTDIRS);
- String xbootclasspathPrependOpt = options.get(XBOOTCLASSPATH_PREPEND);
- String xbootclasspathAppendOpt = options.get(XBOOTCLASSPATH_APPEND);
-
- path.addFiles(xbootclasspathPrependOpt);
-
- if (endorseddirsOpt != null)
- path.addDirectories(endorseddirsOpt);
- else
- path.addDirectories(System.getProperty("java.endorsed.dirs"), false);
-
- if (bootclasspathOpt != null) {
- path.addFiles(bootclasspathOpt);
- } else {
- // Standard system classes for this compiler's release.
- String files = System.getProperty("sun.boot.class.path");
- path.addFiles(files, false);
- File rt_jar = new File("rt.jar");
- for (File file : getPathEntries(files)) {
- if (new File(file.getName()).equals(rt_jar))
- defaultBootClassPathRtJar = file;
- }
- }
-
- path.addFiles(xbootclasspathAppendOpt);
-
- // Strictly speaking, standard extensions are not bootstrap
- // classes, but we treat them identically, so we'll pretend
- // that they are.
- if (extdirsOpt != null)
- path.addDirectories(extdirsOpt);
- else
- path.addDirectories(System.getProperty("java.ext.dirs"), false);
-
- isDefaultBootClassPath =
- (xbootclasspathPrependOpt == null) &&
- (bootclasspathOpt == null) &&
- (xbootclasspathAppendOpt == null);
-
- return path;
- }
-
- private Path computeUserClassPath() {
- String cp = options.get(CLASSPATH);
-
- // CLASSPATH environment variable when run from `javac'.
- if (cp == null) cp = System.getProperty("env.class.path");
-
- // If invoked via a java VM (not the javac launcher), use the
- // platform class path
- if (cp == null && System.getProperty("application.home") == null)
- cp = System.getProperty("java.class.path");
-
- // Default to current working directory.
- if (cp == null) cp = ".";
-
- return new Path()
- .expandJarClassPaths(true) // Only search user jars for Class-Paths
- .emptyPathDefault(new File(".")) // Empty path elt ==> current directory
- .addFiles(cp);
- }
-
- private Path computeSourcePath() {
- String sourcePathArg = options.get(SOURCEPATH);
- if (sourcePathArg == null)
- return null;
-
- return new Path().addFiles(sourcePathArg);
- }
-
- private Path computeModulePath() {
- String modulePathArg = options.get(MODULEPATH);
- if (modulePathArg == null)
- return null;
-
- return new Path().addFiles(modulePathArg);
- }
-
- private Path computeAnnotationProcessorPath() {
- String processorPathArg = options.get(PROCESSORPATH);
- if (processorPathArg == null)
- return null;
-
- return new Path().addFiles(processorPathArg);
- }
-
- /** The actual effective locations searched for sources */
- private Path sourceSearchPath;
-
- Collection<PathEntry> sourceSearchPath() {
- if (sourceSearchPath == null) {
- lazy();
- Path sourcePath = getPathForLocation(SOURCE_PATH);
- Path userClassPath = getPathForLocation(CLASS_PATH);
- sourceSearchPath = sourcePath != null ? sourcePath : userClassPath;
- }
- return Collections.unmodifiableCollection(sourceSearchPath);
- }
-
- /** The actual effective locations searched for classes */
- private Path classSearchPath;
-
- Collection<PathEntry> classSearchPath() {
- if (classSearchPath == null) {
- lazy();
- Path bootClassPath = getPathForLocation(PLATFORM_CLASS_PATH);
- Path userClassPath = getPathForLocation(CLASS_PATH);
- classSearchPath = new Path();
- classSearchPath.addAll(bootClassPath);
- classSearchPath.addAll(userClassPath);
- }
- return Collections.unmodifiableCollection(classSearchPath);
- }
-
- /** The actual effective locations for non-source, non-class files */
- private Path otherSearchPath;
-
- Collection<PathEntry> otherSearchPath() {
- if (otherSearchPath == null) {
- lazy();
- Path userClassPath = getPathForLocation(CLASS_PATH);
- Path sourcePath = getPathForLocation(SOURCE_PATH);
- if (sourcePath == null)
- otherSearchPath = userClassPath;
- else {
- otherSearchPath = new Path();
- otherSearchPath.addAll(userClassPath);
- otherSearchPath.addAll(sourcePath);
- }
- }
- return Collections.unmodifiableCollection(otherSearchPath);
- }
-
- /**
- * Get any classes that should appear before the main platform classes.
- * For compatibility, this is the classes defined by -Xbootclasspath/p:
- * and the contents of the endorsed directories.
- * See computeBootClassPath() for the full definition of the legacy
- * platform class path.
- */
- Path getPlatformPathPrepend() {
- //return getPathForOption(XBOOTCLASSPATH_PREPEND, EnumSet.of(JavaFileObject.Kind.CLASS));
- Path path = new Path().acceptKinds(EnumSet.of(JavaFileObject.Kind.CLASS));
-
- path.addFiles(options.get(XBOOTCLASSPATH_PREPEND));
-
- String optionValue;
- if ((optionValue = options.get(ENDORSEDDIRS)) != null)
- path.addDirectories(optionValue);
- else
- path.addDirectories(System.getProperty("java.endorsed.dirs"), false);
-
- return (path.size() == 0 ? null : path);
- }
-
- /**
- * Get the main platform classes.
- * For now, this is just the classes defined by -bootclasspath or -Xbootclasspath.
- * See computeBootClassPath() for the full definition of the legacy
- * platform class path.
- */
- Path getPlatformPathBase() {
- return getPathForOption(BOOTCLASSPATH, EnumSet.of(JavaFileObject.Kind.CLASS));
- }
-
- /**
- * Get any classes that should appear after the main platform classes.
- * For compatibility, this is the classes defined by -Xbootclasspath/a:
- * and the contents of the extension directories.
- * See computeBootClassPath() for the full definition of the legacy
- * platform class path.
- */
- Path getPlatformPathAppend() {
- //return getPathForOption(XBOOTCLASSPATH_APPEND, EnumSet.of(JavaFileObject.Kind.CLASS));
- Path path = new Path().acceptKinds(EnumSet.of(JavaFileObject.Kind.CLASS));
-
- path.addFiles(options.get(XBOOTCLASSPATH_APPEND));
-
- // Strictly speaking, standard extensions are not bootstrap
- // classes, but we treat them identically, so we'll pretend
- // that they are.
- String optionValue;
- if ((optionValue = options.get(EXTDIRS)) != null)
- path.addDirectories(optionValue);
- else
- path.addDirectories(System.getProperty("java.ext.dirs"), false);
-
- return (path.size() == 0 ? null : path);
- }
-
- private Path getPathForOption(OptionName o, Set<JavaFileObject.Kind> kinds) {
- String v = options.get(o);
- if (v == null)
- return null;
-
- return new Path().acceptKinds(kinds).addFiles(v);
- }
-
- /** Is this the name of an archive file? */
- private boolean isArchive(File file) {
- String n = file.getName().toLowerCase();
- return fsInfo.isFile(file)
- && (n.endsWith(".jar") || n.endsWith(".zip"));
- }
-
- /**
- * Utility method for converting a search path string to an array
- * of directory and JAR file URLs.
- *
- * Note that this method is called by apt and the DocletInvoker.
- *
- * @param path the search path string
- * @return the resulting array of directory and JAR file URLs
- */
- public static URL[] pathToURLs(String path) {
- StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
- URL[] urls = new URL[st.countTokens()];
- int count = 0;
- while (st.hasMoreTokens()) {
- URL url = fileToURL(new File(st.nextToken()));
- if (url != null) {
- urls[count++] = url;
- }
- }
- if (urls.length != count) {
- URL[] tmp = new URL[count];
- System.arraycopy(urls, 0, tmp, 0, count);
- urls = tmp;
- }
- return urls;
- }
-
- /**
- * Returns the directory or JAR file URL corresponding to the specified
- * local file name.
- *
- * @param file the File object
- * @return the resulting directory or JAR file URL, or null if unknown
- */
- private static URL fileToURL(File file) {
- String name;
- try {
- name = file.getCanonicalPath();
- } catch (IOException e) {
- name = file.getAbsolutePath();
- }
- name = name.replace(File.separatorChar, '/');
- if (!name.startsWith("/")) {
- name = "/" + name;
- }
- // If the file does not exist, then assume that it's a directory
- if (!file.isFile()) {
- name = name + "/";
- }
- try {
- return new URL("file", "", name);
- } catch (MalformedURLException e) {
- throw new IllegalArgumentException(file.toString());
- }
- }
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/JavacOption.java b/langtools/src/share/classes/com/sun/tools/javac/main/JavacOption.java
deleted file mode 100644
index e39793d..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavacOption.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.main;
-
-import java.io.PrintWriter;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Options;
-
-/**
- * TODO: describe com.sun.tools.javac.main.JavacOption
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public interface JavacOption {
-
- OptionKind getKind();
-
- /** Does this option take a (separate) operand?
- * @return true if this option takes a separate operand
- */
- boolean hasArg();
-
- /** Does argument string match option pattern?
- * @param arg the command line argument string
- * @return true if {@code arg} matches this option
- */
- boolean matches(String arg);
-
- /** Process an option with an argument.
- * @param options the accumulated set of analyzed options
- * @param option the option to be processed
- * @param arg the arg for the option to be processed
- * @return true if an error was detected
- */
- boolean process(Options options, String option, String arg);
-
- /** Process the option with no argument.
- * @param options the accumulated set of analyzed options
- * @param option the option to be processed
- * @return true if an error was detected
- */
- boolean process(Options options, String option);
-
- OptionName getName();
-
- enum OptionKind {
- NORMAL,
- EXTENDED,
- HIDDEN,
- }
-
- enum ChoiceKind {
- ONEOF,
- ANYOF
- }
-
- /** This class represents an option recognized by the main program
- */
- static class Option implements JavacOption {
-
- /** Option string.
- */
- OptionName name;
-
- /** Documentation key for arguments.
- */
- String argsNameKey;
-
- /** Documentation key for description.
- */
- String descrKey;
-
- /** Suffix option (-foo=bar or -foo:bar)
- */
- boolean hasSuffix;
-
- /** The kind of choices for this option, if any.
- */
- ChoiceKind choiceKind;
-
- /** The choices for this option, if any, and whether or not the choices
- * are hidden
- */
- Map<String,Boolean> choices;
-
- Option(OptionName name, String argsNameKey, String descrKey) {
- this.name = name;
- this.argsNameKey = argsNameKey;
- this.descrKey = descrKey;
- char lastChar = name.optionName.charAt(name.optionName.length()-1);
- hasSuffix = lastChar == ':' || lastChar == '=';
- }
-
- Option(OptionName name, String descrKey) {
- this(name, null, descrKey);
- }
-
- Option(OptionName name, String descrKey, ChoiceKind choiceKind, String... choices) {
- this(name, descrKey, choiceKind, createChoices(choices));
- }
-
- private static Map<String,Boolean> createChoices(String... choices) {
- Map<String,Boolean> map = new LinkedHashMap<String,Boolean>();
- for (String c: choices)
- map.put(c, false);
- return map;
- }
-
- Option(OptionName name, String descrKey, ChoiceKind choiceKind,
- Map<String,Boolean> choices) {
- this(name, null, descrKey);
- if (choiceKind == null || choices == null)
- throw new NullPointerException();
- this.choiceKind = choiceKind;
- this.choices = choices;
- }
-
- @Override
- public String toString() {
- return name.optionName;
- }
-
- public boolean hasArg() {
- return argsNameKey != null && !hasSuffix;
- }
-
- public boolean matches(String option) {
- if (!hasSuffix)
- return option.equals(name.optionName);
-
- if (!option.startsWith(name.optionName))
- return false;
-
- if (choices != null) {
- String arg = option.substring(name.optionName.length());
- if (choiceKind == ChoiceKind.ONEOF)
- return choices.keySet().contains(arg);
- else {
- for (String a: arg.split(",+")) {
- if (!choices.keySet().contains(a))
- return false;
- }
- }
- }
-
- return true;
- }
-
- /** Print a line of documentation describing this option, if standard.
- * @param out the stream to which to write the documentation
- */
- void help(PrintWriter out) {
- String s = " " + helpSynopsis();
- out.print(s);
- for (int j = Math.min(s.length(), 28); j < 29; j++) out.print(" ");
- Log.printLines(out, Main.getLocalizedString(descrKey));
- }
-
- String helpSynopsis() {
- StringBuilder sb = new StringBuilder();
- sb.append(name);
- if (argsNameKey == null) {
- if (choices != null) {
- String sep = "{";
- for (Map.Entry<String,Boolean> e: choices.entrySet()) {
- if (!e.getValue()) {
- sb.append(sep);
- sb.append(e.getKey());
- sep = ",";
- }
- }
- sb.append("}");
- }
- } else {
- if (!hasSuffix)
- sb.append(" ");
- sb.append(Main.getLocalizedString(argsNameKey));
- }
-
- return sb.toString();
- }
-
- /** Print a line of documentation describing this option, if non-standard.
- * @param out the stream to which to write the documentation
- */
- void xhelp(PrintWriter out) {}
-
- /** Process the option (with arg). Return true if error detected.
- */
- public boolean process(Options options, String option, String arg) {
- if (options != null) {
- if (choices != null) {
- if (choiceKind == ChoiceKind.ONEOF) {
- // some clients like to see just one of option+choice set
- for (String s: choices.keySet())
- options.remove(option + s);
- String opt = option + arg;
- options.put(opt, opt);
- // some clients like to see option (without trailing ":")
- // set to arg
- String nm = option.substring(0, option.length() - 1);
- options.put(nm, arg);
- } else {
- // set option+word for each word in arg
- for (String a: arg.split(",+")) {
- String opt = option + a;
- options.put(opt, opt);
- }
- }
- }
- options.put(option, arg);
- }
- return false;
- }
-
- /** Process the option (without arg). Return true if error detected.
- */
- public boolean process(Options options, String option) {
- if (hasSuffix)
- return process(options, name.optionName, option.substring(name.optionName.length()));
- else
- return process(options, option, option);
- }
-
- public OptionKind getKind() { return OptionKind.NORMAL; }
-
- public OptionName getName() { return name; }
- };
-
- /** A nonstandard or extended (-X) option
- */
- static class XOption extends Option {
- XOption(OptionName name, String argsNameKey, String descrKey) {
- super(name, argsNameKey, descrKey);
- }
- XOption(OptionName name, String descrKey) {
- this(name, null, descrKey);
- }
- XOption(OptionName name, String descrKey, ChoiceKind kind, String... choices) {
- super(name, descrKey, kind, choices);
- }
- XOption(OptionName name, String descrKey, ChoiceKind kind, Map<String,Boolean> choices) {
- super(name, descrKey, kind, choices);
- }
- @Override
- void help(PrintWriter out) {}
- @Override
- void xhelp(PrintWriter out) { super.help(out); }
- @Override
- public OptionKind getKind() { return OptionKind.EXTENDED; }
- };
-
- /** A hidden (implementor) option
- */
- static class HiddenOption extends Option {
- HiddenOption(OptionName name) {
- super(name, null, null);
- }
- HiddenOption(OptionName name, String argsNameKey) {
- super(name, argsNameKey, null);
- }
- @Override
- void help(PrintWriter out) {}
- @Override
- void xhelp(PrintWriter out) {}
- @Override
- public OptionKind getKind() { return OptionKind.HIDDEN; }
- };
-
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/OptionName.java b/langtools/src/share/classes/com/sun/tools/javac/main/OptionName.java
deleted file mode 100644
index 1149971..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/main/OptionName.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.main;
-
-
-/**
- * TODO: describe com.sun.tools.javac.main.OptionName
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public enum OptionName {
- G("-g"),
- G_NONE("-g:none"),
- G_CUSTOM("-g:"),
- XLINT("-Xlint"),
- XLINT_CUSTOM("-Xlint:"),
- DIAGS("-XDdiags="),
- NOWARN("-nowarn"),
- VERBOSE("-verbose"),
- DEPRECATION("-deprecation"),
- CLASSPATH("-classpath"),
- CP("-cp"),
- SOURCEPATH("-sourcepath"),
- BOOTCLASSPATH("-bootclasspath"),
- XBOOTCLASSPATH_PREPEND("-Xbootclasspath/p:"),
- XBOOTCLASSPATH_APPEND("-Xbootclasspath/a:"),
- XBOOTCLASSPATH("-Xbootclasspath:"),
- MODULEPATH("-modulepath"),
- EXTDIRS("-extdirs"),
- DJAVA_EXT_DIRS("-Djava.ext.dirs="),
- ENDORSEDDIRS("-endorseddirs"),
- DJAVA_ENDORSED_DIRS("-Djava.endorsed.dirs="),
- PROC("-proc:"),
- PROCESSOR("-processor"),
- PROCESSORPATH("-processorpath"),
- D("-d"),
- S("-s"),
- IMPLICIT("-implicit:"),
- ENCODING("-encoding"),
- SOURCE("-source"),
- TARGET("-target"),
- VERSION("-version"),
- FULLVERSION("-fullversion"),
- HELP("-help"),
- A("-A"),
- X("-X"),
- J("-J"),
- MOREINFO("-moreinfo"),
- WERROR("-Werror"),
- COMPLEXINFERENCE("-complexinference"),
- PROMPT("-prompt"),
- DOE("-doe"),
- PRINTSOURCE("-printsource"),
- WARNUNCHECKED("-warnunchecked"),
- XMAXERRS("-Xmaxerrs"),
- XMAXWARNS("-Xmaxwarns"),
- XSTDOUT("-Xstdout"),
- XPKGINFO("-Xpkginfo:"),
- XPRINT("-Xprint"),
- XPRINTROUNDS("-XprintRounds"),
- XPRINTPROCESSORINFO("-XprintProcessorInfo"),
- XPREFER("-Xprefer:"),
- O("-O"),
- XJCOV("-Xjcov"),
- XD("-XD"),
- AT("@"),
- SOURCEFILE("sourcefile"),
- L("-L");
-
- public final String optionName;
-
- OptionName(String optionName) {
- this.optionName = optionName;
- }
-
- @Override
- public String toString() {
- return optionName;
- }
-
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java b/langtools/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java
deleted file mode 100644
index bc209b2..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java
+++ /dev/null
@@ -1,660 +0,0 @@
-/*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.main;
-
-import com.sun.tools.javac.code.Lint;
-import com.sun.tools.javac.code.Source;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.jvm.Target;
-import com.sun.tools.javac.main.JavacOption.HiddenOption;
-import com.sun.tools.javac.main.JavacOption.Option;
-import com.sun.tools.javac.main.JavacOption.XOption;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Options;
-import com.sun.tools.javac.processing.JavacProcessingEnvironment;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.EnumSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import javax.lang.model.SourceVersion;
-
-import static com.sun.tools.javac.main.OptionName.*;
-
-/**
- * TODO: describe com.sun.tools.javac.main.RecognizedOptions
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public class RecognizedOptions {
-
- private RecognizedOptions() {}
-
- public interface OptionHelper {
-
- void setOut(PrintWriter out);
-
- void error(String key, Object... args);
-
- void printVersion();
-
- void printFullVersion();
-
- void printHelp();
-
- void printXhelp();
-
- void addFile(File f);
-
- void addClassName(String s);
-
- }
-
- public static class GrumpyHelper implements OptionHelper {
-
- public void setOut(PrintWriter out) {
- throw new IllegalArgumentException();
- }
-
- public void error(String key, Object... args) {
- throw new IllegalArgumentException(Main.getLocalizedString(key, args));
- }
-
- public void printVersion() {
- throw new IllegalArgumentException();
- }
-
- public void printFullVersion() {
- throw new IllegalArgumentException();
- }
-
- public void printHelp() {
- throw new IllegalArgumentException();
- }
-
- public void printXhelp() {
- throw new IllegalArgumentException();
- }
-
- public void addFile(File f) {
- throw new IllegalArgumentException(f.getPath());
- }
-
- public void addClassName(String s) {
- throw new IllegalArgumentException(s);
- }
-
- }
-
- static Set<OptionName> javacOptions = EnumSet.of(
- G,
- G_NONE,
- G_CUSTOM,
- XLINT,
- XLINT_CUSTOM,
- NOWARN,
- VERBOSE,
- DEPRECATION,
- CLASSPATH,
- CP,
- SOURCEPATH,
- BOOTCLASSPATH,
- XBOOTCLASSPATH_PREPEND,
- XBOOTCLASSPATH_APPEND,
- XBOOTCLASSPATH,
- MODULEPATH,
- EXTDIRS,
- DJAVA_EXT_DIRS,
- ENDORSEDDIRS,
- DJAVA_ENDORSED_DIRS,
- PROC,
- PROCESSOR,
- PROCESSORPATH,
- D,
- S,
- IMPLICIT,
- ENCODING,
- SOURCE,
- TARGET,
- VERSION,
- FULLVERSION,
- DIAGS,
- HELP,
- A,
- X,
- J,
- MOREINFO,
- WERROR,
- // COMPLEXINFERENCE,
- PROMPT,
- DOE,
- PRINTSOURCE,
- WARNUNCHECKED,
- XMAXERRS,
- XMAXWARNS,
- XSTDOUT,
- XPKGINFO,
- XPRINT,
- XPRINTROUNDS,
- XPRINTPROCESSORINFO,
- XPREFER,
- O,
- XJCOV,
- XD,
- AT,
- SOURCEFILE,
- L);
-
- static Set<OptionName> javacFileManagerOptions = EnumSet.of(
- CLASSPATH,
- CP,
- SOURCEPATH,
- BOOTCLASSPATH,
- XBOOTCLASSPATH_PREPEND,
- XBOOTCLASSPATH_APPEND,
- XBOOTCLASSPATH,
- MODULEPATH,
- EXTDIRS,
- DJAVA_EXT_DIRS,
- ENDORSEDDIRS,
- DJAVA_ENDORSED_DIRS,
- PROCESSORPATH,
- D,
- S,
- ENCODING,
- SOURCE);
-
- static Set<OptionName> javacToolOptions = EnumSet.of(
- G,
- G_NONE,
- G_CUSTOM,
- XLINT,
- XLINT_CUSTOM,
- NOWARN,
- VERBOSE,
- DEPRECATION,
- PROC,
- PROCESSOR,
- IMPLICIT,
- SOURCE,
- TARGET,
- // VERSION,
- // FULLVERSION,
- // HELP,
- A,
- // X,
- // J,
- MOREINFO,
- WERROR,
- // COMPLEXINFERENCE,
- PROMPT,
- DOE,
- PRINTSOURCE,
- WARNUNCHECKED,
- XMAXERRS,
- XMAXWARNS,
- // XSTDOUT,
- XPKGINFO,
- XPRINT,
- XPRINTROUNDS,
- XPRINTPROCESSORINFO,
- XPREFER,
- O,
- XJCOV,
- XD);
-
- static Option[] getJavaCompilerOptions(OptionHelper helper) {
- return getOptions(helper, javacOptions);
- }
-
- public static Option[] getJavacFileManagerOptions(OptionHelper helper) {
- return getOptions(helper, javacFileManagerOptions);
- }
-
- public static Option[] getJavacToolOptions(OptionHelper helper) {
- return getOptions(helper, javacToolOptions);
- }
-
- static Option[] getOptions(OptionHelper helper, Set<OptionName> desired) {
- ListBuffer<Option> options = new ListBuffer<Option>();
- for (Option option : getAll(helper))
- if (desired.contains(option.getName()))
- options.append(option);
- return options.toArray(new Option[options.length()]);
- }
-
- /**
- * Get all the recognized options.
- * @param helper an {@code OptionHelper} to help when processing options
- * @return an array of options
- */
- public static Option[] getAll(final OptionHelper helper) {
- return new Option[] {
- new Option(G, "opt.g"),
- new Option(G_NONE, "opt.g.none") {
- @Override
- public boolean process(Options options, String option) {
- options.put("-g:", "none");
- return false;
- }
- },
-
- new Option(G_CUSTOM, "opt.g.lines.vars.source",
- Option.ChoiceKind.ANYOF, "lines", "vars", "source"),
-
- new XOption(XLINT, "opt.Xlint"),
- new XOption(XLINT_CUSTOM, "opt.Xlint.suboptlist",
- Option.ChoiceKind.ANYOF, getXLintChoices()),
-
- // -nowarn is retained for command-line backward compatibility
- new Option(NOWARN, "opt.nowarn") {
- @Override
- public boolean process(Options options, String option) {
- options.put("-Xlint:none", option);
- return false;
- }
- },
-
- new Option(VERBOSE, "opt.verbose"),
-
- // -deprecation is retained for command-line backward compatibility
- new Option(DEPRECATION, "opt.deprecation") {
- @Override
- public boolean process(Options options, String option) {
- options.put("-Xlint:deprecation", option);
- return false;
- }
- },
-
- new Option(CLASSPATH, "opt.arg.path", "opt.classpath"),
- new Option(CP, "opt.arg.path", "opt.classpath") {
- @Override
- public boolean process(Options options, String option, String arg) {
- return super.process(options, "-classpath", arg);
- }
- },
- new Option(SOURCEPATH, "opt.arg.path", "opt.sourcepath"),
- new Option(BOOTCLASSPATH, "opt.arg.path", "opt.bootclasspath") {
- @Override
- public boolean process(Options options, String option, String arg) {
- options.remove("-Xbootclasspath/p:");
- options.remove("-Xbootclasspath/a:");
- return super.process(options, option, arg);
- }
- },
- new XOption(XBOOTCLASSPATH_PREPEND,"opt.arg.path", "opt.Xbootclasspath.p"),
- new XOption(XBOOTCLASSPATH_APPEND, "opt.arg.path", "opt.Xbootclasspath.a"),
- new XOption(XBOOTCLASSPATH, "opt.arg.path", "opt.bootclasspath") {
- @Override
- public boolean process(Options options, String option, String arg) {
- options.remove("-Xbootclasspath/p:");
- options.remove("-Xbootclasspath/a:");
- return super.process(options, "-bootclasspath", arg);
- }
- },
- new Option(MODULEPATH, "opt.arg.path", "opt.modulepath") {
- // TEMP HACK FOR JIGSAW TO AUTO-DEFAULT -source TO 7 WHEN -modulepath
- // IS USED. REMOVE WHEN -source 7 IS THE DEFAULT
- @Override
- public boolean process(Options options, String option, String arg) {
- options.put("jigsaw.source", "7");
- return super.process(options, option, arg);
- }
- },
- new Option(L, "opt.arg.library", "opt.L"),
- new Option(EXTDIRS, "opt.arg.dirs", "opt.extdirs"),
- new XOption(DJAVA_EXT_DIRS, "opt.arg.dirs", "opt.extdirs") {
- @Override
- public boolean process(Options options, String option, String arg) {
- return super.process(options, "-extdirs", arg);
- }
- },
- new Option(ENDORSEDDIRS, "opt.arg.dirs", "opt.endorseddirs"),
- new XOption(DJAVA_ENDORSED_DIRS, "opt.arg.dirs", "opt.endorseddirs") {
- @Override
- public boolean process(Options options, String option, String arg) {
- return super.process(options, "-endorseddirs", arg);
- }
- },
- new Option(PROC, "opt.proc.none.only",
- Option.ChoiceKind.ONEOF, "none", "only"),
- new Option(PROCESSOR, "opt.arg.class.list", "opt.processor"),
- new Option(PROCESSORPATH, "opt.arg.path", "opt.processorpath"),
- new Option(D, "opt.arg.directory", "opt.d"),
- new Option(S, "opt.arg.directory", "opt.sourceDest"),
- new Option(IMPLICIT, "opt.implicit",
- Option.ChoiceKind.ONEOF, "none", "class"),
- new Option(ENCODING, "opt.arg.encoding", "opt.encoding"),
- new Option(SOURCE, "opt.arg.release", "opt.source") {
- @Override
- public boolean process(Options options, String option, String operand) {
- Source source = Source.lookup(operand);
- if (source == null) {
- helper.error("err.invalid.source", operand);
- return true;
- }
- return super.process(options, option, operand);
- }
- },
- new Option(TARGET, "opt.arg.release", "opt.target") {
- @Override
- public boolean process(Options options, String option, String operand) {
- Target target = Target.lookup(operand);
- if (target == null) {
- helper.error("err.invalid.target", operand);
- return true;
- }
- return super.process(options, option, operand);
- }
- },
- new Option(VERSION, "opt.version") {
- @Override
- public boolean process(Options options, String option) {
- helper.printVersion();
- return super.process(options, option);
- }
- },
- new HiddenOption(FULLVERSION) {
- @Override
- public boolean process(Options options, String option) {
- helper.printFullVersion();
- return super.process(options, option);
- }
- },
- new HiddenOption(DIAGS) {
- @Override
- public boolean process(Options options, String option) {
- Option xd = getOptions(helper, EnumSet.of(XD))[0];
- option = option.substring(option.indexOf('=') + 1);
- String diagsOption = option.contains("%") ?
- "-XDdiagsFormat=" :
- "-XDdiags=";
- diagsOption += option;
- if (xd.matches(diagsOption))
- return xd.process(options, diagsOption);
- else
- return false;
- }
- },
- new Option(HELP, "opt.help") {
- @Override
- public boolean process(Options options, String option) {
- helper.printHelp();
- return super.process(options, option);
- }
- },
- new Option(A, "opt.arg.key.equals.value","opt.A") {
- @Override
- String helpSynopsis() {
- hasSuffix = true;
- return super.helpSynopsis();
- }
-
- @Override
- public boolean matches(String arg) {
- return arg.startsWith("-A");
- }
-
- @Override
- public boolean hasArg() {
- return false;
- }
- // Mapping for processor options created in
- // JavacProcessingEnvironment
- @Override
- public boolean process(Options options, String option) {
- int argLength = option.length();
- if (argLength == 2) {
- helper.error("err.empty.A.argument");
- return true;
- }
- int sepIndex = option.indexOf('=');
- String key = option.substring(2, (sepIndex != -1 ? sepIndex : argLength) );
- if (!JavacProcessingEnvironment.isValidOptionName(key)) {
- helper.error("err.invalid.A.key", option);
- return true;
- }
- return process(options, option, option);
- }
- },
- new Option(X, "opt.X") {
- @Override
- public boolean process(Options options, String option) {
- helper.printXhelp();
- return super.process(options, option);
- }
- },
-
- // This option exists only for the purpose of documenting itself.
- // It's actually implemented by the launcher.
- new Option(J, "opt.arg.flag", "opt.J") {
- @Override
- String helpSynopsis() {
- hasSuffix = true;
- return super.helpSynopsis();
- }
- @Override
- public boolean process(Options options, String option) {
- throw new AssertionError
- ("the -J flag should be caught by the launcher.");
- }
- },
-
- // stop after parsing and attributing.
- // new HiddenOption("-attrparseonly"),
-
- // new Option("-moreinfo", "opt.moreinfo") {
- new HiddenOption(MOREINFO) {
- @Override
- public boolean process(Options options, String option) {
- Type.moreInfo = true;
- return super.process(options, option);
- }
- },
-
- // treat warnings as errors
- new Option(WERROR, "opt.Werror"),
-
- // use complex inference from context in the position of a method call argument
- new HiddenOption(COMPLEXINFERENCE),
-
- // generare source stubs
- // new HiddenOption("-stubs"),
-
- // relax some constraints to allow compiling from stubs
- // new HiddenOption("-relax"),
-
- // output source after translating away inner classes
- // new Option("-printflat", "opt.printflat"),
- // new HiddenOption("-printflat"),
-
- // display scope search details
- // new Option("-printsearch", "opt.printsearch"),
- // new HiddenOption("-printsearch"),
-
- // prompt after each error
- // new Option("-prompt", "opt.prompt"),
- new HiddenOption(PROMPT),
-
- // dump stack on error
- new HiddenOption(DOE),
-
- // output source after type erasure
- // new Option("-s", "opt.s"),
- new HiddenOption(PRINTSOURCE),
-
- // output shrouded class files
- // new Option("-scramble", "opt.scramble"),
- // new Option("-scrambleall", "opt.scrambleall"),
-
- // display warnings for generic unchecked operations
- new HiddenOption(WARNUNCHECKED) {
- @Override
- public boolean process(Options options, String option) {
- options.put("-Xlint:unchecked", option);
- return false;
- }
- },
-
- new XOption(XMAXERRS, "opt.arg.number", "opt.maxerrs"),
- new XOption(XMAXWARNS, "opt.arg.number", "opt.maxwarns"),
- new XOption(XSTDOUT, "opt.arg.file", "opt.Xstdout") {
- @Override
- public boolean process(Options options, String option, String arg) {
- try {
- helper.setOut(new PrintWriter(new FileWriter(arg), true));
- } catch (java.io.IOException e) {
- helper.error("err.error.writing.file", arg, e);
- return true;
- }
- return super.process(options, option, arg);
- }
- },
-
- new XOption(XPRINT, "opt.print"),
-
- new XOption(XPRINTROUNDS, "opt.printRounds"),
-
- new XOption(XPRINTPROCESSORINFO, "opt.printProcessorInfo"),
-
- new XOption(XPREFER, "opt.prefer",
- Option.ChoiceKind.ONEOF, "source", "newer"),
-
- new XOption(XPKGINFO, "opt.pkginfo",
- Option.ChoiceKind.ONEOF, "always", "legacy", "nonempty"),
-
- /* -O is a no-op, accepted for backward compatibility. */
- new HiddenOption(O),
-
- /* -Xjcov produces tables to support the code coverage tool jcov. */
- new HiddenOption(XJCOV),
-
- /* This is a back door to the compiler's option table.
- * -XDx=y sets the option x to the value y.
- * -XDx sets the option x to the value x.
- */
- new HiddenOption(XD) {
- String s;
- @Override
- public boolean matches(String s) {
- this.s = s;
- return s.startsWith(name.optionName);
- }
- @Override
- public boolean process(Options options, String option) {
- s = s.substring(name.optionName.length());
- int eq = s.indexOf('=');
- String key = (eq < 0) ? s : s.substring(0, eq);
- String value = (eq < 0) ? s : s.substring(eq+1);
- options.put(key, value);
- return false;
- }
- },
-
- // This option exists only for the purpose of documenting itself.
- // It's actually implemented by the CommandLine class.
- new Option(AT, "opt.arg.file", "opt.AT") {
- @Override
- String helpSynopsis() {
- hasSuffix = true;
- return super.helpSynopsis();
- }
- @Override
- public boolean process(Options options, String option) {
- throw new AssertionError
- ("the @ flag should be caught by CommandLine.");
- }
- },
-
- /*
- * TODO: With apt, the matches method accepts anything if
- * -XclassAsDecls is used; code elsewhere does the lookup to
- * see if the class name is both legal and found.
- *
- * In apt, the process method adds the candidate class file
- * name to a separate list.
- */
- new HiddenOption(SOURCEFILE) {
- String s;
- @Override
- public boolean matches(String s) {
- this.s = s;
- return s.endsWith(".java") // Java source file
- || SourceVersion.isName(s); // Legal type name
- }
- @Override
- public boolean process(Options options, String option) {
- if (s.endsWith(".java") ) {
- File f = new File(s);
- if (!f.exists()) {
- helper.error("err.file.not.found", f);
- return true;
- }
- if (!f.isFile()) {
- helper.error("err.file.not.file", f);
- return true;
- }
- // TEMP HACK FOR JIGSAW TO AUTO-DEFAULT -source TO 7 WHEN
- // module-info.java USED. REMOVE WHEN -source 7 IS THE DEFAULT
- if (f.getName().equals("module-info.java"))
- options.put("jigsaw.source", "7");
- helper.addFile(f);
- }
- else
- helper.addClassName(s);
- return false;
- }
- },
- };
- }
-
- public enum PkgInfo {
- ALWAYS, LEGACY, NONEMPTY;
- public static PkgInfo get(Options options) {
- String v = options.get(XPKGINFO);
- return (v == null
- ? PkgInfo.LEGACY
- : PkgInfo.valueOf(v.toUpperCase()));
- }
- }
-
- private static Map<String,Boolean> getXLintChoices() {
- Map<String,Boolean> choices = new LinkedHashMap<String,Boolean>();
- choices.put("all", false);
- for (Lint.LintCategory c : Lint.LintCategory.values())
- choices.put(c.option, c.hidden);
- for (Lint.LintCategory c : Lint.LintCategory.values())
- choices.put("-" + c.option, c.hidden);
- choices.put("none", false);
- return choices;
- }
-
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentScanner.java b/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentScanner.java
deleted file mode 100644
index e6d687d..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentScanner.java
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.parser;
-
-import java.nio.*;
-
-import com.sun.tools.javac.util.*;
-import static com.sun.tools.javac.util.LayoutCharacters.*;
-
-/** An extension to the base lexical analyzer that captures
- * and processes the contents of doc comments. It does so by
- * translating Unicode escape sequences and by stripping the
- * leading whitespace and starts from each line of the comment.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class DocCommentScanner extends Scanner {
-
- /** Create a scanner from the input buffer. buffer must implement
- * array() and compact(), and remaining() must be less than limit().
- */
- protected DocCommentScanner(ScannerFactory fac, CharBuffer buffer) {
- super(fac, buffer);
- }
-
- /** Create a scanner from the input array. The array must have at
- * least a single character of extra space.
- */
- protected DocCommentScanner(ScannerFactory fac, char[] input, int inputLength) {
- super(fac, input, inputLength);
- }
-
- /** Starting position of the comment in original source
- */
- private int pos;
-
- /** The comment input buffer, index of next chacter to be read,
- * index of one past last character in buffer.
- */
- private char[] buf;
- private int bp;
- private int buflen;
-
- /** The current character.
- */
- private char ch;
-
- /** The column number position of the current character.
- */
- private int col;
-
- /** The buffer index of the last converted Unicode character
- */
- private int unicodeConversionBp = 0;
-
- /**
- * Buffer for doc comment.
- */
- private char[] docCommentBuffer = new char[1024];
-
- /**
- * Number of characters in doc comment buffer.
- */
- private int docCommentCount;
-
- /**
- * Translated and stripped contents of doc comment
- */
- private String docComment = null;
-
-
- /** Unconditionally expand the comment buffer.
- */
- private void expandCommentBuffer() {
- char[] newBuffer = new char[docCommentBuffer.length * 2];
- System.arraycopy(docCommentBuffer, 0, newBuffer,
- 0, docCommentBuffer.length);
- docCommentBuffer = newBuffer;
- }
-
- /** Convert an ASCII digit from its base (8, 10, or 16)
- * to its value.
- */
- private int digit(int base) {
- char c = ch;
- int result = Character.digit(c, base);
- if (result >= 0 && c > 0x7f) {
- ch = "0123456789abcdef".charAt(result);
- }
- return result;
- }
-
- /** Convert Unicode escape; bp points to initial '\' character
- * (Spec 3.3).
- */
- private void convertUnicode() {
- if (ch == '\\' && unicodeConversionBp != bp) {
- bp++; ch = buf[bp]; col++;
- if (ch == 'u') {
- do {
- bp++; ch = buf[bp]; col++;
- } while (ch == 'u');
- int limit = bp + 3;
- if (limit < buflen) {
- int d = digit(16);
- int code = d;
- while (bp < limit && d >= 0) {
- bp++; ch = buf[bp]; col++;
- d = digit(16);
- code = (code << 4) + d;
- }
- if (d >= 0) {
- ch = (char)code;
- unicodeConversionBp = bp;
- return;
- }
- }
- // "illegal.Unicode.esc", reported by base scanner
- } else {
- bp--;
- ch = '\\';
- col--;
- }
- }
- }
-
-
- /** Read next character.
- */
- private void scanChar() {
- bp++;
- ch = buf[bp];
- switch (ch) {
- case '\r': // return
- col = 0;
- break;
- case '\n': // newline
- if (bp == 0 || buf[bp-1] != '\r') {
- col = 0;
- }
- break;
- case '\t': // tab
- col = (col / TabInc * TabInc) + TabInc;
- break;
- case '\\': // possible Unicode
- col++;
- convertUnicode();
- break;
- default:
- col++;
- break;
- }
- }
-
- /**
- * Read next character in doc comment, skipping over double '\' characters.
- * If a double '\' is skipped, put in the buffer and update buffer count.
- */
- private void scanDocCommentChar() {
- scanChar();
- if (ch == '\\') {
- if (buf[bp+1] == '\\' && unicodeConversionBp != bp) {
- if (docCommentCount == docCommentBuffer.length)
- expandCommentBuffer();
- docCommentBuffer[docCommentCount++] = ch;
- bp++; col++;
- } else {
- convertUnicode();
- }
- }
- }
-
- /* Reset doc comment before reading each new token
- */
- public void nextToken() {
- docComment = null;
- super.nextToken();
- }
-
- /**
- * Returns the documentation string of the current token.
- */
- public String docComment() {
- return docComment;
- }
-
- /**
- * Process a doc comment and make the string content available.
- * Strips leading whitespace and stars.
- */
- @SuppressWarnings("fallthrough")
- protected void processComment(CommentStyle style) {
- if (style != CommentStyle.JAVADOC) {
- return;
- }
-
- pos = pos();
- buf = getRawCharacters(pos, endPos());
- buflen = buf.length;
- bp = 0;
- col = 0;
-
- docCommentCount = 0;
-
- boolean firstLine = true;
-
- // Skip over first slash
- scanDocCommentChar();
- // Skip over first star
- scanDocCommentChar();
-
- // consume any number of stars
- while (bp < buflen && ch == '*') {
- scanDocCommentChar();
- }
- // is the comment in the form /**/, /***/, /****/, etc. ?
- if (bp < buflen && ch == '/') {
- docComment = "";
- return;
- }
-
- // skip a newline on the first line of the comment.
- if (bp < buflen) {
- if (ch == LF) {
- scanDocCommentChar();
- firstLine = false;
- } else if (ch == CR) {
- scanDocCommentChar();
- if (ch == LF) {
- scanDocCommentChar();
- firstLine = false;
- }
- }
- }
-
- outerLoop:
-
- // The outerLoop processes the doc comment, looping once
- // for each line. For each line, it first strips off
- // whitespace, then it consumes any stars, then it
- // puts the rest of the line into our buffer.
- while (bp < buflen) {
-
- // The wsLoop consumes whitespace from the beginning
- // of each line.
- wsLoop:
-
- while (bp < buflen) {
- switch(ch) {
- case ' ':
- scanDocCommentChar();
- break;
- case '\t':
- col = ((col - 1) / TabInc * TabInc) + TabInc;
- scanDocCommentChar();
- break;
- case FF:
- col = 0;
- scanDocCommentChar();
- break;
-// Treat newline at beginning of line (blank line, no star)
-// as comment text. Old Javadoc compatibility requires this.
-/*---------------------------------*
- case CR: // (Spec 3.4)
- scanDocCommentChar();
- if (ch == LF) {
- col = 0;
- scanDocCommentChar();
- }
- break;
- case LF: // (Spec 3.4)
- scanDocCommentChar();
- break;
-*---------------------------------*/
- default:
- // we've seen something that isn't whitespace;
- // jump out.
- break wsLoop;
- }
- }
-
- // Are there stars here? If so, consume them all
- // and check for the end of comment.
- if (ch == '*') {
- // skip all of the stars
- do {
- scanDocCommentChar();
- } while (ch == '*');
-
- // check for the closing slash.
- if (ch == '/') {
- // We're done with the doc comment
- // scanChar() and breakout.
- break outerLoop;
- }
- } else if (! firstLine) {
- //The current line does not begin with a '*' so we will indent it.
- for (int i = 1; i < col; i++) {
- if (docCommentCount == docCommentBuffer.length)
- expandCommentBuffer();
- docCommentBuffer[docCommentCount++] = ' ';
- }
- }
-
- // The textLoop processes the rest of the characters
- // on the line, adding them to our buffer.
- textLoop:
- while (bp < buflen) {
- switch (ch) {
- case '*':
- // Is this just a star? Or is this the
- // end of a comment?
- scanDocCommentChar();
- if (ch == '/') {
- // This is the end of the comment,
- // set ch and return our buffer.
- break outerLoop;
- }
- // This is just an ordinary star. Add it to
- // the buffer.
- if (docCommentCount == docCommentBuffer.length)
- expandCommentBuffer();
- docCommentBuffer[docCommentCount++] = '*';
- break;
- case ' ':
- case '\t':
- if (docCommentCount == docCommentBuffer.length)
- expandCommentBuffer();
- docCommentBuffer[docCommentCount++] = ch;
- scanDocCommentChar();
- break;
- case FF:
- scanDocCommentChar();
- break textLoop; // treat as end of line
- case CR: // (Spec 3.4)
- scanDocCommentChar();
- if (ch != LF) {
- // Canonicalize CR-only line terminator to LF
- if (docCommentCount == docCommentBuffer.length)
- expandCommentBuffer();
- docCommentBuffer[docCommentCount++] = (char)LF;
- break textLoop;
- }
- /* fall through to LF case */
- case LF: // (Spec 3.4)
- // We've seen a newline. Add it to our
- // buffer and break out of this loop,
- // starting fresh on a new line.
- if (docCommentCount == docCommentBuffer.length)
- expandCommentBuffer();
- docCommentBuffer[docCommentCount++] = ch;
- scanDocCommentChar();
- break textLoop;
- default:
- // Add the character to our buffer.
- if (docCommentCount == docCommentBuffer.length)
- expandCommentBuffer();
- docCommentBuffer[docCommentCount++] = ch;
- scanDocCommentChar();
- }
- } // end textLoop
- firstLine = false;
- } // end outerLoop
-
- if (docCommentCount > 0) {
- int i = docCommentCount - 1;
- trailLoop:
- while (i > -1) {
- switch (docCommentBuffer[i]) {
- case '*':
- i--;
- break;
- default:
- break trailLoop;
- }
- }
- docCommentCount = i + 1;
-
- // Store the text of the doc comment
- docComment = new String(docCommentBuffer, 0 , docCommentCount);
- } else {
- docComment = "";
- }
- }
-
- /** Build a map for translating between line numbers and
- * positions in the input.
- *
- * @return a LineMap */
- public Position.LineMap getLineMap() {
- char[] buf = getRawCharacters();
- return Position.makeLineMap(buf, buf.length, true);
- }
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/EndPosParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/EndPosParser.java
deleted file mode 100644
index 715839b..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/EndPosParser.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.parser;
-
-import java.util.Map;
-import java.util.HashMap;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.TreeInfo;
-
-import static com.sun.tools.javac.tree.JCTree.*;
-
-/**
- * This class is similar to Parser except that it stores ending
- * positions for the tree nodes.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b></p>
- */
-public class EndPosParser extends JavacParser {
-
- public EndPosParser(ParserFactory fac, Lexer S, boolean keepDocComments, boolean keepLineMap) {
- super(fac, S, keepDocComments, keepLineMap);
- this.S = S;
- endPositions = new HashMap<JCTree,Integer>();
- }
-
- private Lexer S;
-
- /** A hashtable to store ending positions
- * of source ranges indexed by the tree nodes.
- * Defined only if option flag genEndPos is set.
- */
- Map<JCTree, Integer> endPositions;
-
- /** {@inheritDoc} */
- @Override
- protected void storeEnd(JCTree tree, int endpos) {
- int errorEndPos = getErrorEndPos();
- endPositions.put(tree, errorEndPos > endpos ? errorEndPos : endpos);
- }
-
- /** {@inheritDoc} */
- @Override
- protected <T extends JCTree> T to(T t) {
- storeEnd(t, S.endPos());
- return t;
- }
-
- /** {@inheritDoc} */
- @Override
- protected <T extends JCTree> T toP(T t) {
- storeEnd(t, S.prevEndPos());
- return t;
- }
-
- @Override
- public JCCompilationUnit parseCompilationUnit() {
- JCCompilationUnit t = super.parseCompilationUnit();
- t.endPositions = endPositions;
- return t;
- }
-
- /** {@inheritDoc} */
- @Override
- JCExpression parExpression() {
- int pos = S.pos();
- JCExpression t = super.parExpression();
- return toP(F.at(pos).Parens(t));
- }
-
- /** {@inheritDoc} */
- @Override
- public int getEndPos(JCTree tree) {
- return TreeInfo.getEndPos(tree, endPositions);
- }
-
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java b/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java
deleted file mode 100644
index f5f24c5..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.parser;
-
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Names;
-
-import static com.sun.tools.javac.parser.Token.*;
-
-/**
- * Map from Name to Token and Token to String.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Keywords {
- public static final Context.Key<Keywords> keywordsKey =
- new Context.Key<Keywords>();
-
- public static Keywords instance(Context context) {
- Keywords instance = context.get(keywordsKey);
- if (instance == null)
- instance = new Keywords(context);
- return instance;
- }
-
- private final Names names;
-
- protected Keywords(Context context) {
- context.put(keywordsKey, this);
- names = Names.instance(context);
-
- for (Token t : Token.values()) {
- if (t.name != null)
- enterKeyword(t.name, t);
- else
- tokenName[t.ordinal()] = null;
- }
-
- key = new Token[maxKey+1];
- for (int i = 0; i <= maxKey; i++) key[i] = IDENTIFIER;
- for (Token t : Token.values()) {
- if (t.name != null)
- key[tokenName[t.ordinal()].getIndex()] = t;
- }
- }
-
-
- public Token key(Name name) {
- return (name.getIndex() > maxKey) ? IDENTIFIER : key[name.getIndex()];
- }
-
- /**
- * Keyword array. Maps name indices to Token.
- */
- private final Token[] key;
-
- /** The number of the last entered keyword.
- */
- private int maxKey = 0;
-
- /** The names of all tokens.
- */
- private Name[] tokenName = new Name[Token.values().length];
-
- private void enterKeyword(String s, Token token) {
- Name n = names.fromString(s);
- tokenName[token.ordinal()] = n;
- if (n.getIndex() > maxKey) maxKey = n.getIndex();
- }
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java b/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java
deleted file mode 100644
index ca2300d..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.parser;
-
-import java.util.Locale;
-
-import com.sun.tools.javac.api.Formattable;
-import com.sun.tools.javac.api.Messages;
-
-/** An interface that defines codes for Java source tokens
- * returned from lexical analysis.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public enum Token implements Formattable {
- EOF,
- ERROR,
- IDENTIFIER,
- ABSTRACT("abstract"),
- ASSERT("assert"),
- BOOLEAN("boolean"),
- BREAK("break"),
- BYTE("byte"),
- CASE("case"),
- CATCH("catch"),
- CHAR("char"),
- CLASS("class"),
- CONST("const"),
- CONTINUE("continue"),
- DEFAULT("default"),
- DO("do"),
- DOUBLE("double"),
- ELSE("else"),
- ENUM("enum"),
- EXTENDS("extends"),
- FINAL("final"),
- FINALLY("finally"),
- FLOAT("float"),
- FOR("for"),
- GOTO("goto"),
- IF("if"),
- IMPLEMENTS("implements"),
- IMPORT("import"),
- INSTANCEOF("instanceof"),
- INT("int"),
- INTERFACE("interface"),
- LONG("long"),
- NATIVE("native"),
- NEW("new"),
- PACKAGE("package"),
- PRIVATE("private"),
- PROTECTED("protected"),
- PUBLIC("public"),
- RETURN("return"),
- SHORT("short"),
- STATIC("static"),
- STRICTFP("strictfp"),
- SUPER("super"),
- SWITCH("switch"),
- SYNCHRONIZED("synchronized"),
- THIS("this"),
- THROW("throw"),
- THROWS("throws"),
- TRANSIENT("transient"),
- TRY("try"),
- VOID("void"),
- VOLATILE("volatile"),
- WHILE("while"),
- INTLITERAL,
- LONGLITERAL,
- FLOATLITERAL,
- DOUBLELITERAL,
- CHARLITERAL,
- STRINGLITERAL,
- TRUE("true"),
- FALSE("false"),
- NULL("null"),
- LPAREN("("),
- RPAREN(")"),
- LBRACE("{"),
- RBRACE("}"),
- LBRACKET("["),
- RBRACKET("]"),
- SEMI(";"),
- COMMA(","),
- DOT("."),
- ELLIPSIS("..."),
- EQ("="),
- GT(">"),
- LT("<"),
- BANG("!"),
- TILDE("~"),
- QUES("?"),
- COLON(":"),
- EQEQ("=="),
- LTEQ("<="),
- GTEQ(">="),
- BANGEQ("!="),
- AMPAMP("&&"),
- BARBAR("||"),
- PLUSPLUS("++"),
- SUBSUB("--"),
- PLUS("+"),
- SUB("-"),
- STAR("*"),
- SLASH("/"),
- AMP("&"),
- BAR("|"),
- CARET("^"),
- PERCENT("%"),
- LTLT("<<"),
- GTGT(">>"),
- GTGTGT(">>>"),
- PLUSEQ("+="),
- SUBEQ("-="),
- STAREQ("*="),
- STARSTAR("**"),
- SLASHEQ("/="),
- AMPEQ("&="),
- BAREQ("|="),
- CARETEQ("^="),
- PERCENTEQ("%="),
- LTLTEQ("<<="),
- GTGTEQ(">>="),
- GTGTGTEQ(">>>="),
- MONKEYS_AT("@"),
- MODULEVERSIONLITERAL,
- CUSTOM;
-
- Token() {
- this(null);
- }
- Token(String name) {
- this.name = name;
- }
-
- public final String name;
-
- public String toString() {
- switch (this) {
- case IDENTIFIER:
- return "token.identifier";
- case CHARLITERAL:
- return "token.character";
- case STRINGLITERAL:
- return "token.string";
- case INTLITERAL:
- return "token.integer";
- case LONGLITERAL:
- return "token.long-integer";
- case FLOATLITERAL:
- return "token.float";
- case DOUBLELITERAL:
- return "token.double";
- case MODULEVERSIONLITERAL:
- return "token.version";
- case ERROR:
- return "token.bad-symbol";
- case EOF:
- return "token.end-of-input";
- case DOT: case COMMA: case SEMI: case LPAREN: case RPAREN:
- case LBRACKET: case RBRACKET: case LBRACE: case RBRACE:
- return "'" + name + "'";
- default:
- return name;
- }
- }
-
- public String getKind() {
- return "Token";
- }
-
- public String toString(Locale locale, Messages messages) {
- return name != null ? toString() : messages.getLocalizedString(locale, "compiler.misc." + toString());
- }
-}
diff --git a/langtools/test/tools/javac/parser/netbeans/JavacParserTest.java b/langtools/test/tools/javac/parser/netbeans/JavacParserTest.java
deleted file mode 100644
index 79ce213..0000000
--- a/langtools/test/tools/javac/parser/netbeans/JavacParserTest.java
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 7073631
- * @summary tests error and diagnostics positions
- * @author jan.lahoda at oracle.com
- */
-
-import com.sun.source.tree.BinaryTree;
-import com.sun.source.tree.BlockTree;
-import com.sun.source.tree.ClassTree;
-import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.tree.ExpressionStatementTree;
-import com.sun.source.tree.ExpressionTree;
-import com.sun.source.tree.MethodInvocationTree;
-import com.sun.source.tree.MethodTree;
-import com.sun.source.tree.ModifiersTree;
-import com.sun.source.tree.StatementTree;
-import com.sun.source.tree.Tree;
-import com.sun.source.tree.Tree.Kind;
-import com.sun.source.tree.VariableTree;
-import com.sun.source.tree.WhileLoopTree;
-import com.sun.source.util.SourcePositions;
-import com.sun.source.util.TreeScanner;
-import com.sun.source.util.Trees;
-import com.sun.tools.javac.api.JavacTaskImpl;
-import com.sun.tools.javac.tree.JCTree;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticCollector;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.ToolProvider;
-
-public class JavacParserTest extends TestCase {
- final JavaCompiler tool;
- public JavacParserTest(String testName) {
- tool = ToolProvider.getSystemJavaCompiler();
- System.out.println("java.home=" + System.getProperty("java.home"));
- }
-
- static class MyFileObject extends SimpleJavaFileObject {
-
- private String text;
-
- public MyFileObject(String text) {
- super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
- this.text = text;
- }
-
- @Override
- public CharSequence getCharContent(boolean ignoreEncodingErrors) {
- return text;
- }
- }
-
- public void testPositionForSuperConstructorCalls() throws IOException {
- assert tool != null;
-
- String code = "package test; public class Test {public Test() {super();}}";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
- SourcePositions pos = Trees.instance(ct).getSourcePositions();
-
- MethodTree method =
- (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
- ExpressionStatementTree es =
- (ExpressionStatementTree) method.getBody().getStatements().get(0);
-
- assertEquals("testPositionForSuperConstructorCalls",
- 72 - 24, pos.getStartPosition(cut, es));
- assertEquals("testPositionForSuperConstructorCalls",
- 80 - 24, pos.getEndPosition(cut, es));
-
- MethodInvocationTree mit = (MethodInvocationTree) es.getExpression();
-
- assertEquals("testPositionForSuperConstructorCalls",
- 72 - 24, pos.getStartPosition(cut, mit));
- assertEquals("testPositionForSuperConstructorCalls",
- 79 - 24, pos.getEndPosition(cut, mit));
-
- assertEquals("testPositionForSuperConstructorCalls",
- 72 - 24, pos.getStartPosition(cut, mit.getMethodSelect()));
- assertEquals("testPositionForSuperConstructorCalls",
- 77 - 24, pos.getEndPosition(cut, mit.getMethodSelect()));
-
- }
-
- public void testPositionForEnumModifiers() throws IOException {
-
- String code = "package test; public enum Test {A;}";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
- SourcePositions pos = Trees.instance(ct).getSourcePositions();
-
- ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
- ModifiersTree mt = clazz.getModifiers();
-
- assertEquals("testPositionForEnumModifiers",
- 38 - 24, pos.getStartPosition(cut, mt));
- assertEquals("testPositionForEnumModifiers",
- 44 - 24, pos.getEndPosition(cut, mt));
- }
-
- public void testNewClassWithEnclosing() throws IOException {
-
-
- String code = "package test; class Test { " +
- "class d {} private void method() { " +
- "Object o = Test.this.new d(); } }";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
- SourcePositions pos = Trees.instance(ct).getSourcePositions();
-
- ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
- ExpressionTree est =
- ((VariableTree) ((MethodTree) clazz.getMembers().get(1)).getBody().getStatements().get(0)).getInitializer();
-
- assertEquals("testNewClassWithEnclosing",
- 97 - 24, pos.getStartPosition(cut, est));
- assertEquals("testNewClassWithEnclosing",
- 114 - 24, pos.getEndPosition(cut, est));
- }
-
- public void testPreferredPositionForBinaryOp() throws IOException {
-
- String code = "package test; public class Test {" +
- "private void test() {" +
- "Object o = null; boolean b = o != null && o instanceof String;" +
- "} private Test() {}}";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
-
- ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
- MethodTree method = (MethodTree) clazz.getMembers().get(0);
- VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1);
- BinaryTree cond = (BinaryTree) condSt.getInitializer();
-
- JCTree condJC = (JCTree) cond;
-
- assertEquals("testNewClassWithEnclosing",
- 117 - 24, condJC.pos);
- }
-
- public void testPositionBrokenSource126732a() throws IOException {
- String[] commands = new String[]{
- "return Runnable()",
- "do { } while (true)",
- "throw UnsupportedOperationException()",
- "assert true",
- "1 + 1",};
-
- for (String command : commands) {
-
- String code = "package test;\n"
- + "public class Test {\n"
- + " public static void test() {\n"
- + " " + command + " {\n"
- + " new Runnable() {\n"
- + " };\n"
- + " }\n"
- + "}";
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null,
- null, null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
-
- ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
- MethodTree method = (MethodTree) clazz.getMembers().get(0);
- List<? extends StatementTree> statements =
- method.getBody().getStatements();
-
- StatementTree ret = statements.get(0);
- StatementTree block = statements.get(1);
-
- Trees t = Trees.instance(ct);
- int len = code.indexOf(command + " {") + (command + " ").length();
- assertEquals(command, len,
- t.getSourcePositions().getEndPosition(cut, ret));
- assertEquals(command, len,
- t.getSourcePositions().getStartPosition(cut, block));
- }
- }
-
- public void testPositionBrokenSource126732b() throws IOException {
- String[] commands = new String[]{
- "break",
- "break A",
- "continue ",
- "continue A",};
-
- for (String command : commands) {
-
- String code = "package test;\n"
- + "public class Test {\n"
- + " public static void test() {\n"
- + " while (true) {\n"
- + " " + command + " {\n"
- + " new Runnable() {\n"
- + " };\n"
- + " }\n"
- + " }\n"
- + "}";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null,
- null, null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
-
- ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
- MethodTree method = (MethodTree) clazz.getMembers().get(0);
- List<? extends StatementTree> statements =
- ((BlockTree) ((WhileLoopTree) method.getBody().getStatements().get(0)).getStatement()).getStatements();
-
- StatementTree ret = statements.get(0);
- StatementTree block = statements.get(1);
-
- Trees t = Trees.instance(ct);
- int len = code.indexOf(command + " {") + (command + " ").length();
- assertEquals(command, len,
- t.getSourcePositions().getEndPosition(cut, ret));
- assertEquals(command, len,
- t.getSourcePositions().getStartPosition(cut, block));
- }
- }
-
- public void testErrorRecoveryForEnhancedForLoop142381() throws IOException {
-
- String code = "package test; class Test { " +
- "private void method() { " +
- "java.util.Set<String> s = null; for (a : s) {} } }";
-
- final List<Diagnostic<? extends JavaFileObject>> errors =
- new LinkedList<Diagnostic<? extends JavaFileObject>>();
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
- new DiagnosticListener<JavaFileObject>() {
- public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
- errors.add(diagnostic);
- }
- }, null, null, Arrays.asList(new MyFileObject(code)));
-
- CompilationUnitTree cut = ct.parse().iterator().next();
-
- ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
- StatementTree forStatement =
- ((MethodTree) clazz.getMembers().get(0)).getBody().getStatements().get(1);
-
- assertEquals("testErrorRecoveryForEnhancedForLoop142381",
- Kind.ENHANCED_FOR_LOOP, forStatement.getKind());
- assertFalse("testErrorRecoveryForEnhancedForLoop142381", errors.isEmpty());
- }
-
- public void testPositionAnnotationNoPackage187551() throws IOException {
-
- String code = "\n at interface Test {}";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
-
- CompilationUnitTree cut = ct.parse().iterator().next();
- ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
- Trees t = Trees.instance(ct);
-
- assertEquals("testPositionAnnotationNoPackage187551",
- 1, t.getSourcePositions().getStartPosition(cut, clazz));
- }
-
- public void testPositionsSane() throws IOException {
- performPositionsSanityTest("package test; class Test { " +
- "private void method() { " +
- "java.util.List<? extends java.util.List<? extends String>> l; " +
- "} }");
- performPositionsSanityTest("package test; class Test { " +
- "private void method() { " +
- "java.util.List<? super java.util.List<? super String>> l; " +
- "} }");
- performPositionsSanityTest("package test; class Test { " +
- "private void method() { " +
- "java.util.List<? super java.util.List<?>> l; } }");
- }
-
- private void performPositionsSanityTest(String code) throws IOException {
-
- final List<Diagnostic<? extends JavaFileObject>> errors =
- new LinkedList<Diagnostic<? extends JavaFileObject>>();
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
- new DiagnosticListener<JavaFileObject>() {
-
- public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
- errors.add(diagnostic);
- }
- }, null, null, Arrays.asList(new MyFileObject(code)));
-
- final CompilationUnitTree cut = ct.parse().iterator().next();
- final Trees trees = Trees.instance(ct);
-
- new TreeScanner<Void, Void>() {
-
- private long parentStart = 0;
- private long parentEnd = Integer.MAX_VALUE;
-
- @Override
- public Void scan(Tree node, Void p) {
- if (node == null) {
- return null;
- }
-
- long start = trees.getSourcePositions().getStartPosition(cut, node);
-
- if (start == (-1)) {
- return null; //synthetic tree
- }
- assertTrue(node.toString() + ":" + start + "/" + parentStart,
- parentStart <= start);
-
- long prevParentStart = parentStart;
-
- parentStart = start;
-
- long end = trees.getSourcePositions().getEndPosition(cut, node);
-
- assertTrue(node.toString() + ":" + end + "/" + parentEnd,
- end <= parentEnd);
-
- long prevParentEnd = parentEnd;
-
- parentEnd = end;
-
- super.scan(node, p);
-
- parentStart = prevParentStart;
- parentEnd = prevParentEnd;
-
- return null;
- }
-
- private void assertTrue(String message, boolean b) {
- if (!b) fail(message);
- }
- }.scan(cut, null);
- }
-
- public void testCorrectWilcardPositions() throws IOException {
- performWildcardPositionsTest("package test; import java.util.List; " +
- "class Test { private void method() { List<? extends List<? extends String>> l; } }",
-
- Arrays.asList("List<? extends List<? extends String>> l;",
- "List<? extends List<? extends String>>",
- "List",
- "? extends List<? extends String>",
- "List<? extends String>",
- "List",
- "? extends String",
- "String"));
- performWildcardPositionsTest("package test; import java.util.List; " +
- "class Test { private void method() { List<? super List<? super String>> l; } }",
-
- Arrays.asList("List<? super List<? super String>> l;",
- "List<? super List<? super String>>",
- "List",
- "? super List<? super String>",
- "List<? super String>",
- "List",
- "? super String",
- "String"));
- performWildcardPositionsTest("package test; import java.util.List; " +
- "class Test { private void method() { List<? super List<?>> l; } }",
-
- Arrays.asList("List<? super List<?>> l;",
- "List<? super List<?>>",
- "List",
- "? super List<?>",
- "List<?>",
- "List",
- "?"));
- performWildcardPositionsTest("package test; import java.util.List; " +
- "class Test { private void method() { " +
- "List<? extends List<? extends List<? extends String>>> l; } }",
-
- Arrays.asList("List<? extends List<? extends List<? extends String>>> l;",
- "List<? extends List<? extends List<? extends String>>>",
- "List",
- "? extends List<? extends List<? extends String>>",
- "List<? extends List<? extends String>>",
- "List",
- "? extends List<? extends String>",
- "List<? extends String>",
- "List",
- "? extends String",
- "String"));
- performWildcardPositionsTest("package test; import java.util.List; " +
- "class Test { private void method() { " +
- "List<? extends List<? extends List<? extends String >>> l; } }",
- Arrays.asList("List<? extends List<? extends List<? extends String >>> l;",
- "List<? extends List<? extends List<? extends String >>>",
- "List",
- "? extends List<? extends List<? extends String >>",
- "List<? extends List<? extends String >>",
- "List",
- "? extends List<? extends String >",
- "List<? extends String >",
- "List",
- "? extends String",
- "String"));
- }
-
- public void performWildcardPositionsTest(final String code,
- List<String> golden) throws IOException {
-
- final List<Diagnostic<? extends JavaFileObject>> errors =
- new LinkedList<Diagnostic<? extends JavaFileObject>>();
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null,
- new DiagnosticListener<JavaFileObject>() {
- public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
- errors.add(diagnostic);
- }
- }, null, null, Arrays.asList(new MyFileObject(code)));
-
- final CompilationUnitTree cut = ct.parse().iterator().next();
- final List<String> content = new LinkedList<String>();
- final Trees trees = Trees.instance(ct);
-
- new TreeScanner<Void, Void>() {
- @Override
- public Void scan(Tree node, Void p) {
- if (node == null) {
- return null;
- }
- long start = trees.getSourcePositions().getStartPosition(cut, node);
-
- if (start == (-1)) {
- return null; //synthetic tree
- }
- long end = trees.getSourcePositions().getEndPosition(cut, node);
- String s = code.substring((int) start, (int) end);
- content.add(s);
-
- return super.scan(node, p);
- }
- }.scan(((MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0)).getBody().getStatements().get(0), null);
-
- assertEquals("performWildcardPositionsTest",golden.toString(),
- content.toString());
- }
-
- public void testStartPositionForMethodWithoutModifiers() throws IOException {
-
- String code = "package t; class Test { <T> void t() {} }";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
- ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
- MethodTree mt = (MethodTree) clazz.getMembers().get(0);
- Trees t = Trees.instance(ct);
- int start = (int) t.getSourcePositions().getStartPosition(cut, mt);
- int end = (int) t.getSourcePositions().getEndPosition(cut, mt);
-
- assertEquals("testStartPositionForMethodWithoutModifiers",
- "<T> void t() {}", code.substring(start, end));
- }
-
- public void testStartPositionEnumConstantInit() throws IOException {
-
- String code = "package t; enum Test { AAA; }";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
- ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
- VariableTree enumAAA = (VariableTree) clazz.getMembers().get(0);
- Trees t = Trees.instance(ct);
- int start = (int) t.getSourcePositions().getStartPosition(cut,
- enumAAA.getInitializer());
-
- assertEquals("testStartPositionEnumConstantInit", -1, start);
- }
-
- public void testVariableInIfThen1() throws IOException {
-
- String code = "package t; class Test { " +
- "private static void t(String name) { " +
- "if (name != null) String nn = name.trim(); } }";
-
- DiagnosticCollector<JavaFileObject> coll =
- new DiagnosticCollector<JavaFileObject>();
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
- null, Arrays.asList(new MyFileObject(code)));
-
- ct.parse();
-
- List<String> codes = new LinkedList<String>();
-
- for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
- codes.add(d.getCode());
- }
-
- assertEquals("testVariableInIfThen1",
- Arrays.<String>asList("compiler.err.variable.not.allowed"),
- codes);
- }
-
- public void testVariableInIfThen2() throws IOException {
-
- String code = "package t; class Test { " +
- "private static void t(String name) { " +
- "if (name != null) class X {} } }";
- DiagnosticCollector<JavaFileObject> coll =
- new DiagnosticCollector<JavaFileObject>();
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
- null, Arrays.asList(new MyFileObject(code)));
-
- ct.parse();
-
- List<String> codes = new LinkedList<String>();
-
- for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
- codes.add(d.getCode());
- }
-
- assertEquals("testVariableInIfThen2",
- Arrays.<String>asList("compiler.err.class.not.allowed"), codes);
- }
-
- public void testVariableInIfThen3() throws IOException {
-
- String code = "package t; class Test { "+
- "private static void t(String name) { " +
- "if (name != null) abstract } }";
- DiagnosticCollector<JavaFileObject> coll =
- new DiagnosticCollector<JavaFileObject>();
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, coll, null,
- null, Arrays.asList(new MyFileObject(code)));
-
- ct.parse();
-
- List<String> codes = new LinkedList<String>();
-
- for (Diagnostic<? extends JavaFileObject> d : coll.getDiagnostics()) {
- codes.add(d.getCode());
- }
-
- assertEquals("testVariableInIfThen3",
- Arrays.<String>asList("compiler.err.illegal.start.of.expr"),
- codes);
- }
-
- //see javac bug #6882235, NB bug #98234:
- public void testMissingExponent() throws IOException {
-
- String code = "\nclass Test { { System.err.println(0e); } }";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
-
- assertNotNull(ct.parse().iterator().next());
- }
-
- public void testTryResourcePos() throws IOException {
-
- final String code = "package t; class Test { " +
- "{ try (java.io.InputStream in = null) { } } }";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
-
- new TreeScanner<Void, Void>() {
- @Override
- public Void visitVariable(VariableTree node, Void p) {
- if ("in".contentEquals(node.getName())) {
- JCTree.JCVariableDecl var = (JCTree.JCVariableDecl) node;
- System.out.println(node.getName() + "," + var.pos);
- assertEquals("testTryResourcePos", "in = null) { } } }",
- code.substring(var.pos));
- }
- return super.visitVariable(node, p);
- }
- }.scan(cut, null);
- }
-
- public void testVarPos() throws IOException {
-
- final String code = "package t; class Test { " +
- "{ java.io.InputStream in = null; } }";
-
- JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null,
- null, Arrays.asList(new MyFileObject(code)));
- CompilationUnitTree cut = ct.parse().iterator().next();
-
- new TreeScanner<Void, Void>() {
-
- @Override
- public Void visitVariable(VariableTree node, Void p) {
- if ("in".contentEquals(node.getName())) {
- JCTree.JCVariableDecl var = (JCTree.JCVariableDecl) node;
- assertEquals("testVarPos","in = null; } }",
- code.substring(var.pos));
- }
- return super.visitVariable(node, p);
- }
- }.scan(cut, null);
- }
-
- void testsNotWorking() throws IOException {
-
- // Fails with nb-javac, needs further investigation
- testPositionBrokenSource126732a();
- testPositionBrokenSource126732b();
-
- // Fails, these tests yet to be addressed
- testVariableInIfThen1();
- testVariableInIfThen2();
- testPositionForEnumModifiers();
- testStartPositionEnumConstantInit();
- }
- void testPositions() throws IOException {
- testPositionsSane();
- testCorrectWilcardPositions();
- testPositionAnnotationNoPackage187551();
- testPositionForSuperConstructorCalls();
- testPreferredPositionForBinaryOp();
- testStartPositionForMethodWithoutModifiers();
- testVarPos();
- testVariableInIfThen3();
- testTryResourcePos();
- }
-
- public static void main(String... args) throws IOException {
- JavacParserTest jpt = new JavacParserTest("JavacParserTest");
- jpt.testPositions();
- System.out.println("PASS");
- }
-}
-
-abstract class TestCase {
-
- void assertEquals(String message, int i, int pos) {
- if (i != pos) {
- fail(message);
- }
- }
-
- void assertFalse(String message, boolean empty) {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- void assertEquals(String message, int i, long l) {
- if (i != l) {
- fail(message + ":" + i + ":" + l);
- }
- }
-
- void assertEquals(String message, Object o1, Object o2) {
- System.out.println(o1);
- System.out.println(o2);
- if (o1 != null && o2 != null && !o1.equals(o2)) {
- fail(message);
- }
- if (o1 == null && o2 != null) {
- fail(message);
- }
- }
-
- void assertNotNull(Object o) {
- if (o == null) {
- fail();
- }
- }
-
- void fail() {
- fail("test failed");
- }
-
- void fail(String message) {
- throw new RuntimeException(message);
- }
-}
--
jigsaw packaging
More information about the pkg-java-commits
mailing list