[llvm-commits] [llvm-gcc-4.2] r43913 [58/80] - in /llvm-gcc-4.2/trunk: boehm-gc/ boehm-gc/Mac_files/ boehm-gc/cord/ boehm-gc/doc/ boehm-gc/include/ boehm-gc/include/private/ boehm-gc/tests/ libffi/ libffi/include/ libffi/src/ libffi/src/alpha/ libffi/src/arm/ libffi/src/cris/ libffi/src/frv/ libffi/src/ia64/ libffi/src/m32r/ libffi/src/m68k/ libffi/src/mips/ libffi/src/pa/ libffi/src/powerpc/ libffi/src/s390/ libffi/src/sh/ libffi/src/sh64/ libffi/src/sparc/ libffi/src/x86/ libffi/testsuite/ libffi/testsuite/config/ li...

Bill Wendling isanbard at gmail.com
Thu Nov 8 14:57:11 PST 2007


Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,626 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/java-net
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libjavanet_la_DEPENDENCIES =  \
+	$(top_builddir)/native/jni/classpath/jcl.lo \
+	$(am__DEPENDENCIES_1)
+am__libjavanet_la_SOURCES_DIST = javanet.c javanet.h \
+	java_net_VMInetAddress.c java_net_VMNetworkInterface.c \
+	java_net_VMURLConnection.c \
+	gnu_java_net_VMPlainDatagramSocketImpl.c \
+	gnu_java_net_VMPlainSocketImpl.c \
+	gnu_java_net_local_LocalSocketImpl.c local.c local.h
+ at ENABLE_LOCAL_SOCKETS_FALSE@am__objects_1 = gnu_java_net_local_LocalSocketImpl.lo
+ at ENABLE_LOCAL_SOCKETS_TRUE@am__objects_1 = gnu_java_net_local_LocalSocketImpl.lo \
+ at ENABLE_LOCAL_SOCKETS_TRUE@	local.lo
+am_libjavanet_la_OBJECTS = javanet.lo java_net_VMInetAddress.lo \
+	java_net_VMNetworkInterface.lo java_net_VMURLConnection.lo \
+	gnu_java_net_VMPlainDatagramSocketImpl.lo \
+	gnu_java_net_VMPlainSocketImpl.lo $(am__objects_1)
+libjavanet_la_OBJECTS = $(am_libjavanet_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libjavanet_la_SOURCES)
+DIST_SOURCES = $(am__libjavanet_la_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libjavanet.la
+ at ENABLE_LOCAL_SOCKETS_FALSE@local_sources = gnu_java_net_local_LocalSocketImpl.c
+ at ENABLE_LOCAL_SOCKETS_TRUE@local_sources = gnu_java_net_local_LocalSocketImpl.c \
+ at ENABLE_LOCAL_SOCKETS_TRUE@		local.c \
+ at ENABLE_LOCAL_SOCKETS_TRUE@		local.h
+
+libjavanet_la_SOURCES = javanet.c \
+			javanet.h \
+			java_net_VMInetAddress.c \
+			java_net_VMNetworkInterface.c \
+			java_net_VMURLConnection.c \
+			gnu_java_net_VMPlainDatagramSocketImpl.c \
+                        gnu_java_net_VMPlainSocketImpl.c \
+			$(local_sources)
+
+libjavanet_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo $(LIBMAGIC)
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/java-net/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/java-net/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libjavanet.la: $(libjavanet_la_OBJECTS) $(libjavanet_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libjavanet_la_LDFLAGS) $(libjavanet_la_OBJECTS) $(libjavanet_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_net_VMPlainDatagramSocketImpl.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_net_VMPlainSocketImpl.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_net_local_LocalSocketImpl.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_net_VMInetAddress.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_net_VMNetworkInterface.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_net_VMURLConnection.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/javanet.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/local.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,399 @@
+/* VMPlainDatagramSocketImpl.c - Native methods for PlainDatagramSocketImpl
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "javanet.h"
+
+#include "target_native.h"
+#ifndef WITHOUT_NETWORK
+  #include "target_native_network.h"
+#endif /* WITHOUT_NETWORK */
+
+
+#include "gnu_java_net_VMPlainDatagramSocketImpl.h"
+
+/*
+ * Note that most of the functions in this module simply redirect to another
+ * internal function.  Why?  Because many of these functions are shared
+ * with PlainSocketImpl. 
+ */
+
+/*************************************************************************/
+
+/*
+ * Creates a new datagram socket
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_create(JNIEnv *env,
+						   jclass klass __attribute__ ((__unused__))
+						   , jobject obj)
+{
+
+#ifndef WITHOUT_NETWORK
+  _javanet_create(env, obj, 0);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Close the socket.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_close(JNIEnv *env,
+						  jclass klass __attribute__ ((__unused__)),
+						  jobject obj)
+{
+
+#ifndef WITHOUT_NETWORK
+  _javanet_close(env, obj, 0);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Connects to the specified destination.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_connect(JNIEnv *env,
+						    jclass klass __attribute__ ((__unused__)),
+						    jobject obj,
+						    jobject addr, jint port)
+{
+#ifndef WITHOUT_NETWORK
+
+  _javanet_connect(env, obj, addr, port, 0);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * This method binds the specified address to the specified local port.
+ * Note that we have to set the local address and local port public instance 
+ * variables. 
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_bind(JNIEnv *env,
+						 jclass klass __attribute__ ((__unused__)),
+						 jobject obj,
+						 jint port, jobject addr)
+{
+
+#ifndef WITHOUT_NETWORK
+  _javanet_bind(env, obj, addr, port, 0);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * This method sets the specified option for a socket
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_setOption(JNIEnv *env,
+						      jclass klass __attribute__ ((__unused__)),
+						      jobject obj, 
+						      jint option_id,
+						      jobject val)
+{
+
+#ifndef WITHOUT_NETWORK
+  _javanet_set_option(env, obj, option_id, val);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * This method sets the specified option for a socket
+ */
+JNIEXPORT jobject JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_getOption(JNIEnv *env,
+						      jclass klass __attribute__ ((__unused__)),
+						      jobject obj, 
+						      jint option_id)
+{
+
+#ifndef WITHOUT_NETWORK
+  return(_javanet_get_option(env, obj, option_id));
+#else /* not WITHOUT_NETWORK */
+  return NULL;
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Reads a buffer from a remote host
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_nativeReceive(JNIEnv     *env,
+                                                          jclass     klass __attribute__ ((__unused__)),
+                                                          jobject    obj,
+                                                          jbyteArray arr,
+                                                          jint       offset,
+                                                          jint       length,
+                                                          jbyteArray receivedFromAddress,
+                                                          jintArray  receivedFromPort,
+                                                          jintArray  receivedLength)
+{
+#ifndef WITHOUT_NETWORK
+  int           addr, *port, *bytes_read;
+  char          *addressBytes;
+
+  addr = 0;
+    
+  port = (int*)(*env)->GetIntArrayElements(env, receivedFromPort, NULL);
+  if (port == NULL)
+    {
+      JCL_ThrowException(env, IO_EXCEPTION, "Internal error: could not access receivedFromPort array");
+      return;
+    }
+  
+  bytes_read = (int*)(*env)->GetIntArrayElements(env, receivedLength, NULL);
+  if (bytes_read == NULL)
+    {
+      (*env)->ReleaseIntArrayElements(env, receivedFromPort, (jint*)port, 0);
+      JCL_ThrowException(env, IO_EXCEPTION, "Internal error: could not access receivedLength array");
+      return;
+    }
+
+  /* Receive the packet */
+  /* should we try some sort of validation on the length? */
+  (*bytes_read) = _javanet_recvfrom(env, obj, arr, offset, length, &addr, port);
+
+  /* Special case the strange situation where the receiver didn't want any
+     bytes. */
+  if (length == 0 && (*bytes_read) == -1)
+    *bytes_read = 0;
+
+  if ((*bytes_read) == -1)
+    {
+      (*env)->ReleaseIntArrayElements(env, receivedFromPort, (jint*)port, 0);
+      (*env)->ReleaseIntArrayElements(env, receivedLength, (jint*)bytes_read, 0);
+      JCL_ThrowException(env, IO_EXCEPTION, "Internal error: receive");
+      return;
+    }
+
+  (*env)->ReleaseIntArrayElements(env, receivedFromPort, (jint*)port, 0);
+  (*env)->ReleaseIntArrayElements(env, receivedLength, (jint*)bytes_read, 0);
+
+  if ((*env)->ExceptionOccurred(env))
+    {
+      return;
+    }
+
+  DBG("PlainDatagramSocketImpl.receive(): Received packet\n");
+  
+  
+  /* Store the address */
+  addressBytes = (char*)(*env)->GetPrimitiveArrayCritical(env, receivedFromAddress, NULL);
+  TARGET_NATIVE_NETWORK_INT_TO_IPADDRESS_BYTES(addr,
+                                               addressBytes[0],
+                                               addressBytes[1],
+                                               addressBytes[2],
+                                               addressBytes[3]
+                                              );
+  (*env)->ReleasePrimitiveArrayCritical(env, receivedFromAddress, addressBytes, 0);
+    
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Writes a buffer to the remote host
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_nativeSendTo(JNIEnv  *env,
+                                                         jclass  klass __attribute__ ((__unused__)),
+                                                         jobject obj, 
+                                                         jobject addr,
+                                                         jint    port,
+                                                         jarray  buf, 
+                                                         jint    offset,
+                                                         jint    len)
+{
+#ifndef WITHOUT_NETWORK
+  jint netAddress;
+
+  /* check if address given, tr 7.3.2005 */
+  if (addr != NULL)
+    {
+      netAddress = _javanet_get_netaddr(env, addr);
+      if ((*env)->ExceptionOccurred(env))
+        {
+          return;
+        }
+    }
+  else
+    {
+      netAddress = 0;
+    }
+
+  DBG("PlainDatagramSocketImpl.sendto(): have addr\n");
+
+  _javanet_sendto(env, obj, buf, offset, len, netAddress, port);
+  if ((*env)->ExceptionOccurred(env))
+    {
+      return;
+    }
+
+  DBG("PlainDatagramSocketImpl.sendto(): finished\n");
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Joins a multicast group
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_join(JNIEnv *env,
+						 jclass klass __attribute__ ((__unused__)),
+						 jobject obj, 
+						 jobject addr)
+{
+#ifndef WITHOUT_NETWORK
+  jint netAddress;
+  int  fd;
+  int  result;
+
+  /* check if address given, tr 7.3.2005 */
+  if (addr != NULL)
+    {
+      netAddress = _javanet_get_netaddr(env, addr);
+      if ((*env)->ExceptionOccurred(env))
+        {
+          JCL_ThrowException(env, IO_EXCEPTION, "Internal error");
+          return;
+        }
+    }
+  else
+    {
+      netAddress = 0;
+    }
+
+  fd = _javanet_get_int_field(env, obj, "native_fd");
+  if ((*env)->ExceptionOccurred(env))
+    {
+      JCL_ThrowException(env, IO_EXCEPTION, "Internal error");
+      return;
+    }
+
+  DBG("PlainDatagramSocketImpl.join(): have native fd\n");
+
+  TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_ADD_MEMBERSHIP(fd,netAddress,result);
+
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException(env, IO_EXCEPTION, TARGET_NATIVE_LAST_ERROR_STRING());
+      return;
+    }
+
+  DBG("PlainDatagramSocketImpl.join(): finished\n");
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Leaves a multicast group
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainDatagramSocketImpl_leave(JNIEnv *env,
+						  jclass klass __attribute__ ((__unused__)),
+						  jobject obj, 
+						  jobject addr)
+{
+#ifndef WITHOUT_NETWORK
+  jint netAddress;
+  int  fd;
+  int  result;
+
+  /* check if address given, tr 7.3.2005 */
+  if (addr != NULL)
+    {
+      netAddress = _javanet_get_netaddr(env, addr);
+      if ((*env)->ExceptionOccurred(env))
+        {
+          JCL_ThrowException(env, IO_EXCEPTION, "Internal error");
+          return;
+        }
+    }
+  else
+    {
+      netAddress = 0;
+    }
+
+  fd = _javanet_get_int_field(env, obj, "native_fd");
+  if ((*env)->ExceptionOccurred(env))
+    { JCL_ThrowException(env, IO_EXCEPTION, "Internal error"); return; }
+
+  DBG("PlainDatagramSocketImpl.leave(): have native fd\n");
+
+  TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_DROP_MEMBERSHIP(fd,netAddress,result);
+  if (result!=TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException(env, IO_EXCEPTION, TARGET_NATIVE_LAST_ERROR_STRING());
+      return;
+    }
+
+  DBG("PlainDatagramSocketImpl.leave(): finished\n");
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,303 @@
+/* VMPlainSocketImpl.c - Native methods for PlainSocketImpl class
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+ 
+#include <jni.h>
+#include <jcl.h>
+
+#include "javanet.h"
+
+#include "target_native.h"
+#ifndef WITHOUT_NETWORK
+  #include "target_native_file.h"  /* Get FIONREAD on Solaris.  */
+  #include "target_native_network.h"
+#endif /* WITHOUT_NETWORK */
+
+#include "gnu_java_net_VMPlainSocketImpl.h"
+
+/*
+ * Note that the functions in this module simply redirect to another
+ * internal function.  Why?  Because many of these functions are shared
+ * with PlainDatagramSocketImpl.  The unshared ones were done the same
+ * way for consistency.
+ */
+
+/*************************************************************************/
+
+/*
+ * Creates a new stream or datagram socket
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_create(JNIEnv *env,
+					   jclass klass __attribute__ ((__unused__)),
+					   jobject obj)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_create(env, obj, JNI_TRUE);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Close the socket.  Any underlying streams will be closed by this
+ * action as well.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_close(JNIEnv *env,
+					  jclass klass __attribute__ ((__unused__)),
+					  jobject obj)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_close(env, obj, 1);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Connects to the specified destination.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_connect(JNIEnv *env,
+					    jclass klass __attribute__ ((__unused__)),
+					    jobject obj, 
+					    jobject addr, jint port)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_connect(env, obj, addr, port, 1);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * This method binds the specified address to the specified local port.
+ * Note that we have to set the local address and local port public instance 
+ * variables. 
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_bind(JNIEnv *env,
+					 jclass klass __attribute__ ((__unused__)),
+					 jobject obj, jobject addr,
+					 jint port)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_bind(env, obj, addr, port, 1);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Starts listening on a socket with the specified number of pending 
+ * connections allowed.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_listen(JNIEnv *env,
+					   jclass klass __attribute__ ((__unused__)),
+					   jobject obj, jint queuelen)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_listen(env, obj, queuelen);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Accepts a new connection and assigns it to the passed in SocketImpl
+ * object. Note that we assume this is a PlainSocketImpl just like us.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_accept(JNIEnv *env,
+					   jclass klass __attribute__ ((__unused__)),
+					   jobject obj, jobject impl)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_accept(env, obj, impl);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_available(JNIEnv *env,
+					      jclass klass __attribute__ ((__unused__)),
+					      jobject obj)
+{
+#ifndef WITHOUT_NETWORK
+  jclass   cls;
+  jfieldID fid;
+  int      fd;
+  int      bytesAvailable;
+  int      result;
+  
+  cls = (*env)->GetObjectClass(env, obj);
+  if (cls == 0)
+    {
+      JCL_ThrowException(env, IO_EXCEPTION, "internal error");
+      return 0;
+    }
+  
+  fid = (*env)->GetFieldID(env, cls, "native_fd", "I"); 
+  if (fid == 0)
+    {
+      JCL_ThrowException(env, IO_EXCEPTION, "internal error");
+      return 0;
+    }
+
+  fd = (*env)->GetIntField(env, obj, fid);
+  
+  TARGET_NATIVE_NETWORK_SOCKET_RECEIVE_AVAILABLE(fd,bytesAvailable,result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException(env, IO_EXCEPTION, TARGET_NATIVE_LAST_ERROR_STRING());
+      return 0;
+    }
+
+  return bytesAvailable;
+#else /* not WITHOUT_NETWORK */
+  return 0;
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * This method sets the specified option for a socket
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_setOption(JNIEnv *env,
+					      jclass klass __attribute__ ((__unused__)),
+					      jobject obj, 
+					      jint option_id, jobject val)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_set_option(env, obj, option_id, val);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * This method gets the specified option for a socket
+ */
+JNIEXPORT jobject JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_getOption(JNIEnv *env,
+					      jclass klass __attribute__ ((__unused__)),
+					      jobject obj, 
+					      jint option_id)
+{
+#ifndef WITHOUT_NETWORK
+  return(_javanet_get_option(env, obj, option_id));
+#else /* not WITHOUT_NETWORK */
+  return NULL;
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Reads a buffer from a remote host
+ */
+JNIEXPORT jint JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_read(JNIEnv *env,
+					 jclass klass __attribute__ ((__unused__)),
+					 jobject obj, jarray buf,
+					 jint offset, jint len)
+{
+#ifndef WITHOUT_NETWORK
+  return(_javanet_recvfrom(env, obj, buf, offset, len, 0, 0));
+#else /* not WITHOUT_NETWORK */
+  return 0;
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Writes a buffer to the remote host
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_write(JNIEnv *env,
+					  jclass klass __attribute__ ((__unused__)),
+					  jobject obj, jarray buf,
+					  jint offset, jint len)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_sendto(env, obj, buf, offset, len, 0, 0);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_shutdownInput (JNIEnv * env,
+						   jclass klass __attribute__ ((__unused__)),
+						   jobject this)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_shutdownInput (env, this);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_net_VMPlainSocketImpl_shutdownOutput (JNIEnv * env,
+						    jclass klass __attribute__ ((__unused__)),
+						    jobject this)
+{
+#ifndef WITHOUT_NETWORK
+  _javanet_shutdownOutput (env, this);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/* end of file */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,518 @@
+/* gnu_java_net_local_LocalSocketImpl.c -- native local socket implementation.
+   Copyright (C) 2006  Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.  */
+
+
+#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <gnu_java_net_local_LocalSocketImpl.h>
+
+#include <stddef.h>
+#include "local.h"
+
+#ifdef DEBUG
+#define TRACE(msg) fprintf (stderr, "%s(%s:%d) -- %s\n", __FUNCTION__, __FILE__, __LINE__, msg)
+#else
+#define TRACE(msg)
+#endif
+
+static void
+_throw (JNIEnv *env, const char *exception, const char *msg)
+{
+  jclass _theclass = (*env)->FindClass (env, exception);
+  TRACE("begin");
+  if (!_theclass)
+    {
+      (*env)->FatalError (env, "exception class not found");
+    }
+  (*env)->ThrowNew (env, _theclass, msg);
+  TRACE("end");
+}
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_create (JNIEnv *env, jobject this, jboolean stream)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jfieldID socket_fd, created;
+  jclass clazz;
+  jint fd = (jint) local_create ((int) stream);
+
+  TRACE("begin");
+
+  if (fd < 0)
+    {
+      _throw (env, "java/io/IOException", local_error ());
+      return;
+    }
+  clazz = (*env)->GetObjectClass (env, this);
+  socket_fd = (*env)->GetFieldID (env, clazz, "socket_fd", "I");
+  if (!socket_fd)
+    {
+      return;
+    }
+  created = (*env)->GetFieldID (env, clazz, "created", "Z");
+  if (!created)
+    {
+      return;
+    }
+  (*env)->SetIntField (env, this, socket_fd, fd);
+  (*env)->SetBooleanField (env, this, created, JNI_TRUE);
+
+  TRACE("end");
+#else
+  (void) this;
+  (void) stream;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_listen (JNIEnv *env, jobject this, jint backlog)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jfieldID socket_fd;
+  jclass clazz;
+  int fd;
+
+  TRACE("begin");
+
+  clazz = (*env)->GetObjectClass (env, this);
+  socket_fd = (*env)->GetFieldID (env, clazz, "socket_fd", "I");
+  if (!socket_fd)
+    {
+      return;
+    }
+  fd = (int) (*env)->GetIntField (env, this, socket_fd);
+  if (local_listen (fd, (int) backlog))
+    {
+      _throw (env, "java/io/IOException", local_error ());
+      return;
+    }
+
+  TRACE("end");
+#else
+  (void) this;
+  (void) backlog;
+  _throw (env, "java/lang/Error", "support for local sockets not available");  
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_accept (JNIEnv *env, jobject this, jobject socket)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jmethodID addr_init;
+  jfieldID socket_fd, remote_addr, local_addr;
+  jclass clazz1, clazz2;
+  jobject remote, local;
+  jint fd;
+  char path[108];
+
+  TRACE("begin");
+
+  clazz1 = (*env)->GetObjectClass (env, this);
+  socket_fd = (*env)->GetFieldID (env, clazz1, "socket_fd", "I");
+  if (!socket_fd)
+    {
+      return;
+    }
+  fd = (*env)->GetIntField (env, this, socket_fd);
+  fd = (jint) local_accept ((int) fd, path);
+  if (fd < 0)
+    {
+      _throw (env, "java/io/IOException", local_error ());
+      return;
+    }
+
+  clazz2 = (*env)->FindClass (env, "gnu/java/net/local/LocalSocketAddress");
+  if (!clazz2)
+    {
+      return;
+    }
+  addr_init = (*env)->GetMethodID (env, clazz2, "<init>", "(Ljava/lang/String;)V");
+  if (!addr_init)
+    {
+      return;
+    }
+  remote = (*env)->NewObject (env, clazz2, addr_init, (*env)->NewStringUTF (env, path));
+
+  remote_addr = (*env)->GetFieldID (env, clazz1, "remote", "Lgnu/java/net/local/LocalSocketAddress;");
+  if (!remote_addr)
+    {
+      return;
+    }
+  local_addr = (*env)->GetFieldID (env, clazz1, "local", "Lgnu/java/net/local/LocalSocketAddress;");
+  if (!local_addr)
+    {
+      return;
+    }
+  local = (*env)->GetObjectField (env, this, local_addr);
+  (*env)->SetIntField (env, socket, socket_fd, fd);
+  (*env)->SetObjectField (env, socket, remote_addr, remote);
+  (*env)->SetObjectField (env, socket, local_addr, local);
+
+  TRACE("end");
+#else
+  (void) this;
+  (void) socket;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+jint
+Java_gnu_java_net_local_LocalSocketImpl_available
+(JNIEnv *env, jobject this __attribute__((unused)), jint fd)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jint avail;
+
+  TRACE("begin");
+
+  avail = (jint) local_available (fd);
+  if (avail < 0)
+    {
+      _throw (env, "java/io/IOException", local_error ());
+      return 0;
+    }
+
+  TRACE("end");
+
+  return avail;
+#else
+  (void) this;
+  (void) fd;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+  return -1;
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_close (JNIEnv *env, jobject this)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jfieldID socket_fd;
+  jclass clazz;
+  int fd;
+
+  TRACE("begin");
+
+  clazz = (*env)->GetObjectClass (env, this);
+  socket_fd = (*env)->GetFieldID (env, clazz, "socket_fd", "I");
+  if (!socket_fd)
+    {
+      return;
+    }
+  fd = (int) (*env)->GetIntField (env, this, socket_fd);
+  if (local_close (fd))
+    {
+      _throw (env, "java/io/IOException", local_error ());
+    }
+
+  TRACE("end");
+#else
+  (void) this;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_unlink (JNIEnv *env, jobject this)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jfieldID local;
+  jmethodID get_path;
+  jclass clazz1, clazz2;
+  jobject local_ref, path;
+  char *addr_path;
+
+  TRACE("begin");
+
+  clazz1 = (*env)->GetObjectClass (env, this);
+  local = (*env)->GetFieldID (env, clazz1, "local", "Lgnu/java/net/local/LocalSocketAddress;");
+  if (!local)
+    {
+      return;
+    }
+  local_ref = (*env)->GetObjectField (env, this, local);
+  clazz2 = (*env)->GetObjectClass (env, local_ref);
+  get_path = (*env)->GetMethodID (env, clazz2, "getPath", "()Ljava/lang/String;");
+  if (!get_path)
+    {
+      return;
+    }
+  path = (*env)->CallObjectMethod (env, local_ref, get_path);
+  addr_path = (char *) (*env)->GetStringUTFChars (env, (jstring) path, NULL);
+  if (local_unlink (addr_path))
+    {
+      _throw (env, "java/io/IOException", local_error ());
+    }
+  (*env)->ReleaseStringUTFChars (env, (jstring) path, addr_path);
+
+  TRACE("end");
+#else
+  (void) this;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_sendUrgentData (JNIEnv *env, jobject this __attribute__((unused)), jint data __attribute__((unused)))
+{
+  /* XXX I don't remember why I have this. Probably should just
+     remove. */
+  (*env)->FatalError (env, "Java_gnu_java_net_local_LocalSocketImpl_shutdownInput (JNIEnv *env, jobject) not implemented");
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_shutdownInput (JNIEnv *env, jobject this)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jfieldID socket_fd;
+  jclass clazz;
+  int fd;
+
+  TRACE("begin");
+
+  clazz = (*env)->GetObjectClass (env, this);
+  socket_fd = (*env)->GetFieldID (env, clazz, "socket_fd", "I");
+  if (!socket_fd)
+    {
+      return;
+    }
+  fd = (*env)->GetIntField (env, this, socket_fd);
+  if (local_shutdown_input (fd))
+    {
+      _throw (env, "java/io/IOException", local_error ());
+    }
+
+  TRACE("end");
+#else
+  (void) this;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_shutdownOutput (JNIEnv *env, jobject this)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jfieldID socket_fd;
+  jclass clazz;
+  int fd;
+
+  TRACE("begin");
+
+  clazz = (*env)->GetObjectClass (env, this);
+  socket_fd = (*env)->GetFieldID (env, clazz, "socket_fd", "I");
+  if (!socket_fd)
+    {
+      return;
+    }
+  fd = (*env)->GetIntField (env, this, socket_fd);
+  if (local_shutdown_output (fd))
+    {
+      _throw (env, "java/io/IOException", local_error ());
+    }
+
+  TRACE("end");
+#else
+  (void) this;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_localBind (JNIEnv *env, jobject this, jobject address)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jfieldID socket_fd;
+  jmethodID get_path;
+  jobject path;
+  jclass clazz1, clazz2;
+  const char *addr_path;
+  int fd;
+
+  TRACE("begin");
+
+  clazz1 = (*env)->GetObjectClass (env, this);
+  socket_fd = (*env)->GetFieldID (env, clazz1, "socket_fd", "I");
+  if (!socket_fd)
+    {
+      return;
+    }
+  fd = (int) (*env)->GetIntField (env, this, socket_fd);
+  clazz2 = (*env)->GetObjectClass (env, address);
+  get_path = (*env)->GetMethodID (env, clazz2, "getPath", "()Ljava/lang/String;");
+  path = (*env)->CallObjectMethod (env, address, get_path);
+  addr_path = (*env)->GetStringUTFChars (env, (jstring) path, NULL);
+  if (local_bind (fd, addr_path))
+    {
+      _throw (env, "java/io/IOException", local_error ());
+    }
+  (*env)->ReleaseStringUTFChars (env, (jstring) path, addr_path);
+
+  TRACE("end");
+#else
+  (void) this;
+  (void) address;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_localConnect (JNIEnv *env, jobject this, jobject address)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jfieldID socket_fd;
+  jmethodID get_path;
+  jobject path;
+  jclass clazz1, clazz2;
+  char *addr_path;
+  int fd;
+
+  TRACE("begin");
+
+  clazz1 = (*env)->GetObjectClass (env, this);
+  socket_fd = (*env)->GetFieldID (env, clazz1, "socket_fd", "I");
+  if (!socket_fd)
+    {
+      return;
+    }
+  fd = (int) (*env)->GetIntField (env, this, socket_fd);
+  clazz2 = (*env)->GetObjectClass (env, address);
+  get_path = (*env)->GetMethodID (env, clazz2, "getPath", "()Ljava/lang/String;");
+  path = (*env)->CallObjectMethod (env, address, get_path);
+  addr_path = (char *) (*env)->GetStringUTFChars (env, (jstring) path, NULL);
+  if (local_connect (fd, addr_path))
+    {
+      _throw (env, "java/io/IOException", local_error ());
+    }
+  (*env)->ReleaseStringUTFChars (env, (jstring) path, addr_path);
+
+  TRACE("end");
+#else
+  (void) this;
+  (void) address;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+jint
+Java_gnu_java_net_local_LocalSocketImpl_read
+(JNIEnv *env, jobject this __attribute__((unused)), jint fd, jbyteArray buf,
+ jint off, jint len)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jbyte *buffer;
+  jint count;
+
+  TRACE("begin");
+
+  if (off < 0 || len < 0 || off + len > (*env)->GetArrayLength (env, buf))
+    {
+      _throw (env, "java/lang/ArrayIndexOutOfBoundsException", "");
+    }
+
+  buffer = (*env)->GetByteArrayElements (env, buf, NULL);
+  count = (jint) local_read (fd, (void *) (buffer + off), (int) len);
+  if (count < 0)
+    {
+      _throw (env, "java/io/IOException", local_error ());
+    }
+  (*env)->ReleaseByteArrayElements (env, buf, buffer, 0);
+
+  TRACE("end");
+
+  return count;
+#else
+  (void) this;
+  (void) fd;
+  (void) buf;
+  (void) off;
+  (void) len;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+  return -1;
+#endif /* ENABLE_LOCAL_SOCKETS */
+}
+
+
+void
+Java_gnu_java_net_local_LocalSocketImpl_write
+(JNIEnv *env, jobject this __attribute__((unused)), jint fd, jbyteArray buf,
+ jint off, jint len)
+{
+#ifdef ENABLE_LOCAL_SOCKETS
+  jbyte *buffer;
+
+  TRACE("begin");
+
+  if (off < 0 || len < 0 || off + len > (*env)->GetArrayLength (env, buf))
+    {
+      _throw (env, "java/lang/ArrayIndexOutOfBoundsException", "");
+    }
+
+  buffer = (*env)->GetByteArrayElements (env, buf, NULL);
+  if (local_write (fd, (void *) (buffer + off), (int) len) < 0)
+    {
+      _throw (env, "java/io/IOException", local_error ());
+    }
+  (*env)->ReleaseByteArrayElements (env, buf, buffer, JNI_ABORT);
+
+  TRACE("end");
+#else
+  (void) this;
+  (void) fd;
+  (void) buf;
+  (void) off;
+  (void) len;
+  _throw (env, "java/lang/Error", "support for local sockets not available");
+#endif /* ENABLE_LOCAL_SOCKETS */
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,270 @@
+/* VMInetAddress.c - Native methods for InetAddress class
+   Copyright (C) 1998, 2002, 2005, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "javanet.h"
+
+#include "target_native.h"
+#ifndef WITHOUT_NETWORK
+#include "target_native_network.h"
+#endif /* WITHOUT_NETWORK */
+
+#include "java_net_VMInetAddress.h"
+
+/*************************************************************************/
+
+/*
+ * Function to return the local hostname
+ */
+JNIEXPORT jstring JNICALL
+Java_java_net_VMInetAddress_getLocalHostname (JNIEnv * env,
+					      jclass class
+					      __attribute__ ((__unused__)))
+{
+  char hostname[256];
+  int result;
+  jstring retval;
+
+#ifndef WITHOUT_NETWORK
+  TARGET_NATIVE_NETWORK_GET_HOSTNAME (hostname, sizeof (hostname), result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      strcpy (hostname, "localhost");
+    }
+#else /* not WITHOUT_NETWORK */
+  strcpy (hostname, "localhost");
+#endif /* not WITHOUT_NETWORK */
+
+  retval = (*env)->NewStringUTF (env, hostname);
+
+  return (retval);
+}
+
+/*************************************************************************/
+
+/*
+ * Returns the value of the special IP address INADDR_ANY 
+ */
+JNIEXPORT jarray JNICALL
+Java_java_net_VMInetAddress_lookupInaddrAny (JNIEnv * env,
+					     jclass class
+					     __attribute__ ((__unused__)))
+{
+  jarray IParray;
+  jbyte *octets;
+
+  /* Allocate an array for the IP address */
+  IParray = (*env)->NewByteArray (env, 4);
+  if (IParray == NULL)
+    {
+      JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Internal Error");
+      return (jarray) NULL;
+    }
+
+  /* Copy in the values */
+  octets = (*env)->GetByteArrayElements (env, IParray, 0);
+
+#ifndef WITHOUT_NETWORK
+  TARGET_NATIVE_NETWORK_INT_TO_IPADDRESS_BYTES (INADDR_ANY,
+						octets[0],
+						octets[1],
+						octets[2], octets[3]);
+  (*env)->ReleaseByteArrayElements (env, IParray, octets, 0);
+#else /* not WITHOUT_NETWORK */
+  octets[0] = 0;
+  octets[1] = 0;
+  octets[2] = 0;
+  octets[3] = 0;
+#endif /* not WITHOUT_NETWORK */
+
+  return (IParray);
+}
+
+/*************************************************************************/
+
+/*
+ * Function to return the canonical hostname for a given IP address passed
+ * in as a byte array
+ */
+JNIEXPORT jstring JNICALL
+Java_java_net_VMInetAddress_getHostByAddr (JNIEnv * env,
+					   jclass class
+					   __attribute__ ((__unused__)),
+					   jarray arr)
+{
+#ifndef WITHOUT_NETWORK
+  jbyte *octets;
+  jsize len;
+  int addr;
+  char hostname[255];
+  int result;
+  jstring retval;
+
+  /* Grab the byte[] array with the IP out of the input data */
+  len = (*env)->GetArrayLength (env, arr);
+  if (len != 4)
+    {
+      JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Bad IP Address");
+      return (jstring) NULL;
+    }
+
+  octets = (*env)->GetByteArrayElements (env, arr, 0);
+  if (!octets)
+    {
+      JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Bad IP Address");
+      return (jstring) NULL;
+    }
+
+  /* Convert it to a 32 bit address */
+  TARGET_NATIVE_NETWORK_IPADDRESS_BYTES_TO_INT (octets[0],
+						octets[1],
+						octets[2], octets[3], addr);
+
+  /* Release some memory */
+  (*env)->ReleaseByteArrayElements (env, arr, octets, 0);
+
+  /* Resolve the address and return the name */
+  TARGET_NATIVE_NETWORK_GET_HOSTNAME_BY_ADDRESS (addr, hostname,
+						 sizeof (hostname), result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      return (jstring) NULL;
+    }
+
+  retval = (*env)->NewStringUTF (env, hostname);
+
+  return (retval);
+#else /* not WITHOUT_NETWORK */
+  return (jstring) NULL;
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+JNIEXPORT jobjectArray JNICALL
+Java_java_net_VMInetAddress_getHostByName (JNIEnv * env,
+					   jclass class
+					   __attribute__ ((__unused__)),
+					   jstring host)
+{
+#ifndef WITHOUT_NETWORK
+  const char *hostname;
+/* FIXME: limitation of max. 64 addresses - how to make it more flexibale? */
+  int addresses[64];
+  jsize addresses_count;
+  int result;
+  jclass arr_class;
+  jobjectArray addrs;
+  int i;
+  jbyte *octets;
+  jarray ret_octets;
+  int max_addresses;
+
+  /* Grab the hostname string */
+  hostname = (*env)->GetStringUTFChars (env, host, 0);
+  if (!hostname)
+    {
+      JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Null hostname");
+      return (jobjectArray) NULL;
+    }
+
+  max_addresses = sizeof (addresses) / sizeof (addresses[0]);
+  TARGET_NATIVE_NETWORK_GET_HOSTNAME_BY_NAME (hostname,
+					      addresses,
+					      max_addresses,
+					      addresses_count, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, (char *) hostname);
+      return (jobjectArray) NULL;
+    }
+  (*env)->ReleaseStringUTFChars (env, host, hostname);
+
+  arr_class = (*env)->FindClass (env, "[B");
+  if (!arr_class)
+    {
+      JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Internal Error");
+      return (jobjectArray) NULL;
+    }
+
+  addrs = (*env)->NewObjectArray (env, addresses_count, arr_class, 0);
+  if (!addrs)
+    {
+      JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Internal Error");
+      return (jobjectArray) NULL;
+    }
+
+  /* Now loop and copy in each address */
+  for (i = 0; i < addresses_count; i++)
+    {
+      ret_octets = (*env)->NewByteArray (env, 4);
+      if (!ret_octets)
+	{
+	  JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Internal Error");
+	  return (jobjectArray) NULL;
+	}
+
+      octets = (*env)->GetByteArrayElements (env, ret_octets, 0);
+
+      TARGET_NATIVE_NETWORK_INT_TO_IPADDRESS_BYTES (addresses[i],
+						    octets[0],
+						    octets[1],
+						    octets[2], octets[3]);
+
+      (*env)->ReleaseByteArrayElements (env, ret_octets, octets, 0);
+
+      (*env)->SetObjectArrayElement (env, addrs, i, ret_octets);
+    }
+
+  return (addrs);
+#else /* not WITHOUT_NETWORK */
+  return (jobjectArray) NULL;
+#endif /* not WITHOUT_NETWORK */
+}
+
+/* end of file */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMNetworkInterface.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMNetworkInterface.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMNetworkInterface.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMNetworkInterface.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,65 @@
+/* VMNetworkInterface.c - Native methods for NetworkInterface class
+   Copyright (C) 2003, 2005, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "java_net_VMNetworkInterface.h"
+
+#include "javanet.h"
+
+/*
+ * Returns all local network interfaces as vector
+ */
+JNIEXPORT jobject JNICALL
+Java_java_net_VMNetworkInterface_getInterfaces (JNIEnv * env,
+						jclass class
+						__attribute__ ((__unused__)))
+{
+  JCL_ThrowException (env, IO_EXCEPTION,
+		      "java.net.VMNetworkInterface.getInterfaces(): not implemented");
+  return 0;
+}
+
+/* end of file */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMURLConnection.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMURLConnection.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMURLConnection.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/java_net_VMURLConnection.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,102 @@
+/* VMURLConnection.c - native bits for URLConnection
+   Copyright (C) 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+
+#include <java_net_VMURLConnection.h>
+
+#ifdef HAVE_MAGIC_H
+
+#include <magic.h>
+
+static magic_t cookie;
+
+#endif /* HAVE_MAGIC_H */
+
+void
+Java_java_net_VMURLConnection_init (JNIEnv *env __attribute__ ((__unused__)),
+				    jclass klass __attribute__ ((__unused__)))
+{
+#ifdef HAVE_MAGIC_H
+  cookie = magic_open (MAGIC_MIME);
+  if (cookie == (magic_t) NULL)
+    return;
+  if (magic_load (cookie, NULL) == -1)
+    {
+      magic_close (cookie);
+      cookie = (magic_t) NULL;
+    }
+#endif /* HAVE_MAGIC_H */
+}
+
+#ifdef HAVE_MAGIC_H
+jstring
+Java_java_net_VMURLConnection_guessContentTypeFromBuffer (JNIEnv *env,
+							  jclass klass
+							  __attribute__ ((__unused__)),
+							  jbyteArray bytes,
+							  jint valid)
+{
+  jbyte *elements;
+  const char *result;
+
+  if (cookie == (magic_t) NULL)
+    return NULL;
+
+  elements = (*env)->GetByteArrayElements (env, bytes, NULL);
+  result = magic_buffer (cookie, elements, valid);
+
+  /* The mode we use doesn't matter, since we don't change the array. */
+  (*env)->ReleaseByteArrayElements (env, bytes, elements, JNI_ABORT);
+
+  if (result == NULL)
+    return NULL;
+  return (*env)->NewStringUTF (env, result);
+#else
+jstring
+Java_java_net_VMURLConnection_guessContentTypeFromBuffer (JNIEnv *env
+							  __attribute__ ((__unused__)),
+							  jclass klass
+							  __attribute__ ((__unused__)),
+							  jbyteArray bytes
+							  __attribute__ ((__unused__)),
+							  jint valid
+							  __attribute__ ((__unused__)))
+{
+  return NULL;
+#endif /* HAVE_MAGIC_H */
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/javanet.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/javanet.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/javanet.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/javanet.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1539 @@
+/* javanet.c - Common internal functions for the java.net package
+   Copyright (C) 1998, 2002, 2004, 2005, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "javanet.h"
+
+#include "target_native.h"
+#ifndef WITHOUT_NETWORK
+#include "target_native_network.h"
+#endif /* WITHOUT_NETWORK */
+
+#ifndef WITHOUT_NETWORK
+/* Need to have some value for SO_TIMEOUT */
+#ifndef SO_TIMEOUT
+#ifndef SO_RCVTIMEO
+#warning Neither SO_TIMEOUT or SO_RCVTIMEO are defined!
+#warning This will cause all get/setOption calls with that value to throw an exception
+#else
+#define SO_TIMEOUT SO_RCVTIMEO
+#endif /* not SO_RCVTIMEO */
+#endif /* not SO_TIMEOUT */
+#endif /* WITHOUT_NETWORK */
+
+/*************************************************************************/
+
+/*
+ * Sets an integer field in the specified object.
+ */
+static void
+_javanet_set_int_field (JNIEnv * env, jobject obj,
+			const char *class, const char *field, int val)
+{
+  jclass cls;
+  jfieldID fid;
+
+  cls = (*env)->FindClass (env, class);
+  if (cls == NULL)
+    return;
+
+  fid = (*env)->GetFieldID (env, cls, field, "I");
+  if (fid == NULL)
+    return;
+
+  (*env)->SetIntField (env, obj, fid, val);
+
+  return;
+}
+
+/*************************************************************************/
+
+/*
+ * Returns the value of the specified integer instance variable field or
+ * -1 if an error occurs.
+ */
+int
+_javanet_get_int_field (JNIEnv * env, jobject obj, const char *field)
+{
+  jclass cls = 0;
+  jfieldID fid;
+  int fd;
+
+  DBG ("_javanet_get_int_field(): Entered _javanet_get_int_field\n");
+
+  cls = (*env)->GetObjectClass (env, obj);
+  if (cls == NULL)
+    return -1;
+
+  fid = (*env)->GetFieldID (env, cls, field, "I");
+  if (fid == NULL)
+    return -1;
+  DBG ("_javanet_get_int_field(): Found field id\n");
+
+  fd = (*env)->GetIntField (env, obj, fid);
+
+  return fd;
+}
+
+/*************************************************************************/
+
+/*
+ * Creates a FileDescriptor object in the parent class.  It is not used
+ * by this implementation, but the docs list it as a variable, so we
+ * need to include it.
+ */
+static void
+_javanet_create_localfd (JNIEnv * env, jobject this, jboolean stream)
+{
+  jclass this_cls, fd_cls;
+  jfieldID fid;
+  jmethodID mid;
+  jobject fd_obj;
+
+  DBG ("_javanet_create_localfd(): Entered _javanet_create_localfd\n");
+
+  /* Look up the fd field */
+  if (stream)
+    this_cls = (*env)->FindClass(env, "java/net/SocketImpl");
+  else
+    this_cls = (*env)->FindClass(env, "java/net/DatagramSocketImpl");
+  if (this_cls == NULL)
+    return;
+
+  fid = (*env)->GetFieldID (env, this_cls, "fd", "Ljava/io/FileDescriptor;");
+  if (fid == NULL)
+    return;
+
+  DBG ("_javanet_create_localfd(): Found fd variable\n");
+
+  /* Create a FileDescriptor */
+  fd_cls = (*env)->FindClass (env, "java/io/FileDescriptor");
+  if (fd_cls == NULL)
+    return;
+
+  DBG ("_javanet_create_localfd(): Found FileDescriptor class\n");
+
+  mid = (*env)->GetMethodID (env, fd_cls, "<init>", "()V");
+  if (mid == NULL)
+    return;
+
+  DBG ("_javanet_create_localfd(): Found FileDescriptor constructor\n");
+
+  fd_obj = (*env)->NewObject (env, fd_cls, mid);
+  if (fd_obj == NULL)
+    return;
+
+  DBG ("_javanet_create_localfd(): Created FileDescriptor\n");
+
+  /* Now set the pointer to the new FileDescriptor */
+  (*env)->SetObjectField (env, this, fid, fd_obj);
+  DBG ("_javanet_create_localfd(): Set fd field\n");
+
+  return;
+}
+
+/*************************************************************************/
+
+/*
+ * Returns a Boolean object with the specfied value
+ */
+static jobject
+_javanet_create_boolean (JNIEnv * env, jboolean val)
+{
+  jclass cls;
+  jmethodID mid;
+  jobject obj;
+
+  cls = (*env)->FindClass (env, "java/lang/Boolean");
+  if (cls == NULL)
+    return NULL;
+
+  mid = (*env)->GetMethodID (env, cls, "<init>", "(Z)V");
+  if (mid == NULL)
+    return NULL;
+
+  obj = (*env)->NewObject (env, cls, mid, val);
+  if (obj == NULL)
+    return NULL;
+
+  return obj;
+}
+
+/*************************************************************************/
+
+/*
+ * Returns an Integer object with the specfied value
+ */
+static jobject
+_javanet_create_integer (JNIEnv * env, jint val)
+{
+  jclass cls;
+  jmethodID mid;
+  jobject obj;
+
+  cls = (*env)->FindClass (env, "java/lang/Integer");
+  if (cls == NULL)
+    return NULL;
+
+  mid = (*env)->GetMethodID (env, cls, "<init>", "(I)V");
+  if (mid == NULL)
+    return NULL;
+
+  obj = (*env)->NewObject (env, cls, mid, val);
+  if (obj == NULL)
+    return NULL;
+
+  return obj;
+}
+
+/*************************************************************************/
+
+/*
+ * Builds an InetAddress object from a 32 bit address in host byte order
+ */
+static jobject
+_javanet_create_inetaddress (JNIEnv * env, int netaddr)
+{
+#ifndef WITHOUT_NETWORK
+  unsigned char octets[4];
+  char buf[16];
+  jclass ia_cls;
+  jmethodID mid;
+  jstring ip_str;
+  jobject ia;
+
+  /* Build a string IP address */
+  TARGET_NATIVE_NETWORK_INT_TO_IPADDRESS_BYTES (netaddr,
+						octets[0],
+						octets[1],
+						octets[2], octets[3]);
+  sprintf (buf, "%d.%d.%d.%d", octets[0], octets[1], octets[2], octets[3]);
+  DBG ("_javanet_create_inetaddress(): Created ip addr string\n");
+
+  /* Get an InetAddress object for this IP */
+  ia_cls = (*env)->FindClass (env, "java/net/InetAddress");
+  if (ia_cls == NULL)
+    {
+      return NULL;
+    }
+
+  DBG ("_javanet_create_inetaddress(): Found InetAddress class\n");
+
+  mid = (*env)->GetStaticMethodID (env, ia_cls, "getByName",
+				   "(Ljava/lang/String;)Ljava/net/InetAddress;");
+  if (mid == NULL)
+    {
+      return NULL;
+    }
+
+  DBG ("_javanet_create_inetaddress(): Found getByName method\n");
+
+  ip_str = (*env)->NewStringUTF (env, buf);
+  if (ip_str == NULL)
+    {
+      return NULL;
+    }
+
+  ia = (*env)->CallStaticObjectMethod (env, ia_cls, mid, ip_str);
+  if (ia == NULL)
+    {
+      return NULL;
+    }
+
+  DBG ("_javanet_create_inetaddress(): Called getByName method\n");
+
+  return ia;
+#else /* not WITHOUT_NETWORK */
+  return NULL;
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+static void
+_javanet_set_remhost_addr (JNIEnv * env, jobject this, jobject ia)
+{
+  jclass this_cls;
+  jfieldID fid;
+
+  /* Set the variable in the object */
+  this_cls = (*env)->FindClass (env, "java/net/SocketImpl");
+  if (this_cls == NULL)
+    return;
+
+  fid =
+    (*env)->GetFieldID (env, this_cls, "address", "Ljava/net/InetAddress;");
+  if (fid == NULL)
+    return;
+
+  DBG ("_javanet_set_remhost_addr(): Found address field\n");
+
+  (*env)->SetObjectField (env, this, fid, ia);
+  DBG ("_javanet_set_remhost_addr(): Set field\n");
+}
+
+/*
+ * Set's the value of the "addr" field in PlainSocketImpl with a new
+ * InetAddress for the specified addr
+ */
+static void
+_javanet_set_remhost (JNIEnv * env, jobject this, int netaddr)
+{
+  jobject ia;
+
+  DBG ("_javanet_set_remhost(): Entered _javanet_set_remhost\n");
+
+  /* Get an InetAddress object */
+  ia = _javanet_create_inetaddress (env, netaddr);
+  if (ia == NULL)
+    return;
+
+  _javanet_set_remhost_addr (env, this, ia);
+}
+
+
+/*************************************************************************/
+
+/*
+ * Returns a 32 bit Internet address for the passed in InetAddress object
+ */
+int
+_javanet_get_netaddr (JNIEnv * env, jobject addr)
+{
+#ifndef WITHOUT_NETWORK
+  jclass cls = 0;
+  jmethodID mid;
+  jarray arr = 0;
+  jbyte *octets;
+  int netaddr, len;
+
+  DBG ("_javanet_get_netaddr(): Entered _javanet_get_netaddr\n");
+
+  if (addr == NULL)
+    {
+      JCL_ThrowException (env, "java/lang/NullPointerException",
+			  "Null address");
+      return 0;
+    }
+
+  /* Call the getAddress method on the object to retrieve the IP address */
+  cls = (*env)->GetObjectClass (env, addr);
+  if (cls == NULL)
+    return 0;
+
+  mid = (*env)->GetMethodID (env, cls, "getAddress", "()[B");
+  if (mid == NULL)
+    return 0;
+
+  DBG ("_javanet_get_netaddr(): Got getAddress method\n");
+
+  arr = (*env)->CallObjectMethod (env, addr, mid);
+  if (arr == NULL)
+    return 0;
+
+  DBG ("_javanet_get_netaddr(): Got the address\n");
+
+  /* Turn the IP address into a 32 bit Internet address in network byte order */
+  len = (*env)->GetArrayLength (env, arr);
+  if (len != 4)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION, "Internal Error");
+      return 0;
+    }
+  DBG ("_javanet_get_netaddr(): Length ok\n");
+
+  octets = (*env)->GetByteArrayElements (env, arr, 0);
+  if (octets == NULL)
+    return 0;
+
+  DBG ("_javanet_get_netaddr(): Grabbed bytes\n");
+
+  TARGET_NATIVE_NETWORK_IPADDRESS_BYTES_TO_INT (octets[0],
+						octets[1],
+						octets[2],
+						octets[3], netaddr);
+
+  (*env)->ReleaseByteArrayElements (env, arr, octets, 0);
+  DBG ("_javanet_get_netaddr(): Done getting addr\n");
+
+  return netaddr;
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Creates a new stream or datagram socket
+ */
+void
+_javanet_create (JNIEnv * env, jobject this, jboolean stream)
+{
+#ifndef WITHOUT_NETWORK
+  int fd;
+  int result;
+
+  if (stream)
+    {
+      /* create a stream socket */
+      TARGET_NATIVE_NETWORK_SOCKET_OPEN_STREAM (fd, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+    }
+  else
+    {
+      /* create a datagram socket, set broadcast option */
+      TARGET_NATIVE_NETWORK_SOCKET_OPEN_DATAGRAM (fd, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+      TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_BROADCAST (fd, 1, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+    }
+
+  if (stream)
+    _javanet_set_int_field (env, this, "gnu/java/net/PlainSocketImpl",
+			    "native_fd", fd);
+  else
+    _javanet_set_int_field (env, this, "gnu/java/net/PlainDatagramSocketImpl",
+			    "native_fd", fd);
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      /* Try to make sure we close the socket since close() won't work. */
+      do
+	{
+	  TARGET_NATIVE_NETWORK_SOCKET_CLOSE (fd, result);
+	  if (result != TARGET_NATIVE_OK
+	      && (TARGET_NATIVE_LAST_ERROR ()
+		  != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	    return;
+	}
+      while (result != TARGET_NATIVE_OK);
+      return;
+    }
+
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Close the socket.  Any underlying streams will be closed by this
+ * action as well.
+ */
+void
+_javanet_close (JNIEnv * env, jobject this, int stream)
+{
+#ifndef WITHOUT_NETWORK
+  int fd;
+  int result;
+  int error = 0;
+
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    return;
+
+  if (stream)
+    _javanet_set_int_field (env, this, "gnu/java/net/PlainSocketImpl",
+			    "native_fd", -1);
+  else
+    _javanet_set_int_field (env, this, "gnu/java/net/PlainDatagramSocketImpl",
+			    "native_fd", -1);
+  do
+    {
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (fd, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  /* Only throw an error when a "real" error occurs. */
+	  error = TARGET_NATIVE_LAST_ERROR ();
+	  if (error != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL
+	      && error != ENOTCONN && error != ECONNRESET && error != EBADF)
+	    JCL_ThrowException (env, IO_EXCEPTION,
+				TARGET_NATIVE_LAST_ERROR_STRING ());
+	}
+    }
+  while (error == TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL);
+
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Connects to the specified destination.
+ */
+void
+_javanet_connect (JNIEnv * env, jobject this, jobject addr, jint port,
+		  jboolean stream)
+{
+#ifndef WITHOUT_NETWORK
+  int netaddr, fd;
+  int result;
+  int local_address, local_port;
+  int remote_address, remote_port;
+
+  DBG ("_javanet_connect(): Entered _javanet_connect\n");
+
+  /* Pre-process input variables */
+  netaddr = _javanet_get_netaddr (env, addr);
+  if ((*env)->ExceptionOccurred (env))
+    return;
+
+  if (port == -1)
+    port = 0;
+  DBG ("_javanet_connect(): Got network address\n");
+
+  /* Grab the real socket file descriptor */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Internal error: _javanet_connect(): no native file descriptor");
+      return;
+    }
+  DBG ("_javanet_connect(): Got native fd\n");
+
+  /* Connect up */
+  do
+    {
+      TARGET_NATIVE_NETWORK_SOCKET_CONNECT (fd, netaddr, port, result);
+      if (result != TARGET_NATIVE_OK
+	  && (TARGET_NATIVE_LAST_ERROR ()
+	      != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	{
+	  JCL_ThrowException (env, CONNECT_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+    }
+  while (result != TARGET_NATIVE_OK);
+
+  DBG ("_javanet_connect(): Connected successfully\n");
+
+  /* Populate instance variables */
+  TARGET_NATIVE_NETWORK_SOCKET_GET_LOCAL_INFO (fd, local_address, local_port,
+					       result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (fd, result);
+      return;
+    }
+
+  _javanet_create_localfd (env, this, stream);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (fd, result);
+      return;
+    }
+  DBG ("_javanet_connect(): Created fd\n");
+
+  if (stream)
+    _javanet_set_int_field (env, this, "java/net/SocketImpl", "localport",
+			    local_port);
+  else
+    _javanet_set_int_field (env, this, "java/net/DatagramSocketImpl",
+			    "localPort", local_port);
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (fd, result);
+      return;
+    }
+  DBG ("_javanet_connect(): Set the local port\n");
+
+  TARGET_NATIVE_NETWORK_SOCKET_GET_REMOTE_INFO (fd, remote_address,
+						remote_port, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (fd, result);
+      return;
+    }
+
+  if (stream)
+    {
+      if (remote_address == netaddr)
+	{
+	  _javanet_set_remhost_addr (env, this, addr);
+	}
+      else
+	{
+	  _javanet_set_remhost (env, this, remote_address);
+	}
+      if ((*env)->ExceptionOccurred (env))
+	{
+	  /* We don't care whether this succeeds. close() will cleanup later.
+	   */
+	  TARGET_NATIVE_NETWORK_SOCKET_CLOSE (fd, result);
+	  return;
+	}
+      DBG ("_javanet_connect(): Set the remote host\n");
+
+      _javanet_set_int_field (env, this, "java/net/SocketImpl", "port",
+			      remote_port);
+      if ((*env)->ExceptionOccurred (env))
+	{
+	  /* We don't care whether this succeeds. close() will cleanup later.
+	   */
+	  TARGET_NATIVE_NETWORK_SOCKET_CLOSE (fd, result);
+	  return;
+	}
+      DBG ("_javanet_connect(): Set the remote port\n");
+    }
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * This method binds the specified address to the specified local port.
+ * Note that we have to set the local address and local
+ * port public instance variables. 
+ */
+void
+_javanet_bind (JNIEnv * env, jobject this, jobject addr, jint port,
+	       int stream)
+{
+#ifndef WITHOUT_NETWORK
+  jclass cls;
+  jmethodID mid;
+  jbyteArray arr = 0;
+  jbyte *octets;
+  jint fd;
+  int tmpaddr;
+  int result;
+  int local_address, local_port;
+
+  DBG ("_javanet_bind(): Entering native bind()\n");
+
+  /* Get the address to connect to */
+  cls = (*env)->GetObjectClass (env, addr);
+  if (cls == NULL)
+    return;
+
+  mid = (*env)->GetMethodID (env, cls, "getAddress", "()[B");
+  if (mid == NULL)
+    return;
+
+  DBG ("_javanet_bind(): Past getAddress method id\n");
+
+  arr = (*env)->CallObjectMethod (env, addr, mid);
+  if ((arr == NULL) || (*env)->ExceptionOccurred (env))
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Internal error: _javanet_bind()");
+      return;
+    }
+
+  DBG ("_javanet_bind(): Past call object method\n");
+
+  octets = (*env)->GetByteArrayElements (env, arr, 0);
+  if (octets == NULL)
+    return;
+
+  DBG ("_javanet_bind(): Past grab array\n");
+
+  /* Get the native socket file descriptor */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      (*env)->ReleaseByteArrayElements (env, arr, octets, 0);
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Internal error: _javanet_bind(): no native file descriptor");
+      return;
+    }
+  DBG ("_javanet_bind(): Past native_fd lookup\n");
+
+  /* XXX NYI ??? */
+  _javanet_set_option (env, this, SOCKOPT_SO_REUSEADDR,
+		       _javanet_create_boolean (env, JNI_TRUE));
+
+
+  /* Bind the socket */
+  TARGET_NATIVE_NETWORK_IPADDRESS_BYTES_TO_INT (octets[0],
+						octets[1],
+						octets[2],
+						octets[3], tmpaddr);
+  TARGET_NATIVE_NETWORK_SOCKET_BIND (fd, tmpaddr, port, result);
+
+  if (result != TARGET_NATIVE_OK)
+    {
+      char *errorstr = TARGET_NATIVE_LAST_ERROR_STRING ();
+      (*env)->ReleaseByteArrayElements (env, arr, octets, 0);
+
+      JCL_ThrowException (env, BIND_EXCEPTION,
+			  errorstr);
+      return;
+    }
+  DBG ("_javanet_bind(): Past bind\n");
+
+  (*env)->ReleaseByteArrayElements (env, arr, octets, 0);
+
+  /* Update instance variables, specifically the local port number */
+  TARGET_NATIVE_NETWORK_SOCKET_GET_LOCAL_INFO (fd, local_address, local_port,
+					       result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      return;
+    }
+
+  if (stream)
+    _javanet_set_int_field (env, this, "java/net/SocketImpl",
+			    "localport", local_port);
+  else
+    _javanet_set_int_field (env, this, "java/net/DatagramSocketImpl",
+			    "localPort", local_port);
+  DBG ("_javanet_bind(): Past update port number\n");
+
+  return;
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Starts listening on a socket with the specified number of pending 
+ * connections allowed.
+ */
+void
+_javanet_listen (JNIEnv * env, jobject this, jint queuelen)
+{
+#ifndef WITHOUT_NETWORK
+  int fd;
+  int result;
+
+  /* Get the real file descriptor */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Internal error: _javanet_listen(): no native file descriptor");
+      return;
+    }
+
+  /* Start listening */
+  TARGET_NATIVE_NETWORK_SOCKET_LISTEN (fd, queuelen, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      return;
+    }
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Accepts a new connection and assigns it to the passed in SocketImpl
+ * object. Note that we assume this is a PlainSocketImpl just like us
+ */
+void
+_javanet_accept (JNIEnv * env, jobject this, jobject impl)
+{
+#ifndef WITHOUT_NETWORK
+  int fd, newfd;
+  int result;
+  int local_address, local_port;
+  int remote_address, remote_port;
+
+  /* Get the real file descriptor */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Internal error: _javanet_accept(): no native file descriptor");
+      return;
+    }
+
+  /* Accept the connection */
+  do
+    {
+      TARGET_NATIVE_NETWORK_SOCKET_ACCEPT (fd, newfd, result);
+      if (result != TARGET_NATIVE_OK
+	  && (TARGET_NATIVE_LAST_ERROR ()
+	      != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	{
+	  if (TARGET_NATIVE_LAST_ERROR () == EAGAIN)
+	    JCL_ThrowException (env, "java/net/SocketTimeoutException",
+				"Timeout");
+	  else
+	    JCL_ThrowException (env, IO_EXCEPTION,
+				TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+    }
+  while (result != TARGET_NATIVE_OK);
+
+  /* Reset the inherited timeout. */
+  TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_TIMEOUT (newfd, 0, result);
+
+  /* Populate instance variables */
+  _javanet_set_int_field (env, impl, "gnu/java/net/PlainSocketImpl",
+			  "native_fd", newfd);
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      /* Try to make sure we close the socket since close() won't work. */
+      do
+	{
+	  TARGET_NATIVE_NETWORK_SOCKET_CLOSE (newfd, result);
+	  if (result != TARGET_NATIVE_OK
+	      && (TARGET_NATIVE_LAST_ERROR ()
+		  != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	    return;
+	}
+      while (result != TARGET_NATIVE_OK);
+      return;
+    }
+
+  TARGET_NATIVE_NETWORK_SOCKET_GET_LOCAL_INFO (newfd, local_address,
+					       local_port, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (newfd, result);
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      return;
+    }
+
+  _javanet_create_localfd (env, impl, 1);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (newfd, result);
+      return;
+    }
+
+  _javanet_set_int_field (env, impl, "java/net/SocketImpl", "localport",
+			  local_port);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (newfd, result);
+      return;
+    }
+
+  TARGET_NATIVE_NETWORK_SOCKET_GET_REMOTE_INFO (newfd, remote_address,
+						remote_port, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (newfd, result);
+      return;
+    }
+
+  _javanet_set_remhost (env, impl, remote_address);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (newfd, result);
+      return;
+    }
+
+  _javanet_set_int_field (env, impl, "java/net/SocketImpl", "port",
+			  remote_port);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      /* We don't care whether this succeeds. close() will cleanup later. */
+      TARGET_NATIVE_NETWORK_SOCKET_CLOSE (newfd, result);
+      return;
+    }
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Receives a buffer from a remote host. The args are:
+ *
+ * buf - The byte array into which the data received will be written
+ * offset - Offset into the byte array to start writing
+ * len - The number of bytes to read.
+ * addr - Pointer to 32 bit net address of host to receive from. If null,
+ *        this parm is ignored.  If pointing to an address of 0, the 
+ *        actual address read is stored here
+ * port - Pointer to the port to receive from. If null, this parm is ignored.
+ *        If it is 0, the actual remote port received from is stored here
+ *
+ * The actual number of bytes read is returned.
+ */
+int
+_javanet_recvfrom (JNIEnv * env, jobject this, jarray buf, int offset,
+		   int len, int *addr, int *port)
+{
+#ifndef WITHOUT_NETWORK
+  int fd;
+  jbyte *p;
+  int from_address, from_port;
+  int received_bytes;
+
+  DBG ("_javanet_recvfrom(): Entered _javanet_recvfrom\n");
+
+  /* Get the real file descriptor */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Internal error: _javanet_recvfrom(): no native file descriptor");
+      return 0;
+    }
+  DBG ("_javanet_recvfrom(): Got native_fd\n");
+
+  /* Get a pointer to the buffer */
+  p = (*env)->GetByteArrayElements (env, buf, 0);
+  if (p == NULL)
+    return 0;
+
+  DBG ("_javanet_recvfrom(): Got buffer\n");
+
+  /* Read the data */
+  from_address = 0;
+  from_port = 0;
+  do
+    {
+      if (addr != NULL)
+	{
+	  TARGET_NATIVE_NETWORK_SOCKET_RECEIVE_WITH_ADDRESS_PORT (fd,
+								  p + offset,
+								  len,
+								  from_address,
+								  from_port,
+								  received_bytes);
+	}
+      else
+	{
+	  TARGET_NATIVE_NETWORK_SOCKET_RECEIVE (fd, p + offset, len,
+						received_bytes);
+	}
+    }
+  while ((received_bytes == -1) &&
+	 (TARGET_NATIVE_LAST_ERROR () ==
+	  TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL));
+
+  if (received_bytes == -1)
+    {
+      if (TARGET_NATIVE_LAST_ERROR () == EAGAIN)
+	JCL_ThrowException (env, "java/net/SocketTimeoutException", "Timeout");
+      else
+	JCL_ThrowException (env, IO_EXCEPTION,
+			    TARGET_NATIVE_LAST_ERROR_STRING ());
+ 
+      /* Cleanup and return. */
+      (*env)->ReleaseByteArrayElements (env, buf, p, 0);
+      return 0;
+    }
+
+  (*env)->ReleaseByteArrayElements (env, buf, p, 0);
+
+  /* Handle return addr case */
+  if (addr != NULL)
+    {
+      (*addr) = from_address;
+      if (port != NULL)
+	(*port) = from_port;
+    }
+
+  /* zero bytes received means recv() noticed the other side orderly
+     closing the connection. */
+  if (received_bytes == 0)
+    received_bytes = -1;
+
+  return (received_bytes);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Sends a buffer to a remote host.  The args are:
+ *
+ * buf - A byte array
+ * offset - Index into the byte array to start sendign
+ * len - The number of bytes to write
+ * addr - The 32bit address to send to (may be 0)
+ * port - The port number to send to (may be 0)
+ */
+void
+_javanet_sendto (JNIEnv * env, jobject this, jarray buf, int offset, int len,
+		 int addr, int port)
+{
+#ifndef WITHOUT_NETWORK
+  int fd;
+  jbyte *p;
+  int bytes_sent;
+
+  /* Get the real file descriptor */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Internal error: _javanet_sendto(): no native file descriptor");
+      return;
+    }
+
+  /* Get a pointer to the buffer */
+  p = (*env)->GetByteArrayElements (env, buf, 0);
+  if (p == NULL)
+    return;
+
+  /* We must send all the data, so repeat till done. */
+  while (len > 0)
+    {
+      /* Send the data */
+      if (addr == 0)
+	{
+	  DBG ("_javanet_sendto(): Sending....\n");
+	  TARGET_NATIVE_NETWORK_SOCKET_SEND (fd, p + offset, len, bytes_sent);
+	}
+      else
+	{
+	  DBG ("_javanet_sendto(): Sending....\n");
+	  TARGET_NATIVE_NETWORK_SOCKET_SEND_WITH_ADDRESS_PORT (fd, p + offset,
+							       len, addr, port,
+							       bytes_sent);
+	}
+
+      if (bytes_sent < 0)
+	{
+	  if (TARGET_NATIVE_LAST_ERROR ()
+	      != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL)
+	    {
+	      JCL_ThrowException (env, IO_EXCEPTION,
+				  TARGET_NATIVE_LAST_ERROR_STRING ());
+	      break;
+	    }
+	}
+      else
+	{
+	  len -= bytes_sent;
+	  addr += bytes_sent;
+	}
+    }
+
+  (*env)->ReleaseByteArrayElements (env, buf, p, 0);
+
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Sets the specified option for a socket
+ */
+void
+_javanet_set_option (JNIEnv * env, jobject this, jint option_id, jobject val)
+{
+#ifndef WITHOUT_NETWORK
+  int fd;
+  int optval;
+  jclass cls;
+  jmethodID mid;
+  int address;
+  int result;
+
+  /* Get the real file descriptor */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Internal error: _javanet_set_option(): no native file descriptor");
+      return;
+    }
+
+  /* We need a class object for all cases below */
+  cls = (*env)->GetObjectClass (env, val);
+  if (cls == NULL)
+    return;
+
+  /* Process the option request */
+  result = TARGET_NATIVE_ERROR;
+  switch (option_id)
+    {
+      /* TCP_NODELAY case.  val is a Boolean that tells us what to do */
+    case SOCKOPT_TCP_NODELAY:
+      mid = (*env)->GetMethodID (env, cls, "booleanValue", "()Z");
+      if (mid == NULL)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      "Internal error: _javanet_set_option()");
+	  return;
+	}
+
+      /* Should be a 0 or a 1 */
+      optval = (*env)->CallBooleanMethod (env, val, mid);
+      if ((*env)->ExceptionOccurred (env))
+	return;
+
+      TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_TCP_NODELAY (fd, optval,
+							   result);
+      break;
+
+      /* SO_LINGER case.  If val is a boolean, then it will always be set
+         to false indicating disable linger, otherwise it will be an
+         integer that contains the linger value */
+    case SOCKOPT_SO_LINGER:
+      mid = (*env)->GetMethodID (env, cls, "booleanValue", "()Z");
+      if (mid)
+	{
+	  /* We are disabling linger */
+	  TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_LINGER (fd, 1, 0,
+							     result);
+	}
+      else
+	{
+	  /* Clear exception if thrown for failure to do method lookup
+	     above */
+	  if ((*env)->ExceptionOccurred (env))
+	    (*env)->ExceptionClear (env);
+
+	  mid = (*env)->GetMethodID (env, cls, "intValue", "()I");
+	  if (mid == NULL)
+	    {
+	      JCL_ThrowException (env, IO_EXCEPTION,
+				  "Internal error: _javanet_set_option()");
+	      return;
+	    }
+
+	  optval = (*env)->CallIntMethod (env, val, mid);
+	  if ((*env)->ExceptionOccurred (env))
+	    return;
+
+	  TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_LINGER (fd, 0, optval,
+							     result);
+	}
+      break;
+
+      /* SO_TIMEOUT case. Val will be an integer with the new value */
+      /* Not writable on Linux */
+    case SOCKOPT_SO_TIMEOUT:
+#ifdef SO_TIMEOUT
+      mid = (*env)->GetMethodID (env, cls, "intValue", "()I");
+      if (mid == NULL)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      "Internal error: _javanet_set_option()");
+	  return;
+	}
+
+      optval = (*env)->CallIntMethod (env, val, mid);
+      if ((*env)->ExceptionOccurred (env))
+	return;
+
+      TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_TIMEOUT (fd, optval, result);
+#else
+      result = TARGET_NATIVE_OK;
+#endif
+      break;
+
+    case SOCKOPT_SO_SNDBUF:
+    case SOCKOPT_SO_RCVBUF:
+      mid = (*env)->GetMethodID (env, cls, "intValue", "()I");
+      if (mid == NULL)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      "Internal error: _javanet_set_option()");
+	  return;
+	}
+
+
+      optval = (*env)->CallIntMethod (env, val, mid);
+      if ((*env)->ExceptionOccurred (env))
+	return;
+
+      if (option_id == SOCKOPT_SO_SNDBUF)
+	TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_SNDBUF (fd, optval,
+							   result);
+      else
+	TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_SO_RCDBUF (fd, optval,
+							   result);
+      break;
+
+      /* TTL case.  Val with be an Integer with the new time to live value */
+    case SOCKOPT_IP_TTL:
+      mid = (*env)->GetMethodID (env, cls, "intValue", "()I");
+      if (!mid)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      "Internal error: _javanet_set_option()");
+	  return;
+	}
+
+      optval = (*env)->CallIntMethod (env, val, mid);
+      if ((*env)->ExceptionOccurred (env))
+	return;
+
+      TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_IP_TTL (fd, optval, result);
+      break;
+
+      /* Multicast Interface case - val is InetAddress object */
+    case SOCKOPT_IP_MULTICAST_IF:
+      address = _javanet_get_netaddr (env, val);
+
+      if ((*env)->ExceptionOccurred (env))
+	return;
+
+      TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_IP_MULTICAST_IF (fd, address,
+							       result);
+      break;
+
+    case SOCKOPT_SO_REUSEADDR:
+      mid = (*env)->GetMethodID (env, cls, "booleanValue", "()Z");
+      if (mid == NULL)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      "Internal error: _javanet_set_option()");
+	  return;
+	}
+
+      /* Should be a 0 or a 1 */
+      optval = (*env)->CallBooleanMethod (env, val, mid);
+      if ((*env)->ExceptionOccurred (env))
+	return;
+
+      TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_REUSE_ADDRESS (fd, optval,
+							     result);
+      break;
+
+    case SOCKOPT_SO_KEEPALIVE:
+      mid = (*env)->GetMethodID (env, cls, "booleanValue", "()Z");
+      if (mid == NULL)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      "Internal error: _javanet_set_option()");
+	  return;
+	}
+
+      /* Should be a 0 or a 1 */
+      optval = (*env)->CallBooleanMethod (env, val, mid);
+      if ((*env)->ExceptionOccurred (env))
+	return;
+
+      TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_KEEP_ALIVE (fd, optval, result);
+      break;
+
+    case SOCKOPT_SO_BINDADDR:
+      JCL_ThrowException (env, SOCKET_EXCEPTION, "This option cannot be set");
+      break;
+
+    default:
+      JCL_ThrowException (env, SOCKET_EXCEPTION, "Unrecognized option");
+      return;
+    }
+
+  /* Check to see if above operations succeeded */
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, SOCKET_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      return;
+    }
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+/*************************************************************************/
+
+/*
+ * Retrieves the specified option values for a socket
+ */
+jobject
+_javanet_get_option (JNIEnv * env, jobject this, jint option_id)
+{
+#ifndef WITHOUT_NETWORK
+  int fd;
+  int flag, optval;
+  int address;
+  int result;
+
+  /* Get the real file descriptor */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      JCL_ThrowException (env, SOCKET_EXCEPTION,
+			  "Internal error: _javanet_get_option(): no native file descriptor");
+      return (0);
+    }
+
+  /* Process the option requested */
+  switch (option_id)
+    {
+      /* TCP_NODELAY case.  Return a Boolean indicating on or off */
+    case SOCKOPT_TCP_NODELAY:
+      TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_TCP_NODELAY (fd, optval,
+							   result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, SOCKET_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (0);
+	}
+
+      if (optval)
+	return (_javanet_create_boolean (env, JNI_TRUE));
+      else
+	return (_javanet_create_boolean (env, JNI_FALSE));
+
+      break;
+
+      /* SO_LINGER case.  If disabled, return a Boolean object that represents
+         false, else return an Integer that is the value of SO_LINGER */
+    case SOCKOPT_SO_LINGER:
+      TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_LINGER (fd, flag, optval,
+							 result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, SOCKET_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (0);
+	}
+
+      if (optval)
+	return (_javanet_create_integer (env, JNI_TRUE));
+      else
+	return (_javanet_create_boolean (env, JNI_FALSE));
+
+      break;
+
+      /* SO_TIMEOUT case. Return an Integer object with the timeout value */
+    case SOCKOPT_SO_TIMEOUT:
+#ifdef SO_TIMEOUT
+      TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_TIMEOUT (fd, optval, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, SOCKET_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (0);
+	}
+      return (_javanet_create_integer (env, optval));
+#else
+      JCL_ThrowException (env, SOCKET_EXCEPTION,
+			  "SO_TIMEOUT not supported on this platform");
+      return (0);
+#endif /* not SO_TIMEOUT */
+      break;
+
+    case SOCKOPT_SO_SNDBUF:
+    case SOCKOPT_SO_RCVBUF:
+      if (option_id == SOCKOPT_SO_SNDBUF)
+	TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_SNDBUF (fd, optval,
+							   result);
+      else
+	TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_SO_RCDBUF (fd, optval,
+							   result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, SOCKET_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (0);
+	}
+
+      return (_javanet_create_integer (env, optval));
+      break;
+
+      /* The TTL case.  Return an Integer with the Time to Live value */
+    case SOCKOPT_IP_TTL:
+      TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_IP_TTL (fd, optval, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, SOCKET_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (0);
+	}
+
+      return (_javanet_create_integer (env, optval));
+      break;
+
+      /* Multicast interface case */
+    case SOCKOPT_IP_MULTICAST_IF:
+      TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_IP_MULTICAST_IF (fd, address,
+							       result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, SOCKET_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (0);
+	}
+
+      return (_javanet_create_inetaddress (env, address));
+      break;
+
+    case SOCKOPT_SO_BINDADDR:
+      TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_BIND_ADDRESS (fd, address,
+							    result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, SOCKET_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (0);
+	}
+
+      return (_javanet_create_inetaddress (env, address));
+      break;
+
+    case SOCKOPT_SO_REUSEADDR:
+      TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_REUSE_ADDRESS (fd, optval,
+							     result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, SOCKET_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (0);
+	}
+
+      if (optval)
+	return (_javanet_create_boolean (env, JNI_TRUE));
+      else
+	return (_javanet_create_boolean (env, JNI_FALSE));
+
+      break;
+
+    case SOCKOPT_SO_KEEPALIVE:
+      TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_KEEP_ALIVE (fd, optval, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, SOCKET_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (0);
+	}
+
+      if (optval)
+	return (_javanet_create_boolean (env, JNI_TRUE));
+      else
+	return (_javanet_create_boolean (env, JNI_FALSE));
+
+      break;
+
+    default:
+      JCL_ThrowException (env, SOCKET_EXCEPTION, "No such option");
+      return (0);
+    }
+
+  return (0);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+void
+_javanet_shutdownInput (JNIEnv * env, jobject this)
+{
+  int fd;
+
+  /* Get the real file descriptor. */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      JCL_ThrowException (env, SOCKET_EXCEPTION,
+			  "Internal error: _javanet_get_option(): no native file descriptor");
+      return;
+    }
+
+  /* Shutdown input stream of socket. */
+  if (shutdown (fd, SHUT_RD) == -1)
+    {
+      JCL_ThrowException (env, SOCKET_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING());
+      return;
+    }
+}
+
+void
+_javanet_shutdownOutput (JNIEnv * env, jobject this)
+{
+  int fd;
+
+  /* Get the real file descriptor. */
+  fd = _javanet_get_int_field (env, this, "native_fd");
+  if (fd == -1)
+    {
+      JCL_ThrowException (env, SOCKET_EXCEPTION,
+			  "Internal error: _javanet_get_option(): no native file descriptor");
+      return;
+    }
+
+  /* Shutdown output stream of socket. */
+  if (shutdown (fd, SHUT_WR) == -1)
+    {
+      JCL_ThrowException (env, SOCKET_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING());
+      return;
+    }
+}
+
+/* end of file */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/javanet.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/javanet.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/javanet.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/javanet.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,98 @@
+/* javanet.h - Declarations for common functions for the java.net package
+   Copyright (C) 1998, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#ifndef _JAVANET_LOADED
+#define _JAVANET_LOADED 
+
+#include <jni.h>
+#include "jcl.h"
+
+/*************************************************************************/
+
+/*
+ * Defined constants
+ */
+
+/* Exception Classes */
+#define BIND_EXCEPTION "java/net/BindException"
+#define IO_EXCEPTION "java/io/IOException"
+#define CONNECT_EXCEPTION "java/net/ConnectException"
+#define SOCKET_EXCEPTION "java/net/SocketException"
+#define UNKNOWN_HOST_EXCEPTION "java/net/UnknownHostException"
+
+/* Socket Option Identifiers - Don't change or binary compatibility with 
+                               the JDK will be broken! These also need to
+                               be kept compatible with java.net.SocketOptions */
+#define SOCKOPT_TCP_NODELAY 1
+#define SOCKOPT_SO_BINDADDR 15
+#define SOCKOPT_SO_LINGER 128
+#define SOCKOPT_SO_TIMEOUT 4102
+#define SOCKOPT_SO_SNDBUF 4097
+#define SOCKOPT_SO_RCVBUF 4098
+#define SOCKOPT_SO_REUSEADDR 4
+#define SOCKOPT_IP_MULTICAST_IF 16
+#define SOCKOPT_SO_KEEPALIVE 8
+
+/* Internal option identifiers. Not needed for JDK compatibility */
+#define SOCKOPT_IP_TTL 7777
+
+/*************************************************************************/
+
+/*
+ * Function Prototypes
+ */
+
+extern int _javanet_get_int_field(JNIEnv *, jobject, const char *);
+extern int _javanet_get_netaddr(JNIEnv *, jobject);
+extern void _javanet_create(JNIEnv *, jobject, jboolean);
+extern void _javanet_close(JNIEnv *, jobject, int);
+extern void _javanet_connect(JNIEnv *, jobject, jobject, jint, jboolean);
+extern void _javanet_bind(JNIEnv *, jobject, jobject, jint, int);
+extern void _javanet_listen(JNIEnv *, jobject, jint);
+extern void _javanet_accept(JNIEnv *, jobject, jobject);
+extern int _javanet_recvfrom(JNIEnv *, jobject, jarray, int, int, int *, int *);
+extern void _javanet_sendto(JNIEnv *, jobject, jarray, int, int, int, int);
+extern jobject _javanet_get_option(JNIEnv *, jobject, jint);
+extern void _javanet_set_option(JNIEnv *, jobject, jint, jobject);
+extern void _javanet_shutdownInput (JNIEnv *, jobject);
+extern void _javanet_shutdownOutput (JNIEnv *, jobject);
+
+/*************************************************************************/
+
+#endif /* not _JAVANET_H_LOADED */
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/local.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/local.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/local.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/local.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,193 @@
+/* local.c -- implementation of unix-domain sockets.
+   Copyright (C) 2006  Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.  */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#ifdef ENABLE_LOCAL_SOCKETS
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <stdio.h>
+
+#include "local.h"
+
+const char *
+local_error (void)
+{
+  return strerror (errno);
+}
+
+int
+local_create (int stream)
+{
+  return socket (PF_UNIX, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
+}
+
+static int gcc_sucks = 0;
+
+int
+local_bind (int fd, const char *addr)
+{
+  struct sockaddr_un saddr;
+
+  /* For some reason, GCC 4.0.1 on Darwin/x86 MODIFIES the `addr'
+     pointer in the CALLER's STACK FRAME after calling this function,
+     but if we add this statement below, it doesn't!  */
+  if (gcc_sucks)
+    fprintf (stderr, "bind %p\n", addr);
+
+  if (strlen (addr) > sizeof (saddr.sun_path))
+    {
+      errno = ENAMETOOLONG;
+      return -1;
+    }
+
+  strncpy (saddr.sun_path, addr, sizeof (saddr.sun_path));
+  saddr.sun_path[sizeof (saddr.sun_path)] = '\0';
+  saddr.sun_family = AF_LOCAL;
+
+  return bind (fd, (struct sockaddr *) &saddr, SUN_LEN (&saddr));
+}
+
+int
+local_listen (int fd, int backlog)
+{
+  return listen (fd, backlog);
+}
+
+int
+local_accept (int fd, char *path)
+{
+  int newfd;
+  struct sockaddr_un addr;
+  socklen_t sz = SUN_LEN(&addr);
+
+  newfd = accept (fd, (struct sockaddr *) &addr, &sz);
+  if (newfd >= 0)
+    {
+      /** sun_path is some crazy statically-sized buffer, and it's
+          size is different on different OSes. */
+      int n = sizeof (addr.sun_path);
+      strncpy (path, addr.sun_path, n);
+      path[n] = '\0';
+    }
+  return newfd;
+}
+
+int
+local_available (int fd)
+{
+  int val;
+  if (ioctl (fd, FIONREAD, &val))
+    {
+      return -1;
+    }
+  return val;
+}
+
+int
+local_close (int fd)
+{
+  return close (fd);
+}
+
+int
+local_unlink (char *path)
+{
+  return unlink (path);
+}
+
+int
+local_shutdown_input (int fd)
+{
+  return shutdown (fd, 0);
+}
+
+int
+local_shutdown_output (int fd)
+{
+  return shutdown (fd, 1);
+}
+
+int
+local_connect (int fd, char *path)
+{
+  struct sockaddr_un saddr;
+
+  strncpy (saddr.sun_path, path, sizeof (saddr.sun_path));
+  saddr.sun_path[sizeof (saddr.sun_path) - 1] = '\0';
+  saddr.sun_family = AF_UNIX;
+
+  return connect (fd, (struct sockaddr *) &saddr, SUN_LEN(&saddr));
+}
+
+int
+local_read (int fd, void *buf, int len)
+{
+  int count = -1;
+  do
+    {
+      count = read (fd, buf, len);
+    }
+  while (count == -1 && errno == EINTR);
+  return count;
+}
+
+int
+local_write (int fd, void *buf, int len)
+{
+  int count = -1;
+  do
+    {
+      count = write (fd, buf, len);
+    }
+  while (count == -1 && errno == EINTR);
+  return count;
+}
+
+#endif /* ENABLE_LOCAL_SOCKETS */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/local.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/local.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/local.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-net/local.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,28 @@
+#ifndef __LOCAL_H__
+#define __LOCAL_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#define __EMACSEN__ }
+
+extern const char *local_error (void);
+extern int local_create (int);
+extern int local_bind (int, const char *);
+extern int local_listen (int, int);
+extern int local_accept (int, char *);
+extern int local_available (int);
+extern int local_close (int);
+extern int local_shutdown_input (int);
+extern int local_shutdown_output (int);
+extern int local_connect (int, char *);
+extern int local_unlink (char *);
+extern int local_read (int, void *, int);
+extern int local_write (int, void *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __LOCAL_H__ */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,17 @@
+nativeexeclib_LTLIBRARIES = libjavanio.la
+
+libjavanio_la_SOURCES = gnu_java_nio_VMPipe.c \
+			gnu_java_nio_VMChannel.c \
+			gnu_java_nio_VMSelector.c \
+			gnu_java_nio_channels_FileChannelImpl.c \
+			gnu_java_nio_charset_iconv_IconvDecoder.c \
+			gnu_java_nio_charset_iconv_IconvEncoder.c \
+			java_nio_MappedByteBufferImpl.c \
+			java_nio_VMDirectByteBuffer.c
+
+libjavanio_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo \
+		       $(LTLIBICONV) 
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,617 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/java-nio
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libjavanio_la_DEPENDENCIES =  \
+	$(top_builddir)/native/jni/classpath/jcl.lo \
+	$(am__DEPENDENCIES_1)
+am_libjavanio_la_OBJECTS = gnu_java_nio_VMPipe.lo \
+	gnu_java_nio_VMChannel.lo gnu_java_nio_VMSelector.lo \
+	gnu_java_nio_channels_FileChannelImpl.lo \
+	gnu_java_nio_charset_iconv_IconvDecoder.lo \
+	gnu_java_nio_charset_iconv_IconvEncoder.lo \
+	java_nio_MappedByteBufferImpl.lo \
+	java_nio_VMDirectByteBuffer.lo
+libjavanio_la_OBJECTS = $(am_libjavanio_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libjavanio_la_SOURCES)
+DIST_SOURCES = $(libjavanio_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libjavanio.la
+libjavanio_la_SOURCES = gnu_java_nio_VMPipe.c \
+			gnu_java_nio_VMChannel.c \
+			gnu_java_nio_VMSelector.c \
+			gnu_java_nio_channels_FileChannelImpl.c \
+			gnu_java_nio_charset_iconv_IconvDecoder.c \
+			gnu_java_nio_charset_iconv_IconvEncoder.c \
+			java_nio_MappedByteBufferImpl.c \
+			java_nio_VMDirectByteBuffer.c
+
+libjavanio_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo \
+		       $(LTLIBICONV) 
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/java-nio/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/java-nio/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libjavanio.la: $(libjavanio_la_OBJECTS) $(libjavanio_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libjavanio_la_LDFLAGS) $(libjavanio_la_OBJECTS) $(libjavanio_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_nio_VMChannel.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_nio_VMPipe.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_nio_VMSelector.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_nio_channels_FileChannelImpl.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_nio_charset_iconv_IconvDecoder.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_java_nio_charset_iconv_IconvEncoder.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_nio_MappedByteBufferImpl.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_nio_VMDirectByteBuffer.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,525 @@
+/* gnu_java_nio_VMChannel.c -
+   Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+#include <string.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "gnu_java_nio_VMChannel.h"
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif /* HAVE_FCNTL_H */
+
+#define IO_EXCEPTION "java/io/IOException"
+#define NON_READABLE_CHANNEL_EXCEPTION "java/nio/channels/NonReadableChannelException"
+#define NON_WRITABLE_CHANNEL_EXCEPTION "java/nio/channels/NonWritableChannelException"
+
+/*
+ * Limit to maximum of 16 buffers
+ */
+#define JCL_IOV_MAX 16
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+enum JCL_buffer_type { DIRECT, ARRAY, UNKNOWN };
+
+struct JCL_buffer
+{
+  enum JCL_buffer_type type;
+  jbyte *ptr;
+  jint offset;
+  jint position;
+  jint limit;
+  jint count;
+};
+
+jmethodID get_method_id(JNIEnv *, jclass, const char *, const char *);
+void JCL_print_buffer(JNIEnv *, struct JCL_buffer *);
+int JCL_init_buffer(JNIEnv *, struct JCL_buffer *, jobject);
+void JCL_release_buffer(JNIEnv *, struct JCL_buffer *, jobject, jint);
+void JCL_cleanup_buffers(JNIEnv *, struct JCL_buffer *, jint, jobjectArray, jint, jlong);
+
+static jfieldID address_fid;
+static jmethodID get_position_mid;
+static jmethodID set_position_mid;
+static jmethodID get_limit_mid;
+static jmethodID set_limit_mid;
+static jmethodID has_array_mid;
+static jmethodID array_mid;
+static jmethodID array_offset_mid;
+
+jmethodID
+get_method_id(JNIEnv *env,  jclass clazz, const char *name, 
+	          const char *sig)
+{
+  jmethodID mid = (*env)->GetMethodID(env, clazz, name, sig);
+  if (mid == NULL)
+    {
+  	  JCL_ThrowException(env, "java/lang/InternalError", name);
+      return NULL;
+    }
+  
+  return mid;
+}
+
+void
+JCL_print_buffer(JNIEnv *env __attribute__((__unused__)), struct JCL_buffer *buf)
+{
+  fprintf(stdout, "Buffer - type: %d, ptr: %p\n", buf->type, buf->ptr);
+  fflush(stdout);
+}
+
+
+int
+JCL_init_buffer(JNIEnv *env, struct JCL_buffer *buf, jobject bbuf)
+{
+  jobject address = (*env)->GetObjectField(env, bbuf, address_fid);
+  
+  buf->position = (*env)->CallIntMethod(env, bbuf, get_position_mid);
+  buf->limit = (*env)->CallIntMethod(env, bbuf, get_limit_mid);
+  buf->offset = 0;
+  buf->count = 0;
+  buf->type = UNKNOWN;
+    
+  if (address != NULL)
+    {
+      buf->ptr = (jbyte *) JCL_GetRawData(env, address);
+      buf->type = DIRECT;
+      (*env)->DeleteLocalRef(env, address);
+    }
+  else
+    {
+      jboolean has_array;
+      has_array = (*env)->CallBooleanMethod(env, bbuf, has_array_mid);
+      
+      if (has_array == JNI_TRUE)
+        {
+          jbyteArray arr;
+          buf->offset = (*env)->CallIntMethod(env, bbuf, array_offset_mid);
+          arr = (*env)->CallObjectMethod(env, bbuf, array_mid);
+          buf->ptr = (*env)->GetByteArrayElements(env, arr, 0);
+          buf->type = ARRAY;
+          (*env)->DeleteLocalRef(env, arr);
+        }
+      else
+        {
+          return -1;
+        }
+    }
+      
+  return 0;
+}
+
+void
+JCL_release_buffer(JNIEnv *env, struct JCL_buffer *buf, jobject bbuf, 
+    jint action)
+{
+  jbyteArray arr;
+  
+  /* Set the position to the appropriate value */
+  if (buf->count > 0)
+    {
+      jobject bbufTemp;
+      bbufTemp = (*env)->CallObjectMethod(env, bbuf, set_position_mid, 
+                                          buf->position + buf->count);
+      (*env)->DeleteLocalRef(env, bbufTemp);
+    }
+    
+  switch (buf->type)
+    {
+    case DIRECT:
+      break;
+    case ARRAY:
+      arr = (*env)->CallObjectMethod(env, bbuf, array_mid);
+      (*env)->ReleaseByteArrayElements(env, arr, buf->ptr, action);
+      (*env)->DeleteLocalRef(env, arr);
+      break;
+    case UNKNOWN:
+      /* TODO: Handle buffers that are not direct or array backed */
+      break;
+    }
+}
+
+void
+JCL_cleanup_buffers(JNIEnv *env, 
+                    struct JCL_buffer *bi_list, 
+                    jint vec_len, 
+                    jobjectArray bbufs, 
+                    jint offset,
+                    jlong num_bytes)
+{
+  jint i;
+  
+  /* Update all of the bbufs with the approriate information */
+  for (i = 0; i < vec_len; i++)
+    {
+      struct JCL_buffer* buf;
+      jobject bbuf;
+      
+      buf = &bi_list[i];
+      bbuf = (*env)->GetObjectArrayElement(env, bbufs, offset + i);
+
+      if (num_bytes > (buf->limit - buf->position))
+        buf->count = (buf->limit - buf->position);
+      else
+        buf->count = num_bytes;
+        
+      num_bytes -= buf->count;
+      
+      JCL_release_buffer(env, buf, bbuf, JNI_ABORT);
+      (*env)->DeleteLocalRef(env, bbuf);
+    }
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_nio_VMChannel_initIDs  (JNIEnv *env, 
+	jclass clazz __attribute__ ((__unused__)))
+{
+  jclass bufferClass = JCL_FindClass(env, "java/nio/Buffer");
+  jclass byteBufferClass = JCL_FindClass(env, "java/nio/ByteBuffer");
+  
+  address_fid = (*env)->GetFieldID(env, bufferClass, "address", 
+                                   "Lgnu/classpath/Pointer;");
+  if (address_fid == NULL)
+    {
+  	  JCL_ThrowException(env, "java/lang/InternalError", 
+  	  	"Unable to find internal field");
+      return;
+    }
+  
+  get_position_mid = get_method_id(env, bufferClass, "position", "()I");
+  set_position_mid = get_method_id(env, bufferClass, "position", 
+                                   "(I)Ljava/nio/Buffer;");
+  get_limit_mid = get_method_id(env, bufferClass, "limit", "()I");
+  set_limit_mid = get_method_id(env, bufferClass, "limit", 
+                                "(I)Ljava/nio/Buffer;");
+  has_array_mid = get_method_id(env, byteBufferClass, "hasArray", "()Z");
+  array_mid = get_method_id(env, byteBufferClass, "array", "()[B");
+  array_offset_mid = get_method_id(env, byteBufferClass, "arrayOffset", "()I");
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_nio_VMChannel_setBlocking (JNIEnv *env, 
+	jobject o __attribute__ ((__unused__)), 
+	jint fd, 
+	jboolean blocking)
+{
+  int opts;
+  
+  opts = fcntl(fd, F_GETFL);
+  if (opts < 0)
+    {
+      JCL_ThrowException(env, IO_EXCEPTION, 
+        "Failed to get flags for file desriptor");
+      return;
+    }
+  
+  if (blocking)
+    opts |= O_NONBLOCK;
+  else
+    opts &= ~(O_NONBLOCK);
+  
+  opts = fcntl(fd, F_SETFL, opts);
+  
+  if (opts < 0)
+    {
+      JCL_ThrowException(env, IO_EXCEPTION, 
+        "Failed to set flags for file desriptor");
+      return;
+    }  
+}
+
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_nio_VMChannel_read (JNIEnv *env, 
+	jobject o __attribute__ ((__unused__)), 
+	jint fd, 
+	jobject bbuf)
+{
+  jint len;
+  ssize_t result;
+  struct JCL_buffer buf;
+  
+  if (JCL_init_buffer(env, &buf, bbuf) < 0)
+    {
+      /* TODO: Rethrown exception */
+      JCL_ThrowException (env, IO_EXCEPTION, "Buffer initialisation failed");
+      return -1;
+    }
+  
+  len = buf.limit - buf.position;
+  
+  result = read(fd, &(buf.ptr[buf.position + buf.offset]), len);
+  buf.count = result;
+  
+  if (result == 0)
+    result = -1; /* End Of File */
+  else if (result == -1)
+    {
+      buf.count = 0;
+      if (errno == EAGAIN) /* Non-blocking */
+        result = 0;
+      else if (errno == EBADF) /* Bad fd */
+        {
+          JCL_release_buffer(env, &buf, bbuf, JNI_ABORT);
+          JCL_ThrowException (env, NON_READABLE_CHANNEL_EXCEPTION, 
+                              strerror(errno));
+          return -1;
+        }            
+      else
+        {
+          JCL_release_buffer(env, &buf, bbuf, JNI_ABORT);
+      	  JCL_ThrowException (env, IO_EXCEPTION, strerror(errno));
+      	  return -1;
+        }
+    }
+  else 
+    
+  JCL_release_buffer(env, &buf, bbuf, JNI_COMMIT);
+  
+  return result;
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_nio_VMChannel_write (JNIEnv *env, 
+	jobject o __attribute__ ((__unused__)), 
+	jint fd, 
+	jobject bbuf)
+{
+  jint len;
+  ssize_t result;
+  struct JCL_buffer buf;
+  
+  if (JCL_init_buffer(env, &buf, bbuf) < 0)
+    {
+      /* TODO: Rethrown exception */
+      JCL_ThrowException (env, IO_EXCEPTION, "Buffer initialisation failed");
+      return -1;
+    }
+  
+  len = buf.limit - buf.position;
+  
+  result = write(fd, &(buf.ptr[buf.position + buf.offset]), len);
+  buf.count = result;
+  
+  if (result == -1)
+    {
+      if (errno == EAGAIN) /* Non-blocking */
+          result = 0;
+      else
+        {
+          JCL_release_buffer(env, &buf, bbuf, JNI_ABORT);
+          JCL_ThrowException(env, IO_EXCEPTION, strerror(errno));
+          return -1;
+        }
+    }
+    
+  JCL_release_buffer(env, &buf, bbuf, JNI_ABORT);
+  
+  return result;  
+}
+
+
+/*
+ * Implementation of a scattering read.  Will use the appropriate
+ * vector based read call (currently readv on Linux).
+ * 
+ * This has a limit to the number of buffers that will be read.  It
+ * will not make muliple readv calls.  This is to ensure that operations 
+ * are atomic.  Currently it is limited to 16 buffers.  This is for 
+ * compatibiliy with Sun.
+ */
+JNIEXPORT jlong JNICALL 
+Java_gnu_java_nio_VMChannel_readScattering (JNIEnv *env, 
+	jobject o __attribute__ ((__unused__)), 
+	jint fd, 
+	jobjectArray bbufs, 
+	jint offset, 
+	jint length)
+{
+  jint i;
+/*   jboolean is_error = JNI_FALSE; */
+/*   char *error_msg; */
+  struct iovec buffers[JCL_IOV_MAX];
+  struct JCL_buffer bi_list[JCL_IOV_MAX];
+  ssize_t result;
+  jint vec_len = length < JCL_IOV_MAX ? length : JCL_IOV_MAX;
+  jlong bytes_read = 0;      
+  
+  /* Build the vector of buffers to read into */
+  for (i = 0; i < vec_len; i++)
+    {
+      struct JCL_buffer* buf;
+      jobject bbuf;
+      
+      buf = &bi_list[i];
+      bbuf = (*env)->GetObjectArrayElement(env, bbufs, offset + i);
+      
+      JCL_init_buffer(env, buf, bbuf); 
+      
+      buffers[i].iov_base = &(buf->ptr[buf->position + buf->offset]);
+      buffers[i].iov_len = buf->limit - buf->position;
+      (*env)->DeleteLocalRef(env, bbuf);
+    }
+    
+  /* Work the scattering magic */
+  result = readv(fd, buffers, vec_len);
+  bytes_read = (jlong) result;
+  
+  /* Handle the response */
+  if (result < 0)
+    {
+      if (errno == EAGAIN) /* Non blocking */
+        result = 0;
+      else if (errno == EBADF) /* Bad fd */
+        {
+          JCL_cleanup_buffers(env, bi_list, vec_len, bbufs, offset, bytes_read);
+          JCL_ThrowException (env, NON_READABLE_CHANNEL_EXCEPTION, 
+                              strerror(errno));
+          return -1;
+        } 
+      else
+        {
+          JCL_cleanup_buffers(env, bi_list, vec_len, bbufs, offset, bytes_read);
+          JCL_ThrowException (env, IO_EXCEPTION, strerror(errno));
+          return -1;
+        }
+      bytes_read = 0;
+    }
+  else if (result == 0) /* EOF */
+    {
+      result = -1;
+    }
+    
+  JCL_cleanup_buffers(env, bi_list, vec_len, bbufs, offset, bytes_read);
+                  
+  return (jlong) result;
+}
+
+/*
+ * Implementation of a gathering write.  Will use the appropriate
+ * vector based read call (currently readv on Linux).
+ * 
+ * This has a limit to the number of buffers that will be read.  It
+ * will not make muliple readv calls.  This is to ensure that operations 
+ * are atomic.  Currently it is limited to 16 buffers.  This is for 
+ * compatibiliy with Sun.
+ */
+JNIEXPORT jlong JNICALL 
+Java_gnu_java_nio_VMChannel_writeGathering (JNIEnv *env, 
+	jobject o __attribute__ ((__unused__)), 
+	jint fd, 
+	jobjectArray bbufs, 
+	jint offset, 
+	jint length)
+{
+  int i;
+/*   jboolean is_error = JNI_FALSE; */
+/*   char *error_msg; */
+  struct iovec buffers[JCL_IOV_MAX];
+  struct JCL_buffer bi_list[JCL_IOV_MAX];
+  ssize_t result;
+  jint vec_len = length < JCL_IOV_MAX ? length : JCL_IOV_MAX;
+  jlong bytes_written;
+  
+  
+  /* Build the vector of buffers to read into */
+  for (i = 0; i < vec_len; i++)
+    {
+      struct JCL_buffer* buf;
+      jobject bbuf;
+      
+      buf = &bi_list[i];
+      bbuf = (*env)->GetObjectArrayElement(env, bbufs, offset + i);
+      
+      JCL_init_buffer(env, buf, bbuf); 
+      
+      buffers[i].iov_base = &(buf->ptr[buf->position + buf->offset]);
+      buffers[i].iov_len = buf->limit - buf->position;
+      (*env)->DeleteLocalRef(env, bbuf);
+    }
+    
+  /* Work the gathering magic */
+  result = writev(fd, buffers, vec_len);
+  bytes_written = (jlong) result;
+
+  if (result < 0)
+    {
+      bytes_written = 0;
+      if (errno == EAGAIN) /* Non blocking */
+        result = 0;
+      else if (errno == EBADF) /* Bad fd */
+        {
+          JCL_cleanup_buffers(env, bi_list, vec_len, bbufs, offset, 
+                              bytes_written);
+          JCL_ThrowException (env, NON_WRITABLE_CHANNEL_EXCEPTION, 
+                              strerror(errno));
+          return -1;
+        } 
+      else
+        {
+          JCL_cleanup_buffers(env, bi_list, vec_len, bbufs, offset,
+                              bytes_written);
+          JCL_ThrowException (env, IO_EXCEPTION, strerror(errno));
+          return -1;
+        }
+    }
+  else if (result == 0) /* EOF??  Does this happen on a write */
+    result = -1;
+    
+  JCL_cleanup_buffers(env, bi_list, vec_len, bbufs, offset, bytes_written);    
+  return (jlong) result;
+}
+
+
+
+
+#ifdef __cplusplus
+}
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMPipe.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMPipe.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMPipe.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMPipe.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* gnu_java_nio_VMPipe.c - Native methods for PipeImpl class
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+#include <errno.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "gnu_java_nio_VMPipe.h"
+
+#define IO_EXCEPTION "java/io/IOException"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_VMPipe_init (JNIEnv * env,
+			       jclass cls __attribute__ ((__unused__)),
+			       jobject self __attribute__ ((__unused__)),
+			       jobject provider __attribute__ ((__unused__)))
+{
+  JCL_ThrowException (env, IO_EXCEPTION,
+		      "gnu.java.nio.VMPipe.init(): not implemented");
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMSelector.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMSelector.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMSelector.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_VMSelector.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,296 @@
+/* gnu_java_nio_VMSelector.c - Native methods for SelectorImpl class
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "config.h"
+
+/* <sys/types.h> needs to be included on OSX before <sys/select.h> */
+#if defined(HAVE_SYS_TYPES_H)
+#include <sys/types.h>
+#endif
+
+#include <sys/select.h>
+#include <sys/time.h>
+
+#include <string.h>
+
+#include <errno.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "gnu_java_nio_VMSelector.h"
+
+/* Amount of characters in the error message buffer for strerror_r. */
+#define BUF_SIZE 250
+
+void helper_put_filedescriptors (JNIEnv *, jintArray, fd_set *, int *);
+
+void helper_get_filedescriptors (JNIEnv *, jintArray *, fd_set *);
+
+void helper_reset (JNIEnv *, jintArray *);
+
+int
+helper_select (JNIEnv *, jclass, jmethodID,
+	       int, fd_set *, fd_set *, fd_set *, struct timeval *);
+
+void
+helper_put_filedescriptors (JNIEnv * env, jintArray fdArray, fd_set * fds,
+			    int *max_fd)
+{
+  jint *tmpFDArray = (*env)->GetIntArrayElements (env, fdArray, 0);
+  int size = (*env)->GetArrayLength (env, fdArray);
+  int index, fd;
+
+  for (index = 0; index < size; index++)
+    {
+      fd = tmpFDArray[index];
+
+      if (fd > 0)
+	{
+	  FD_SET (tmpFDArray[index], fds);
+
+	  if (tmpFDArray[index] > (*max_fd))
+	    (*max_fd) = tmpFDArray[index];
+	}
+    }
+}
+
+void
+helper_get_filedescriptors (JNIEnv * env, jintArray * fdArray, fd_set * fds)
+{
+  jint *tmpFDArray = (*env)->GetIntArrayElements (env, fdArray, 0);
+  int size = (*env)->GetArrayLength (env, fdArray);
+  int index, fd;
+
+  for (index = 0; index < size; index++)
+    {
+      fd = tmpFDArray[index];
+      if (fd < 0 || !FD_ISSET (fd, fds))
+	tmpFDArray[index] = 0;
+    }
+}
+
+void
+helper_reset (JNIEnv * env, jintArray * fdArray)
+{
+  jint *tmpFDArray = (*env)->GetIntArrayElements (env, fdArray, 0);
+  int size = (*env)->GetArrayLength (env, fdArray);
+  int index;
+
+  for (index = 0; index < size; index++)
+    tmpFDArray[index] = 0;
+}
+
+/* A wrapper for select() which ignores EINTR.
+ * Taken from gclib's posix.cc
+ */
+int
+helper_select (JNIEnv * env, jclass thread_class,
+	       jmethodID thread_interrupted, int n, fd_set * readfds,
+	       fd_set * writefds, fd_set * exceptfds, struct timeval *timeout)
+{
+#ifdef HAVE_SYS_SELECT_H
+  /* If we have a timeout, compute the absolute ending time. */
+  struct timeval end, delay, after;
+  int r;
+
+  if (timeout)
+    {
+      gettimeofday (&end, NULL);
+
+      end.tv_usec += timeout->tv_usec;
+
+      if (end.tv_usec >= 1000000)
+	{
+	  ++end.tv_sec;
+	  end.tv_usec -= 1000000;
+	}
+
+      end.tv_sec += timeout->tv_sec;
+      delay = *timeout;
+    }
+  else
+    {
+      /* Placate compiler. */
+      delay.tv_sec = delay.tv_usec = 0;
+    }
+
+  while (1)
+    {
+      r = select (n, readfds, writefds, exceptfds, timeout ? &delay : NULL);
+
+      if (r < 0 && errno != EINTR)
+	return -errno;
+      else if (r >= 0)
+	return r;
+
+      /* Here we know we got EINTR. */
+      if ((*env)->
+	  CallStaticBooleanMethod (env, thread_class, thread_interrupted))
+	{
+	  return -EINTR;
+	}
+
+      if (timeout)
+	{
+	  gettimeofday (&after, NULL);
+
+	  /* Now compute new timeout argument. */
+	  delay.tv_usec = end.tv_usec - after.tv_usec;
+	  delay.tv_sec = end.tv_sec - after.tv_sec;
+
+	  if (delay.tv_usec < 0)
+	    {
+	      --delay.tv_sec;
+	      delay.tv_usec += 1000000;
+	    }
+
+	  if (delay.tv_sec < 0)
+	    {
+	      /* We assume that the user wants a valid select() call
+	       * more than precise timing.  So if we get a series of
+	       * EINTR we just keep trying with delay 0 until we get a
+	       * valid result.
+	       */
+	      delay.tv_sec = 0;
+	    }
+	}
+    }
+#else /* HAVE_SYS_SELECT_H */
+  return 0;
+#endif
+
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_nio_VMSelector_select (JNIEnv * env,
+				     jclass obj __attribute__ ((__unused__)),
+				     jintArray read,
+				     jintArray write,
+				     jintArray except, jlong timeout)
+{
+  jint result;
+  jclass thread_class = (*env)->FindClass (env, "java/lang/Thread");
+  jmethodID thread_current_thread =
+    (*env)->GetStaticMethodID (env, thread_class, "currentThread",
+			       "()Ljava/lang/Thread;");
+  jmethodID thread_interrupt =
+    (*env)->GetMethodID (env, thread_class, "interrupt", "()V");
+  jmethodID thread_interrupted =
+    (*env)->GetStaticMethodID (env, thread_class, "interrupted", "()Z");
+  jobject current_thread;
+  int max_fd = 0;
+  fd_set read_fds;
+  fd_set write_fds;
+  fd_set except_fds;
+  struct timeval real_time_data;
+  struct timeval *time_data = NULL;
+  char message_buf[BUF_SIZE + 1];
+
+  /* If a legal timeout value isn't given, use NULL.
+   * This means an infinite timeout. The specification
+   * also says that a zero timeout should be treated
+   * as infinite. Otherwise (if the timeout value is legal),
+   * fill our timeval struct and use it for the select.
+   */
+  if (timeout > 0)
+    {
+      real_time_data.tv_sec = timeout / 1000;
+      real_time_data.tv_usec = (timeout % 1000) * 1000;
+      time_data = &real_time_data;
+    }
+
+  /* Reset all fd_set structures */
+  FD_ZERO (&read_fds);
+  FD_ZERO (&write_fds);
+  FD_ZERO (&except_fds);
+
+  /* Fill the fd_set data structures for the _Jv_select() call. */
+  helper_put_filedescriptors (env, read, &read_fds, &max_fd);
+  helper_put_filedescriptors (env, write, &write_fds, &max_fd);
+  helper_put_filedescriptors (env, except, &except_fds, &max_fd);
+
+  /* Actually do the select */
+  result =
+    helper_select (env, thread_class, thread_interrupted, max_fd + 1,
+		   &read_fds, &write_fds, &except_fds, time_data);
+
+  if (result == -EINTR)
+    {
+      /* The behavior of JRE 1.4.1 is that no exception is thrown
+       * when the thread is interrupted, but the thread's interrupt
+       * status is set. Clear all of our select sets and return 0,
+       * indicating that nothing was selected.
+       */
+      current_thread =
+	(*env)->CallStaticObjectMethod (env, thread_class,
+					thread_current_thread);
+      (*env)->CallVoidMethod (env, current_thread, thread_interrupt);
+
+      helper_reset (env, read);
+      helper_reset (env, write);
+      helper_reset (env, except);
+
+      return 0;
+    }
+
+  if (result < 0)
+    {
+
+      int errorcode = -result;
+
+      if (strerror_r (errorcode, message_buf, BUF_SIZE))
+	{
+	  /* This would mean that message_buf was to small
+	   * to hold the error message.
+	   */
+	  JCL_ThrowException (env, "java/lang/InternalError",
+			      "Not enough space in message buffer.");
+	  return 0;
+	}
+
+      JCL_ThrowException (env, "java/io/IOException", message_buf);
+      return 0;
+    }
+
+  /* Set the file descriptors according to the values returned from select(). */
+  helper_get_filedescriptors (env, read, &read_fds);
+  helper_get_filedescriptors (env, write, &write_fds);
+  helper_get_filedescriptors (env, except, &except_fds);
+
+  return result;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,902 @@
+/* gnu_java_nio_channels_FileChannelImpl.c -
+   Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+#include <errno.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "target_native.h"
+#ifndef WITHOUT_FILESYSTEM
+#include "target_native_file.h"
+#endif
+#include "target_native_math_int.h"
+
+#include "gnu_java_nio_channels_FileChannelImpl.h"
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif /* HAVE_FCNTL_H */
+
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif /* HAVE_SYS_MMAN_H */
+
+/* These values must be kept in sync with FileChannelImpl.java.  */
+#define FILECHANNELIMPL_READ   1
+#define FILECHANNELIMPL_WRITE  2
+#define FILECHANNELIMPL_APPEND 4
+
+/* These values must be kept in sync with FileChannelImpl.java.  */
+/* #define FILECHANNELIMPL_FILESEEK_SET          0 */
+/* #define FILECHANNELIMPL_FILESEEK_CUR          1 */
+/* #define FILECHANNELIMPL_FILESEEK_END          2 */
+
+#define FILECHANNELIMPL_FILEOPEN_FLAG_READ    1
+#define FILECHANNELIMPL_FILEOPEN_FLAG_WRITE   2
+#define FILECHANNELIMPL_FILEOPEN_FLAG_APPEND  4
+#define FILECHANNELIMPL_FILEOPEN_FLAG_EXCL    8
+#define FILECHANNELIMPL_FILEOPEN_FLAG_SYNC   16
+#define FILECHANNELIMPL_FILEOPEN_FLAG_DSYNC  32
+
+#define IO_EXCEPTION "java/io/IOException"
+
+/* FIXME: This can't be right.  Need converter macros. */
+#define CONVERT_JLONG_TO_INT(x) TARGET_NATIVE_MATH_INT_INT64_TO_INT32(x)
+#define CONVERT_INT_TO_JLONG(x) TARGET_NATIVE_MATH_INT_INT32_TO_INT64(x)
+
+/* FIXME: This can't be right.  Need converter macros. */
+#define CONVERT_JLONG_TO_OFF_T(x) TARGET_NATIVE_MATH_INT_INT64_TO_INT32(x)
+#define CONVERT_OFF_T_TO_JLONG(x) TARGET_NATIVE_MATH_INT_INT32_TO_INT64(x)
+
+/* FIXME: This can't be right.  Need converter macros */
+#define CONVERT_JINT_TO_INT(x) ((int)(x & 0xFFFFFFFF))
+#define CONVERT_INT_TO_JINT(x) ((int)(x & 0xFFFFFFFF))
+
+/* FIXME: This can't be right.  Need converter macros. */
+#define CONVERT_SSIZE_T_TO_JINT(x) ((jint)(x & 0xFFFFFFFF))
+#define CONVERT_JINT_TO_SSIZE_T(x) (x)
+
+/* Align a value up or down to a multiple of the pagesize. */
+#define ALIGN_DOWN(p,s) ((p) - ((p) % (s)))
+#define ALIGN_UP(p,s) ((p) + ((s) - ((p) % (s))))
+
+/* cached fieldID of gnu.java.nio.channels.FileChannelImpl.fd */
+static jfieldID native_fd_fieldID;
+
+static jint
+get_native_fd (JNIEnv * env, jobject obj)
+{
+  return (*env)->GetIntField (env, obj, native_fd_fieldID);
+}
+
+/*
+ * Library initialization routine.  Called as part of java.io.FileDescriptor
+ * static initialization.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_init (JNIEnv * env,
+						jclass clazz
+						__attribute__ ((__unused__)))
+{
+  jclass clazz_fc;
+  jfieldID field;
+
+  /* Initialize native_fd_fieldID so we only compute it once! */
+  clazz_fc = (*env)->FindClass (env, "gnu/java/nio/channels/FileChannelImpl");
+  if (!clazz_fc)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION, "Internal error");
+      return;
+    }
+
+  field = (*env)->GetFieldID (env, clazz_fc, "fd", "I");
+  if (!field)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION, "Internal error");
+      return;
+    }
+
+  native_fd_fieldID = field;
+}
+
+/*
+ * Open the specified file and return a native file descriptor
+ */
+JNIEXPORT jint JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_open (JNIEnv * env,
+						 jobject obj
+						 __attribute__ ((__unused__)),
+						 jstring name, jint mode)
+{
+  const char *filename;
+  int flags;
+  int permissions;
+  int native_fd;
+  int result;
+
+  filename = JCL_jstring_to_cstring (env, name);
+  if (filename == NULL)
+    return (-1);		/* Exception will already have been thrown */
+
+  /* get file/permission flags for open() */
+  if ((mode & FILECHANNELIMPL_FILEOPEN_FLAG_READ)
+      && (mode & FILECHANNELIMPL_FILEOPEN_FLAG_WRITE))
+    {
+      /* read/write */
+      flags =
+	TARGET_NATIVE_FILE_FILEFLAG_CREATE |
+	TARGET_NATIVE_FILE_FILEFLAG_READWRITE;
+      permissions = TARGET_NATIVE_FILE_FILEPERMISSION_NORMAL;
+    }
+  else if ((mode & FILECHANNELIMPL_FILEOPEN_FLAG_READ))
+    {
+      /* read */
+      flags = TARGET_NATIVE_FILE_FILEFLAG_READ;
+      permissions = TARGET_NATIVE_FILE_FILEPERMISSION_NORMAL;
+    }
+  else
+    {
+      /* write */
+      flags =
+	TARGET_NATIVE_FILE_FILEFLAG_CREATE |
+	TARGET_NATIVE_FILE_FILEFLAG_WRITE;
+      if ((mode & FILECHANNELIMPL_FILEOPEN_FLAG_APPEND))
+	{
+	  flags |= TARGET_NATIVE_FILE_FILEFLAG_APPEND;
+	}
+      else
+	{
+	  flags |= TARGET_NATIVE_FILE_FILEFLAG_TRUNCATE;
+	}
+      permissions = TARGET_NATIVE_FILE_FILEPERMISSION_NORMAL;
+    }
+
+  if ((mode & FILECHANNELIMPL_FILEOPEN_FLAG_SYNC))
+    {
+      flags |= TARGET_NATIVE_FILE_FILEFLAG_SYNC;
+    }
+
+  if ((mode & FILECHANNELIMPL_FILEOPEN_FLAG_DSYNC))
+    {
+      flags |= TARGET_NATIVE_FILE_FILEFLAG_DSYNC;
+    }
+#ifdef O_BINARY
+  flags |= TARGET_NATIVE_FILE_FILEFLAG_BINARY;
+#endif
+
+  TARGET_NATIVE_FILE_OPEN (filename, native_fd, flags, permissions, result);
+
+  if (result != TARGET_NATIVE_OK)
+    {
+      char message[256]; /* Fixed size we don't need to malloc. */
+      char *error_string = TARGET_NATIVE_LAST_ERROR_STRING ();
+
+      snprintf(message, 256, "%s: %s", error_string, filename);
+      /* We are only allowed to throw FileNotFoundException.  */
+      JCL_ThrowException (env,
+			  "java/io/FileNotFoundException",
+			  message);
+      JCL_free_cstring (env, name, filename);
+      return TARGET_NATIVE_MATH_INT_INT64_CONST_MINUS_1;
+    }
+
+  JCL_free_cstring (env, name, filename);
+  return native_fd;
+}
+
+/*
+ * Closes the specified file descriptor and return status code.
+ * Exception on error
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_implCloseChannel (JNIEnv * env,
+							     jobject obj)
+{
+  int native_fd;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+
+  do
+    {
+      TARGET_NATIVE_FILE_CLOSE (native_fd, result);
+      if (result != TARGET_NATIVE_OK
+	  && (TARGET_NATIVE_LAST_ERROR ()
+	      != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+    }
+  while (result != TARGET_NATIVE_OK);
+}
+
+/*
+ * Return number of bytes that can be read from the file w/o blocking.
+ * Exception on error
+ */
+JNIEXPORT jint JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_available (JNIEnv * env,
+						      jobject obj)
+{
+  int native_fd;
+  jlong bytes_available;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+
+  do
+    {
+      TARGET_NATIVE_FILE_AVAILABLE (native_fd, bytes_available, result);
+      if (result != TARGET_NATIVE_OK
+	  && (TARGET_NATIVE_LAST_ERROR ()
+	      != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return 0;
+	}
+    }
+  while (result != TARGET_NATIVE_OK);
+
+  /* FIXME NYI ??? why only jint and not jlong? */
+  return TARGET_NATIVE_MATH_INT_INT64_TO_INT32 (bytes_available);
+}
+
+JNIEXPORT jlong JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_size (JNIEnv * env, jobject obj)
+{
+  int native_fd;
+  jlong file_size;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+
+  TARGET_NATIVE_FILE_SIZE (native_fd, file_size, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      return TARGET_NATIVE_MATH_INT_INT64_CONST_MINUS_1;
+    }
+
+  return file_size;
+}
+
+/*
+ * Return the current position of the file pointer
+ * Exception on error
+ */
+JNIEXPORT jlong JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_implPosition (JNIEnv * env,
+							 jobject obj)
+{
+  int native_fd;
+  jlong current_offset;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+
+  TARGET_NATIVE_FILE_TELL (native_fd, current_offset, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      return TARGET_NATIVE_MATH_INT_INT64_CONST_MINUS_1;
+    }
+
+  return current_offset;
+}
+
+/*
+ * Wrapper around lseek call.  Return new file position
+ * Exception on error
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_seek (JNIEnv * env, jobject obj,
+						 jlong offset)
+{
+  int native_fd;
+  jlong new_offset;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+
+#if 0
+  /* Should there be such an exception? All native layer macros should
+     be accepting 64bit-values if needed. It some target is not able
+     to handle such values it should simply operate with 32bit-values
+     and convert 64bit-values appriopated. In this case I assume
+     problems should not occurre: if some specific target is not able
+     to handle 64bit-values the system is limited to 32bit at all, thus
+     the application can not do a seek() or something else beyond the
+     32bit limit. It this true?
+   */
+
+  /* FIXME: What do we do if offset > the max value of off_t on this 32bit
+   * system?  How do we detect that and what do we do? */
+  if (CONVERT_OFF_T_TO_JLONG (native_offset) != offset)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Cannot represent position correctly on this system");
+    }
+#endif /* 0 */
+
+  result = TARGET_NATIVE_ERROR;
+  new_offset = TARGET_NATIVE_MATH_INT_INT64_CONST_MINUS_1;
+  TARGET_NATIVE_FILE_SEEK_BEGIN (native_fd, offset, new_offset, result);
+
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+    }
+}
+
+/*
+ * Set the length of the file
+ * Exception on error
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_implTruncate (JNIEnv * env,
+							 jobject obj,
+							 jlong len)
+{
+  int native_fd;
+  jlong file_size;
+  int bytes_written;
+  jlong save_offset, new_offset;
+  char data;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+
+#if 0
+  /* Should there be such an exception? All native layer macros should
+     be accepting 64bit-values if needed. It some target is not able
+     to handle such values it should simply operate with 32bit-values
+     and convert 64bit-values appriopated. In this case I assume
+     problems should not occurre: if some specific target is not able
+     to handle 64bit-values the system is limited to 32bit at all, thus
+     the application can not do a seek() or something else beyond the
+     32bit limit. It this true?
+   */
+
+  /* FIXME: What do we do if len > the max value of off_t on this 32bit
+   * system?  How do we detect that and what do we do? */
+  if (CONVERT_OFF_T_TO_JLONG (native_len) != len)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "Cannot represent position correctly on this system");
+      return;
+    }
+#endif /* 0 */
+
+  /* get file size */
+  TARGET_NATIVE_FILE_SIZE (native_fd, file_size, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      return;
+    }
+
+  /* Save off current position */
+  TARGET_NATIVE_FILE_TELL (native_fd, save_offset, result);
+  if (result != TARGET_NATIVE_OK)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  TARGET_NATIVE_LAST_ERROR_STRING ());
+      return;
+    }
+
+  if (TARGET_NATIVE_MATH_INT_INT64_LT (file_size, len))
+    {
+      /* File is too short -- seek to one byte short of where we want,
+       * then write a byte */
+
+      /* move to position n-1 */
+      TARGET_NATIVE_FILE_SEEK_BEGIN (native_fd,
+				     TARGET_NATIVE_MATH_INT_INT64_SUB (len,
+								       1),
+				     new_offset, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+
+      /* write a byte
+         Note: This will fail if we somehow get here in read only mode
+         * That shouldn't happen */
+      data = '\0';
+      TARGET_NATIVE_FILE_WRITE (native_fd, &data, 1, bytes_written, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+
+      /* Reposition file pointer to where we started if not beyond new len. */
+      if (TARGET_NATIVE_MATH_INT_INT64_LT (save_offset, len))
+	{
+	  TARGET_NATIVE_FILE_SEEK_BEGIN (native_fd, save_offset,
+					 new_offset, result);
+	  if (result != TARGET_NATIVE_OK)
+	    {
+	      JCL_ThrowException (env, IO_EXCEPTION,
+				  TARGET_NATIVE_LAST_ERROR_STRING ());
+	      return;
+	    }
+	}
+    }
+  else if (TARGET_NATIVE_MATH_INT_INT64_GT (file_size, len))
+    {
+      /* File is too long - use ftruncate if available */
+#ifdef HAVE_FTRUNCATE
+      TARGET_NATIVE_FILE_TRUNCATE (native_fd, len, result);
+      if (result != TARGET_NATIVE_OK)
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+#else /* HAVE_FTRUNCATE */
+      /* FIXME: Probably operation isn't supported, but this exception
+       * is too harsh as it will probably crash the program without need
+       JCL_ThrowException(env, "java/lang/UnsupportedOperationException",
+       "not implemented - can't shorten files on this platform");
+       */
+      JCL_ThrowException (env, IO_EXCEPTION, "Unable to shorten file length");
+#endif /* HAVE_FTRUNCATE */
+
+      /* Reposition file pointer when it now is beyond the end of file. */
+      if (TARGET_NATIVE_MATH_INT_INT64_GT (save_offset, len))
+	{
+	  TARGET_NATIVE_FILE_SEEK_BEGIN (native_fd, len, new_offset, result);
+	  if (result != TARGET_NATIVE_OK)
+	    {
+	      JCL_ThrowException (env, IO_EXCEPTION,
+				  TARGET_NATIVE_LAST_ERROR_STRING ());
+	      return;
+	    }
+	}
+    }
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_mapImpl (JNIEnv *env, jobject obj,
+						    jchar mode, jlong position, jint size)
+{
+#ifdef HAVE_MMAP
+  jclass MappedByteBufferImpl_class;
+  jmethodID MappedByteBufferImpl_init = NULL;
+  jobject Pointer_instance;
+  volatile jobject buffer;
+  long pagesize;
+  int prot, flags;
+  int fd;
+  void *p;
+  void *address;
+
+  /* FIXME: should we just assume we're on an OS modern enough to
+     have 'sysconf'? And not check for 'getpagesize'? */
+#if defined(HAVE_GETPAGESIZE)
+  pagesize = getpagesize ();
+#elif defined(HAVE_SYSCONF)
+  pagesize = sysconf (_SC_PAGESIZE);
+#else
+  JCL_ThrowException (env, IO_EXCEPTION,
+		      "can't determine memory page size");
+  return NULL;
+#endif /* HAVE_GETPAGESIZE/HAVE_SYSCONF */
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return NULL;
+    }
+
+  fd = get_native_fd (env, obj);
+
+  prot = PROT_READ;
+  if (mode == '+' || mode == 'c')
+    {
+      /* When writing we need to make sure the file is big enough,
+         otherwise the result of mmap is undefined. */
+      jlong filesize;
+      filesize = Java_gnu_java_nio_channels_FileChannelImpl_size(env, obj);
+      if (filesize == -1)
+	return NULL;
+      if (position + size > filesize)
+	if (ftruncate(fd, position + size) == -1)
+	  {
+	    JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+	    return NULL;
+	  }
+      prot |= PROT_WRITE;
+    }
+
+  flags = (mode == 'c' ? MAP_PRIVATE : MAP_SHARED);
+  p = mmap (NULL, (size_t) ALIGN_UP (size, pagesize), prot, flags,
+	    fd, ALIGN_DOWN (position, pagesize));
+  if (p == MAP_FAILED)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+      return NULL;
+    }
+
+  /* Unalign the mapped value back up, since we aligned offset
+     down to a multiple of the page size. */
+  address = (void *) ((char *) p + (position % pagesize));
+
+  Pointer_instance = JCL_NewRawDataObject(env, address);
+
+  MappedByteBufferImpl_class = (*env)->FindClass (env,
+						  "java/nio/MappedByteBufferImpl");
+  if (MappedByteBufferImpl_class != NULL)
+    {
+      MappedByteBufferImpl_init =
+	(*env)->GetMethodID (env, MappedByteBufferImpl_class,
+			     "<init>", "(Lgnu/classpath/Pointer;IZ)V");
+    }
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      munmap (p, ALIGN_UP (size, pagesize));
+      return NULL;
+    }
+  if (MappedByteBufferImpl_init == NULL)
+    {
+      JCL_ThrowException (env, "java/lang/InternalError",
+                          "could not get MappedByteBufferImpl constructor");
+      munmap (p, ALIGN_UP (size, pagesize));
+      return NULL;
+    }
+
+  buffer = (*env)->NewObject (env, MappedByteBufferImpl_class,
+                              MappedByteBufferImpl_init, Pointer_instance,
+                              (jint) size, mode == 'r');
+  return buffer;
+#else
+  (void) obj;
+  (void) mode;
+  (void) position;
+  (void) size;
+  JCL_ThrowException (env, IO_EXCEPTION,
+		      "memory-mapped files not implemented");
+  return 0;
+#endif /* HAVE_MMAP */
+}
+
+/*
+ * Read a single byte from the file descriptor
+ * Return byte read or -1 on eof, exception on error
+ */
+JNIEXPORT jint JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_read__ (JNIEnv * env, jobject obj)
+{
+  int native_fd;
+  char data;
+  ssize_t bytes_read;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+
+  bytes_read = 0;
+  do
+    {
+      TARGET_NATIVE_FILE_READ (native_fd, &data, 1, bytes_read, result);
+      if ((result == TARGET_NATIVE_OK) && (bytes_read == 0))
+	{
+	  return (-1);
+	}
+      if ((result != TARGET_NATIVE_OK)
+	  && (TARGET_NATIVE_LAST_ERROR () !=
+	      TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return (-1);
+	}
+    }
+  while (result != TARGET_NATIVE_OK);
+
+  return ((jint) (data & 0xFF));
+}
+
+/*
+ * Reads to a byte buffer from the specified file descriptor
+ * Return number of bytes read or -1 on eof, exception on error
+ */
+JNIEXPORT jint JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_read___3BII (JNIEnv * env,
+							jobject obj,
+							jbyteArray buffer,
+							jint offset,
+							jint length)
+{
+  int native_fd;
+  jbyte *bufptr;
+  ssize_t bytes_read;
+  ssize_t n;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+
+  /* Must return 0 if an attempt is made to read 0 bytes. */
+  if (length == 0)
+    return 0;
+
+  if (offset < 0)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION, "negative offset");
+      return -1;
+    }
+
+  bufptr = (*env)->GetByteArrayElements (env, buffer, 0);
+  if (!bufptr)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION, "Unexpected JNI error");
+      return (-1);
+    }
+
+  if (length + offset > (*env)->GetArrayLength (env, buffer))
+    {
+      JCL_ThrowException (env, IO_EXCEPTION,
+			  "length + offset > buffer.length");
+      return -1;
+    }
+
+  bytes_read = 0;
+  do
+    {
+      TARGET_NATIVE_FILE_READ (native_fd, (bufptr + offset + bytes_read),
+			       (length - bytes_read), n, result);
+      if ((result == TARGET_NATIVE_OK) && (n == 0))
+	{
+	  (*env)->ReleaseByteArrayElements (env, buffer, bufptr, 0);
+	  if (bytes_read == 0)
+	    return -1;		/* Signal end of file to Java */
+	  else
+	    return CONVERT_SSIZE_T_TO_JINT (bytes_read);
+	}
+      if ((result != TARGET_NATIVE_OK)
+	  && (TARGET_NATIVE_LAST_ERROR () !=
+	      TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  (*env)->ReleaseByteArrayElements (env, buffer, bufptr, 0);
+	  return -1;
+	}
+      if (result == TARGET_NATIVE_OK)
+	bytes_read += n;
+    }
+  while (bytes_read < 1);
+
+  (*env)->ReleaseByteArrayElements (env, buffer, bufptr, 0);
+  return CONVERT_SSIZE_T_TO_JINT (bytes_read);
+}
+
+/*
+ * Writes a single byte to the specified file descriptor
+ * Return status code, exception on error
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_write__I (JNIEnv * env,
+						     jobject obj, jint b)
+{
+  int native_fd;
+  char native_data;
+  ssize_t bytes_written;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+  native_data = (char) (CONVERT_JINT_TO_INT (b) & 0xFF);
+
+  do
+    {
+      TARGET_NATIVE_FILE_WRITE (native_fd, &native_data, 1, bytes_written,
+				result);
+      if ((result != TARGET_NATIVE_OK)
+	  && (TARGET_NATIVE_LAST_ERROR () !=
+	      TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  return;
+	}
+    }
+  while (result != TARGET_NATIVE_OK);
+}
+
+/*
+ * Copies all parts of a file to disk.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_force (JNIEnv * env,
+						  jobject obj)
+{
+  int native_fd;
+  int result;
+  native_fd = get_native_fd (env, obj);
+  TARGET_NATIVE_FILE_FSYNC (native_fd, result);
+  if (result != TARGET_NATIVE_OK)
+    JCL_ThrowException (env, IO_EXCEPTION,
+			TARGET_NATIVE_LAST_ERROR_STRING ());
+}
+
+/*
+ * Writes a byte buffer to the specified file descriptor
+ * Return status code, exception on error
+ */
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_write___3BII (JNIEnv * env,
+							 jobject obj,
+							 jbyteArray buffer,
+							 jint offset,
+							 jint length)
+{
+  int native_fd;
+  jbyte *bufptr;
+  ssize_t bytes_written;
+  ssize_t n;
+  int result;
+
+  native_fd = get_native_fd (env, obj);
+
+  /* Just return if an attempt is made to write 0 bytes. */
+  if (length == 0)
+    return;
+
+  bufptr = (*env)->GetByteArrayElements (env, buffer, 0);
+  if (!bufptr)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION, "Unexpected JNI error");
+      return;
+    }
+
+  bytes_written = 0;
+  while (bytes_written < CONVERT_JINT_TO_SSIZE_T (length))
+    {
+      TARGET_NATIVE_FILE_WRITE (native_fd, (bufptr + offset + bytes_written),
+				(length - bytes_written), n, result);
+      if ((result != TARGET_NATIVE_OK)
+	  && (TARGET_NATIVE_LAST_ERROR () !=
+	      TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
+	{
+	  JCL_ThrowException (env, IO_EXCEPTION,
+			      TARGET_NATIVE_LAST_ERROR_STRING ());
+	  (*env)->ReleaseByteArrayElements (env, buffer, bufptr, 0);
+	  return;
+	}
+      if (result == TARGET_NATIVE_OK)
+	bytes_written += n;
+    }
+
+  (*env)->ReleaseByteArrayElements (env, buffer, bufptr, 0);
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_lock (JNIEnv *env, jobject obj,
+                                                 jlong position, jlong size,
+                                                 jboolean shared, jboolean wait)
+{
+#ifdef HAVE_FCNTL
+  int fd = get_native_fd (env, obj);
+  int cmd = wait ? F_SETLKW : F_SETLK;
+  struct flock flock;
+  int ret;
+
+  flock.l_type = shared ? F_RDLCK : F_WRLCK;
+  flock.l_whence = SEEK_SET;
+  flock.l_start = (off_t) position;
+  /* Long.MAX_VALUE means lock everything possible starting at pos. */
+  if (size == 9223372036854775807LL)
+    flock.l_len = 0;
+  else
+    flock.l_len = (off_t) size;
+
+  ret = fcntl (fd, cmd, &flock);
+  /* fprintf(stderr, "fd %d, wait %d, shared %d, ret %d, position %lld, size %lld, l_start %ld, l_len %ld\n", fd, wait, shared,ret, position, size, (long) flock.l_start, (long) flock.l_len); */
+  if (ret)
+    {
+      /* Linux man pages for fcntl state that errno might be either
+         EACCES or EAGAIN if we try F_SETLK, and another process has
+         an overlapping lock. We should not get an unexpected errno. */
+      if (errno != EACCES && errno != EAGAIN)
+        {
+          JCL_ThrowException (env, "java/lang/InternalError",
+			      strerror (errno));
+        }
+      return JNI_FALSE;
+    }
+  return JNI_TRUE;
+#else
+  (void) obj;
+  (void) position;
+  (void) size;
+  (void) shared;
+  (void) wait;
+  JCL_ThrowException (env, "java/lang/UnsupportedOperationException",
+                      "file locks not implemented on this platform");
+  return JNI_FALSE;
+#endif /* HAVE_FCNTL */
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_channels_FileChannelImpl_unlock (JNIEnv *env,
+                                                   jobject obj,
+                                                   jlong position,
+                                                   jlong length)
+{
+#ifdef HAVE_FCNTL
+  int fd = get_native_fd (env, obj);
+  struct flock flock;
+  int ret;
+
+  flock.l_type = F_UNLCK;
+  flock.l_whence = SEEK_SET;
+  flock.l_start = (off_t) position;
+  /* Long.MAX_VALUE means unlock everything possible starting at pos. */
+  if (length == 9223372036854775807LL)
+    flock.l_len = 0;
+  else
+    flock.l_len = (off_t) length;
+
+  ret = fcntl (fd, F_SETLK, &flock);
+  if (ret)
+    {
+      JCL_ThrowException (env, "java/lang/InternalError",
+			  strerror (errno));
+    }
+#else
+  (void) obj;
+  (void) position;
+  (void) length;
+  JCL_ThrowException (env, "java/lang/UnsupportedOperationException",
+                      "file locks not implemented on this platform");
+#endif /* HAVE_FCNTL */
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,201 @@
+/* gnu_java_nio_charset_iconv_IconvDecoder.c --
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+#include <jcl.h>
+
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+
+#if defined(HAVE_ICONV)
+#include <iconv.h>
+#endif
+
+#include "gnu_java_nio_charset_iconv_IconvDecoder.h"
+
+static void createRawData (JNIEnv * env, jobject obj, void *ptr);
+static void *getData (JNIEnv * env, jobject obj);
+
+static jfieldID infid = NULL;
+static jfieldID outfid = NULL;
+
+/* Union used for type punning. */
+union char_union
+{
+  jbyte **jb;
+  jchar **jc;
+  char **c;
+};
+
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_charset_iconv_IconvDecoder_openIconv (JNIEnv * env,
+							jobject obj,
+							jstring jname)
+{
+#if defined(HAVE_ICONV)
+  iconv_t iconv_object;
+  jclass cls;
+
+  const char *name = JCL_jstring_to_cstring (env, jname);
+  if (name == NULL)
+    return;
+
+  /* Cache fieldIDs for use in decode function. */
+  if (infid == NULL || outfid == NULL)
+    {
+      cls = (*env)->GetObjectClass (env, obj);
+      infid = (*env)->GetFieldID (env, cls, "inremaining", "I");
+      assert (infid != 0);
+      outfid = (*env)->GetFieldID (env, cls, "outremaining", "I");
+      assert (outfid != 0);
+    }
+
+  /* to java from "name", native java format depends on endianness */
+#ifdef WORDS_BIGENDIAN
+  iconv_object = iconv_open ("UTF-16BE", name);
+#else
+  iconv_object = iconv_open ("UTF-16LE", name);
+#endif
+
+  JCL_free_cstring (env, jname, name);
+  if ((long) iconv_object == -1L)
+    {
+      JCL_ThrowException (env, "java/lang/IllegalArgumentException",
+			  "Charset not available");
+      return;
+    }
+  createRawData (env, obj, (void *) iconv_object);
+#else
+  JCL_ThrowException (env, "java/lang/IllegalArgumentException",
+		      "iconv not available");
+#endif
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_nio_charset_iconv_IconvDecoder_decode (JNIEnv * env,
+						     jobject obj,
+						     jbyteArray inArr,
+						     jcharArray outArr,
+						     jint posIn, jint remIn,
+						     jint posOut, jint remOut)
+{
+#if defined(HAVE_ICONV)
+  iconv_t iconv_object = getData (env, obj);
+  size_t retval;
+  union char_union in, out;
+  jbyte *input, *inputcopy;
+  jchar *output, *outputcopy;
+  size_t lenIn = (size_t) remIn;
+  size_t lenOut = (size_t) remOut * 2;
+
+  inputcopy = input = (*env)->GetByteArrayElements (env, inArr, 0);
+  outputcopy = output = (*env)->GetCharArrayElements (env, outArr, 0);
+
+  input += posIn;
+  output += posOut;
+
+  in.jb = &input;
+  out.jc = &output;
+  retval = iconv (iconv_object, (ICONV_CONST char **) in.c, &lenIn,
+		  out.c, &lenOut);
+
+  /* XXX: Do we need to relase the input array? It's not modified. */
+  (*env)->ReleaseByteArrayElements (env, inArr, inputcopy, 0);
+  (*env)->ReleaseCharArrayElements (env, outArr, outputcopy, 0);
+
+  if (retval == (size_t) (-1))
+    {
+      if (errno == EILSEQ)
+	retval = 1;
+      else
+	retval = 0;
+    }
+  else
+    retval = 0;
+
+  (*env)->SetIntField (env, obj, infid, (jint) lenIn);
+  (*env)->SetIntField (env, obj, outfid, (jint) (lenOut >> 1));
+
+  return (jint) retval;
+#else
+  return -1;
+#endif
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_charset_iconv_IconvDecoder_closeIconv (JNIEnv * env,
+							 jobject obj)
+{
+#if defined(HAVE_ICONV)
+  iconv_t iconv_object;
+  iconv_object = getData (env, obj);
+  iconv_close (iconv_object);
+#endif
+}
+
+
+static void
+createRawData (JNIEnv * env, jobject obj, void *ptr)
+{
+  jclass cls;
+  jobject data;
+  jfieldID data_fid;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/Pointer;");
+  assert (data_fid != 0);
+
+  data = JCL_NewRawDataObject(env, ptr);
+
+  (*env)->SetObjectField (env, obj, data_fid, data);
+}
+
+static void *
+getData (JNIEnv * env, jobject obj)
+{
+  jclass cls;
+  jfieldID data_fid;
+  jobject data;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/Pointer;");
+  assert (data_fid != 0);
+  data = (*env)->GetObjectField (env, obj, data_fid);
+
+  return JCL_GetRawData(env, data);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,201 @@
+/* gnu_java_nio_charset_iconv_IconvEncoder.c --
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+#include <jcl.h>
+
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+
+#if defined(HAVE_ICONV)
+#include <iconv.h>
+#endif
+
+#include "gnu_java_nio_charset_iconv_IconvEncoder.h"
+
+static void createRawData (JNIEnv * env, jobject obj, void *ptr);
+static void *getData (JNIEnv * env, jobject obj);
+
+static jfieldID infid = NULL;
+static jfieldID outfid = NULL;
+
+/* Union used for type punning. */
+union char_union
+{
+  jbyte **jb;
+  jchar **jc;
+  char **c;
+};
+
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_charset_iconv_IconvEncoder_openIconv (JNIEnv * env,
+							jobject obj,
+							jstring jname)
+{
+#if defined(HAVE_ICONV)
+  iconv_t iconv_object;
+  jclass cls;
+
+  const char *name = JCL_jstring_to_cstring (env, jname);
+  if (name == NULL)
+    return;
+
+  /* Cache fieldIDs for use in encode function. */
+  if (infid == NULL || outfid == NULL)
+    {
+      cls = (*env)->GetObjectClass (env, obj);
+      infid = (*env)->GetFieldID (env, cls, "inremaining", "I");
+      assert (infid != 0);
+      outfid = (*env)->GetFieldID (env, cls, "outremaining", "I");
+      assert (outfid != 0);
+    }
+
+  /* to "name" from java, native java format depends on endianness */
+#ifdef WORDS_BIGENDIAN
+  iconv_object = iconv_open (name, "UTF-16BE");
+#else
+  iconv_object = iconv_open (name, "UTF-16LE");
+#endif
+
+  JCL_free_cstring (env, jname, name);
+  if ((long) iconv_object == -1L)
+    {
+      JCL_ThrowException (env, "java/lang/IllegalArgumentException",
+			  "Charset not available");
+      return;
+    }
+  createRawData (env, obj, (void *) iconv_object);
+#else
+  JCL_ThrowException (env, "java/lang/IllegalArgumentException",
+		      "iconv not available");
+#endif
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_nio_charset_iconv_IconvEncoder_encode (JNIEnv * env,
+						     jobject obj,
+						     jcharArray inArr,
+						     jbyteArray outArr,
+						     jint posIn, jint remIn,
+						     jint posOut, jint remOut)
+{
+#if defined(HAVE_ICONV)
+  iconv_t iconv_object = getData (env, obj);
+  size_t retval;
+  union char_union in, out;
+  jchar *input, *inputcopy;
+  jbyte *output, *outputcopy;
+  size_t lenIn = (size_t) remIn * 2;
+  size_t lenOut = (size_t) remOut;
+
+  inputcopy = input = (*env)->GetCharArrayElements (env, inArr, 0);
+  outputcopy = output = (*env)->GetByteArrayElements (env, outArr, 0);
+
+  input += posIn;
+  output += posOut;
+
+  in.jc = &input;
+  out.jb = &output;
+  retval = iconv (iconv_object, (ICONV_CONST char **) in.c, &lenIn,
+		  out.c, &lenOut);
+
+  /* XXX: Do we need to relase the input array? It's not modified. */
+  (*env)->ReleaseCharArrayElements (env, inArr, inputcopy, 0);
+  (*env)->ReleaseByteArrayElements (env, outArr, outputcopy, 0);
+
+  if (retval == (size_t) (-1))
+    {
+      if (errno == EILSEQ || errno == EINVAL)
+	retval = 1;
+      else
+	retval = 0;
+    }
+  else
+    retval = 0;
+
+  (*env)->SetIntField (env, obj, infid, (jint) (lenIn >> 1));
+  (*env)->SetIntField (env, obj, outfid, (jint) lenOut);
+
+  return (jint) retval;
+#else
+  return -1;
+#endif
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_nio_charset_iconv_IconvEncoder_closeIconv (JNIEnv * env,
+							 jobject obj)
+{
+#if defined(HAVE_ICONV)
+  iconv_t iconv_object;
+  iconv_object = getData (env, obj);
+  iconv_close (iconv_object);
+#endif
+}
+
+
+static void
+createRawData (JNIEnv * env, jobject obj, void *ptr)
+{
+  jclass cls;
+  jobject data;
+  jfieldID data_fid;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/Pointer;");
+  assert (data_fid != 0);
+  
+  data = JCL_NewRawDataObject (env, ptr);
+
+  (*env)->SetObjectField (env, obj, data_fid, data);
+}
+
+static void *
+getData (JNIEnv * env, jobject obj)
+{
+  jclass cls;
+  jfieldID data_fid;
+  jobject data;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  data_fid = (*env)->GetFieldID (env, cls, "data", "Lgnu/classpath/Pointer;");
+  assert (data_fid != 0);
+  data = (*env)->GetObjectField (env, obj, data_fid);
+
+  return JCL_GetRawData(env, data);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,242 @@
+/* java_nio_MappedByteBufferImpl.c - Native methods for MappedByteBufferImpl
+   Copyright (C) 2004,2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+#include <errno.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "java_nio_MappedByteBufferImpl.h"
+
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif /* HAVE_SYS_MMAN_H */
+
+#define IO_EXCEPTION "java/io/IOException"
+
+/* FIXME these are defined in gnu_java_nio_channels_FileChannelImpl
+   too; should be someplace common. */
+#define ALIGN_DOWN(p,s) ((jpointer)(p) - ((jpointer)(p) % (s)))
+#define ALIGN_UP(p,s) ((jpointer)(p) + ((s) - ((jpointer)(p) % (s))))
+
+/**
+ * Returns the memory page size of this platform.
+ *
+ * \return The page size.
+ */
+static long
+get_pagesize (void)
+{
+  /* FIXME can we just try HAVE_SYSCONF? */
+#if defined(HAVE_GETPAGESIZE)
+  return getpagesize ();
+#elif defined (HAVE_SYSCONF)
+  return sysconf (_SC_PAGESIZE);
+#endif /* HAVE_GETPAGESIZE / HAVE_SYSCONF */
+}
+
+/**
+ * Retrieve the 'address' and 'cap' (the mapped size) fields of this
+ * buffer.
+ *
+ * This function will align the address down to the nearest page
+ * boundary, and the size up to the nearest page boundary. Thus, it is
+ * safe to use these values in 'mman' functions.
+ *
+ * \param env The JNI environment pointer.
+ * \param this The MappedByteBufferImpl instance.
+ * \param address A pointer to where the actual pointer should be
+ * stored.
+ * \param size A pointer to where the mapped region's size should be
+ * stored
+ */
+static void
+get_raw_values (JNIEnv *env, jobject this, void **address, size_t *size)
+{
+  const long pagesize = get_pagesize ();
+  jfieldID MappedByteBufferImpl_address;
+  jfieldID MappedByteBufferImpl_size;
+  jobject MappedByteBufferImpl_address_value = NULL;
+
+  *address = NULL;
+  /* 'address' is declared in java.nio.Buffer */
+  MappedByteBufferImpl_address
+    = (*env)->GetFieldID (env, (*env)->GetObjectClass (env, this),
+			  "address", "Lgnu/classpath/Pointer;");
+  /* 'cap' -- likewise, the capacity */
+  MappedByteBufferImpl_size
+    = (*env)->GetFieldID (env, (*env)->GetObjectClass (env, this),
+			  "cap", "I");
+  if (MappedByteBufferImpl_address != NULL)
+    {
+      MappedByteBufferImpl_address_value =
+	(*env)->GetObjectField (env, this, MappedByteBufferImpl_address);
+    }
+  if ((*env)->ExceptionOccurred (env))
+    return;
+  if (MappedByteBufferImpl_address_value == NULL)
+    {
+      JCL_ThrowException (env, "java/lang/NullPointerException",
+                          "mapped address is NULL");
+      return;
+    }
+
+  *address = (void *)
+    ALIGN_DOWN (JCL_GetRawData (env, MappedByteBufferImpl_address_value), pagesize);
+  *size = (size_t)
+    ALIGN_UP ((*env)->GetIntField (env, this, MappedByteBufferImpl_size),
+	      pagesize);
+}
+
+JNIEXPORT void JNICALL
+Java_java_nio_MappedByteBufferImpl_unmapImpl (JNIEnv *env, jobject this)
+{
+#ifdef HAVE_MUNMAP
+  void *address;
+  size_t size;
+
+  get_raw_values (env, this, &address, &size);
+
+  if (address == NULL)
+    return;
+
+  if (munmap (address, size) != 0)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+      return;
+    }
+#else
+  JCL_ThrowException (env, IO_EXCEPTION,
+		      "unmapping files not implemented");
+#endif /* HAVE_MUNMAP */
+}
+
+JNIEXPORT jboolean JNICALL
+Java_java_nio_MappedByteBufferImpl_isLoadedImpl (JNIEnv * env, jobject this)
+{
+#ifdef HAVE_MINCORE
+  void *address;
+  size_t size;
+  char *vec;
+  size_t count, i;
+  const long pagesize = get_pagesize ();
+
+  /*
+   * FIXME on Darwin this does not work if the mapped region is
+   * exactly one page long; i.e., 'mincore' tells us it isn't loaded.
+   */
+  get_raw_values (env, this, &address, &size);
+  if (address == NULL)
+    return JNI_FALSE;
+  count = (size_t) ((size + pagesize - 1) / pagesize);
+  vec = (char *) malloc (count * sizeof (unsigned char));
+
+  /*
+   * Darwin (and BSD?) define argument 3 of 'mincore' to be 'char *',
+   * while GNU libc defines it to be 'unsigned char *'. Casting the
+   * argument to 'void *' fixes this, but not with C++. So you might
+   * be SOL if you compile this with g++ (!) on GNU with -Werror.
+   */
+#ifdef __cplusplus
+  if (mincore (address, size, vec) != 0)
+#else
+  if (mincore (address, size, (void *) vec) != 0)
+#endif /* __cplusplus */
+    {
+      free (vec);
+      JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+      return JNI_FALSE;
+    }
+
+  for (i = 0; i < count; i++)
+    {
+      if ((vec[i] & 1) == 0)
+        return JNI_FALSE;
+    }
+  return JNI_TRUE;
+#else
+  return JNI_FALSE;
+#endif
+}
+
+JNIEXPORT void JNICALL
+Java_java_nio_MappedByteBufferImpl_loadImpl (JNIEnv *env, jobject this)
+{
+#ifdef HAVE_MADVISE
+  void *address;
+  size_t size;
+
+  get_raw_values (env, this, &address, &size);
+  if (address == NULL)
+    return;
+
+  madvise (address, size, MADV_WILLNEED);
+#else
+  JCL_ThrowException (env, IO_EXCEPTION,
+                      "forcing mapped files into core not implemented");
+#endif /* HAVE_MADVISE */
+}
+
+JNIEXPORT void JNICALL
+Java_java_nio_MappedByteBufferImpl_forceImpl (JNIEnv *env, jobject this)
+{
+#ifdef HAVE_MSYNC
+  void *address;
+  size_t size;
+
+  get_raw_values (env, this, &address, &size);
+
+  if (address == NULL)
+    return;
+
+  /* FIXME: is using MS_SYNC ok? Should we use MS_INVALIDATE? */
+  if (msync (address, size, MS_SYNC) != 0)
+    {
+      JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
+    }
+#else
+  JCL_ThrowException (env, IO_EXCEPTION,
+		      "forcing mapped files to disk not implemented");
+#endif /* HAVE_MSYNC */
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-nio/java_nio_VMDirectByteBuffer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,130 @@
+/* java_nio_VMDirectByteBuffer.c - Native methods for VMDirectByteBuffer
+   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "java_nio_VMDirectByteBuffer.h"
+
+JNIEXPORT jobject JNICALL
+Java_java_nio_VMDirectByteBuffer_allocate
+  (JNIEnv * env, jclass clazz __attribute__ ((__unused__)), jint capacity)
+{
+  void *buffer;
+
+  buffer = malloc (capacity);
+
+  if (buffer == NULL)
+    {
+      JCL_ThrowException (env, "java/lang/OutOfMemoryError",
+			  "unable to allocate memory for direct byte buffer");
+      return 0;
+    }
+
+  memset (buffer, 0, capacity);
+
+  return JCL_NewRawDataObject (env, buffer);
+}
+
+JNIEXPORT void JNICALL
+Java_java_nio_VMDirectByteBuffer_free
+  (JNIEnv * env, jclass clazz __attribute__ ((__unused__)), jobject address)
+{
+  free (JCL_GetRawData (env, address));
+}
+
+JNIEXPORT jbyte JNICALL
+Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_Pointer_2I
+  (JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
+   jobject address, jint index)
+{
+  return ((jbyte *) JCL_GetRawData (env, address))[index];
+}
+
+JNIEXPORT void JNICALL
+Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_Pointer_2IB
+  (JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
+   jobject address, jint index, jbyte value)
+{
+  jbyte *pointer = (jbyte *) JCL_GetRawData (env, address) + index;
+  *pointer = value;
+}
+
+JNIEXPORT void JNICALL
+Java_java_nio_VMDirectByteBuffer_get__Lgnu_classpath_Pointer_2I_3BII
+  (JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
+   jobject address, jint index, jbyteArray dst, jint dst_offset, jint dst_len)
+{
+  jbyte *src = (jbyte *) JCL_GetRawData (env, address) + index;
+  jbyte *_dst = (*env)->GetByteArrayElements (env, dst, NULL);
+  memcpy (_dst + dst_offset, src, dst_len);
+  (*env)->ReleaseByteArrayElements (env, dst, _dst, 0);
+}
+
+JNIEXPORT void JNICALL
+Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_Pointer_2I_3BII
+  (JNIEnv *env, jclass clazz __attribute__ ((__unused__)),
+   jobject address, jint index, jbyteArray src, jint src_offset, jint src_len)
+{
+  jbyte *_src = (*env)->GetByteArrayElements (env, src, NULL);
+  jbyte *dst = (jbyte *)JCL_GetRawData (env, address);
+  memcpy (dst + index, _src + src_offset, src_len);
+  (*env)->ReleaseByteArrayElements (env, src, _src, 0);
+}
+
+JNIEXPORT void JNICALL
+Java_java_nio_VMDirectByteBuffer_shiftDown
+  (JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
+   jobject address, jint dst_offset, jint src_offset, jint count)
+{
+  jbyte *dst = (jbyte *) JCL_GetRawData (env, address) + dst_offset;
+  jbyte *src = (jbyte *) JCL_GetRawData (env, address) + src_offset;
+  memmove (dst, src, count);
+}
+
+JNIEXPORT jobject JNICALL
+Java_java_nio_VMDirectByteBuffer_adjustAddress
+  (JNIEnv * env, jclass clazz __attribute__ ((__unused__)),
+   jobject address, jint offset)
+{
+  return JCL_NewRawDataObject (env, (jbyte *) JCL_GetRawData (env, address) + offset);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,7 @@
+nativeexeclib_LTLIBRARIES = libjavautil.la
+
+libjavautil_la_SOURCES = java_util_VMTimeZone.c
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,590 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/java-util
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libjavautil_la_LIBADD =
+am_libjavautil_la_OBJECTS = java_util_VMTimeZone.lo
+libjavautil_la_OBJECTS = $(am_libjavautil_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libjavautil_la_SOURCES)
+DIST_SOURCES = $(libjavautil_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libjavautil.la
+libjavautil_la_SOURCES = java_util_VMTimeZone.c
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/java-util/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/java-util/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libjavautil.la: $(libjavautil_la_OBJECTS) $(libjavautil_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libjavautil_la_LDFLAGS) $(libjavautil_la_OBJECTS) $(libjavautil_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/java_util_VMTimeZone.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/java_util_VMTimeZone.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/java_util_VMTimeZone.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/java_util_VMTimeZone.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/java-util/java_util_VMTimeZone.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,223 @@
+/* VMTimeZone.c - Native method for java.util.VMTimeZone
+   Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "config.h"
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <jni.h>
+
+#include "java_util_VMTimeZone.h"
+
+static size_t jint_to_charbuf (char *bufend, jint num);
+
+/**
+ * This method returns a time zone id string which is in the form
+ * (standard zone name) or (standard zone name)(GMT offset) or
+ * (standard zone name)(GMT offset)(daylight time zone name).  The
+ * GMT offset can be in seconds, or where it is evenly divisible by
+ * 3600, then it can be in hours.  The offset must be the time to
+ * add to the local time to get GMT.  If a offset is given and the
+ * time zone observes daylight saving then the (daylight time zone
+ * name) must also be given (otherwise it is assumed the time zone
+ * does not observe any daylight savings).
+ * <p>
+ * The result of this method is given to getDefaultTimeZone(String)
+ * which tries to map the time zone id to a known TimeZone.  See
+ * that method on how the returned String is mapped to a real
+ * TimeZone object.
+ */
+JNIEXPORT jstring JNICALL
+Java_java_util_VMTimeZone_getSystemTimeZoneId (JNIEnv * env,
+					       jclass clazz
+					       __attribute__ ((__unused__)))
+{
+  struct tm tim;
+#ifndef HAVE_LOCALTIME_R
+  struct tm *lt_tim;
+#endif
+#ifdef HAVE_TM_ZONE
+  int month;
+#endif
+  time_t current_time;
+  long tzoffset;
+  const char *tz1, *tz2;
+  char tzoff[11];
+  size_t tz1_len, tz2_len, tzoff_len;
+  char *tzid;
+  jstring retval;
+
+  time (&current_time);
+#ifdef HAVE_LOCALTIME_R
+  localtime_r (&current_time, &tim);
+#else
+  /* Fall back on non-thread safe localtime. */
+  lt_tim = localtime (&current_time);
+  memcpy (&tim, lt_tim, sizeof (struct tm));
+#endif
+  mktime (&tim);
+
+#ifdef HAVE_STRUCT_TM_TM_ZONE
+  /* We will cycle through the months to make sure we hit dst. */
+  month = tim.tm_mon;
+  tz1 = tz2 = NULL;
+  while (tz1 == NULL || tz2 == NULL)
+    {
+      if (tim.tm_isdst > 0)
+	tz2 = tim.tm_zone;
+      else if (tz1 == NULL)
+	{
+	  tz1 = tim.tm_zone;
+	  month = tim.tm_mon;
+	}
+
+      if (tz1 == NULL || tz2 == NULL)
+	{
+	  tim.tm_mon++;
+	  tim.tm_mon %= 12;
+	}
+
+      if (tim.tm_mon == month && tz2 == NULL)
+	tz2 = "";
+      else
+	mktime (&tim);
+    }
+  /* We want to make sure the tm struct we use later on is not dst. */
+  tim.tm_mon = month;
+  mktime (&tim);
+#elif defined (HAVE_TZNAME)
+  /* If dst is never used, tzname[1] is the empty string. */
+  tzset ();
+  tz1 = tzname[0];
+  tz2 = tzname[1];
+#else
+  /* Some targets have no concept of timezones. Assume GMT without dst. */
+  tz1 = "GMT";
+  tz2 = "";
+#endif
+
+#ifdef STRUCT_TM_HAS_GMTOFF
+  /* tm_gmtoff is the number of seconds that you must add to GMT to get
+     local time, we need the number of seconds to add to the local time
+     to get GMT. */
+  tzoffset = -1L * tim.tm_gmtoff;
+#elif HAVE_UNDERSCORE_TIMEZONE
+  /* On some systems _timezone is actually defined as time_t. */
+  tzoffset = (long) _timezone;
+#elif HAVE_TIMEZONE
+  /* timezone is secs WEST of UTC. */
+  tzoffset = timezone;
+#else
+  /* FIXME: there must be another global if neither tm_gmtoff nor timezone
+     is available, esp. if tzname is valid.
+     Richard Earnshaw <rearnsha at arm.com> has suggested using difftime to
+     calculate between gmtime and localtime (and accounting for possible
+     daylight savings time) as an alternative. */
+  tzoffset = 0L;
+#endif
+
+  if ((tzoffset % 3600) == 0)
+    tzoffset = tzoffset / 3600;
+
+  tz1_len = strlen (tz1);
+  tz2_len = strlen (tz2);
+  tzoff_len = jint_to_charbuf (tzoff + 11, tzoffset);
+  tzid = (char *) malloc (tz1_len + tz2_len + tzoff_len + 1);	/* FIXME alloc */
+  memcpy (tzid, tz1, tz1_len);
+  memcpy (tzid + tz1_len, tzoff + 11 - tzoff_len, tzoff_len);
+  memcpy (tzid + tz1_len + tzoff_len, tz2, tz2_len);
+  tzid[tz1_len + tzoff_len + tz2_len] = '\0';
+
+  retval = (*env)->NewStringUTF (env, tzid);
+  free (tzid);
+
+  return retval;
+}
+
+/* Put printed (decimal) representation of NUM in a buffer.
+   BUFEND marks the end of the buffer, which must be at least 11 chars long.
+   Returns the COUNT of chars written.  The result is in
+   (BUFEND - COUNT) (inclusive) upto (BUFEND) (exclusive).
+
+   Note that libgcj has a slightly different version called _Jv_FormatInt
+   that works on jchar buffers.
+*/
+
+static size_t
+jint_to_charbuf (char *bufend, jint num)
+{
+  register char *ptr = bufend;
+  jboolean isNeg;
+  if (num < 0)
+    {
+      isNeg = JNI_TRUE;
+      num = -(num);
+      if (num < 0)
+	{
+	  /* Must be MIN_VALUE, so handle this special case.
+	     FIXME use 'unsigned jint' for num. */
+	  *--ptr = '8';
+	  num = 214748364;
+	}
+    }
+  else
+    isNeg = JNI_FALSE;
+
+  do
+    {
+      *--ptr = (char) ((int) '0' + (num % 10));
+      num /= 10;
+    }
+  while (num > 0);
+
+  if (isNeg)
+    *--ptr = '-';
+  return bufend - ptr;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,12 @@
+nativeexeclib_LTLIBRARIES = libgjsmalsa.la 
+
+libgjsmalsa_la_SOURCES = gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c \
+gnu_javax_sound_midi_alsa_AlsaPortDevice.c \
+gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
+
+libgjsmalsa_la_LIBADD = -lasound
+libgjsmalsa_la_LDFLAGS = -avoid-version
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ `pkg-config  --cflags-only-I alsa`
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ `pkg-config --cflags-only-other alsa`

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,600 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/midi-alsa
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libgjsmalsa_la_DEPENDENCIES =
+am_libgjsmalsa_la_OBJECTS =  \
+	gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo \
+	gnu_javax_sound_midi_alsa_AlsaPortDevice.lo \
+	gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.lo
+libgjsmalsa_la_OBJECTS = $(am_libgjsmalsa_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgjsmalsa_la_SOURCES)
+DIST_SOURCES = $(libgjsmalsa_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libgjsmalsa.la 
+libgjsmalsa_la_SOURCES = gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c \
+gnu_javax_sound_midi_alsa_AlsaPortDevice.c \
+gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
+
+libgjsmalsa_la_LIBADD = -lasound
+libgjsmalsa_la_LDFLAGS = -avoid-version
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ `pkg-config  --cflags-only-I alsa`
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ `pkg-config --cflags-only-other alsa`
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/midi-alsa/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/midi-alsa/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libgjsmalsa.la: $(libgjsmalsa_la_OBJECTS) $(libgjsmalsa_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libgjsmalsa_la_LDFLAGS) $(libgjsmalsa_la_OBJECTS) $(libgjsmalsa_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_javax_sound_midi_alsa_AlsaPortDevice.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,148 @@
+/* gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   
+   This file is part of GNU Classpath.
+   
+   GNU Classpath is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+   
+   GNU Classpath is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with GNU Classpath; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.
+   
+   Linking this library statically or dynamically with other modules is
+   making a combined work based on this library.  Thus, the terms and
+   conditions of the GNU General Public License cover the whole
+   combination.
+   
+   As a special exception, the copyright holders of this library give you
+   permission to link this library with independent modules to produce an
+   executable, regardless of the license terms of these independent
+   modules, and to copy and distribute the resulting executable under
+   terms of your choice, provided that you also meet, for each linked
+   independent module, the terms and conditions of the license of that
+   module.  An independent module is a module which is not derived from
+   or based on this library.  If you modify this library, you may extend
+   this exception to your version of the library, but you are not
+   obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version. */
+
+#include <config.h>
+#include <gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h>
+
+#include <alsa/asoundlib.h>
+
+static snd_seq_t *seq;
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_init_1 
+(JNIEnv *env __attribute__((unused)), jobject this __attribute__((unused)))
+{
+  int rc = snd_seq_open (&seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK);
+  if (rc < 0)
+    abort ();
+  snd_seq_set_client_name(seq, "gnu.javax.sound.midi.alsa");
+}
+
+/**
+ * Return a CLAZZ[] filled with ports matching TYPE. 
+ */
+static jobjectArray 
+getPortDeviceInfo (JNIEnv *env, unsigned type, const char *clazz)
+{
+  jobjectArray rarray;
+  snd_seq_client_info_t *cinfo;
+  snd_seq_port_info_t *pinfo;
+  int client;
+  int count = 0;
+  jclass icls;
+  jmethodID mid;
+
+  snd_seq_client_info_alloca(&cinfo);
+  snd_seq_port_info_alloca(&pinfo);
+
+  /* First, count the number of input devices.  */
+  snd_seq_client_info_set_client (cinfo, -1);
+  while (snd_seq_query_next_client (seq, cinfo) >= 0)
+    {
+      client = snd_seq_client_info_get_client (cinfo);
+      if (client == 0)
+	continue;
+      snd_seq_port_info_set_client (pinfo, client);
+      snd_seq_port_info_set_port (pinfo, -1);
+      while (snd_seq_query_next_port (seq, pinfo) >= 0)
+	{
+	  if ((snd_seq_port_info_get_capability (pinfo) & type) != type)
+	    continue;
+	  count++;
+	}
+    }
+
+  icls = (*env)->FindClass(env, clazz);
+  mid = (*env)->GetMethodID(env, icls, "<init>", 
+			    "(Ljava/lang/String;Ljava/lang/String;JJ)V");
+
+  rarray = (jobjectArray) (*env)->NewObjectArray(env, count, icls, NULL); 
+
+  /* Now, populate our array.  */
+  count = 0;
+  snd_seq_client_info_set_client (cinfo, -1);
+  while (snd_seq_query_next_client (seq, cinfo) >= 0)
+    {
+      const char *client_name;
+      client = snd_seq_client_info_get_client (cinfo);
+      if (client == 0)
+	continue;
+      snd_seq_port_info_set_client (pinfo, client);
+      snd_seq_port_info_set_port (pinfo, -1);
+
+      client_name = snd_seq_client_info_get_name (cinfo);
+
+      while (snd_seq_query_next_port (seq, pinfo) >= 0)
+	{
+	  const char *port_name;
+
+	  if ((snd_seq_port_info_get_capability (pinfo) & type) != type)
+	    continue;
+
+	  port_name = snd_seq_port_info_get_name (pinfo);
+
+	  (*env)->SetObjectArrayElement(env, rarray, count,
+					(*env)->NewObject (env, icls, mid,
+							   (*env)->NewStringUTF (env, client_name),
+							   (*env)->NewStringUTF (env, port_name),
+							   (jlong) snd_seq_port_info_get_client(pinfo), 
+							   (jlong) snd_seq_port_info_get_port(pinfo)));
+	  count++;
+	}
+    }
+
+  return rarray;
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getInputDeviceInfo_1 
+  (JNIEnv *env, jobject this __attribute__((unused)))
+{
+  return getPortDeviceInfo (env, 
+			    (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ), 
+			    "gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider$AlsaInputPortInfo");
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getOutputDeviceInfo_1 
+  (JNIEnv *env, jobject this __attribute__((unused)))
+{
+  return getPortDeviceInfo (env, 
+			    (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE), 
+			    "gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider$AlsaOutputPortInfo");
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,59 @@
+/* gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c
+   Copyright (C) 2005 
+   Free Software Foundation, Inc.
+   
+This file is part of GNU Classpath.
+   
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+   
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+   
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+   
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+   
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+#include <gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h>
+
+JNIEXPORT jlong JNICALL 
+Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_open_1 
+  (JNIEnv *env __attribute__((unused)), jobject this __attribute__((unused)))
+{
+  /* Nothing yet.  */
+  return 555;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_close_1 
+  (JNIEnv *env __attribute__((unused)), 
+   jobject this __attribute__((unused)), jlong s __attribute__((unused)))
+{
+  /* Nothing.  */
+}
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,150 @@
+/* gnu_javax_sound_midi_alsa_AlsaPortDevice.c - Native support
+   Copyright (C) 2005 
+   Free Software Foundation, Inc.
+   
+This file is part of GNU Classpath.
+   
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+   
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+   
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+   
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+   
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+#include <gnu_javax_sound_midi_alsa_AlsaPortDevice.h>
+#include <unistd.h>
+
+#include <alsa/asoundlib.h>
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1
+  (JNIEnv *env, jobject this __attribute__((unused)), 
+   jlong client, jlong port, jobject receiver)
+{
+  int rc;
+  snd_seq_port_info_t *pinfo, *sinfo;
+  snd_seq_port_subscribe_t *subs;
+  snd_seq_addr_t sender, dest;
+  snd_seq_t *seq;
+
+  snd_seq_port_info_alloca (&pinfo);
+  snd_seq_port_info_alloca (&sinfo);
+  snd_seq_port_subscribe_alloca (&subs);
+
+  rc = snd_seq_open (&seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK);
+
+  snd_seq_port_info_set_capability (pinfo, SND_SEQ_PORT_CAP_WRITE);
+  snd_seq_port_info_set_type (pinfo, SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+
+  rc = snd_seq_create_port (seq, pinfo);
+
+  sender.client = (int) client;
+  sender.port = (int) port;
+  dest.client = snd_seq_port_info_get_client(pinfo);
+  dest.port = snd_seq_port_info_get_port(pinfo);
+
+  snd_seq_port_subscribe_set_sender (subs, &sender);
+  snd_seq_port_subscribe_set_dest (subs, &dest);
+  rc = snd_seq_subscribe_port(seq, subs);
+
+  {
+    int npfd;
+    struct pollfd *pfd;
+    jclass smcls, rcls;
+    jmethodID sminit, rsend;
+    jbyteArray mba;
+    jbyte *ba;
+    jobject msg;
+    jlong jtimestamp;
+
+    npfd = snd_seq_poll_descriptors_count (seq, POLLIN);
+    pfd = (struct pollfd *) alloca (npfd * sizeof (struct pollfd));
+    snd_seq_poll_descriptors (seq, pfd, npfd, POLLIN);
+
+    smcls = (*env)->FindClass(env, "javax/sound/midi/ShortMessage");
+    sminit = (*env)->GetMethodID(env, smcls, "<init>", "([B)V");
+
+    rcls = (*env)->FindClass(env, "javax/sound/midi/Receiver");
+    rsend = (*env)->GetMethodID(env, rcls, "send", "(Ljavax/sound/midi/MidiMessage;J)V");
+
+    while (1)
+      {
+	if (poll (pfd, npfd, 100000) > 0)
+	  {
+	    snd_seq_event_t *ev;
+	    
+	    do
+	      {
+		snd_seq_event_input (seq, &ev);
+
+		if ((ev->flags & SND_SEQ_TIME_STAMP_MASK) == SND_SEQ_TIME_STAMP_TICK)
+		  jtimestamp = (jlong) ev->time.tick;
+		else
+		  jtimestamp = (jlong) ev->time.time.tv_sec * (jlong) 1000000000 
+		    + (jlong) ev->time.time.tv_nsec;
+
+		switch (ev->type)
+		  {
+		  case SND_SEQ_EVENT_NOTEON:
+		    mba = (*env)->NewByteArray (env, 3);
+		    ba = (*env)->GetByteArrayElements (env, mba, 0);
+		    ba[0] = 0x90 + ev->data.control.channel;
+		    ba[1] = ev->data.note.note;
+		    ba[2] = ev->data.note.velocity;
+		    (*env)->ReleaseByteArrayElements (env, mba, ba, 0);
+		    msg = (*env)->NewObject(env, smcls, sminit, mba);
+		    (*env)->CallObjectMethod(env, receiver, 
+					     rsend, msg, jtimestamp);
+		    break;
+		    
+		  case SND_SEQ_EVENT_CONTROLLER:
+		    mba = (*env)->NewByteArray (env, 3);
+		    ba = (*env)->GetByteArrayElements (env, mba, 0);
+		    ba[0] = 0xB0 + ev->data.control.channel;
+		    ba[1] = ev->data.control.param;
+		    ba[2] = ev->data.control.value;
+		    (*env)->ReleaseByteArrayElements (env, mba, ba, 0);
+		    msg = (*env)->NewObject(env, smcls, sminit, mba);
+		    (*env)->CallObjectMethod(env, receiver, 
+					     rsend, msg, jtimestamp);
+		    break;
+
+		  default:
+		    printf ("UNKNOWN EVENT 0x%x\n", ev->type);
+		    break;
+		  }
+
+		snd_seq_free_event(ev);
+	      }
+	    while (snd_seq_event_input_pending (seq, 0) > 0);
+	  }
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,12 @@
+nativeexeclib_LTLIBRARIES = libgjsmdssi.la 
+
+libgjsmdssi_la_SOURCES = gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c \
+			 gnu_javax_sound_midi_dssi_DSSISynthesizer.c \
+			 dssi_data.h
+
+libgjsmdssi_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo -ljack
+libgjsmdssi_la_LDFLAGS = -avoid-version
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ 
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,599 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/midi-dssi
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libgjsmdssi_la_DEPENDENCIES =  \
+	$(top_builddir)/native/jni/classpath/jcl.lo
+am_libgjsmdssi_la_OBJECTS =  \
+	gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.lo \
+	gnu_javax_sound_midi_dssi_DSSISynthesizer.lo
+libgjsmdssi_la_OBJECTS = $(am_libgjsmdssi_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgjsmdssi_la_SOURCES)
+DIST_SOURCES = $(libgjsmdssi_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libgjsmdssi.la 
+libgjsmdssi_la_SOURCES = gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c \
+			 gnu_javax_sound_midi_dssi_DSSISynthesizer.c \
+			 dssi_data.h
+
+libgjsmdssi_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo -ljack
+libgjsmdssi_la_LDFLAGS = -avoid-version
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ 
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/midi-dssi/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/midi-dssi/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libgjsmdssi.la: $(libgjsmdssi_la_OBJECTS) $(libgjsmdssi_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libgjsmdssi_la_LDFLAGS) $(libgjsmdssi_la_OBJECTS) $(libgjsmdssi_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu_javax_sound_midi_dssi_DSSISynthesizer.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/README
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/README?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/README (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/README Thu Nov  8 16:56:19 2007
@@ -0,0 +1,134 @@
+The file native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+contains two functions (get_port_default and set_control) derived from
+example code in the DSSI distribution (http://dssi.sourceforge.net).
+The original DSSI example code is distributed under the following
+terms:
+
+ Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton.
+ 
+ Permission to use, copy, modify, distribute, and sell this software
+ for any purpose is hereby granted without fee, provided that the
+ above copyright notice and this permission notice are included in
+ all copies or substantial portions of the software.
+
+
+The rest of this file contain the original versions of these
+functions.
+
+
+LADSPA_Data get_port_default(const LADSPA_Descriptor *plugin, int port)
+{
+    LADSPA_PortRangeHint hint = plugin->PortRangeHints[port];
+    float lower = hint.LowerBound *
+	(LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+    float upper = hint.UpperBound *
+	(LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+
+    if (!LADSPA_IS_HINT_HAS_DEFAULT(hint.HintDescriptor)) {
+	if (!LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) ||
+	    !LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) {
+	    /* No hint, its not bounded, wild guess */
+	    return 0.0f;
+	}
+
+	if (lower <= 0.0f && upper >= 0.0f) {
+	    /* It spans 0.0, 0.0 is often a good guess */
+	    return 0.0f;
+	}
+
+	/* No clues, return minimum */
+	return lower;
+    }
+
+    /* Try all the easy ones */
+    
+    if (LADSPA_IS_HINT_DEFAULT_0(hint.HintDescriptor)) {
+	return 0.0f;
+    } else if (LADSPA_IS_HINT_DEFAULT_1(hint.HintDescriptor)) {
+	return 1.0f;
+    } else if (LADSPA_IS_HINT_DEFAULT_100(hint.HintDescriptor)) {
+	return 100.0f;
+    } else if (LADSPA_IS_HINT_DEFAULT_440(hint.HintDescriptor)) {
+	return 440.0f;
+    }
+
+    /* All the others require some bounds */
+
+    if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) {
+	if (LADSPA_IS_HINT_DEFAULT_MINIMUM(hint.HintDescriptor)) {
+	    return lower;
+	}
+    }
+    if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) {
+	if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hint.HintDescriptor)) {
+	    return upper;
+	}
+	if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) {
+	    if (LADSPA_IS_HINT_DEFAULT_LOW(hint.HintDescriptor)) {
+		return lower * 0.75f + upper * 0.25f;
+	    } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hint.HintDescriptor)) {
+		return lower * 0.5f + upper * 0.5f;
+	    } else if (LADSPA_IS_HINT_DEFAULT_HIGH(hint.HintDescriptor)) {
+		return lower * 0.25f + upper * 0.75f;
+	    }
+	}
+    }
+
+    /* fallback */
+    return 0.0f;
+}
+
+
+void
+setControl(d3h_instance_t *instance, long controlIn, snd_seq_event_t *event)
+{
+    long port = pluginControlInPortNumbers[controlIn];
+
+    const LADSPA_Descriptor *p = instance->plugin->descriptor->LADSPA_Plugin;
+
+    LADSPA_PortRangeHintDescriptor d = p->PortRangeHints[port].HintDescriptor;
+
+    LADSPA_Data lb = p->PortRangeHints[port].LowerBound *
+	(LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+	 sample_rate : 1.0f);
+
+    LADSPA_Data ub = p->PortRangeHints[port].UpperBound *
+	(LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+	 sample_rate : 1.0f);
+
+    float value = (float)event->data.control.value;
+
+    if (!LADSPA_IS_HINT_BOUNDED_BELOW(d)) {
+	if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) {
+	    /* unbounded: might as well leave the value alone. */
+	} else {
+	    /* bounded above only. just shift the range. */
+	    value = ub - 127.0f + value;
+	}
+    } else {
+	if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) {
+	    /* bounded below only. just shift the range. */
+	    value = lb + value;
+	} else {
+	    /* bounded both ends.  more interesting. */
+	    if (LADSPA_IS_HINT_LOGARITHMIC(d)) {
+		const float llb = logf(lb);
+		const float lub = logf(ub);
+
+		value = expf(llb + ((lub - llb) * value / 127.0f));
+	    } else {
+		value = lb + ((ub - lb) * value / 127.0f);
+	    }
+	}
+    }
+
+    if (verbose) {
+	printf("%s: %s MIDI controller %d=%d -> control in %ld=%f\n", myName,
+	       instance->friendly_name, event->data.control.param,
+	       event->data.control.value, controlIn, value);
+    }
+
+    pluginControlIns[controlIn] = value;
+    pluginPortUpdated[controlIn] = 1;
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/dssi_data.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/dssi_data.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/dssi_data.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/dssi_data.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,116 @@
+/* dssi_data.h - DSSI data
+   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+#include <jni.h>
+#include <dssi.h>
+#include <jack/jack.h>
+#include <alsa/asoundlib.h>
+#include <alsa/seq.h>
+
+#include <stdio.h>
+
+#include "target_native.h"
+#include "target_native_misc.h"
+#include "../classpath/jcl.h"
+
+/* Specify the size of the circular buffer.  It only needs to be big
+   enough to hold the events that happen between jack callbacks (~
+   1/40th of a second).  */
+#define EVENT_BUFFER_SIZE 1024
+
+/* Every DSSI Synthesizer has one of these associated with it.  The
+   Java class sees it as a "long" handle.  */
+
+typedef struct
+{
+  /* This is a handle to the dlopen'ed .so file containing the DSSI
+     synthesizer.  */
+  void *dlhandle;
+
+  /* The function to call to get the DSS_Descriptor.  */
+  DSSI_Descriptor_Function fn;
+
+  /* The descriptor for this synthesizer.  See the dssi.h system
+     header.  */
+  const DSSI_Descriptor *desc;
+
+  /* We currently open a jack client connection for every
+     synthesizer.  */
+  jack_client_t *jack_client;
+
+  /* We currently only handle stereo jack connections.  Output from
+     mono synthesizers is sent to both left and right ports.  */
+  jack_port_t *jack_left_output_port;
+  jack_port_t *jack_right_output_port;
+
+  /* We use a circular buffer to hold MIDI events before processing
+     them in the jack audio processing callback function.  */
+  snd_seq_event_t midiEventBuffer[EVENT_BUFFER_SIZE];
+  int midiEventReadIndex; 
+  int midiEventWriteIndex;
+
+  /* This is a handle the synthesizers underlying LADSPA structure.
+     See the ladspa.h system header for details.  */
+  LADSPA_Handle plugin_handle;
+
+  /* These are buffers we pass to the DSSI Synthesizer for
+     filling.  */
+  float *left_buffer;
+  float *right_buffer;
+
+  /* The number of input controls for this synth.  */
+  unsigned control_count;
+  
+  /* An array of control values, control_count in length.  */
+  LADSPA_Data *control_values;
+
+  /* A mapping of MIDI controllers to control values.  There are a
+     maximum of 128 MIDI controllers.  */
+  unsigned control_value_map[128];
+
+  /* A mapping of MIDI controllers to LADSPA ports.  There are a
+     maximum of 128 MIDI controllers.  */
+  unsigned control_port_map[128];
+
+  /* The sample rate.  */
+  jack_nframes_t sample_rate;
+
+} dssi_data;
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,139 @@
+/* gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c - DSSI Provider
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+#include <gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h> 
+
+#include "dssi_data.h"
+
+void
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlclose_1 
+  (JNIEnv *env, jclass clazz __attribute__((unused)), jlong sohandle)
+{
+  dssi_data *data = (dssi_data *) (long) sohandle;
+  dlclose (data->dlhandle);
+  JCL_free (env, data);  
+}
+
+jlong
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlopen_1 
+  (JNIEnv *env, jclass clazz __attribute__((unused)), jstring name)
+{
+  const char *filename;
+  void *handle;
+  DSSI_Descriptor_Function fn;
+  dssi_data *data = 0;
+  
+  filename = JCL_jstring_to_cstring (env, name);
+  if (filename == NULL)
+    return (0);
+  
+  handle = dlopen(filename, RTLD_NOW);
+  
+  if (handle == 0)
+    goto done;
+  
+  fn = (DSSI_Descriptor_Function) dlsym(handle, "dssi_descriptor");
+  
+  if (fn == 0)
+    {
+      dlclose(handle);
+      goto done;
+    }
+  
+  data = (dssi_data *) JCL_malloc(env, sizeof(dssi_data));
+  data->dlhandle = handle;
+  data->fn = fn;
+  data->midiEventReadIndex = 0;
+  data->midiEventWriteIndex = 0;
+  
+ done:
+  JCL_free_cstring (env, name, filename);
+  return PTR_TO_JLONG(data);
+}
+
+jlong
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIHandle_1 
+  (JNIEnv *env __attribute__((unused)), 
+   jclass clazz __attribute__((unused)), jlong handle, jlong index)
+{ 
+  dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+  data->desc = (data->fn)(index);
+  return PTR_TO_JLONG(data->desc);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIName_1 
+  (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+  DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+  const char *str = desc->LADSPA_Plugin->Name;
+  
+  return (*env)->NewStringUTF (env, str);
+} 
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSICopyright_1 
+  (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+  DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+  const char *str = desc->LADSPA_Plugin->Copyright;
+  
+  return (*env)->NewStringUTF (env, str);
+} 
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIVendor_1 
+  (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+  DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+  const char *str = desc->LADSPA_Plugin->Maker;
+  
+  return (*env)->NewStringUTF (env, str);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSILabel_1 
+  (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+  DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+  const char *str = desc->LADSPA_Plugin->Label;
+  
+  return (*env)->NewStringUTF (env, str);
+}
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,584 @@
+/* gnu_javax_sound_midi_dssi_DSSISynthesizer.c - DSSI Synth
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* The original get_port_default() and set_control() routines were
+ * copied from the DSSI source distribution and are covered by the
+ * following copyright and license...
+ *
+ * Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton.
+ * 
+ * Permission to use, copy, modify, distribute, and sell this software
+ * for any purpose is hereby granted without fee, provided that the
+ * above copyright notice and this permission notice are included in
+ * all copies or substantial portions of the software.
+ */
+
+#include <config.h>
+#include <gnu_javax_sound_midi_dssi_DSSISynthesizer.h> 
+#include <math.h>
+
+#include "dssi_data.h"
+
+/* Define this for debug output.  */
+#undef DEBUG_DSSI_PROVIDER
+
+static void set_control (dssi_data *data, snd_seq_event_t *event);
+
+
+/**
+ * The jack callback routine.
+ *
+ * This function is called by the jack audio system in its own thread
+ * whenever it needs new audio data.
+ *
+ */
+static int
+process (jack_nframes_t nframes, void *arg)
+{    
+  dssi_data *data = (dssi_data *) arg;
+  int index;
+  jack_default_audio_sample_t *buffer;
+
+  /* Look through the event buffer to see if any control values
+     need changing.  */
+  for ( index = data->midiEventReadIndex; 
+	index != data->midiEventWriteIndex;
+	index = (index + 1) % EVENT_BUFFER_SIZE)
+    {
+      if (data->midiEventBuffer[index].type == SND_SEQ_EVENT_CONTROLLER)
+	set_control (data, & data->midiEventBuffer[index]);
+    }
+
+  if (data->desc->run_synth)
+    {
+      /* Call the synth audio processing routine.  */
+      data->desc->run_synth
+	(data->plugin_handle,
+	 nframes,
+	 &data->midiEventBuffer[data->midiEventReadIndex],
+	 data->midiEventWriteIndex - data->midiEventReadIndex);
+    }
+  else 
+    if (data->desc->run_multiple_synths)
+      {
+	snd_seq_event_t *events = 
+	  &data->midiEventBuffer[data->midiEventReadIndex];
+	unsigned long event_count = 
+	  data->midiEventWriteIndex - data->midiEventReadIndex;
+
+	/* Call the synth audio processing routine.  */
+	data->desc->run_multiple_synths
+	  (1,
+	   & (data->plugin_handle),
+	   nframes,
+	   &events,
+	   &event_count);
+      }
+
+  /* Update the read index on our circular buffer.  */
+  data->midiEventReadIndex = data->midiEventWriteIndex;
+
+  /* Copy output from the synth to jack.  
+
+     FIXME: This is hack that only gets one channel from the synth and
+     send that to both jack ports (until we handle stero synths
+     properly).
+
+     FIXME: Can we avoid this copying?  */
+  buffer = jack_port_get_buffer(data->jack_left_output_port, nframes);
+  memcpy (buffer, data->left_buffer, nframes * sizeof(LADSPA_Data));
+  buffer = jack_port_get_buffer(data->jack_right_output_port, nframes);
+  memcpy (buffer, data->left_buffer, nframes * sizeof(LADSPA_Data));
+
+  return 0;   
+}
+
+
+/**
+ * Calculate a reasonable default value for a specific control port.
+ * This is mostly copied from the DSSI example code.  Copyright info
+ * is found at the top of this file.
+ *
+ */
+static LADSPA_Data 
+get_port_default (const LADSPA_Descriptor *plugin, 
+		  int port, jack_nframes_t sample_rate)
+{
+  LADSPA_PortRangeHint hint = plugin->PortRangeHints[port];
+  float lower = hint.LowerBound *
+    (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+  float upper = hint.UpperBound *
+    (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+  
+  if (!LADSPA_IS_HINT_HAS_DEFAULT(hint.HintDescriptor)) 
+    {
+      if (!LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) ||
+	  !LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) 
+	{
+	  /* No hint, its not bounded, wild guess */
+	  return 0.0f;
+	}
+    
+      if (lower <= 0.0f && upper >= 0.0f) 
+	{
+	  /* It spans 0.0, 0.0 is often a good guess */
+	  return 0.0f;
+	}
+    
+      /* No clues, return minimum */
+      return lower;
+    }
+  
+  /* Try all the easy ones */
+  
+  if (LADSPA_IS_HINT_DEFAULT_0(hint.HintDescriptor))
+    return 0.0f;
+  else if (LADSPA_IS_HINT_DEFAULT_1(hint.HintDescriptor)) 
+    return 1.0f;
+  else if (LADSPA_IS_HINT_DEFAULT_100(hint.HintDescriptor)) 
+    return 100.0f;
+  else if (LADSPA_IS_HINT_DEFAULT_440(hint.HintDescriptor)) 
+    return 440.0f;
+   
+  /* All the others require some bounds */
+  
+  if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)
+      && (LADSPA_IS_HINT_DEFAULT_MINIMUM(hint.HintDescriptor)))
+    return lower;
+
+  if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
+    {
+      if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hint.HintDescriptor))
+	return upper;
+
+      if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) 
+	{
+	  if (LADSPA_IS_HINT_DEFAULT_LOW(hint.HintDescriptor)) 
+	    return lower * 0.75f + upper * 0.25f;
+	  else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hint.HintDescriptor)) 
+	    return lower * 0.5f + upper * 0.5f;
+	  else if (LADSPA_IS_HINT_DEFAULT_HIGH(hint.HintDescriptor)) 
+	    return lower * 0.25f + upper * 0.75f;
+	}
+    }
+  
+  /* fallback */
+  return 0.0f;
+}
+
+/**
+ * Set a control value by mapping the MIDI event to a suitable value
+ * for this control.
+ * This is mostly copied from the DSSI example code.  Copyright info
+ * is found at the top of this file.
+ *
+ */
+static void
+set_control(dssi_data *data, snd_seq_event_t *event)
+{
+  unsigned control = event->data.control.param;
+  unsigned port = data->control_port_map[control];
+
+  const LADSPA_Descriptor *p = data->desc->LADSPA_Plugin;
+
+  LADSPA_PortRangeHintDescriptor d = p->PortRangeHints[port].HintDescriptor;
+
+  LADSPA_Data lb = p->PortRangeHints[port].LowerBound *
+    (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+     data->sample_rate : 1.0f);
+  
+  LADSPA_Data ub = p->PortRangeHints[port].UpperBound *
+    (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+     data->sample_rate : 1.0f);
+  
+  float value = (float)event->data.control.value;
+  
+  if (!LADSPA_IS_HINT_BOUNDED_BELOW(d)) 
+    {
+      if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) 
+	{
+	  /* unbounded: might as well leave the value alone. */
+	} 
+      else 
+	{
+	  /* bounded above only. just shift the range. */
+	  value = ub - 127.0f + value;
+	}
+    } 
+  else 
+    {
+      if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) 
+	{
+	  /* bounded below only. just shift the range. */
+	  value = lb + value;
+	} 
+      else 
+	{
+	  /* bounded both ends.  more interesting. */
+	  if (LADSPA_IS_HINT_LOGARITHMIC(d)) 
+	    {
+	      const float llb = logf(lb);
+	      const float lub = logf(ub);
+	      
+	      value = expf(llb + ((lub - llb) * value / 127.0f));
+	    } 
+	  else 
+	    {
+	      value = lb + ((ub - lb) * value / 127.0f);
+	    }
+	}
+    }
+  
+#ifdef DEBUG_DSSI_PROVIDER
+  printf("MIDI controller %d=%d -> control in %u=%f\n", 
+	 event->data.control.param,
+	 event->data.control.value, 
+	 data->control_value_map[control], value);
+#endif
+  
+  data->control_values[data->control_value_map[control]] = value;
+}
+
+/**
+ * Open a new synthesizer.  This currently involves instantiating a
+ * new synth, creating a new jack client connection, and activating
+ * both.
+ *
+ */
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1 
+  (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+  unsigned int port_count, j, cindex;
+  const char **ports;
+  int controller = 0;
+  dssi_data *data = (dssi_data *) (long) handle;
+  if ((data->jack_client = jack_client_new (data->desc->LADSPA_Plugin->Label)) == 0)
+    {
+      /*	JCL_ThrowException (env, "javax/sound/midi/MidiUnavailableException",   */
+      JCL_ThrowException (env, "java/io/IOException", 
+			  "can't create jack client");
+      return;
+    } 
+
+  /* Get the jack sample rate, which may be used in default control port
+     value calculations.  */
+  data->sample_rate = jack_get_sample_rate (data->jack_client);
+  
+  data->plugin_handle = 
+    (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, 
+					     data->sample_rate);
+  
+  if (jack_set_process_callback (data->jack_client, process, data) != 0)
+    {
+      JCL_ThrowException (env, "java/io/IOException", 
+			  "can't set jack process callback");
+      return;
+    }
+  
+  data->jack_left_output_port =
+    jack_port_register (data->jack_client, "output_left",
+                        JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+  data->jack_right_output_port =
+    jack_port_register (data->jack_client, "output_right",
+                        JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+
+  /* Count the number of controls and audio ouput ports.  */
+  port_count = data->control_count = 0;
+  for (j = 0; j < data->desc->LADSPA_Plugin->PortCount; j++) 
+    {
+      LADSPA_PortDescriptor pod =
+    	data->desc->LADSPA_Plugin->PortDescriptors[j];
+      
+      if (LADSPA_IS_PORT_AUDIO(pod) && LADSPA_IS_PORT_OUTPUT(pod))
+	port_count++;
+      else if (LADSPA_IS_PORT_CONTROL(pod) && LADSPA_IS_PORT_INPUT(pod))
+	data->control_count++;
+    }
+
+  /* Allocate the array of control values.  */
+  data->control_values = 
+    (LADSPA_Data *) JCL_malloc (env, 
+				data->control_count * sizeof (LADSPA_Data));
+
+  /* Initialize the MIDI control map.  */
+  memset (data->control_value_map, 0, data->control_count * sizeof(unsigned));
+  
+  /* Create buffers for each port.  */
+  for (cindex = 0, j = 0; j < data->desc->LADSPA_Plugin->PortCount; j++) 
+    {  
+      LADSPA_PortDescriptor pod =
+	data->desc->LADSPA_Plugin->PortDescriptors[j];
+      if (LADSPA_IS_PORT_AUDIO(pod) && LADSPA_IS_PORT_OUTPUT(pod))
+  	{
+	  data->left_buffer = 
+	    (float *) calloc(jack_get_buffer_size(data->jack_client), 
+			     sizeof(float));
+	  (data->desc->LADSPA_Plugin->connect_port)(data->plugin_handle, j, 
+						    data->left_buffer);
+  	}
+      else 
+	if (LADSPA_IS_PORT_CONTROL(pod) && LADSPA_IS_PORT_INPUT(pod))
+	  {
+	    /* This is an input control port.  Connect it to a properly
+	       initialized value in our controller value array.  */
+	    (data->desc->LADSPA_Plugin->connect_port)
+	      (data->plugin_handle, j, &(data->control_values[cindex]));
+	    data->control_values[cindex] = 
+	      get_port_default (data->desc->LADSPA_Plugin,
+				j, data->sample_rate);
+
+	    /* Set up the mapping between MIDI controllers and this
+	       contoller value.  */
+	    if (data->desc->get_midi_controller_for_port)
+	      {
+		controller = data->desc->
+		  get_midi_controller_for_port(data->plugin_handle, j);
+
+		if ((controller != DSSI_NONE) && DSSI_IS_CC(controller))
+		  {
+		    data->control_value_map[DSSI_CC_NUMBER(controller)] = cindex;
+		    data->control_port_map[DSSI_CC_NUMBER(controller)] = j;
+
+#ifdef DEBUG_DSSI_PROVIDER
+		    printf ("MIDI Controller 0x%x [%s] = %g\n", 
+			    DSSI_CC_NUMBER(controller),
+			    data->desc->LADSPA_Plugin->PortNames[j],
+			    data->control_values[cindex]);
+#endif
+		  }
+	      }
+
+	    cindex++;
+	  }
+    }
+  
+  (data->desc->LADSPA_Plugin->activate)(data->plugin_handle);
+
+  if (jack_activate (data->jack_client))
+    JCL_ThrowException (env, "java/io/IOException", 
+			"can't activate jack client"); 
+
+  /* Try to connect the synth output to hardware audio ports.  */
+  ports = jack_get_ports (data->jack_client, NULL, NULL, 
+			  JackPortIsPhysical | JackPortIsInput);
+  if (ports)
+    {
+      if (ports[0] && ports[1]) 
+	{
+	  /* Don't bother checking return values.  Failing is OK.  */
+	  jack_connect (data->jack_client, 
+			jack_port_name (data->jack_left_output_port),
+			ports[0]);
+	  jack_connect (data->jack_client, 
+			jack_port_name (data->jack_right_output_port),
+			ports[1]);
+	}
+      free(ports);
+    }
+}
+
+/**
+ * This is called when we receive a new MIDI CONTROL CHANGE message.
+ * Simply stick an appropriate event in the event buffer.  This will
+ * get processed in the jack callback function.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_controlChange_1 
+  (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), 
+   jlong handle, jint channel, jint control, jint value)
+{
+  dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+
+  /* Insert this event in the event buffer.  */
+  snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex];
+
+  /* Set the event value.  */
+  snd_seq_ev_set_controller (ev, channel, control, value);
+
+  data->midiEventWriteIndex = 
+    (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE;
+}
+
+/**
+ * This is called when we receive a new MIDI NOTE ON message.  Simply
+ * stick an appropriate event in the event buffer.  This will get
+ * processed in the jack callback function.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1 
+  (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), 
+   jlong handle, jint channel, jint note, jint velocity)
+{
+  dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+
+  /* Insert this event in the event buffer.  */
+  snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex];
+
+  ev->type = SND_SEQ_EVENT_NOTEON;
+  ev->data.control.channel = channel;
+  ev->data.note.note = note;
+  ev->data.note.velocity = velocity;
+
+  data->midiEventWriteIndex = 
+    (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE;
+}
+
+/**
+ * This is called when we receive a new MIDI NOTE OFF message.  Simply
+ * stick an appropriate event in the event buffer.  This will get
+ * processed in the jack callback function.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1 
+  (JNIEnv *env __attribute__((unused)), 
+   jclass clazz __attribute__((unused)), 
+   jlong handle, jint channel, jint note, jint velocity)
+{
+  dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+
+  /* Insert this event in the event buffer.  */
+  snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex];
+
+  ev->type = SND_SEQ_EVENT_NOTEOFF;
+  ev->data.control.channel = channel;
+  ev->data.note.note = note;
+  ev->data.note.velocity = velocity;
+
+  data->midiEventWriteIndex = 
+    (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_setPolyPressure_1 
+  (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), 
+   jlong handle __attribute__((unused)), jint channel __attribute__((unused)), 
+   jint note __attribute__((unused)), jint velocity __attribute__((unused)))
+{
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getPolyPressure_1 
+  (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), 
+   jlong handle __attribute__((unused)), jint channel __attribute__((unused)), 
+   jint note __attribute__((unused)))
+{
+  return 0;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_close_1 
+  (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), 
+   jlong handle __attribute__((unused)))
+{
+}
+
+/* FIXME: These next three functions are really inefficient because
+   we're instantiating and cleaning up plugin instances just to query
+   values.  */
+
+JNIEXPORT jstring JNICALL 
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1 
+  (JNIEnv *env, jclass clazz __attribute__((unused)), 
+   jlong handle, jint index)
+{
+  LADSPA_Handle lhandle;
+  jstring name = (jstring) NULL;
+  dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+  if (data->desc->get_program == NULL)
+    return NULL;
+  lhandle =
+    (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, 
+					     48000);
+  const DSSI_Program_Descriptor *program = 
+    (data->desc->get_program)(lhandle, (unsigned long) index);
+  if (program)
+    name = (*env)->NewStringUTF (env, program->Name);
+  (data->desc->LADSPA_Plugin->cleanup)(lhandle);
+
+  return name;
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1 
+  (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+   jlong handle, jint index)
+{
+  LADSPA_Handle lhandle;
+  jint result = -1;
+  dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+  lhandle =
+    (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, 
+					     48000);
+  const DSSI_Program_Descriptor *program = 
+    (data->desc->get_program)(lhandle, (unsigned long) index);
+  if (program)
+    result = (jint) program->Bank;
+  (data->desc->LADSPA_Plugin->cleanup)(lhandle);
+  return result;
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1 
+  (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), 
+   jlong handle, jint index)
+{
+  LADSPA_Handle lhandle;
+  jint result = -1;
+  dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+  lhandle =
+    (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, 
+					     48000);
+  const DSSI_Program_Descriptor *program = 
+    (data->desc->get_program)(lhandle, (unsigned long) index);
+  if (program)
+    result = (jint) program->Program;
+  (data->desc->LADSPA_Plugin->cleanup)(lhandle);
+  return result;
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_selectProgram_1 
+  (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), 
+   jlong handle, jint bank, jint program)
+{
+  dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+
+  (data->desc->select_program)(data->plugin_handle, 
+			       (unsigned) bank, (unsigned) program);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/.cvsignore
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/.cvsignore?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/.cvsignore (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/.cvsignore Thu Nov  8 16:56:19 2007
@@ -0,0 +1,9 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.deps
+Makefile
+Makefile.in
+slotcallbacks.moc.h

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,79 @@
+# Qt AWT backend for Classpath
+#
+
+nativeexeclib_LTLIBRARIES = libqtpeer.la
+
+AM_LDFLAGS = @CLASSPATH_MODULE@ @QT_LIBS@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+
+AM_CXXFLAGS = @QT_CFLAGS@
+
+libqtpeer_la_MOC = \
+	slotcallbacks.moc.h
+
+slotcallbacks.moc.h: slotcallbacks.cpp
+	$(MOC) -o slotcallbacks.moc.h $(srcdir)/slotcallbacks.cpp
+
+nodist_libqtpeer_la_SOURCES = \
+	$(libqtpeer_la_MOC) 
+
+libqtpeer_la_SOURCES = \
+        buttonevent.h \
+        componentevent.cpp \
+        componentevent.h \
+        containers.h \
+        eventmethods.h \
+        keybindings.cpp \
+        keybindings.h \
+        mainqtthread.cpp \
+        mainthreadinterface.cpp \
+        mainthreadinterface.h \
+        nativewrapper.cpp \
+        nativewrapper.h \
+        qmatrix.cpp \
+        qpainterpath.cpp \
+        qpen.cpp \
+        qtaudioclip.cpp \
+        qtbuttonpeer.cpp \
+        qtcanvaspeer.cpp \
+        qtcheckboxpeer.cpp \
+        qtchoicepeer.cpp \
+        qtcomponent.cpp \
+        qtcomponent.h \
+        qtcomponentpeer.cpp \
+        qtdialogpeer.cpp \
+	qtembeddedwindowpeer.cpp \
+        qtfiledialogpeer.cpp \
+        qtfont.h \
+        qtfontmetrics.cpp \
+        qtfontpeer.cpp \
+        qtframepeer.cpp \
+        qtgraphics.cpp \
+        qtgraphics.h \
+        qtimage.cpp \
+        qtimage.h \
+        qtlabelpeer.cpp \
+        qtlistpeer.cpp \
+        qtmenubarpeer.cpp \
+        qtmenucomponentpeer.cpp \
+        qtmenuitempeer.cpp \
+        qtmenupeer.cpp \
+        qtpanelpeer.cpp \
+        qtpopupmenupeer.cpp \
+        qtscreendevice.cpp \
+        qtscrollbarpeer.cpp \
+        qtscrollpanepeer.cpp \
+        qtstrings.cpp \
+        qtstrings.h \
+        qttextareapeer.cpp \
+        qttextfieldpeer.cpp \
+        qttoolkit.cpp \
+        qtvolatileimage.cpp \
+        qtwindowpeer.cpp \
+        slotcallbacks.cpp \
+        slotcallbacks.h 
+libqtpeer_la_LDFLAGS = -avoid-version
+
+BUILT_SOURCES = $(libqtpeer_la_MOC)
+
+CLEANFILES = so_locations $(BUILT_SOURCES)

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,728 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# Qt AWT backend for Classpath
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/qt-peer
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libqtpeer_la_LIBADD =
+am_libqtpeer_la_OBJECTS = componentevent.lo keybindings.lo \
+	mainqtthread.lo mainthreadinterface.lo nativewrapper.lo \
+	qmatrix.lo qpainterpath.lo qpen.lo qtaudioclip.lo \
+	qtbuttonpeer.lo qtcanvaspeer.lo qtcheckboxpeer.lo \
+	qtchoicepeer.lo qtcomponent.lo qtcomponentpeer.lo \
+	qtdialogpeer.lo qtembeddedwindowpeer.lo qtfiledialogpeer.lo \
+	qtfontmetrics.lo qtfontpeer.lo qtframepeer.lo qtgraphics.lo \
+	qtimage.lo qtlabelpeer.lo qtlistpeer.lo qtmenubarpeer.lo \
+	qtmenucomponentpeer.lo qtmenuitempeer.lo qtmenupeer.lo \
+	qtpanelpeer.lo qtpopupmenupeer.lo qtscreendevice.lo \
+	qtscrollbarpeer.lo qtscrollpanepeer.lo qtstrings.lo \
+	qttextareapeer.lo qttextfieldpeer.lo qttoolkit.lo \
+	qtvolatileimage.lo qtwindowpeer.lo slotcallbacks.lo
+am__objects_1 =
+nodist_libqtpeer_la_OBJECTS = $(am__objects_1)
+libqtpeer_la_OBJECTS = $(am_libqtpeer_la_OBJECTS) \
+	$(nodist_libqtpeer_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libqtpeer_la_SOURCES) $(nodist_libqtpeer_la_SOURCES)
+DIST_SOURCES = $(libqtpeer_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libqtpeer.la
+AM_LDFLAGS = @CLASSPATH_MODULE@ @QT_LIBS@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CXXFLAGS = @QT_CFLAGS@
+libqtpeer_la_MOC = \
+	slotcallbacks.moc.h
+
+nodist_libqtpeer_la_SOURCES = \
+	$(libqtpeer_la_MOC) 
+
+libqtpeer_la_SOURCES = \
+        buttonevent.h \
+        componentevent.cpp \
+        componentevent.h \
+        containers.h \
+        eventmethods.h \
+        keybindings.cpp \
+        keybindings.h \
+        mainqtthread.cpp \
+        mainthreadinterface.cpp \
+        mainthreadinterface.h \
+        nativewrapper.cpp \
+        nativewrapper.h \
+        qmatrix.cpp \
+        qpainterpath.cpp \
+        qpen.cpp \
+        qtaudioclip.cpp \
+        qtbuttonpeer.cpp \
+        qtcanvaspeer.cpp \
+        qtcheckboxpeer.cpp \
+        qtchoicepeer.cpp \
+        qtcomponent.cpp \
+        qtcomponent.h \
+        qtcomponentpeer.cpp \
+        qtdialogpeer.cpp \
+	qtembeddedwindowpeer.cpp \
+        qtfiledialogpeer.cpp \
+        qtfont.h \
+        qtfontmetrics.cpp \
+        qtfontpeer.cpp \
+        qtframepeer.cpp \
+        qtgraphics.cpp \
+        qtgraphics.h \
+        qtimage.cpp \
+        qtimage.h \
+        qtlabelpeer.cpp \
+        qtlistpeer.cpp \
+        qtmenubarpeer.cpp \
+        qtmenucomponentpeer.cpp \
+        qtmenuitempeer.cpp \
+        qtmenupeer.cpp \
+        qtpanelpeer.cpp \
+        qtpopupmenupeer.cpp \
+        qtscreendevice.cpp \
+        qtscrollbarpeer.cpp \
+        qtscrollpanepeer.cpp \
+        qtstrings.cpp \
+        qtstrings.h \
+        qttextareapeer.cpp \
+        qttextfieldpeer.cpp \
+        qttoolkit.cpp \
+        qtvolatileimage.cpp \
+        qtwindowpeer.cpp \
+        slotcallbacks.cpp \
+        slotcallbacks.h 
+
+libqtpeer_la_LDFLAGS = -avoid-version
+BUILT_SOURCES = $(libqtpeer_la_MOC)
+CLEANFILES = so_locations $(BUILT_SOURCES)
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/qt-peer/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/qt-peer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libqtpeer.la: $(libqtpeer_la_OBJECTS) $(libqtpeer_la_DEPENDENCIES) 
+	$(CXXLINK) -rpath $(nativeexeclibdir) $(libqtpeer_la_LDFLAGS) $(libqtpeer_la_OBJECTS) $(libqtpeer_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/componentevent.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/keybindings.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mainqtthread.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mainthreadinterface.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nativewrapper.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qmatrix.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qpainterpath.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qpen.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtaudioclip.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtbuttonpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtcanvaspeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtcheckboxpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtchoicepeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtcomponent.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtcomponentpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtdialogpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtembeddedwindowpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtfiledialogpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtfontmetrics.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtfontpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtframepeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtgraphics.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtimage.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtlabelpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtlistpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtmenubarpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtmenucomponentpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtmenuitempeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtmenupeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtpanelpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtpopupmenupeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtscreendevice.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtscrollbarpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtscrollpanepeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtstrings.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qttextareapeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qttextfieldpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qttoolkit.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtvolatileimage.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qtwindowpeer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slotcallbacks.Plo at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+ at am__fastdepCXX_TRUE@	if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+
+slotcallbacks.moc.h: slotcallbacks.cpp
+	$(MOC) -o slotcallbacks.moc.h $(srcdir)/slotcallbacks.cpp
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/buttonevent.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/buttonevent.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/buttonevent.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/buttonevent.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,27 @@
+#ifndef BUTTONEVENT_H
+#define BUTTONEVENT_H
+
+#include <QAbstractButton>
+#include "mainthreadinterface.h"
+
+class AWTLabelEvent : public AWTEvent {
+  
+ private:
+  QAbstractButton *widget;
+  QString *string;
+  
+ public:
+  AWTLabelEvent(QAbstractButton *w, QString *s) : AWTEvent()
+  {
+    widget = w;
+    string = s;
+  }
+
+  void runEvent()
+  {
+    widget->setText( *string );
+    delete string;
+  }
+};
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/componentevent.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/componentevent.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/componentevent.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/componentevent.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,223 @@
+/* componentevent.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QWidget>
+#include <QPoint>
+
+#include "componentevent.h"
+  
+AWTInitEvent::AWTInitEvent(JNIEnv *env, jobject obj) : AWTEvent()
+{
+  env->GetJavaVM( &vm );
+  target = env->NewGlobalRef( obj );
+}
+
+void AWTInitEvent::runEvent()
+{
+  JNIEnv *env;
+  vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+  jclass targetCls = env->GetObjectClass( target );
+  // call init()
+  jmethodID mID = env->GetMethodID( targetCls,
+				       "init",
+				       "()V" );
+  env->CallVoidMethod( target, mID );
+
+  // call notify()
+  mID = env->GetMethodID( targetCls,
+			  "notify",
+			  "()V" );
+  assert(mID != NULL);
+  env->MonitorEnter( target );
+  env->CallVoidMethod( target, mID );
+  env->MonitorExit( target );
+
+  env->DeleteGlobalRef( target );
+}
+
+AWTShowEvent::AWTShowEvent(QWidget *w, bool v) : AWTEvent()
+{
+  widget = w;
+  visible = v;
+}
+
+void AWTShowEvent::runEvent()
+{
+  widget->setVisible( visible );
+}
+
+AWTEnableEvent::AWTEnableEvent(QWidget *w, bool v) : AWTEvent()
+{
+  widget = w;
+  enabled = v;
+}
+
+void AWTEnableEvent::runEvent()
+{
+  widget->setEnabled( enabled );
+}
+
+AWTCursorEvent::AWTCursorEvent(QWidget *w, Qt::CursorShape s) : AWTEvent()
+{
+  widget = w;
+  shape = s;
+}
+
+void AWTCursorEvent::runEvent()
+{
+  QCursor *s = new QCursor(shape);
+  widget->setCursor( *s );
+}
+
+AWTResizeEvent::AWTResizeEvent(QWidget *wid, int x0, int y0, int w0, int h0)
+{
+  widget = wid;
+  x = x0; y = y0;
+  w = w0; h = h0;
+  if(w == 0 && h == 0) w = h = 10;
+}
+
+void AWTResizeEvent::runEvent()
+{
+  QRect g = widget->geometry();
+  if(g.x() != x || g.y() != y || g.width() != w || g.height() != h)
+    widget->setGeometry( x, y, w, h );
+}
+
+AWTBackgroundEvent::AWTBackgroundEvent(QWidget *wid, bool fg, QColor *clr)
+{
+  widget = wid;
+  foreground = fg;
+  color = clr;
+}
+
+void AWTBackgroundEvent::runEvent()
+{  
+  QPalette p = widget->palette();
+  if (foreground)
+    {
+      p.setColor(QPalette::Active, QPalette::Foreground, *color);
+      p.setColor(QPalette::Active, QPalette::Text, *color);
+    }
+  else
+    {
+      p.setColor(QPalette::Active, QPalette::Background, *color);
+      p.setColor(QPalette::Active, QPalette::Button, *color);
+      p.setColor(QPalette::Active, QPalette::Base, *color);
+      p.setColor(QPalette::Active, QPalette::AlternateBase, *color);
+    }
+  widget->setPalette(p);
+  widget->repaint();
+  delete color;
+}
+
+AWTGetOriginEvent::AWTGetOriginEvent(QWidget *w, JNIEnv *env, jobject obj) : AWTEvent()
+{
+  widget = w;
+  env->GetJavaVM( &vm );
+  target = env->NewGlobalRef( obj );
+}
+
+void AWTGetOriginEvent::runEvent()
+{
+  JNIEnv *env;
+  vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+  jclass targetCls = env->GetObjectClass( target );
+
+  QPoint *p = new QPoint( widget->mapToGlobal( QPoint(0, 0) ) );
+  // call init()
+  jmethodID mID = env->GetMethodID( targetCls,
+				       "setLocation",
+				       "(II)V" );
+  env->CallVoidMethod( target, mID, p->x(), p->y() );
+  delete p;
+
+  // call notify()
+  mID = env->GetMethodID( targetCls,
+			  "notify",
+			  "()V" );
+  assert(mID != NULL);
+  env->MonitorEnter( target );
+  env->CallVoidMethod( target, mID );
+  env->MonitorExit( target );
+
+  env->DeleteGlobalRef( target );
+}
+
+GetSizeEvent::GetSizeEvent(QWidget *w, JNIEnv *env, jobject obj, bool p) : AWTEvent()
+{
+  widget = w;
+  env->GetJavaVM( &vm );
+  target = env->NewGlobalRef( obj );
+  pref = p;
+}
+
+void GetSizeEvent::runEvent()
+{
+  JNIEnv *env;
+  vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+  jclass targetCls = env->GetObjectClass( target );
+
+  QPoint *p = new QPoint( widget->mapToGlobal( QPoint(0, 0) ) );
+  QSize s;
+  if( pref )
+    s = widget->sizeHint();
+  else
+    s = widget->minimumSizeHint();
+
+  // call init()
+  jmethodID mID = env->GetMethodID( targetCls,
+				       "setSize",
+				       "(II)V" );
+  env->CallVoidMethod( target, mID, s.width(), s.height() );
+
+  // call notify()
+  mID = env->GetMethodID( targetCls,
+			  "notify",
+			  "()V" );
+  assert(mID != NULL);
+  env->MonitorEnter( target );
+  env->CallVoidMethod( target, mID );
+  env->MonitorExit( target );
+
+  env->DeleteGlobalRef( target );
+}
+
+
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/componentevent.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/componentevent.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/componentevent.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/componentevent.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,203 @@
+#ifndef CALLBACKEVENT_H
+#define CALLBACKEVENT_H
+
+#include <jni.h>
+#include <QWidget>
+#include <QEvent>
+#include <QColor>
+#include <QCursor>
+#include <QFont>
+#include <QPoint>
+#include <QWidget>
+#include <QSize>
+
+#include "mainthreadinterface.h"
+
+class AWTInitEvent : public AWTEvent {
+  
+ private:
+  JavaVM* vm;
+  jobject target;
+
+ public:
+  AWTInitEvent(JNIEnv *env, jobject obj);
+  void runEvent();
+};
+
+class AWTDestroyEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+
+ public:
+  AWTDestroyEvent(QWidget *w)
+    {
+      widget = w;
+    }
+
+  void runEvent()
+  {
+    if( widget != NULL ) 
+      delete widget;
+  }
+};
+
+class AWTFontEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  QFont *font;
+
+ public:
+  AWTFontEvent(QWidget *w, QFont *f)
+    {
+      widget = w;
+      font = f;
+    }
+
+  void runEvent()
+  {
+    widget->setFont( *font );
+  }
+};
+
+class AWTUpdateEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  int x,y,w,h;
+  bool updateAll;
+
+ public:
+  AWTUpdateEvent(QWidget *src, bool all, int x0, int y0, int w0, int h0)
+    {
+      widget = src;
+      updateAll = all;
+      x = x0; y = y0; w = w0; h = h0;
+    }
+
+  void runEvent()
+  {
+    if(updateAll)
+      widget->update();
+    else
+      widget->update(x,y,w,h);
+  }
+};
+
+class AWTShowEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  bool visible;
+
+ public:
+  AWTShowEvent(QWidget *w, bool v);
+  void runEvent();
+};
+
+class AWTEnableEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  bool enabled;
+
+ public:
+  AWTEnableEvent(QWidget *w, bool v);
+  void runEvent();
+};
+
+class AWTCursorEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  Qt::CursorShape shape;
+  
+ public:
+  AWTCursorEvent(QWidget *w,  Qt::CursorShape s);
+  void runEvent();
+};
+
+class AWTResizeEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  int x, y, w, h;
+  
+ public:
+  AWTResizeEvent(QWidget *wid, int x0, int y0, int w0, int h0);
+  void runEvent();
+};
+
+class AWTBackgroundEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  bool foreground;
+  QColor *color;
+  
+ public:
+  AWTBackgroundEvent(QWidget *wid, bool fg, QColor *clr);
+  void runEvent();
+};
+
+class AWTReqFocusEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+
+ public:
+  AWTReqFocusEvent(QWidget *w) : AWTEvent()
+    { 
+      widget = w; 
+    }
+  void runEvent()
+  {
+    widget->setFocus();
+  }
+};
+
+class AWTGetOriginEvent : public AWTEvent {
+  
+ private:
+  JavaVM* vm;
+  jobject target;
+  QWidget *widget;
+
+ public:
+  AWTGetOriginEvent(QWidget *w, JNIEnv *env, jobject obj);
+  void runEvent();
+};
+
+class GetSizeEvent : public AWTEvent {
+  
+ private:
+  JavaVM* vm;
+  jobject target;
+  QWidget *widget;
+  bool pref;
+
+ public:
+  GetSizeEvent(QWidget *w, JNIEnv *env, jobject obj, bool p);
+  void runEvent();
+};
+
+class AWTReparent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  QWidget *parent;
+
+ public:
+  AWTReparent(QWidget *w, QWidget *p) : AWTEvent()
+    { 
+      widget = w; 
+      parent = p;
+    }
+  void runEvent()
+  {
+    widget->setParent( parent );
+  }
+};
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/containers.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/containers.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/containers.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/containers.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,10 @@
+#ifndef QTFRAME_H
+#define QTFRAME_H
+
+#include <jni.h>
+#include <QWidget>
+
+QWidget *frameChildWidget( JNIEnv *env, jobject component );
+QWidget *scrollPaneChildWidget( JNIEnv *env, jobject component);
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/eventmethods.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/eventmethods.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/eventmethods.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/eventmethods.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,245 @@
+/* eventmethods.cpp --
+   Copyright (C)  2005, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifdef I_KNOW_WHAT_IM_DOING
+
+bool draw;
+  
+private:
+  JavaVM* vm;
+  jobject target;
+  jclass componentCls;
+
+  void setup(JNIEnv *env, jobject obj)
+  {
+    env->GetJavaVM(&vm);
+    componentCls = NULL;
+    target = env->NewGlobalRef(obj);
+    componentCls = (jclass)env->NewGlobalRef(env->GetObjectClass( target ));
+    setMouseTracking( true );
+    draw = true;
+  }
+
+  void destroy()
+  {
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    env->DeleteGlobalRef(target);
+    env->DeleteGlobalRef(componentCls);
+  }
+
+  void callVoidMethod(const char *methodName)
+  {
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    jmethodID fireEventID = env->GetMethodID( componentCls,
+					      methodName,
+					      "()V" );
+    env->CallVoidMethod( target, fireEventID );
+  }
+
+  void callMouseMethod(const char *methodName,
+		       int modifiers, int x, int y, int clickCount)
+  {
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    jmethodID fireEventID = env->GetMethodID( componentCls,
+					      methodName,
+					      "(IIII)V" );
+    env->CallVoidMethod( target, fireEventID, modifiers, x, y, clickCount );
+  }
+
+protected:
+
+  void closeEvent( QCloseEvent *e )
+  {
+    PARENT::closeEvent(e);
+    callVoidMethod("closeEvent");
+  }
+  
+  void focusInEvent( QFocusEvent *e )
+  {
+    PARENT::focusInEvent(e);
+    callVoidMethod("focusInEvent");
+  }
+
+  void focusOutEvent( QFocusEvent *e )
+  {
+    PARENT::focusOutEvent(e);
+    callVoidMethod("focusOutEvent");
+  }
+
+  void enterEvent( QEvent *e )
+  {
+    PARENT::enterEvent(e);
+    QPoint p = mapFromGlobal( QCursor::pos() );
+    int modifiers = getKeyModifiers( QApplication::keyboardModifiers() );
+    callMouseMethod("enterEvent", modifiers, p.x(), p.y(), 0);
+  }
+
+  void keyPressEvent( QKeyEvent *e )
+  {
+    PARENT::keyPressEvent(e);
+    int modifiers, x, y;
+    modifiers = getKeyModifiers(e->modifiers());
+    x = mapKeyCode(e);
+    y = getUnicode(e);
+    callMouseMethod("keyPressEvent", modifiers, x, y, 0);
+  }
+
+  void keyReleaseEvent( QKeyEvent *e )
+  {
+    PARENT::keyReleaseEvent(e);
+    int modifiers, x, y;
+    modifiers = getKeyModifiers(e->modifiers());
+    x = mapKeyCode(e);
+    y = getUnicode(e);
+    callMouseMethod("keyReleaseEvent", modifiers, x, y, 0);
+  }
+
+  void leaveEvent( QEvent *e )
+  {
+    PARENT::leaveEvent(e);
+    QPoint p = mapFromGlobal( QCursor::pos() );
+    int modifiers = getKeyModifiers( QApplication::keyboardModifiers() );
+    callMouseMethod("leaveEvent", modifiers, p.x(), p.y(), 0);
+  }
+
+  void mouseDoubleClickEvent( QMouseEvent *e )
+  {
+    PARENT::mouseDoubleClickEvent(e);
+    int modifiers, x, y, clickCount;
+    clickCount = 2;
+    modifiers = getMouseModifiers(e);
+    x = e->x();
+    y = e->y();
+    callMouseMethod("mouseDoubleClickEvent", modifiers, x, y, clickCount);
+  }
+
+  void mouseMoveEvent( QMouseEvent *e )
+  {
+    PARENT::mouseMoveEvent(e);
+    int modifiers, x, y, clickCount;
+    clickCount = 0;
+    modifiers = getMouseModifiers(e);
+    x = e->x();
+    y = e->y();
+    callMouseMethod("mouseMoveEvent", modifiers, x, y, clickCount);
+  }
+
+  void mousePressEvent( QMouseEvent *e )
+  {
+    PARENT::mousePressEvent(e);
+    int modifiers, x, y, clickCount;
+    clickCount = 0;
+    modifiers = getMouseModifiers(e);
+    x = e->x();
+    y = e->y();
+    callMouseMethod("mousePressEvent", modifiers, x, y, clickCount);
+  }
+
+  void mouseReleaseEvent( QMouseEvent *e )
+  {
+    PARENT::mouseReleaseEvent(e);
+    int modifiers, x, y, clickCount;
+    modifiers = 0;
+
+    modifiers |= getReleaseModifiers( e );
+    x = e->x();
+    y = e->y();
+    callMouseMethod("mouseReleaseEvent", modifiers, x, y, 0);
+  }
+
+  void moveEvent( QMoveEvent *e )
+  {
+    PARENT::moveEvent(e);
+    callMouseMethod("moveEvent", e->pos().x(), e->pos().y(),
+		    e->oldPos().x(), e->oldPos().y());
+  }
+
+  void resizeEvent( QResizeEvent *e )
+  {
+    PARENT::resizeEvent(e);
+    callMouseMethod("resizeEvent", 
+		    e->oldSize().width(), e->oldSize().height(),
+		    e->size().width(), e->size().height());
+  }
+
+  void hideEvent( QHideEvent *e )
+  {
+    PARENT::hideEvent(e);
+    callVoidMethod("hideEvent");
+  }
+
+  void showEvent( QShowEvent *e )
+  {
+    PARENT::showEvent(e);
+    callVoidMethod("showEvent");
+  }
+
+  void paintEvent ( QPaintEvent * e )
+  {
+    PARENT::paintEvent( e );
+    if ( draw )
+      {
+	// Create a QPainter
+	GraphicsPainter painter( this );
+	int x, y, w, h;
+	e->rect().getRect ( &x, &y, &w, &h );
+
+	// Get the environment.
+	JNIEnv *env;
+	vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+
+	// create a QtGraphics wrapper for the QPainter
+	jclass cls = env->FindClass( "gnu/java/awt/peer/qt/QtComponentGraphics" );
+	jmethodID mid = env->GetMethodID(cls, "<init>", "(JLgnu/java/awt/peer/qt/QtComponentPeer;IIII)V");
+	jobject graphics = env->NewObject(cls, mid, (jlong)&painter, target,
+					  (jint)x, (jint)y, (jint)w, (jint)h);
+
+	// call QtComponentPeer.paintEvent()
+	jmethodID paintEventID = env->GetMethodID( componentCls,
+						   "paint",
+						   "(Ljava/awt/Graphics;)V" );
+	env->CallVoidMethod( target, paintEventID, graphics );
+	env->DeleteLocalRef( cls );
+	env->DeleteLocalRef( graphics );
+	painter.end();
+      }
+  }
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/keybindings.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/keybindings.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/keybindings.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/keybindings.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,600 @@
+/* keybindings.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "keybindings.h"
+
+/* InputEvent key modifiers */
+#define SHIFT_MASK 1
+#define CTRL_MASK 2
+#define META_MASK 4
+#define ALT_MASK 8
+#define ALT_GRAPH_MASK 0x20
+#define BUTTON1_MASK 0x10
+#define BUTTON2_MASK 8
+#define BUTTON3_MASK 4
+
+#define SHIFT_DOWN_MASK 0x0040
+#define CTRL_DOWN_MASK 0x0080
+#define META_DOWN_MASK 0x0100
+#define ALT_DOWN_MASK 0x0200
+#define BUTTON1_DOWN_MASK  0x0400
+#define BUTTON2_DOWN_MASK  0x0800
+#define BUTTON3_DOWN_MASK  0x1000
+#define ALT_GRAPH_DOWN_MASK  0x2000
+
+/* Virtual Keys */
+/* This list should be kept in the same order as the VK_ field
+   declarations in KeyEvent.java. */
+#define VK_ENTER '\n'
+#define VK_BACK_SPACE '\b'
+#define VK_TAB '\t'
+#define VK_CANCEL 3
+#define VK_CLEAR 12
+#define VK_SHIFT 16
+#define VK_CONTROL 17
+#define VK_ALT 18
+#define VK_PAUSE 19
+#define VK_CAPS_LOCK 20
+#define VK_ESCAPE 27
+#define VK_SPACE ' '
+#define VK_PAGE_UP 33
+#define VK_PAGE_DOWN 34
+#define VK_END 35
+#define VK_HOME 36
+#define VK_LEFT 37
+#define VK_UP 38
+#define VK_RIGHT 39
+#define VK_DOWN 40
+#define VK_COMMA ','
+#define VK_MINUS '-'
+#define VK_PERIOD '.'
+#define VK_SLASH '/'
+#define VK_0 '0'
+#define VK_1 '1'
+#define VK_2 '2'
+#define VK_3 '3'
+#define VK_4 '4'
+#define VK_5 '5'
+#define VK_6 '6'
+#define VK_7 '7'
+#define VK_8 '8'
+#define VK_9 '9'
+#define VK_SEMICOLON ';'
+#define VK_EQUALS '='
+#define VK_A 'A'
+#define VK_B 'B'
+#define VK_C 'C'
+#define VK_D 'D'
+#define VK_E 'E'
+#define VK_F 'F'
+#define VK_G 'G'
+#define VK_H 'H'
+#define VK_I 'I'
+#define VK_J 'J'
+#define VK_K 'K'
+#define VK_L 'L'
+#define VK_M 'M'
+#define VK_N 'N'
+#define VK_O 'O'
+#define VK_P 'P'
+#define VK_Q 'Q'
+#define VK_R 'R'
+#define VK_S 'S'
+#define VK_T 'T'
+#define VK_U 'U'
+#define VK_V 'V'
+#define VK_W 'W'
+#define VK_X 'X'
+#define VK_Y 'Y'
+#define VK_Z 'Z'
+#define VK_OPEN_BRACKET '['
+#define VK_BACK_SLASH '\\'
+#define VK_CLOSE_BRACKET ']'
+#define VK_NUMPAD0 96
+#define VK_NUMPAD1 97
+#define VK_NUMPAD2 98
+#define VK_NUMPAD3 99
+#define VK_NUMPAD4 100
+#define VK_NUMPAD5 101
+#define VK_NUMPAD6 102
+#define VK_NUMPAD7 103
+#define VK_NUMPAD8 104
+#define VK_NUMPAD9 105
+#define VK_MULTIPLY 106
+#define VK_ADD 107
+#define VK_SEPARATER 108
+#define VK_SEPARATOR 108
+#define VK_SUBTRACT 109
+#define VK_DECIMAL 110
+#define VK_DIVIDE 111
+#define VK_DELETE 127
+#define VK_NUM_LOCK 144
+#define VK_SCROLL_LOCK 145
+#define VK_F1 112
+#define VK_F2 113
+#define VK_F3 114
+#define VK_F4 115
+#define VK_F5 116
+#define VK_F6 117
+#define VK_F7 118
+#define VK_F8 119
+#define VK_F9 120
+#define VK_F10 121
+#define VK_F11 122
+#define VK_F12 123
+#define VK_F13 61440
+#define VK_F14 61441
+#define VK_F15 61442
+#define VK_F16 61443
+#define VK_F17 61444
+#define VK_F18 61445
+#define VK_F19 61446
+#define VK_F20 61447
+#define VK_F21 61448
+#define VK_F22 61449
+#define VK_F23 61450
+#define VK_F24 61451
+#define VK_PRINTSCREEN 154
+#define VK_INSERT 155
+#define VK_HELP 156
+#define VK_META 157
+#define VK_BACK_QUOTE 192
+#define VK_QUOTE 222
+#define VK_KP_UP 224
+#define VK_KP_DOWN 225
+#define VK_KP_LEFT 226
+#define VK_KP_RIGHT 227
+#define VK_DEAD_GRAVE 128
+#define VK_DEAD_ACUTE 129
+#define VK_DEAD_CIRCUMFLEX 130
+#define VK_DEAD_TILDE 131
+#define VK_DEAD_MACRON 132
+#define VK_DEAD_BREVE 133
+#define VK_DEAD_ABOVEDOT 134
+#define VK_DEAD_DIAERESIS 135
+#define VK_DEAD_ABOVERING 136
+#define VK_DEAD_DOUBLEACUTE 137
+#define VK_DEAD_CARON 138
+#define VK_DEAD_CEDILLA 139
+#define VK_DEAD_OGONEK 140
+#define VK_DEAD_IOTA 141
+#define VK_DEAD_VOICED_SOUND 142
+#define VK_DEAD_SEMIVOICED_SOUND 143
+#define VK_AMPERSAND 150
+#define VK_ASTERISK 151
+#define VK_QUOTEDBL 152
+#define VK_LESS 153
+#define VK_GREATER 160
+#define VK_BRACELEFT 161
+#define VK_BRACERIGHT 162
+#define VK_AT 512
+#define VK_COLON 513
+#define VK_CIRCUMFLEX 514
+#define VK_DOLLAR 515
+#define VK_EURO_SIGN 516
+#define VK_EXCLAMATION_MARK 517
+#define VK_INVERTED_EXCLAMATION_MARK 518
+#define VK_LEFT_PARENTHESIS 519
+#define VK_NUMBER_SIGN 520
+#define VK_PLUS 521
+#define VK_RIGHT_PARENTHESIS 522
+#define VK_UNDERSCORE 523
+#define VK_FINAL 24
+#define VK_CONVERT 28
+#define VK_NONCONVERT 29
+#define VK_ACCEPT 30
+#define VK_MODECHANGE 31
+#define VK_KANA 21
+#define VK_KANJI 25
+#define VK_ALPHANUMERIC 240
+#define VK_KATAKANA 241
+#define VK_HIRAGANA 242
+#define VK_FULL_WIDTH 243
+#define VK_HALF_WIDTH 244
+#define VK_ROMAN_CHARACTERS 245
+#define VK_ALL_CANDIDATES 256
+#define VK_PREVIOUS_CANDIDATE 257
+#define VK_CODE_INPUT 258
+#define VK_JAPANESE_KATAKANA 259
+#define VK_JAPANESE_HIRAGANA 260
+#define VK_JAPANESE_ROMAN 261
+#define VK_KANA_LOCK 262
+#define VK_INPUT_METHOD_ON_OFF 263
+#define VK_CUT 65489
+#define VK_COPY 65485
+#define VK_PASTE 65487
+#define VK_UNDO 65483
+#define VK_AGAIN 65481
+#define VK_FIND 65488
+#define VK_PROPS 65482
+#define VK_STOP 65480
+#define VK_COMPOSE 65312
+#define VK_ALT_GRAPH 65406
+#define VK_UNDEFINED 0
+
+
+int mapKeyCode(QKeyEvent *key)
+{
+  switch(key->key())
+    {
+    case Qt::Key_Escape:
+      return VK_ESCAPE;
+    case Qt::Key_Tab:
+      return VK_TAB;
+    case Qt::Key_Backspace:
+      return VK_BACK_SPACE;
+    case Qt::Key_Return:
+    case Qt::Key_Enter:
+      return VK_ENTER;
+    case Qt::Key_Insert:
+      return VK_INSERT;
+    case Qt::Key_Delete:
+      return VK_DELETE;
+    case Qt::Key_Pause:
+      return VK_PAUSE;
+    case Qt::Key_Print:
+    case Qt::Key_SysReq:
+      return VK_PRINTSCREEN;
+    case Qt::Key_Home:
+      return VK_HOME;
+    case Qt::Key_End:
+      return VK_END;
+    case Qt::Key_Left:
+      return VK_LEFT;
+    case Qt::Key_Up:
+      return VK_UP;
+    case Qt::Key_Right:
+      return VK_RIGHT;
+    case Qt::Key_Down:
+      return VK_DOWN;
+    case Qt::Key_PageUp:
+      return VK_PAGE_UP;
+    case Qt::Key_PageDown:
+      return VK_PAGE_DOWN;
+    case Qt::Key_Shift:
+      return VK_SHIFT;
+    case Qt::Key_Control:
+      return VK_CONTROL;
+    case Qt::Key_Meta:
+      return VK_META;
+    case Qt::Key_Alt:
+      return VK_ALT;
+    case Qt::Key_CapsLock:
+      return VK_CAPS_LOCK;
+    case Qt::Key_NumLock:
+      return VK_NUM_LOCK;
+    case Qt::Key_ScrollLock:
+      return VK_SCROLL_LOCK;
+    case Qt::Key_Clear:
+      return VK_CLEAR;
+    case Qt::Key_F1:
+      return VK_F1;
+    case Qt::Key_F2:
+      return VK_F2;
+    case Qt::Key_F3:
+      return VK_F3;
+    case Qt::Key_F4:
+      return VK_F4;
+    case Qt::Key_F5:
+      return VK_F5;
+    case Qt::Key_F6:
+      return VK_F6;
+    case Qt::Key_F7:
+      return VK_F7;
+    case Qt::Key_F8:
+      return VK_F8;
+    case Qt::Key_F9:
+      return VK_F9;
+    case Qt::Key_F10:
+      return VK_F10;
+    case Qt::Key_F11:
+      return VK_F11;
+    case Qt::Key_F12:
+      return VK_F12;
+    case Qt::Key_F13:
+      return VK_F13;
+    case Qt::Key_F14:
+      return VK_F14;
+    case Qt::Key_F15:
+      return VK_F15;
+    case Qt::Key_F16:
+      return VK_F16;
+    case Qt::Key_F17:
+      return VK_F17;
+    case Qt::Key_F18:
+      return VK_F18;
+    case Qt::Key_F19:
+      return VK_F19;
+    case Qt::Key_F20:
+      return VK_F20;
+    case Qt::Key_F21:
+      return VK_F21;
+    case Qt::Key_F22:
+      return VK_F22;
+    case Qt::Key_F23:
+      return VK_F23;
+    case Qt::Key_F24:
+      return VK_F24;
+    case Qt::Key_Help:
+      return VK_HELP;
+
+    case Qt::Key_Space:
+      return VK_SPACE;
+
+    case Qt::Key_Exclam:
+      return VK_EXCLAMATION_MARK;
+    case Qt::Key_QuoteDbl:
+      return VK_QUOTEDBL;
+    case Qt::Key_NumberSign:
+      return VK_NUMBER_SIGN;
+
+    case Qt::Key_Dollar:
+      return VK_DOLLAR;
+
+
+    case Qt::Key_Ampersand:
+      return VK_AMPERSAND;
+
+    case Qt::Key_ParenLeft:
+      return VK_LEFT_PARENTHESIS;
+    case Qt::Key_ParenRight:
+      return VK_RIGHT_PARENTHESIS;
+    case Qt::Key_Asterisk:
+      return VK_ASTERISK;
+    case Qt::Key_Plus:
+      return VK_PLUS;
+    case Qt::Key_Comma:
+      return VK_COMMA;
+    case Qt::Key_Minus:
+      return VK_MINUS;
+    case Qt::Key_Period:
+      return VK_PERIOD;
+    case Qt::Key_Slash:
+      return VK_SLASH;
+
+    case Qt::Key_0:
+      return VK_0;
+    case Qt::Key_1:
+      return VK_1;
+    case Qt::Key_2:
+      return VK_2;
+    case Qt::Key_3:
+      return VK_3;
+    case Qt::Key_4:
+      return VK_4;
+    case Qt::Key_5:
+      return VK_5  ;
+    case Qt::Key_6:
+      return VK_6;
+    case Qt::Key_7:
+      return VK_7;
+    case Qt::Key_8:
+      return VK_8;
+    case Qt::Key_9:
+      return VK_9;
+
+    case Qt::Key_Colon:
+      return VK_COLON;
+    case Qt::Key_Semicolon:
+      return VK_SEMICOLON;
+    case Qt::Key_Less:
+      return VK_LESS;
+    case Qt::Key_Equal:
+      return VK_EQUALS;
+    case Qt::Key_Greater:
+      return VK_GREATER;
+    case Qt::Key_Question:
+    case Qt::Key_At:
+
+    case Qt::Key_A:
+      return VK_A;
+    case Qt::Key_B:
+      return VK_B;
+    case Qt::Key_C:
+      return VK_C;
+    case Qt::Key_D:
+      return VK_D;
+    case Qt::Key_E:
+      return VK_E;
+    case Qt::Key_F:
+      return VK_F;
+    case Qt::Key_G:
+      return VK_G;
+    case Qt::Key_H:
+      return VK_H;
+    case Qt::Key_I:
+      return VK_I;
+    case Qt::Key_J:
+      return VK_J;
+    case Qt::Key_K:
+      return VK_K;
+    case Qt::Key_L:
+      return VK_L;
+    case Qt::Key_M:
+      return VK_M;
+    case Qt::Key_N:
+      return VK_N;
+    case Qt::Key_O:
+      return VK_O;
+    case Qt::Key_P:
+      return VK_P;
+    case Qt::Key_Q:
+      return VK_Q;
+    case Qt::Key_R:
+      return VK_R;
+    case Qt::Key_S:
+      return VK_S;
+    case Qt::Key_T:
+      return VK_T;
+    case Qt::Key_U:
+      return VK_U;
+    case Qt::Key_V:
+      return VK_V;
+    case Qt::Key_W:
+      return VK_W;
+    case Qt::Key_X:
+      return VK_X;
+    case Qt::Key_Y:
+      return VK_Y;
+    case Qt::Key_Z:
+      return VK_Z;
+    case Qt::Key_division:
+      return VK_DIVIDE;
+    case Qt::Key_BracketLeft:
+      return VK_OPEN_BRACKET;
+    case Qt::Key_Backslash:
+      return VK_BACK_SLASH;
+    case Qt::Key_BracketRight:
+      return VK_CLOSE_BRACKET;
+    case Qt::Key_BraceLeft:
+      return VK_BRACELEFT;
+    case Qt::Key_BraceRight:
+      return VK_BRACERIGHT;
+    case Qt::Key_brokenbar:
+      return VK_SEPARATOR; // correct?
+
+    default:
+      return VK_UNDEFINED;
+    }
+}
+
+int getUnicode(QKeyEvent *key)
+{
+  QString s = key->text();
+  if(s.isEmpty())
+    return 0; // CHAR_UNDEFINED
+  QChar c = s.at(0);
+  return (int)c.unicode();
+}
+
+/**
+ * Returns the key modifiers in KeyEvent format 
+ */
+int getKeyModifiers(Qt::KeyboardModifiers state)
+{
+  int modifier = 0;
+  if( state & Qt::ShiftModifier )
+    modifier |= SHIFT_DOWN_MASK;
+  if( state & Qt::ControlModifier )
+    modifier |= CTRL_DOWN_MASK;
+  if( state & Qt::AltModifier )
+    modifier |= ALT_DOWN_MASK;
+  if( state & Qt::MetaModifier )
+    modifier |= META_DOWN_MASK;
+
+  return modifier;
+}
+
+/**
+ * Returns the key modifiers in ActionEvent format 
+ */
+int getAEKeyModifiers(Qt::KeyboardModifiers state)
+{
+  int modifier = 0;
+  if( state & Qt::ShiftModifier )
+    modifier |= SHIFT_MASK;
+  if( state & Qt::ControlModifier )
+    modifier |= CTRL_MASK;
+  if( state & Qt::AltModifier )
+    modifier |= ALT_MASK;
+  if( state & Qt::MetaModifier )
+    modifier |= META_MASK;
+
+  return modifier;
+}
+
+/**
+ * Returns the mouse modifiers in InputEvent format 
+ */
+int getMouseModifiers(QMouseEvent *e)
+{
+  int modifier = 0;
+  int buttons = e->buttons();
+  int state = e->modifiers();
+
+  if( buttons & Qt::LeftButton )
+    modifier |= BUTTON1_DOWN_MASK;
+  if( buttons & Qt::MidButton )
+    modifier |= BUTTON2_DOWN_MASK;
+  if( buttons & Qt::RightButton )
+    modifier |= BUTTON3_DOWN_MASK;
+
+  if( state & Qt::ShiftModifier )
+    modifier |= SHIFT_DOWN_MASK;
+  if( state & Qt::ControlModifier )
+    modifier |= CTRL_DOWN_MASK;
+  if( state & Qt::AltModifier )
+    modifier |= ALT_DOWN_MASK;
+  if( state & Qt::MetaModifier )
+    modifier |= META_DOWN_MASK;
+
+  // FIXME: Alt Gr?
+  return modifier;
+}
+
+/**
+ * Returns the mouse modifiers in InputEvent format 
+ * We need a different method here because e->buttons() doesn't work for,
+ * mouseReleased events. (But strangely enough it does for pressed ones)
+ */
+int getReleaseModifiers(QMouseEvent *e)
+{
+  int modifier = 0;
+  int button = e->button();
+  int state = e->modifiers();
+
+  if( button & Qt::LeftButton )
+    modifier |= BUTTON1_DOWN_MASK;
+  if( button & Qt::MidButton )
+    modifier |= BUTTON2_DOWN_MASK;
+  if( button & Qt::RightButton )
+    modifier |= BUTTON3_DOWN_MASK;
+
+  if( state & Qt::ShiftModifier )
+    modifier |= SHIFT_DOWN_MASK;
+  if( state & Qt::ControlModifier )
+    modifier |= CTRL_DOWN_MASK;
+  if( state & Qt::AltModifier )
+    modifier |= ALT_DOWN_MASK;
+  if( state & Qt::MetaModifier )
+    modifier |= META_DOWN_MASK;
+
+  // FIXME: Alt Gr?
+  return modifier;
+}
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/keybindings.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/keybindings.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/keybindings.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/keybindings.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,20 @@
+#ifndef KEYBINDINGS_H
+#define KEYBINDINGS_H
+
+#include <QApplication>
+#include <QKeyEvent>
+#include <QMouseEvent>
+#include <QPainter>
+#include <QPoint>
+#include <qwidget.h>
+#include <qstring.h>
+#include "qtgraphics.h"
+
+int mapKeyCode(QKeyEvent *key);
+int getUnicode(QKeyEvent *key);
+int getKeyModifiers(Qt::KeyboardModifiers state);
+int getAEKeyModifiers(Qt::KeyboardModifiers state);
+int getMouseModifiers(QMouseEvent *event);
+int getReleaseModifiers(QMouseEvent *e);
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainqtthread.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainqtthread.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainqtthread.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainqtthread.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,104 @@
+/* mainqtthread.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <jni.h>
+#include <QApplication>
+#include <QThread>
+#include <gnu_java_awt_peer_qt_MainQtThread.h>
+#include "mainthreadinterface.h"
+
+MainThreadInterface *mainThread;
+QApplication *qApplication;
+
+
+/**
+ * Starts up a QApplication
+ */
+JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_qt_MainQtThread_init
+(JNIEnv *env, jobject obj, jstring theme, jboolean doublebuffer)
+{
+  int *argc;
+  char **argv;
+
+  if(theme != NULL)
+    {
+      argc = (int*)malloc(sizeof(int));
+      *argc = 3;
+      argv = (char **)malloc( 3 * sizeof(char *) );
+      argv[0] = (char *)malloc(10 * sizeof(char));
+      argv[1] = (char *)malloc(10 * sizeof(char));
+      argv[2] = (char *)malloc(100 * sizeof(char));
+      strncpy(argv[0], "\0", 2);
+      strncpy(argv[1], "-style\0", 8);
+      strncpy(argv[2], (char *)env->GetStringUTFChars( theme, NULL ), 100);
+    } 
+   else
+    {
+      argc = (int*)malloc(sizeof(int));
+      *argc = 1;
+      argv = (char **)malloc( 3 * sizeof(char *) );
+      argv[0] = (char *)malloc(10 * sizeof(char));
+      strncpy(argv[0], " \0", 3);
+    }
+  QApplication *qtApp = new QApplication( *argc, argv );
+  assert( qtApp );
+
+  qApplication = qtApp;
+
+  if( theme != NULL)
+    env->ReleaseStringUTFChars( theme, argv[1] );
+
+  mainThread = new MainThreadInterface( qtApp );
+
+  jclass cls = env->GetObjectClass(obj);
+  jfieldID nofid = env->GetFieldID( cls, "mainThreadInterface", "J" );
+  env->SetLongField( obj, nofid, (jlong)mainThread );
+
+  return (jlong)qtApp;
+}
+
+/*
+ * Calls QApplication::exec()
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_MainQtThread_exec
+(JNIEnv *env, jobject obj, jlong ptr)
+{
+  QApplication *app = (QApplication *)ptr;
+  if(app)
+    app->exec();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainthreadinterface.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainthreadinterface.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainthreadinterface.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainthreadinterface.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,69 @@
+/* mainthreadinterface.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <QWidget>
+#include <QThread>
+#include "mainthreadinterface.h"
+
+MainThreadInterface::MainThreadInterface(QApplication *parent) : QObject( parent )
+{
+  mainApp = parent;
+}
+
+/**
+ * This is called from the main Qt event loop, and delegates the work to
+ * the AWTEvent runEvent method.
+ */
+bool MainThreadInterface::event ( QEvent * e )
+{
+  QObject::event( e );
+  if( e->type() == QEvent::User)
+    {
+      AWTEvent *fe = (AWTEvent *)e;
+      fe->runEvent();
+    }
+  return true;
+}
+
+/**
+ * Posts the event to the main Qt event loop for execution.
+ */
+void MainThreadInterface::postEventToMain(AWTEvent *event)
+{ 
+  mainApp->postEvent(this, event);
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainthreadinterface.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainthreadinterface.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainthreadinterface.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/mainthreadinterface.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,36 @@
+#ifndef MAINTHREADINTERFACE_H
+#define MAINTHREADINTERFACE_H
+
+#include <jni.h>
+#include <QApplication>
+#include <QObject>
+#include <QWidget>
+#include <QEvent>
+
+class AWTEvent : public QEvent {
+  
+ public:
+  AWTEvent() : QEvent( QEvent::User )
+    {
+    }
+
+    virtual void runEvent()
+    {
+    }
+
+};
+
+class MainThreadInterface : public QObject {
+  
+ private:
+  QApplication *mainApp;
+
+ public:
+  MainThreadInterface(QApplication *parent);
+  bool event ( QEvent * e );
+  void postEventToMain(AWTEvent *event);
+};
+
+extern MainThreadInterface *mainThread;
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/nativewrapper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/nativewrapper.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/nativewrapper.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/nativewrapper.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,64 @@
+/* nativewrapper.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "nativewrapper.h"
+
+#define WRAPPER_CLASS "gnu/java/awt/peer/qt/NativeWrapper"
+
+/*
+ * Sets the native object field.
+ */
+void setNativeObject( JNIEnv *env, jobject qtcomponent, void *ptr )
+{   
+  jclass cls = env->GetObjectClass( qtcomponent );
+  jlong value = (jlong) ptr; 
+  jfieldID nofid = env->GetFieldID( cls, "nativeObject", "J" );
+  env->SetLongField( qtcomponent, nofid, value );
+  env->DeleteLocalRef( cls );
+}
+
+/**
+ * Gets the native object field.
+ */
+void *getNativeObject( JNIEnv *env, jobject qtcomponent )
+{
+  jclass cls = env->GetObjectClass( qtcomponent );
+  jfieldID nofid = env->GetFieldID( cls, "nativeObject", "J" );
+  jlong value = env->GetLongField( qtcomponent, nofid );
+  env->DeleteLocalRef( cls );
+  return (void *) value;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/nativewrapper.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/nativewrapper.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/nativewrapper.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/nativewrapper.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,10 @@
+#ifndef NATIVEWRAPPER_H
+#define NATIVEWRAPPER_H
+
+#include <jni.h>
+
+void *getNativeObject( JNIEnv *env, jobject qtcomponent );
+
+void setNativeObject( JNIEnv *env, jobject qtcomponent, void *ptr );
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qmatrix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qmatrix.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qmatrix.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qmatrix.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,96 @@
+/* qmatrix.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QMatrix>
+#include <gnu_java_awt_peer_qt_QMatrix.h>
+#include "nativewrapper.h"
+
+/*
+ * Creates a QMatrix
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QMatrix_init
+(JNIEnv *env, jobject obj, jdouble m00, jdouble m10, jdouble m01, jdouble m11, 
+ jdouble m02, jdouble m12 )
+{
+  QMatrix *matrix = new QMatrix( (qreal) m00, (qreal) m10, 
+				 (qreal) m01, (qreal) m11, 
+				 (qreal) m02, (qreal) m12 );
+  assert( matrix );
+  setNativeObject(env, obj, matrix);
+}
+
+/*
+ * Returns the matrix a java array of doubles, 
+ * in m00, m10, m01, m11, m02, m12 (java notation) format.
+ * Note that qt has different notations for the array elements.
+ */
+JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_qt_QMatrix_getMatrix
+(JNIEnv *env, jobject obj)
+{
+  QMatrix *matrix = (QMatrix *)getNativeObject(env, obj);
+  assert( matrix );
+
+  jdoubleArray result_array;
+  jdouble *dst;
+
+  result_array = env->NewDoubleArray( 6 );
+  dst = env->GetDoubleArrayElements(result_array, NULL);
+  
+  dst[0] = (jdouble)matrix->m11(); // qt m11 = java m00
+  dst[1] = (jdouble)matrix->m12(); // qt m12 = java m10
+  dst[2] = (jdouble)matrix->m21(); // qt m21 = java m01
+  dst[3] = (jdouble)matrix->m22(); // qt m22 = java m11
+  dst[4] = (jdouble)matrix->dx();  // qt dx  = java m02
+  dst[5] = (jdouble)matrix->dy();  // qt dy  = java m12
+
+  env->ReleaseDoubleArrayElements (result_array, dst, 0);
+  return result_array;
+}
+
+/*
+ * Dispose of the thing.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QMatrix_dispose
+(JNIEnv *env, jobject obj)
+{
+  QMatrix *matrix = (QMatrix *)getNativeObject(env, obj);
+  if( matrix )
+    delete matrix;
+  setNativeObject(env, obj, NULL);
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qpainterpath.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qpainterpath.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qpainterpath.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qpainterpath.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,239 @@
+/* qpainterpath.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QPainterPath>
+#include <gnu_java_awt_peer_qt_QPainterPath.h>
+#include "nativewrapper.h"
+
+// java.awt.geom.PathIterator constants.
+#define WIND_EVEN_ODD 0
+#define WIND_NON_ZERO 1
+
+
+/*
+ * Creates an empty QPainterPath.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QPainterPath_init
+(JNIEnv *env, jobject obj, jint windingRule)
+{
+  QPainterPath *path = new QPainterPath();
+  assert( path );
+  path->setFillRule( (windingRule == WIND_EVEN_ODD) ? 
+		     Qt::OddEvenFill : Qt::WindingFill );
+  setNativeObject(env, obj, path);
+}
+
+/*
+ * MoveTo
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QPainterPath_moveTo
+(JNIEnv *env, jobject obj, jdouble x, jdouble y)
+{
+  QPainterPath *path = (QPainterPath *)getNativeObject(env, obj);
+  assert( path );
+  path->moveTo( (qreal)x, (qreal)y );
+}
+
+/*
+ * Closes the subpath.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QPainterPath_close
+(JNIEnv *env, jobject obj)
+{
+  QPainterPath *path = (QPainterPath *)getNativeObject(env, obj);
+  assert( path );
+  path->closeSubpath();
+}
+
+/*
+ * LineTo
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QPainterPath_lineTo
+(JNIEnv *env, jobject obj, jdouble x, jdouble y)
+{
+  QPainterPath *path = (QPainterPath *)getNativeObject(env, obj);
+  assert( path );
+  path->lineTo( (qreal)x, (qreal)y );
+}
+
+/*
+ * QuadraticTo
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QPainterPath_quadTo
+(JNIEnv *env, jobject obj, jdouble x, jdouble y, jdouble x2, jdouble y2)
+{
+  QPainterPath *path = (QPainterPath *)getNativeObject(env, obj);
+  assert( path );
+  path->quadTo( (qreal)x, (qreal)y, (qreal)x2, (qreal)y2 );
+}
+
+/*
+ * CubicTo
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QPainterPath_cubicTo
+(JNIEnv *env, jobject obj, jdouble x, jdouble y, jdouble x2, jdouble y2, 
+ jdouble x3, jdouble y3)
+{
+  QPainterPath *path = (QPainterPath *)getNativeObject(env, obj);
+  assert( path );
+  path->cubicTo( (qreal)x, (qreal)y, 
+		 (qreal)x2, (qreal)y2,
+		 (qreal)x3, (qreal)y3 );
+}
+
+/*
+ * Delete the native object
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QPainterPath_dispose
+  (JNIEnv *env, jobject obj)
+{
+  QPainterPath *path = (QPainterPath *)getNativeObject(env, obj);
+  if ( path )
+    delete path;
+}
+
+/********* GeneralPath functions *****************************/
+
+// FIXME : Cache method ids.
+
+static void gp_moveTo( JNIEnv *env,
+		       jobject gp,
+		       jclass cls,
+		       double x1,
+		       double y1 )
+{
+  jmethodID method;
+  jvalue values[2];
+
+  values[0].f = (jfloat) x1;
+  values[1].f = (jfloat) y1;
+
+  method = env->GetMethodID(cls, "moveTo", "(FF)V");
+  env->CallVoidMethodA( gp, method, values );
+}
+
+static void gp_lineTo( JNIEnv *env,
+		       jobject gp,
+		       jclass cls,
+		       double x1,
+		       double y1 )
+{
+  jmethodID method;
+  jvalue values[2];
+
+  values[0].f = (jfloat) x1;
+  values[1].f = (jfloat) y1;
+
+  method = env->GetMethodID(cls, "lineTo", "(FF)V");
+  env->CallVoidMethodA( gp, method, values );
+}
+
+static void gp_curveTo( JNIEnv *env,
+			jobject gp,
+			jclass cls,
+			double x1,
+			double y1,
+			double x2,
+			double y2,
+			double x3,
+			double y3 )
+{
+  jmethodID method;
+  jvalue values[6];
+
+  values[0].f = (jfloat) x1;
+  values[1].f = (jfloat) y1;
+  values[2].f = (jfloat) x2;
+  values[3].f = (jfloat) y2;
+  values[4].f = (jfloat) x3;
+  values[5].f = (jfloat) y3;
+
+  method = env->GetMethodID(cls, "curveTo", "(FFFFFF)V");
+  env->CallVoidMethodA( gp, method, values );
+}
+
+/**
+ * Returns the QPainterPath obj as a java.awt.geom.GeneralPath.
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QPainterPath_getPath
+(JNIEnv *env, jobject obj)
+{
+  jclass cls;
+  jmethodID method;
+  jobject gp;
+  QPainterPath::Element currElement;
+  int windingRule;
+
+  QPainterPath *path = new QPainterPath();
+  assert( path );
+
+  windingRule = (path->fillRule() == Qt::OddEvenFill) ? 
+    WIND_EVEN_ODD : WIND_NON_ZERO;
+
+  cls = env->FindClass("java/awt/geom/GeneralPath");
+  method = env->GetMethodID(cls, "<init>", "(I)V");
+  gp = env->NewObject(cls, method, windingRule);
+  
+  for( int i = 0; i < path->elementCount(); i++)
+    {
+      currElement = path->elementAt( i );
+      switch(currElement.type)
+	{
+	case QPainterPath::MoveToElement:
+	  gp_moveTo(env, gp, cls, currElement.x, currElement.y);
+	  break;
+	case QPainterPath::LineToElement:
+	  gp_lineTo(env, gp, cls, currElement.x, currElement.y);
+	  break;
+	case QPainterPath::CurveToElement:
+	  if( i + 2 >= path->elementCount() )
+	    break;
+	  if(path->elementAt(i + 1).type != QPainterPath::CurveToDataElement ||
+	     path->elementAt(i + 2).type != QPainterPath::CurveToDataElement)
+	    break;
+	  gp_curveTo(env, gp, cls, currElement.x, currElement.y,
+		     path->elementAt(i + 1).x, path->elementAt(i + 1).y, 
+		     path->elementAt(i + 2).x, path->elementAt(i + 2).y );
+	  i += 2;
+	  break;
+	}
+    }
+  env->DeleteLocalRef( cls );
+  return gp;
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qpen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qpen.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qpen.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qpen.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,108 @@
+/* qpen.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QColor>
+#include <QPen>
+#include <gnu_java_awt_peer_qt_QPen.h>
+#include "nativewrapper.h"
+
+/*
+ * java.awt.geom.BasicStroke constants.
+ */
+#define JOIN_MITER 0
+#define JOIN_ROUND 1
+#define JOIN_BEVEL 2
+#define CAP_BUTT   0
+#define CAP_ROUND  1
+#define CAP_SQUARE 2
+
+/**
+ * Create a QPen object
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QPen_init
+(JNIEnv *env, jobject obj , jdouble width, jint cap, jint join, jdouble miterlimit)
+{
+  Qt::PenCapStyle qtCap;
+  Qt::PenJoinStyle qtJoin;
+
+  switch(cap)
+    {
+    case CAP_BUTT:
+      qtCap = Qt::FlatCap;
+      break;
+    case CAP_ROUND:
+      qtCap = Qt::RoundCap;
+      break;
+    case CAP_SQUARE:
+      qtCap = Qt::SquareCap;
+      break;
+    }
+
+  switch(join)
+    {
+    case JOIN_MITER:
+      qtJoin = Qt::MiterJoin;
+      break;
+    case JOIN_ROUND:
+      qtJoin = Qt::RoundJoin;
+      break;
+    case JOIN_BEVEL:
+      qtJoin = Qt::BevelJoin;
+      break;
+    }
+
+  QPen *pen = new QPen();
+  assert( pen );
+  pen->setWidthF( (qreal)width );
+  pen->setCapStyle( qtCap );
+  pen->setJoinStyle( qtJoin );
+
+  setNativeObject(env, obj, pen);
+}
+
+/**
+ * Dispose of the QPen object
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QPen_dispose
+(JNIEnv *env, jobject obj)
+{
+  QPen *pen = (QPen *)getNativeObject(env, obj);
+  if ( pen )
+    delete pen;
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtaudioclip.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtaudioclip.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtaudioclip.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtaudioclip.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,114 @@
+/* qtaudioclip.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <jni.h>
+#include <assert.h>
+#include <QString>
+#include <QSound>
+#include <gnu_java_awt_peer_qt_QtAudioClip.h>
+#include "qtstrings.h"
+#include "nativewrapper.h"
+
+/*
+ * Loads an audio clip. Returns JNI_TRUE if the load succeded, 
+ * JNI_FALSE otherwise.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtAudioClip_loadClip
+(JNIEnv *env, jobject obj, jstring filename)
+{ 
+  QString *qStr = getQString(env, filename);
+
+  QSound *sound = new QSound( *qStr );
+
+  delete qStr;
+
+  setNativeObject( env, obj, sound );
+}
+
+/*
+ * Plays the audio clip, plays looped if loop equals JNI_TRUE.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtAudioClip_play
+(JNIEnv *env, jobject obj, jboolean loop)
+{
+  QSound *sound = (QSound *)getNativeObject(env, obj);
+  if( sound != NULL )
+    {
+      sound->setLoops( (loop == JNI_TRUE) ? -1 : 1 );
+      sound->play();
+    }
+}
+
+/*
+ * Stops the audio playback.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtAudioClip_stop
+(JNIEnv *env, jobject obj)
+{
+  QSound *sound = (QSound *)getNativeObject(env, obj);
+  if( sound != NULL )
+    sound->stop();
+}
+
+/**
+ * Disposes the audio clip
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtAudioClip_dispose
+(JNIEnv *env, jobject obj)
+{
+  QSound *sound = (QSound *)getNativeObject(env, obj);
+  if( sound != NULL )
+    {
+      setNativeObject( env, obj, NULL );
+      if( !sound->isFinished() )
+	sound->stop();
+      delete sound;
+   }
+}
+
+/**
+ * Returns whether sound is available.
+ */
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtAudioClip_isAvailable
+(JNIEnv *env, jobject obj)
+{
+  if( QSound::isAvailable() )
+    return JNI_TRUE;
+  else
+    return JNI_FALSE;
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtbuttonpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtbuttonpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtbuttonpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtbuttonpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,94 @@
+/* qtbuttonpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QMainWindow>
+#include <QPushButton>
+#include <QFont>
+#include <gnu_java_awt_peer_qt_QtButtonPeer.h>
+#include "qtcomponent.h"
+#include "qtstrings.h"
+#include "keybindings.h"
+#include "buttonevent.h"
+#include "slotcallbacks.h"
+
+
+class MyButton : public QPushButton
+{
+public:
+  MyButton(JNIEnv *env, jobject obj, QWidget *parent) : QPushButton(parent)
+  {
+    setup(env, obj);
+  }
+
+  ~MyButton()
+  {
+    destroy();
+  }
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QPushButton
+#include "eventmethods.h"
+};
+
+/**
+ * Init method
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtButtonPeer_init
+(JNIEnv *env, jobject obj)
+{
+
+  QWidget *parentWidget = (QWidget *) getParentWidget( env, obj );
+  MyButton *button = new MyButton( env, obj, parentWidget );
+  assert( button );
+  setNativeObject( env, obj, button );
+  connectButton(button, env, obj); // connect the fireClick method.
+}
+
+/**
+ * Sets the button label.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtButtonPeer_setLabel
+(JNIEnv *env, jobject obj, jstring str)
+{
+  QPushButton *button = (QPushButton *) getNativeObject( env, obj );
+  assert( button );
+
+  QString *qStr = getQString(env, str); // AWTLabelEvent takes care of disposal.
+  mainThread->postEventToMain( new AWTLabelEvent( button, qStr ) );
+}
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcanvaspeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcanvaspeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcanvaspeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcanvaspeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,75 @@
+/* qtcanvaspeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QMainWindow>
+#include <QWidget>
+#include <gnu_java_awt_peer_qt_QtCanvasPeer.h>
+#include "qtcomponent.h"
+#include "keybindings.h"
+
+class MyCanvas : public QWidget
+{
+public:
+  MyCanvas(JNIEnv *env, jobject obj, QWidget *parent) : QWidget( parent )
+  {
+    setup(env, obj);
+  }
+
+  ~MyCanvas()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QWidget
+#include "eventmethods.h"
+};
+
+/*
+ * Construct a QWidget object
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtCanvasPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *)getParentWidget(env, obj);
+  //  QWidget *canvas = new QWidget( parentWidget );
+  QWidget *canvas = new MyCanvas( env, obj, parentWidget );
+  assert( canvas );
+
+  setNativeObject( env, obj, canvas );
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcheckboxpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcheckboxpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcheckboxpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcheckboxpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,164 @@
+/* qtcheckboxpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QAbstractButton>
+#include <QCheckBox>
+#include <QRadioButton>
+#include <gnu_java_awt_peer_qt_QtCheckboxPeer.h>
+#include "qtstrings.h"
+#include "qtcomponent.h"
+#include "keybindings.h"
+#include "buttonevent.h"
+#include "slotcallbacks.h"
+
+class CheckboxCheckEvent : public AWTEvent {
+  
+ private:
+  QAbstractButton *widget;
+  bool checked;
+
+ public:
+  CheckboxCheckEvent(QAbstractButton *w, bool c)
+  {
+    widget = w;
+    checked = c;
+  }
+  
+  void runEvent()
+  {    
+    if (checked != widget->isChecked())
+      widget->setChecked( checked );
+  }
+};
+
+class MyCheckBox : public QCheckBox
+{
+public:
+  MyCheckBox(JNIEnv *env, jobject obj, QWidget *parent) : QCheckBox( parent )
+  {
+    setup(env, obj);
+  }
+
+  ~MyCheckBox()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QCheckBox
+#include "eventmethods.h"
+};
+
+/**
+ * Determines whether the darn native object should be a radio button or not
+ */
+static bool isRadioButton( JNIEnv *env, jobject obj )
+{
+  jclass cls = env->FindClass( "gnu/java/awt/peer/qt/QtCheckboxPeer" );
+  jfieldID field = env->GetFieldID( cls, "group", "Ljava/awt/CheckboxGroup;" );
+  if (env->GetObjectField( obj, field ) != NULL)
+    return true;
+  return false;
+}
+
+/**
+ * Construct the native object.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtCheckboxPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *)getParentWidget(env, obj);
+
+  QAbstractButton *cb = (QAbstractButton *) getNativeObject( env, obj );
+  if (cb)
+    delete cb;
+
+  bool radioButton;
+  {
+    jclass cls = env->GetObjectClass( obj );
+    jfieldID field = env->GetFieldID( cls, "owner", "Ljava/awt/Component;" );
+    assert(field != NULL);
+    jobject owner = env->GetObjectField( obj, field );
+    assert(owner != NULL);
+    cls = env->GetObjectClass( owner );
+    jmethodID method = env->GetMethodID( cls,
+					 "getCheckboxGroup", 
+					 "()Ljava/awt/CheckboxGroup;" );
+    assert(method != NULL);
+    jobject group = env->CallObjectMethod( owner, method, 0);
+    radioButton = (group != NULL);
+  }
+
+  if(radioButton)
+    cb = new QRadioButton( parentWidget );
+  else
+    cb = new QCheckBox( parentWidget );
+  //    cb = new MyCheckBox( env, obj, parentWidget );
+  assert( cb );
+
+  connectToggle(cb, env, obj); // connect the native event.
+
+  setNativeObject( env, obj, cb );
+}
+
+/*
+ * Sets the checkbox label.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtCheckboxPeer_setLabel
+(JNIEnv *env, jobject obj, jstring label)
+{
+  /* Both QCheckbox and QRadioButton inherit QAbstractButton */
+  QAbstractButton *cb = (QAbstractButton *) getNativeObject( env, obj );
+  assert( cb );
+
+  QString *qStr = getQString(env, label); 
+  mainThread->postEventToMain( new AWTLabelEvent( cb, qStr ) );
+  // AWTLabelEvent takes care of disposal of qStr
+}
+
+/*
+ * Sets the checkbox state.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtCheckboxPeer_setState
+(JNIEnv *env, jobject obj, jboolean state)
+{
+  QAbstractButton *cb = (QAbstractButton *) getNativeObject( env, obj );
+  assert( cb );
+  mainThread->postEventToMain( new CheckboxCheckEvent( cb, (state == JNI_TRUE) ) );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtchoicepeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtchoicepeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtchoicepeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtchoicepeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,142 @@
+/* qtchoicepeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QComboBox>
+#include <gnu_java_awt_peer_qt_QtChoicePeer.h>
+#include "qtcomponent.h"
+#include "qtstrings.h"
+#include "mainthreadinterface.h"
+#include "slotcallbacks.h"
+
+class InsertEvent : public AWTEvent {
+  
+ private:
+  QComboBox *widget;
+  QString *string;
+  int index;
+  
+ public:
+  InsertEvent(QComboBox *w, QString *s, int i) : AWTEvent()
+  {
+    widget = w;
+    string = s;
+    index = i;
+  }
+
+  void runEvent()
+  {
+    widget->insertItem( index, *string );
+    delete string;
+  }
+};
+
+class RemoveSelectEvent : public AWTEvent {
+  
+ private:
+  QComboBox *widget;
+  int index;
+  bool remove;
+
+ public:
+  RemoveSelectEvent(QComboBox *w, int i, bool r) : AWTEvent()
+  {
+    widget = w;
+    index = i;
+    remove = r;
+  }
+
+  void runEvent()
+  {
+    if (remove)
+      widget->removeItem( index );
+    else
+      widget->setCurrentIndex( index );
+  }
+};
+
+/*
+ * Constructs tha QComboBox object
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtChoicePeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *)getParentWidget(env, obj);
+      
+  QComboBox *box = new QComboBox( parentWidget );
+  assert( box );
+
+  setNativeObject( env, obj, box );
+
+  connectChoice(box, env, obj); // connect the fireChoice method.
+}
+
+/*
+ * Inserts a choice box item at index.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtChoicePeer_add
+(JNIEnv *env, jobject obj, jstring itemLabel, jint index)
+{
+  QComboBox *box = (QComboBox *) getNativeObject( env, obj );
+  assert( box );
+
+  QString *qStr = getQString( env, itemLabel );
+  mainThread->postEventToMain( new InsertEvent( box, qStr, index ) );
+}
+
+/*
+ * Removes a choice box item at index.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtChoicePeer_remove
+(JNIEnv *env, jobject obj, jint index)
+{
+  QComboBox *box = (QComboBox *) getNativeObject( env, obj );
+  assert( box );
+  mainThread->postEventToMain( new RemoveSelectEvent( box, index, true ) );
+}
+
+/**
+ * Selects a choice box item.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtChoicePeer_select
+(JNIEnv *env, jobject obj, jint index)
+{
+  QComboBox *box = (QComboBox *) getNativeObject( env, obj );
+  assert( box );
+  mainThread->postEventToMain( new RemoveSelectEvent( box, index, false ) );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponent.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponent.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponent.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponent.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,122 @@
+/* qtcomponent.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <jni.h>
+#include <assert.h>
+#include <qmainwindow.h>
+#include <qwidget.h>
+#include "qtcomponent.h"
+#include "containers.h"
+
+#define COMPONENT_CLASS "gnu/java/awt/peer/qt/QtComponentPeer"
+
+/*
+ * Returns the parent widget for a QtComponentPeer
+ */
+void *getParentWidget( JNIEnv *env, jobject qtcomponentpeer )
+{
+  jclass componentCls = env->GetObjectClass( qtcomponentpeer );
+  jfieldID ownerField = env->GetFieldID( componentCls,
+					 "owner", "Ljava/awt/Component;" );
+  assert( ownerField );
+  jobject owner = env->GetObjectField( qtcomponentpeer, ownerField );
+  if (owner == NULL)
+    return NULL;
+
+  jclass ownerCls = env->GetObjectClass( owner );
+  jmethodID getParentMID = env->GetMethodID( ownerCls,
+					     "getParent", 
+					     "()Ljava/awt/Container;" );
+  assert(getParentMID);
+
+  jobject parent = env->CallObjectMethod( owner, getParentMID, 0);
+  assert(parent);
+
+  // Get the parents peer
+  jclass parentCls = env->GetObjectClass( parent );
+  {
+    jclass frameCls = env->FindClass( "java/awt/Frame" );
+    if(env->IsInstanceOf( parent, frameCls ) == JNI_TRUE)
+      return frameChildWidget( env, parent );
+  }
+  {
+    jclass scrollpaneCls = env->FindClass( "java/awt/ScrollPane" );
+    if(env->IsInstanceOf( parent, scrollpaneCls ) == JNI_TRUE)
+      return scrollPaneChildWidget( env, parent );
+  }
+
+  jmethodID getPeerMID = env->GetMethodID( parentCls,
+					   "getPeer",
+					   "()Ljava/awt/peer/ComponentPeer;" );
+  assert(getPeerMID);
+  return getNativeObject(env, env->CallObjectMethod( parent, getPeerMID, 0));
+}
+
+/*
+ * Creates a java.awt.Dimension object from a QSize.
+ */
+jobject makeDimension(JNIEnv *env, QSize *size)
+{
+  if( size == NULL )
+    return NULL;
+  if( size->isNull() || !size->isValid() )
+    return NULL;
+  jclass cls = env->FindClass("java/awt/Dimension");
+  jmethodID mid = env->GetMethodID(cls, "<init>", "(II)V");
+  jvalue values[2];
+  
+  values[0].i = (jint) size->width();
+  values[1].i = (jint) size->height();
+
+  return env->NewObjectA(cls, mid, values);
+}
+
+/*
+ * Creates a java.awt.Point object from a QPoint.
+ */
+jobject makePoint(JNIEnv *env, QPoint &p)
+{
+  jclass cls = env->FindClass("java/awt/Point");
+  jmethodID mid = env->GetMethodID(cls, "<init>", "(II)V");
+  jvalue values[2];
+  
+  values[0].i = (jint) p.x();
+  values[1].i = (jint) p.y();
+
+  return env->NewObjectA(cls, mid, values);
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponent.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponent.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponent.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponent.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,16 @@
+#ifndef QTCOMPONENT_H
+#define QTCOMPONENT_H
+
+#include <QSize>
+#include <QPoint>
+//#include <cassert.h>
+#include <jni.h>
+#include "nativewrapper.h"
+
+void *getParentWidget( JNIEnv *env, jobject qtcomponentpeer );
+
+jobject makeDimension(JNIEnv *env, QSize *size);
+
+jobject makePoint(JNIEnv *env, QPoint &p);
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponentpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponentpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponentpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtcomponentpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,384 @@
+/* qtcomponentpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QShowEvent>
+#include <QHideEvent>
+#include <QColor>
+#include <QCursor>
+#include <QWidget>
+#include <gnu_java_awt_peer_qt_QtComponentPeer.h>
+#include "qtcomponent.h"
+#include "componentevent.h"
+#include "qtfont.h"
+
+extern QApplication *qApplication;
+
+// Java Cursor types.
+#define DEFAULT_CURSOR 	        0
+#define CROSSHAIR_CURSOR 	1
+#define TEXT_CURSOR 	        2
+#define WAIT_CURSOR 	        3
+#define SW_RESIZE_CURSOR 	4
+#define SE_RESIZE_CURSOR 	5
+#define NW_RESIZE_CURSOR 	6
+#define NE_RESIZE_CURSOR 	7
+#define N_RESIZE_CURSOR 	8
+#define S_RESIZE_CURSOR 	9
+#define W_RESIZE_CURSOR 	10
+#define E_RESIZE_CURSOR 	11
+#define HAND_CURSOR 	        12
+#define MOVE_CURSOR 	        13
+
+/**
+ * Call back the init() method from the main thread.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_callInit
+(JNIEnv *env, jobject obj)
+{
+  mainThread->postEventToMain( new AWTInitEvent( env, obj ) );
+}
+
+/*
+ * Generic disposal.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_disposeNative
+(JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  setNativeObject(env, obj, NULL);
+  mainThread->postEventToMain( new AWTDestroyEvent( widget ) );
+}
+
+/**
+ * Returns the on-screen location of the component.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_getLocationOnScreenNative
+(JNIEnv *env, jobject obj, jobject point)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+  mainThread->postEventToMain( new AWTGetOriginEvent( widget, env, point) );
+}
+
+/*
+ * Get the preferred/minimum size of the widget
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_getSizeNative
+(JNIEnv *env, jobject obj, jobject size, jboolean preferred)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+
+  mainThread->postEventToMain
+    (new GetSizeEvent( widget, env, size, (preferred == JNI_TRUE)));
+}
+
+/*
+ */
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_isObscured
+(JNIEnv *env, jobject obj)
+{
+  jboolean retVal;
+
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+
+  retVal = (widget->isVisible() == TRUE) ? JNI_TRUE : JNI_FALSE;
+
+  return retVal;
+}
+
+/*
+ * Returns whether the widget is focusable or not.
+ */
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_isFocusable
+(JNIEnv *env, jobject obj)
+{
+  jboolean retVal;
+
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+
+  retVal = (widget->focusPolicy() != Qt::NoFocus) ? JNI_TRUE : JNI_FALSE;
+
+  return retVal;
+}
+
+/**
+ * Requests the focus
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_requestFocus
+  (JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+  mainThread->postEventToMain( new AWTReqFocusEvent( widget ) );
+}
+
+/*
+ * Sets the size and position. Important.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_setBoundsNative
+(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+  mainThread->postEventToMain
+    (new AWTResizeEvent( widget, x, y, width, height ) );
+}
+
+/*
+ * Sets the mouse cursor
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_setCursor
+  (JNIEnv *env, jobject obj, jint cursortype)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+
+  Qt::CursorShape shape;
+  switch(cursortype)
+    {
+    case CROSSHAIR_CURSOR:
+      shape = Qt::CrossCursor;
+      break;
+
+    case W_RESIZE_CURSOR:
+    case E_RESIZE_CURSOR:
+      shape = Qt::SizeHorCursor;
+      break;
+    case N_RESIZE_CURSOR:
+    case S_RESIZE_CURSOR:
+      shape = Qt::SizeVerCursor;
+      break;
+    case HAND_CURSOR:
+      shape = Qt::PointingHandCursor;
+      break;
+    case MOVE_CURSOR:
+      shape = Qt::SizeAllCursor;
+      break;
+
+    case NE_RESIZE_CURSOR:
+    case SW_RESIZE_CURSOR:
+      shape = Qt::SizeBDiagCursor;
+      break;
+    case NW_RESIZE_CURSOR:
+    case SE_RESIZE_CURSOR:
+      shape = Qt::SizeFDiagCursor;
+      break;
+    case TEXT_CURSOR:
+      shape = Qt::IBeamCursor;
+      break;
+    case WAIT_CURSOR:
+      shape = Qt::WaitCursor;
+      break;
+      
+    case DEFAULT_CURSOR:
+    default:
+      shape = Qt::ArrowCursor;
+      break;
+    }
+
+  mainThread->postEventToMain( new AWTCursorEvent( widget, shape ) );
+}
+
+/*
+ * Enable, disable.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_setEnabled
+(JNIEnv *env, jobject obj, jboolean state)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert(widget != NULL);
+
+  mainThread->postEventToMain( new AWTEnableEvent( widget, (state == JNI_TRUE) ) );
+}
+
+/**
+ * Set the font
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_setFontNative
+(JNIEnv *env, jobject obj, jobject fontpeer)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+  QFont *font = (QFont *) getFont( env, fontpeer );
+  assert( font );
+
+  mainThread->postEventToMain( new AWTFontEvent(widget, font) );
+}
+
+/*
+ * Sets the back- or foreground color.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_setGround
+(JNIEnv *env, jobject obj, jint r, jint g, jint b, jboolean isForeground)
+{
+  QColor *color = new QColor(r, g, b);
+
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert(widget);
+  mainThread->postEventToMain( new AWTBackgroundEvent(widget, 
+						      (isForeground == JNI_TRUE),
+						      color) );
+}
+
+/*
+ * Sets the visibility.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_setVisible
+(JNIEnv *env, jobject obj, jboolean state)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert(widget != NULL);
+  mainThread->postEventToMain( new AWTShowEvent( widget, (state == JNI_TRUE) ) );
+}
+
+/*
+ * Returns whether the widget handles wheel scrolling. 
+ */
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_handlesWheelScrolling
+(JNIEnv *env, jobject obj)
+{
+  jboolean handles = JNI_FALSE;
+
+  QWidget *cb = (QWidget *) getNativeObject( env, obj );
+  if( cb )
+    if( cb->focusPolicy() & Qt::WheelFocus )
+      handles = JNI_TRUE;
+
+  return handles;
+}
+
+/**
+ * calls qwidget::update on the compnent.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_QtUpdateArea
+(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h)
+{
+  QWidget *cb = (QWidget *) getNativeObject( env, obj );
+  if( cb )
+    mainThread->postEventToMain( new AWTUpdateEvent
+				 (cb, false, x, y, w, h ) );
+}
+
+/*
+ * calls qwidget::update on the compnent.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_QtUpdate
+(JNIEnv *env, jobject obj)
+{
+  QWidget *cb = (QWidget *) getNativeObject( env, obj );
+  if( cb )
+    mainThread->postEventToMain( new AWTUpdateEvent
+				 ( cb, true, 0, 0, 0, 0 ) );
+}
+
+/*
+ * Returns the native background color.
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_getNativeBackground
+(JNIEnv *env, jobject obj)
+{
+  QWidget *cb = (QWidget *) getNativeObject( env, obj );
+  assert(cb);
+  QColor c = cb->palette().background().color().toRgb();
+
+  jclass cls = env->FindClass("java/awt/Color");
+  jmethodID mid = env->GetMethodID(cls, "<init>", "(III)V");
+  jvalue values[3];
+  
+  values[0].i = (jint) c.red();
+  values[1].i = (jint) c.green();
+  values[2].i = (jint) c.blue();
+
+  return env->NewObjectA(cls, mid, values);
+}
+
+/*
+ * Returns which screen the component is on.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_whichScreen
+(JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+  return (jint) qApplication->desktop()->screenNumber( widget );
+}
+
+/*
+ * Reparents the widget.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_reparentNative
+(JNIEnv *env, jobject obj, jobject newparent)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+  QWidget *parentWidget = (QWidget *) getNativeObject( env, newparent );
+  assert( parentWidget );
+  mainThread->postEventToMain( new AWTReparent(widget, parentWidget ) );
+}
+
+/*
+ * Get the preferred size of the widget
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtComponentPeer_getBounds
+
+(JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+
+  int x, y, w, h;
+  widget->geometry().getRect(&x, &y, &w, &h);    
+
+  jclass cls = env->FindClass("java/awt/Rectangle");
+  assert( cls != NULL);
+  jmethodID mid = env->GetMethodID(cls, "<init>", "(IIII)V");
+  assert( mid != NULL);
+  jvalue values[4];
+
+  values[0].i = (jint) x;
+  values[1].i = (jint) y;
+  values[2].i = (jint) w;
+  values[3].i = (jint) h;
+
+  return env->NewObjectA(cls, mid, values);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtdialogpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtdialogpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtdialogpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtdialogpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,164 @@
+/* qtdialogpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <qdialog.h>
+#include <gnu_java_awt_peer_qt_QtDialogPeer.h>
+#include "qtcomponent.h"
+#include "containers.h"
+#include "qtstrings.h"
+#include "keybindings.h"
+#include "mainthreadinterface.h"
+
+class MyDialog : public QDialog
+{
+public:
+  MyDialog(JNIEnv *env, jobject obj, QWidget *parent) : QDialog(parent)
+  {
+    setup(env, obj);
+  }
+
+  ~MyDialog()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QDialog
+#include "eventmethods.h"
+};
+
+class DialogSettingsEvent : public AWTEvent {
+  
+ private:
+  QDialog *widget;
+  bool modal;
+  bool value;
+  
+ public:
+  DialogSettingsEvent(QDialog *w, bool m, bool v) : AWTEvent()
+  {
+    widget = w;
+    modal = m; 
+    value = v;
+  }
+
+  void runEvent()
+  {
+    if( modal )
+      widget->setModal( value );
+    else
+      widget->setSizeGripEnabled( value );
+  }
+};
+
+class DialogResizeEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  bool fixed;
+  int x, y, w, h;
+  
+ public:
+  DialogResizeEvent(QWidget *wid, int x0, int y0, int w0, int h0, bool f)
+  {
+    widget = wid;
+    fixed = f;
+    x = x0; y = y0;
+    w = w0; h = h0;
+    if(w == 0 && h == 0) w = h = 10;
+  }
+
+  void runEvent()
+  {
+    if( fixed )
+      widget->setFixedSize( w, h );
+    widget->setGeometry( x, y, w, h );
+  }
+};
+
+/*
+ * Constructs a QDialog native object.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtDialogPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *) getParentWidget( env, obj );
+  //  QDialog *dialog = new QDialog(parentWidget);
+  MyDialog *dialog = new MyDialog(env, obj, parentWidget);
+  assert( dialog );
+  setNativeObject( env, obj, dialog );
+}
+
+
+/*
+ * Sets the modality of the dialog.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtDialogPeer_setModal
+(JNIEnv *env, jobject obj, jboolean flag)
+{
+  QDialog *dialog = (QDialog *) getNativeObject( env, obj );
+  assert( dialog );
+  mainThread->postEventToMain( new DialogSettingsEvent(dialog, true, (flag == JNI_TRUE)));
+}
+
+
+/*
+ * Set resizeable.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtDialogPeer_setResizable
+(JNIEnv *env, jobject obj, jboolean flag)
+{
+  QDialog *dialog = (QDialog *) getNativeObject( env, obj );
+  assert( dialog );
+  mainThread->postEventToMain( new DialogSettingsEvent(dialog, false, (flag == JNI_TRUE)));
+}
+
+/*
+ * Overloaded to allow for size locking.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtDialogPeer_setBoundsNative
+(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height, jboolean fixed)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+
+  QRect g = widget->geometry();
+  if(g.x() != x || g.y() != y || 
+     g.width() != width || g.height() != height)
+    mainThread->postEventToMain( new DialogResizeEvent( widget, x, y, width, height, (fixed == JNI_TRUE) ) );
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtembeddedwindowpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtembeddedwindowpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtembeddedwindowpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtembeddedwindowpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,113 @@
+/* qtembeddedwindowpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QWidget>
+#include <QX11EmbedWidget>
+#include <gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h>
+#include "qtcomponent.h"
+#include "keybindings.h"
+#include "mainthreadinterface.h"
+
+/**
+ * Event wrapper for embedding.
+ */
+class EmbedEvent : public AWTEvent {
+  
+ private:
+  QX11EmbedWidget *widget;
+  WId id;
+  
+ public:
+  EmbedEvent(QX11EmbedWidget *w, WId i) : AWTEvent()
+  {
+    widget = w;
+    id = i;
+  }
+
+  void runEvent()
+  {
+    widget->embedInto( id );
+  }
+};
+
+
+class MyEmbeddedPanel : public QX11EmbedWidget
+{
+public:
+  MyEmbeddedPanel(JNIEnv *env, jobject obj, QWidget *parent) : QX11EmbedWidget( parent )
+  {
+    setup(env, obj);
+  }
+
+  ~MyEmbeddedPanel()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QX11EmbedWidget
+#include "eventmethods.h"
+#undef I_KNOW_WHAT_IM_DOING
+#undef PARENT
+};
+
+/**
+ * Init
+ */ 
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtEmbeddedWindowPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *) getParentWidget( env, obj );  
+  QWidget *panel = new MyEmbeddedPanel( env, obj, parentWidget );
+  assert( panel );
+  
+  setNativeObject( env, obj, panel );
+}
+
+/**
+ * Embed the thing.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtEmbeddedWindowPeer_embed
+(JNIEnv *env, jobject obj, jlong wid)
+{
+  MyEmbeddedPanel *panel = (MyEmbeddedPanel *)getNativeObject( env, obj );
+  assert( panel );
+  
+  mainThread->postEventToMain( new EmbedEvent( panel, (WId)wid ) );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfiledialogpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfiledialogpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfiledialogpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfiledialogpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,101 @@
+/* qtfiledialogpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QFileDialog>
+#include <QDialog>
+#include <gnu_java_awt_peer_qt_QtFileDialogPeer.h>
+#include "qtcomponent.h"
+#include "qtstrings.h"
+#include "mainthreadinterface.h"
+
+// Constants from FileDialog
+#define LOAD 0
+#define SAVE 1
+
+class FileDialogMode : public AWTEvent {
+  
+ private:
+  QFileDialog *widget;
+  bool open;
+  
+ public:
+  FileDialogMode(QFileDialog *w, bool o) : AWTEvent()
+  {
+    widget = w;
+    open = o;
+  }
+
+  void runEvent()
+  {
+    if( open )
+      {
+	widget->setAcceptMode( QFileDialog::AcceptOpen );
+	widget->setFileMode( QFileDialog::ExistingFile );
+      }
+    else
+      {
+	widget->setAcceptMode( QFileDialog::AcceptSave );
+	widget->setFileMode( QFileDialog::AnyFile );	
+      }
+  }
+};
+
+
+/*
+ * Constructs a QDialog native object.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFileDialogPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *) getParentWidget( env, obj );
+  QFileDialog *dialog = new QFileDialog(parentWidget);
+  assert( dialog );
+  setNativeObject( env, obj, dialog );
+}
+
+/**
+ * Sets the mode (LOAD or SAVE)
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFileDialogPeer_setMode
+(JNIEnv *env, jobject obj, jint mode)
+{
+  QFileDialog *filedialog = (QFileDialog *) getNativeObject( env, obj );
+  assert( filedialog );
+
+  mainThread->postEventToMain( new FileDialogMode( filedialog, (mode != SAVE) ) );
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfont.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfont.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfont.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfont.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,8 @@
+#ifndef QTFONT_H
+#define QTFONT_H
+
+#include <jni.h>
+
+QFont *getFont( JNIEnv *env, jobject obj );
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfontmetrics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfontmetrics.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfontmetrics.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfontmetrics.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,233 @@
+/* qtfontmetrics.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QChar>
+#include <QFont>
+#include <QFontMetrics>
+#include <QString>
+#include <QPainter>
+#include <QStringList>
+#include <QFontDatabase>
+#include <gnu_java_awt_peer_qt_QtFontMetrics.h>
+#include "qtfont.h"
+#include "qtstrings.h"
+#include "qtgraphics.h"
+
+QFontMetrics *getFontMetrics( JNIEnv *env, jobject obj )
+{
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  return (QFontMetrics *)env->GetLongField( obj, field );
+}
+
+static void setNativePtr( JNIEnv *env, jobject obj, void *value )
+{
+  jlong longValue = (jlong) value;
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  env->SetLongField( obj, field, longValue );
+}
+
+static jobject makeRectangle(JNIEnv *env, QRect *rect)
+{
+  if( rect == NULL )
+    return NULL;
+  if( rect->isNull() || !rect->isValid() )
+    return NULL;
+  jclass cls = env->FindClass("java/awt/Rectangle");
+  jmethodID mid = env->GetMethodID(cls, "<init>", "(IIII)V");
+  jvalue values[4];
+
+  int x,y,w,h;
+  rect->getRect(&x, &y, &w, &h);    
+  values[0].i = (jint) x;
+  values[1].i = (jint) y;
+  values[2].i = (jint) w;
+  values[3].i = (jint) h;
+
+  return env->NewObjectA(cls, mid, values);
+}
+
+/*
+ * Create font metrics from a font.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_init
+(JNIEnv *env, jobject obj, jobject fontPeer)
+{
+  QFont *f = getFont(env, fontPeer);
+  assert( f );
+  QFontMetrics *fm = new QFontMetrics( *f );
+  assert( fm );
+  setNativePtr( env, obj, fm );
+}
+
+/*
+ * Create font metrics from a font.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_initGraphics
+(JNIEnv *env, jobject obj, jobject fontPeer, jobject graphics)
+{
+  QFont *f = getFont(env, fontPeer);
+  assert( f );
+  QPainter *painter = getPainter( env, graphics );
+  assert( painter );
+  QFontMetrics *fm = new QFontMetrics( *f , painter->device());
+  assert( fm );
+  setNativePtr( env, obj, fm );
+}
+
+/*
+ * Dispose
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_dispose
+(JNIEnv *env, jobject obj)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  if ( fm )
+    delete fm;
+  setNativePtr( env, obj, NULL );
+}
+
+/*
+ * Returns JNI_TRUE if a character is displayable.
+ */
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_canDisplay
+(JNIEnv *env, jobject obj, jchar c)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  assert( fm );
+  bool result = fm->inFont( QChar( (unsigned short)c ) );
+  return (result ? JNI_TRUE : JNI_FALSE);
+}
+
+/*
+ * Returns the ascent.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getAscent
+(JNIEnv *env, jobject obj)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  assert( fm );
+  return fm->ascent();
+}
+
+/*
+ * Returns the descent
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getDescent
+(JNIEnv *env, jobject obj)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  assert( fm );
+  return fm->descent();
+}
+
+/*
+ * Returns the height.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getHeight
+(JNIEnv *env, jobject obj)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  assert( fm );
+  return fm->height();
+}
+
+/*
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getLeading
+(JNIEnv *env, jobject obj)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  assert( fm );
+  return fm->leading();
+}
+
+/*
+ * getStringBounds
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getStringBounds
+(JNIEnv *env, jobject obj, jstring str)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  assert( fm );
+  QString *qStr = getQString(env, str);
+  QRect r = fm->boundingRect( *qStr );
+  delete qStr;
+
+  return makeRectangle( env, &r );
+}
+
+/*
+ * Returns the width of the widest character.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_getMaxAdvance
+(JNIEnv *env, jobject obj)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  assert( fm );
+  return fm->maxWidth();
+}
+
+/*
+ * Returns the width of a given character.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_charWidth
+(JNIEnv *env, jobject obj, jchar c)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  assert( fm );
+  return fm->width( QChar( (unsigned short)c ) );
+}
+
+/*
+ * Returns the width of a string.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFontMetrics_stringWidth
+(JNIEnv *env, jobject obj, jstring str)
+{
+  QFontMetrics *fm = getFontMetrics( env, obj );
+  assert( fm );
+  QString *qStr = getQString(env, str);
+  int width = fm->width( *qStr );
+  delete qStr;
+  return width;
+}
+
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfontpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfontpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfontpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtfontpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,92 @@
+/* qtfontpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QFont>
+#include <QString>
+#include <gnu_java_awt_peer_qt_QtFontPeer.h>
+#include "qtfont.h"
+#include "qtstrings.h"
+
+// java.awt.Font constants
+#define PLAIN  0
+#define BOLD   1
+#define ITALIC 2
+
+QFont *getFont( JNIEnv *env, jobject obj )
+{
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  return (QFont *)env->GetLongField( obj, field );
+}
+
+static void setNativePtr( JNIEnv *env, jobject obj, void *value )
+{
+  jlong longValue = (jlong) value;
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  env->SetLongField( obj, field, longValue );
+}
+
+/*
+ * Creates a font.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFontPeer_create
+(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+  QString *str = getQString(env, name);
+  QFont *font = NULL;
+  font = new QFont( *str, size, 
+		    ((style & BOLD) != 0) ? QFont::Bold : QFont::Normal,
+		    ((style & ITALIC) != 0) );
+  assert( font );
+  delete str;
+  setNativePtr( env, obj, font );
+}
+
+/*
+ * Destroys a font.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFontPeer_dispose
+(JNIEnv *env, jobject obj)
+{
+  QFont *font = getFont( env, obj );
+  if( font )
+    delete font;
+  setNativePtr( env, obj, NULL );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtframepeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtframepeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtframepeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtframepeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,205 @@
+/* qtframepeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QApplication>
+#include <QIcon>
+#include <QMainWindow>
+#include <QMenuBar>
+#include <QPixmap>
+#include <QToolBar>
+#include <QThread>
+#include <gnu_java_awt_peer_qt_QtFramePeer.h>
+#include "qtcomponent.h"
+#include "qtstrings.h"
+#include "qtimage.h"
+#include "containers.h"
+#include "keybindings.h"
+#include "mainthreadinterface.h"
+
+#define MenuSizeDefault 5
+
+/*
+ * Our QMainWindow subclass
+ */
+class MyFrame : public QMainWindow
+{
+public:
+  MyFrame(JNIEnv *env, jobject obj) : QMainWindow(0, Qt::Window )
+  {
+    setup(env, obj);
+  }
+
+  ~MyFrame()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QMainWindow
+#include "eventmethods.h"
+};
+
+/**
+ * Event wrapper for adding a menu bar to the frame
+ * if the QMenuBar pointer is NULL, the current menu bar is removed.
+ */
+class FrameMenuEvent : public AWTEvent {
+  
+ private:
+  QMainWindow *widget;
+  QMenuBar *menu;
+  
+ public:
+  FrameMenuEvent(QMainWindow *w, QMenuBar *mb) : AWTEvent()
+  {
+    widget = w;
+    menu = mb;
+  }
+
+  void runEvent()
+  {
+    if( menu != NULL)
+      widget->setMenuBar( menu );
+    else
+      delete widget->menuBar();
+  }
+};
+
+/**
+ * Returns the child widget for the frame (the centralWidget in qt terms)
+ */
+QWidget *frameChildWidget( JNIEnv *env, jobject component )
+{
+  jclass frameCls = env->FindClass( "java/awt/Frame" );
+  assert( frameCls );
+  jmethodID getPeerMID = env->GetMethodID( frameCls,
+					   "getPeer",
+					   "()Ljava/awt/peer/ComponentPeer;" );
+  assert(getPeerMID);
+
+  jobject framepeerobj = env->CallObjectMethod( component, getPeerMID, 0);
+  if( framepeerobj == NULL )
+    return (QWidget *)NULL;
+
+  MyFrame *window = (MyFrame *)getNativeObject(env, framepeerobj);
+  assert( window );
+  return window;
+}
+
+/*
+ * Constructs a QMainWindow native object.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFramePeer_init
+(JNIEnv *env, jobject obj)
+{
+  MyFrame *frame = new MyFrame(env, obj);
+  assert( frame );
+  frame->addToolBarBreak ( Qt::BottomToolBarArea );
+  setNativeObject( env, obj, frame );
+}
+
+/**
+ * Sets the icon image.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFramePeer_setIcon
+(JNIEnv *env, jobject obj, jobject image)
+{
+  QMainWindow *frame = (QMainWindow *) getNativeObject( env, obj );
+  assert( frame );
+
+  QIcon *i;
+  if( image == NULL )
+    {
+      // remove icon
+      i = new QIcon();
+    }
+  else
+    {
+      // set icon
+      QImage *img = getQtImage( env, image );
+      assert( img );
+      i = new QIcon( QPixmap::fromImage( *img ) );
+    }
+  frame->setWindowIcon( *i );
+  delete i;
+}
+
+/**
+ * Returns the menu bar height for insets.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtFramePeer_menuBarHeight
+(JNIEnv *env, jobject obj)
+{
+  QMainWindow *frame = (QMainWindow *) getNativeObject( env, obj );
+  assert( frame );
+
+  QMenuBar *mb = frame->menuBar();
+
+  return ( mb != NULL ) ? mb->sizeHint().height() : 0 ;
+}
+
+/*
+ * set Menu bar.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFramePeer_setMenu
+(JNIEnv *env, jobject obj, jobject mbPeer)
+{
+  QMainWindow *frame = (QMainWindow *) getNativeObject( env, obj );
+  assert( frame );
+  
+  QMenuBar *menubar = NULL;
+
+  if( mbPeer != NULL )
+    {
+      menubar = (QMenuBar *) getNativeObject( env, mbPeer );
+      assert( menubar );
+    }
+
+  mainThread->postEventToMain( new FrameMenuEvent( frame, menubar ) );
+}
+
+/**
+ * Set the bounds of the maximized frame
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtFramePeer_setMaximizedBounds (JNIEnv *env, jobject obj, jint w, jint h)
+{
+  QMainWindow *frame = (QMainWindow *) getNativeObject( env, obj );
+  assert( frame );
+  // FIXME
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtgraphics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtgraphics.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtgraphics.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtgraphics.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,475 @@
+/* qtgraphics.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <jni.h>
+#include <QPainter>
+#include <QBrush>
+#include <QLinearGradient>
+#include <QPen>
+#include <QPaintDevice>
+#include <QPainterPath>
+#include <QImage>
+#include <QColor>
+#include <gnu_java_awt_peer_qt_QtGraphics.h>
+#include "nativewrapper.h"
+#include "qtimage.h"
+#include "qtstrings.h"
+#include "qtcomponent.h"
+#include "qtgraphics.h"
+#include "qtfont.h"
+
+// Constants from java.awt.AlphaComposite
+#define CLEAR     1
+#define SRC       2
+#define DST       9
+#define SRC_OVER  3
+#define DST_OVER  4
+#define SRC_IN    5
+#define DST_IN    6
+#define SRC_OUT   7
+#define DST_OUT   8
+#define SRC_ATOP  10
+#define DST_ATOP  11
+#define XOR       12
+
+GraphicsPainter *getPainter( JNIEnv *env, jobject obj )
+{
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  return (GraphicsPainter *)env->GetLongField( obj, field );
+}
+
+static void setNativePtr( JNIEnv *env, jobject obj, void *value )
+{
+  jlong longValue = (jlong) value;
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  env->SetLongField( obj, field, longValue );
+}
+
+static jobject getToolkit( JNIEnv *env, jobject obj )
+{
+  jclass cls = env->FindClass( "gnu/java/awt/peer/qt/QtGraphics" );
+
+  jfieldID field = env->GetFieldID( cls, "toolkit",
+				    "Lgnu/java/awt/peer/qt/QtToolkit;" );
+  return env->GetObjectField( obj, field );
+}
+
+///////////////////////// JNI methods ////////////////////////////////
+
+/**
+ * Clones the parent QPainter object.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_cloneNativeContext
+(JNIEnv *env, jobject obj, jobject parent)
+{
+  GraphicsPainter *painter = (GraphicsPainter *)getPainter( env, parent );
+  assert( painter );
+  QPainter *newPainter = new GraphicsPainter( painter->device() );
+  assert( newPainter );
+  setNativePtr(env, obj, newPainter);
+}
+
+/*
+ * Start of JNI methods 
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_initImage
+(JNIEnv *env, jobject obj, jobject image)
+{
+  QImage *im = getQtImage( env, image );
+  assert( im );
+  QPainter *painter = new GraphicsPainter( im );
+  assert( painter );
+  setNativePtr(env, obj, painter);
+  painter->setRenderHint(QPainter::TextAntialiasing);
+  painter->setRenderHint(QPainter::Antialiasing);
+  painter->setRenderHint(QPainter::SmoothPixmapTransform);
+}
+
+/*
+ * Start of JNI methods 
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_initVolatileImage
+(JNIEnv *env, jobject obj, jobject image)
+{
+  QPixmap *im = getQtVolatileImage( env, image );
+  assert( im );
+  QPainter *painter = new GraphicsPainter( im );
+  assert( painter );
+  setNativePtr(env, obj, painter);
+  painter->setRenderHint(QPainter::TextAntialiasing);
+  painter->setRenderHint(QPainter::Antialiasing);
+  painter->setRenderHint(QPainter::SmoothPixmapTransform);
+}
+
+/**
+ * Deletes the QPainter
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_delete
+(JNIEnv *env, jobject obj)
+{
+  GraphicsPainter *painter = (GraphicsPainter *)getPainter( env, obj );
+  setNativePtr( env, obj, NULL );
+  if( painter )
+    {
+      if( painter->isActive() )
+ 	painter->end();
+      delete painter;
+    }
+}
+
+///////////////////////////////////////////////////////////
+/*
+ * Sets the clip to a path.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_setClipNative
+(JNIEnv *env, jobject obj, jobject path)
+{
+  QPainter *painter = getPainter( env, obj );
+  assert( painter );
+  QPainterPath *pp = (QPainterPath *)getNativeObject( env, path );
+  assert( pp );
+  painter->setClipPath( *pp );
+}
+
+/*
+ * Sets the clip to a rectangle.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_setClipRectNative
+(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h)
+{
+  QPainter *painter = getPainter( env, obj );
+  assert( painter );
+  painter->setClipRect( x, y, w, h );
+}
+
+/*
+ * Intersects a shape with the current clip.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_intersectClipNative
+(JNIEnv *env, jobject obj, jobject path)
+{
+  QPainter *painter = getPainter( env, obj );
+  assert( painter );
+  QPainterPath *pp = (QPainterPath *)getNativeObject( env, path );
+  assert( pp );
+  painter->setClipPath( *pp, Qt::IntersectClip );
+}
+
+/*
+ * Intersect a rectangle with the current clip.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_intersectClipRectNative
+(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h)
+{
+  QPainter *painter = getPainter( env, obj );
+  assert( painter );
+  painter->setClipRect( x, y, w, h, Qt::IntersectClip );
+}
+
+/*
+ * Returns a QPainterPath object with the clip path of this painter.
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_getClipNative
+(JNIEnv *env, jobject obj)
+{
+  QPainter *painter = getPainter( env, obj );
+  assert( painter );
+  jclass cls = env->FindClass("gnu/java/awt/peer/qt/QPainterPath");
+  jmethodID method = env->GetMethodID(cls, "<init>", "()V");
+
+  jobject ppo = env->NewObject(cls, method);
+  QPainterPath qpp = painter->clipPath();
+  setNativeObject(env, ppo, &qpp);
+
+  env->DeleteLocalRef( cls );
+  return ppo;
+}
+
+/*
+ * Returns a Rectangle with the bounds of this painters clip path.
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_getClipBounds
+(JNIEnv *env, jobject obj)
+{
+  QPainter *painter = getPainter( env, obj );
+  assert( painter );
+  qreal x, y, w, h;
+  painter->clipPath().boundingRect().getRect(&x, &y, &w, &h);    
+
+  jclass cls = env->FindClass("java/awt/Rectangle");
+  assert( cls != NULL);
+  jmethodID mid = env->GetMethodID(cls, "<init>", "(IIII)V");
+  assert( mid != NULL);
+  jvalue values[4];
+
+  values[0].i = (jint) x;
+  values[1].i = (jint) y;
+  values[2].i = (jint) w;
+  values[3].i = (jint) h;
+
+  return env->NewObjectA(cls, mid, values);
+}
+
+///////////////////////// Color stuff ////////////////////////
+/**
+ *
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_setColor
+(JNIEnv *env, jobject obj, jint r, jint g, jint b, jint alpha)
+{
+  GraphicsPainter *painter = (GraphicsPainter *)getPainter( env, obj );
+  assert( painter );
+  painter->currentPen->setColor( QColor(r, g, b, alpha) );
+  painter->setPen( *painter->currentPen );
+  painter->currentBrush = new QBrush( QColor(r, g, b, alpha) );
+  painter->setBrush( *painter->currentBrush );
+  painter->currentColor = new QColor(r, g, b, alpha);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_setAlphaNative
+  (JNIEnv *env, jobject obj, jdouble alpha)
+{
+  GraphicsPainter *painter = (GraphicsPainter *)getPainter( env, obj );
+  assert( painter );
+
+  QColor c = painter->currentPen->color();
+  c.setAlphaF( (qreal)alpha );
+  painter->currentPen->setColor(c);
+
+  c = painter->currentBrush->color();
+  c.setAlphaF( (qreal)alpha );
+  painter->currentBrush->setColor( c );
+}
+
+/*
+ * Class:     gnu_java_awt_peer_qt_QtGraphics
+ * Method:    drawNative
+ * Signature: (Lgnu/java/awt/peer/qt/QPainterPath;)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_drawNative
+(JNIEnv *env, jobject obj, jobject path)
+{
+  GraphicsPainter *painter = (GraphicsPainter *)getPainter( env, obj );
+  assert( painter );
+  QPainterPath *pp = (QPainterPath *)getNativeObject( env, path );
+  assert( pp );
+  painter->setPen( *painter->currentPen );
+  painter->setBrush( Qt::NoBrush );
+  painter->drawPath( *pp );
+}
+
+/*
+ * Class:     gnu_java_awt_peer_qt_QtGraphics
+ * Method:    fillNative
+ * Signature: (Lgnu/java/awt/peer/qt/QPainterPath;)V
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_fillNative
+(JNIEnv *env, jobject obj, jobject path)
+{
+  GraphicsPainter *painter = (GraphicsPainter *)getPainter( env, obj );
+  assert( painter );
+  QPainterPath *pp = (QPainterPath *)getNativeObject( env, path );
+  assert( pp );
+
+  painter->setPen(Qt::NoPen);
+  painter->setBrush( *painter->currentBrush );
+  painter->drawPath( *pp );
+}
+
+/**
+ * Draws a string.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_drawStringNative
+(JNIEnv *env, jobject obj, jstring str, jdouble x, jdouble y)
+{
+  GraphicsPainter *painter = getPainter( env, obj );
+  assert( painter );
+  QString *qStr = getQString(env, str);
+  painter->setBrush( Qt::NoBrush );
+  painter->setPen( *painter->currentPen );
+  painter->drawText(QPointF( (qreal)x, (qreal)y ), *qStr);
+  delete qStr;
+}
+
+/*
+ * Sets the native stroke
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_setNativeStroke
+(JNIEnv *env, jobject obj, jobject stroke)
+{
+  GraphicsPainter *painter = (GraphicsPainter *)getPainter( env, obj );
+  assert( painter );
+  QPen *pen = (QPen *)getNativeObject(env, stroke);
+  assert( pen );
+  painter->currentPen = new QPen( *pen );
+  painter->setPen( *painter->currentPen );
+}
+
+/*
+ * Sets the transform
+ */ 
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_setQtTransform
+(JNIEnv *env, jobject obj, jobject matrix)
+{
+  QPainter *painter = getPainter( env, obj );
+  assert( painter );
+  QMatrix *m = (QMatrix *)getNativeObject( env, matrix );
+  assert( m );
+  painter->setMatrix( *m );
+}
+
+/**
+ * Set the font
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_setFontNative
+(JNIEnv *env, jobject obj, jobject fontpeer)
+{
+  QPainter *painter = getPainter( env, obj );
+  assert( painter );
+  QFont *font = (QFont *) getFont( env, fontpeer );
+  assert( font );
+  painter->setFont( *font );
+}
+
+/*
+ * Sets Porter-Duff compositing.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_setNativeComposite
+(JNIEnv *env, jobject obj, jint compositeMode)
+{
+  QPainter *painter = getPainter( env, obj );
+  assert( painter );
+  QPainter::CompositionMode mode;
+
+  switch( compositeMode )
+    {
+    case CLEAR:
+      mode = QPainter::CompositionMode_Clear;
+      break;
+    case SRC:
+      mode = QPainter::CompositionMode_Source;
+      break;
+    case DST:
+      mode = QPainter::CompositionMode_Destination;
+      break;
+    case SRC_OVER:
+      mode = QPainter::CompositionMode_SourceOver;
+      break;
+    case DST_OVER:
+      mode = QPainter::CompositionMode_DestinationOver;
+      break;
+    case SRC_IN:
+      mode = QPainter::CompositionMode_SourceIn;
+      break;
+    case DST_IN:
+      mode = QPainter::CompositionMode_DestinationIn;
+      break;
+    case SRC_OUT:
+      mode = QPainter::CompositionMode_SourceOut;
+      break;
+    case DST_OUT:
+      mode = QPainter::CompositionMode_DestinationOut;
+      break;
+    case SRC_ATOP:
+      mode = QPainter::CompositionMode_SourceAtop;
+      break;
+    case DST_ATOP:
+      mode = QPainter::CompositionMode_DestinationAtop;
+      break;
+    case XOR:
+      mode = QPainter::CompositionMode_Xor;
+      break;
+    }
+  painter->setCompositionMode( mode );
+}
+
+/**
+ * Sets the current brush to a linear gradient.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_setLinearGradient
+(JNIEnv *env, jobject obj, jint r1, jint g1, jint b1, jint r2, jint g2, 
+jint b2, jdouble x1, jdouble y1, jdouble x2, jdouble y2, jboolean cyclic)
+{
+  GraphicsPainter *painter = getPainter( env, obj );
+  assert( painter );
+  QLinearGradient *lg = new QLinearGradient(QPointF( (qreal)x1, (qreal)y1 ),
+					    QPointF( (qreal)x2, (qreal)y2 ) );
+  lg->setColorAt( (qreal)0.0, QColor(r1, g1, b1) );
+  lg->setColorAt( (qreal)1.0, QColor(r2, g2, b2) );
+  if( cyclic == JNI_TRUE )
+    lg->setSpread( QGradient::ReflectSpread );
+  else
+    lg->setSpread( QGradient::PadSpread );
+  painter->currentBrush = new QBrush( *lg );
+  delete lg;
+}
+
+/*
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_fill3DRect
+(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h, jboolean raised)
+{
+  GraphicsPainter *painter = getPainter( env, obj );
+  assert( painter );
+  // FIXME: Adjust colors
+  painter->fillRect ( x, y, w, h, QBrush( *painter->currentColor) );
+  QPen *p = new QPen( *painter->currentColor );
+  p->setWidth( 1 );
+  painter->setPen( *p );
+  painter->drawLine( x + w, y, x + w, y + h);
+  painter->drawLine( x, y + h, x + w, y + h);
+}
+
+/*
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtGraphics_draw3DRect
+(JNIEnv *env, jobject obj, jint x, jint y, jint w, jint h, jboolean raised)
+{
+  GraphicsPainter *painter = getPainter( env, obj );
+  assert( painter );
+  // FIXME: Adjust colors
+  QPen *p = new QPen( *painter->currentColor );
+  p->setWidth( 1 );
+  painter->setPen( *p );
+  painter->drawLine( x, y, x + w, y );
+  painter->drawLine( x, y, x, y + h);
+  painter->drawLine( x + w, y, x + w, y + h);
+  painter->drawLine( x, y + h, x + w, y + h);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtgraphics.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtgraphics.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtgraphics.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtgraphics.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,26 @@
+#ifndef QTGRAPHICS_H
+#define QTGRAPHICS_H
+
+#include <jni.h>
+#include <QPainter>
+#include <QPaintDevice>
+#include <QPen>
+#include <QBrush>
+
+class GraphicsPainter : public QPainter
+{
+public:
+  QPen *currentPen;
+  QBrush *currentBrush;
+  QColor *currentColor;
+  GraphicsPainter(QPaintDevice *dev) : QPainter( dev )
+  {
+    currentPen = new QPen();
+    currentBrush = new QBrush();
+    currentColor = new QColor();
+  }
+};
+
+GraphicsPainter *getPainter( JNIEnv *env, jobject obj );
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtimage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtimage.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtimage.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtimage.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,401 @@
+/* qtimage.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QImage>
+#include <QColor>
+#include <QMatrix>
+#include <QPainter>
+#include <gnu_java_awt_peer_qt_QtImage.h>
+#include "qtimage.h"
+#include "qtstrings.h"
+#include "qtgraphics.h"
+#include "nativewrapper.h"
+
+/* The constant fields in java.awt.Image */   
+#define SCALE_DEFAULT      1
+#define SCALE_FAST         2
+#define SCALE_SMOOTH       4
+#define SCALE_REPLICATE    8 
+#define SCALE_AREA_AVERAGING  16
+
+QImage *getQtImage( JNIEnv *env, jobject obj )
+{
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  return (QImage *)env->GetLongField( obj, field );
+}
+
+static void setNativePtr( JNIEnv *env, jobject obj, void *value )
+{
+  jlong longValue = (jlong) value; 
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  env->SetLongField( obj, field, longValue );
+}
+
+/*
+ * Creates a QImage.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtImage_createImage
+(JNIEnv *env, jobject obj)
+{
+  int width, height;
+  jclass cls;
+  jfieldID field;
+
+  cls = env->GetObjectClass( obj );
+  field = env->GetFieldID (cls, "width", "I");
+  assert (field != 0);
+  width = env->GetIntField(obj, field);
+
+  field = env->GetFieldID(cls, "height", "I");
+  assert (field != 0);
+  height = env->GetIntField(obj, field);
+  
+  QImage *image = new QImage ( width, height, 
+			       QImage::Format_ARGB32_Premultiplied );
+  setNativePtr(env, obj, image);
+}
+
+/*
+ * Frees the image data.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtImage_freeImage
+(JNIEnv *env, jobject obj)
+{
+   QImage *image = getQtImage(env, obj);
+   setNativePtr(env, obj, NULL);
+   if ( image )
+     delete image;
+}
+
+/*
+ * Clears the image to zero.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtImage_clear
+(JNIEnv *env, jobject obj)
+{
+  QImage *image = getQtImage(env, obj);
+  assert( image );
+  image->fill(0);
+}
+
+/*
+ * Returns the pixel data in an int array.
+ */
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_qt_QtImage_getPixels
+(JNIEnv *env, jobject obj)
+{
+  QImage *image = getQtImage(env, obj);
+  jintArray result_array;
+  jint *result_array_ptr, *dst;
+  int x, y;
+  jint pixel;
+  QRgb current;
+
+  assert( image );
+
+  result_array = env->NewIntArray (image->width() * image->height());
+  dst = result_array_ptr = 
+    env->GetIntArrayElements(result_array, NULL);
+
+  // A bit inefficient.
+  for ( y = 0; y < image->height(); y++)
+      for ( x = 0; x < image->width(); x++)
+	{
+	  current = image->pixel(x, y);
+	  pixel = 0;
+	  pixel = (qAlpha(current) & 0xFF) << 24 | 
+	    (qRed(current) & 0xFF) << 16 |
+	    (qGreen(current) & 0xFF) << 8 |
+	    (qBlue(current) & 0xFF);
+	  *dst = pixel;
+	  dst++;
+	}
+
+  env->ReleaseIntArrayElements (result_array, result_array_ptr, 0);
+  return result_array;
+}
+
+/*
+ * Sets the pixel data.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtImage_setPixels
+(JNIEnv *env, jobject obj, jintArray pixels)
+{
+  QImage *image = getQtImage(env, obj);
+  assert( image );
+
+  int width, height;
+  jint *src_array, *src;
+
+  width =  image->width();
+  height = image->height();
+
+  src = src_array = 
+    env->GetIntArrayElements(pixels, NULL);
+
+  for(int i = 0 ; i < height; i++)
+    {
+      uchar *scanline = image->scanLine( i );
+      memcpy((void *)scanline, (void *)src, width * 4);
+      src += width;
+    }
+
+  env->ReleaseIntArrayElements(pixels, src_array, 0);
+}
+
+
+/*
+ * Loads an image from a file, 
+ * returns true on success, false on failure.
+ */
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtImage_loadImage
+(JNIEnv *env, jobject obj, jstring fn)
+{
+  QString *filename = getQString(env, fn);
+
+  QImage *image = new QImage();
+  bool retVal = image->load( *filename );
+  delete filename;
+
+  if(image->isNull() && !retVal)
+    {
+      setNativePtr(env, obj, NULL);
+      return JNI_FALSE;
+    }
+
+  setNativePtr(env, obj, image);
+  
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "width", "I" );
+  env->SetIntField( obj, field, image->width() );
+  field = env->GetFieldID( cls, "height", "I" );
+  env->SetIntField( obj, field, image->height() );
+  
+  return JNI_TRUE;
+}
+
+/*
+ * Creates the image from an array of java bytes.
+ */
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_qt_QtImage_loadImageFromData
+(JNIEnv *env, jobject obj, jbyteArray data)
+{
+  jbyte *src_array, *src;
+  bool retVal;
+
+  src = env->GetByteArrayElements(data, NULL);
+  int len = env->GetArrayLength( data );
+
+  QImage *image = new QImage();
+  retVal = image->loadFromData( (uchar *) src, len);
+  env->ReleaseByteArrayElements(data, src, 0);
+
+  if(image->isNull() || retVal == false)
+    {
+      setNativePtr(env, obj, NULL);
+      return JNI_FALSE;
+    }
+
+  setNativePtr(env, obj, image);
+  
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "width", "I" );
+  env->SetIntField( obj, field, image->width() );
+  field = env->GetFieldID( cls, "height", "I" );
+  env->SetIntField( obj, field, image->height() );
+  
+  return JNI_TRUE;
+}
+
+
+/*
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtImage_createScaledImage
+(JNIEnv *env, jobject obj, jobject src, jint hints)
+{
+  int w,h;
+  jclass cls;
+  jfieldID field;
+
+  cls = env->GetObjectClass( obj );
+  field = env->GetFieldID(cls, "width", "I");
+  assert (field != 0);
+  w = env->GetIntField(obj, field);
+
+  field = env->GetFieldID(cls, "height", "I");
+  assert (field != 0);
+  h = env->GetIntField(obj, field);
+
+  QImage *image = getQtImage(env, src);
+  assert( image );
+  QImage imageScaled;
+
+  if (hints == SCALE_SMOOTH || hints == SCALE_AREA_AVERAGING)
+    imageScaled = image->scaled(w, h, 
+				Qt::IgnoreAspectRatio, 
+				Qt::SmoothTransformation);
+  else
+    imageScaled = image->scaled(w, h, 
+				Qt::IgnoreAspectRatio, 
+				Qt::FastTransformation);
+  QImage *scaledPtr = new QImage( imageScaled );
+  
+  // create new QtImage object
+  setNativePtr( env, obj, scaledPtr );
+}
+
+/*
+ * Simple draw without scaling.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtImage_drawPixels
+(JNIEnv *env, jobject obj, jobject graphics, jint bg_red, jint bg_green, 
+ jint bg_blue, jint x, jint y, jboolean composite)
+{
+  QImage *image = getQtImage(env, obj);
+  assert( image );
+  QPainter *painter = getPainter( env, graphics );
+  assert( painter );
+  if(composite == JNI_TRUE)
+    painter->fillRect ( x, y, image->width(), image->height(), 
+ 			QColor(bg_red, bg_green, bg_blue ) );
+  painter->drawImage ( QPoint(x, y), *image );
+}
+
+/*
+ * Draw the image with scaling.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtImage_drawPixelsScaled
+(JNIEnv *env, jobject obj, jobject graphics, 
+ jint bg_red, jint bg_green, jint bg_blue, 
+ jint x, jint y, jint w, jint h, jboolean composite)
+{
+  QImage *image = getQtImage(env, obj);
+  assert( image );
+  QPainter *painter = getPainter( env, graphics );
+  assert( painter );
+
+  if(composite == JNI_TRUE)
+    painter->fillRect ( x, y, w, h, QColor(bg_red, bg_green, bg_blue ) );
+  
+  QRectF *srcRect = new QRectF((qreal)0, (qreal)0,
+			       (qreal)image->width(), (qreal)image->height());
+  QRectF *dstRect = new QRectF((qreal)x, (qreal)y,
+			       (qreal)w, (qreal)h);
+  
+  if(composite == JNI_TRUE)
+    painter->fillRect( *dstRect, QColor(bg_red, bg_green, bg_blue ) );
+
+  painter->drawImage( *dstRect, *image, *srcRect);
+
+  delete srcRect;
+  delete dstRect;
+}
+
+/*
+ * Draws a transformed image.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtImage_drawPixelsTransformed
+(JNIEnv *env, jobject obj, jobject graphics, jobject transform)
+{
+  QImage *originalImage = getQtImage(env, obj);
+  assert( originalImage );
+  QPainter *painter = getPainter( env, graphics );
+  assert( painter );
+  QMatrix *matrix = (QMatrix *)getNativeObject(env, transform);
+  assert( matrix );
+
+  // FIXME : Add rendering hint support here.
+  QPoint p = matrix->map( QPoint(0,0) );
+  QImage image = originalImage->transformed ( *matrix, Qt::FastTransformation );
+  painter->drawImage(p, image);
+}
+
+/**
+ * Draws the pixbuf at x, y, scaled to width and height and 
+ * optionally composited and/or flipped with a given background color.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_qt_QtImage_drawPixelsScaledFlipped 
+(JNIEnv *env, jobject obj, jobject graphics,
+ jint bg_red, jint bg_green, jint bg_blue, 
+ jboolean flipx, jboolean flipy,
+ jint srcx, jint srcy, jint srcwidth, jint srcheight, 
+ jint dstx, jint dsty, jint dstwidth, jint dstheight, 
+ jboolean composite)
+{
+  QImage *originalImage = getQtImage(env, obj);
+  assert( originalImage );
+  QPainter *painter = getPainter( env, graphics );
+  assert( painter );
+
+  QRectF *srcRect = new QRectF((qreal)srcx, (qreal)srcy,
+			       (qreal)srcwidth, (qreal)srcheight);
+  QRectF *dstRect = new QRectF((qreal)dstx, (qreal)dsty,
+			       (qreal)dstwidth, (qreal)dstheight);
+  
+  QImage image;
+  if( flipx == JNI_TRUE || flipy == JNI_TRUE)
+    image = originalImage->mirrored ( (flipx == JNI_TRUE), 
+				      (flipy == JNI_TRUE) );
+  else
+    image = *originalImage;
+
+  if(composite == JNI_TRUE)
+    painter->fillRect( *dstRect, QColor(bg_red, bg_green, bg_blue ) );
+
+  painter->drawImage( *dstRect, image, *srcRect);
+
+  delete srcRect;
+  delete dstRect;
+}
+
+/**
+ * Copies an area of the image (used by Graphics)
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtImage_copyArea
+(JNIEnv *env, jobject obj , jint x, jint y, jint w, jint h, jint dx, jint dy)
+{
+  QImage *image = getQtImage(env, obj);
+  assert( image );
+  QImage area = image->copy(x, y, w, h);
+  QPainter *p = new QPainter( image );
+  p->drawImage( x + dx, y + dy, area );
+  delete p;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtimage.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtimage.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtimage.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtimage.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,10 @@
+#ifndef QTIMAGE_H
+#define QTIMAGE_H
+
+#include <QImage>
+#include <QPixmap>
+
+QImage *getQtImage( JNIEnv *env, jobject obj );
+QPixmap *getQtVolatileImage( JNIEnv *env, jobject obj );
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtlabelpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtlabelpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtlabelpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtlabelpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,151 @@
+/* qtlabelpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QLabel>
+#include <QString>
+#include <gnu_java_awt_peer_qt_QtLabelPeer.h>
+#include "qtcomponent.h"
+#include "qtstrings.h"
+#include "mainthreadinterface.h"
+#include "keybindings.h"
+
+// java.awt.Label justification fields
+#define LEFT   0
+#define CENTER 1
+#define RIGHT  2
+
+class MyLabel : public QLabel
+{
+public:
+  MyLabel(JNIEnv *env, jobject obj, QWidget *parent) : QLabel( parent )
+  {
+    setup(env, obj);
+  }
+  
+  ~MyLabel()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QLabel
+#include "eventmethods.h"
+};
+
+class LabelTitle : public AWTEvent {
+  
+ private:
+  QLabel *widget;
+  QString *string;
+  Qt::Alignment alignment;
+
+ public:
+  LabelTitle(QLabel *w, QString *s, Qt::Alignment a) : AWTEvent()
+  {
+    widget = w;
+    string = s;
+    alignment = a;
+  }
+
+  void runEvent()
+  {
+    if( string != NULL)
+      {
+	widget->setText( *string );
+	delete string;
+      }
+    else
+      {
+	widget->setAlignment( alignment );
+      }
+  }
+};
+
+/*
+ * Init a QLabel
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtLabelPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *) getParentWidget( env, obj );  
+  QLabel *label = new MyLabel( env, obj, parentWidget );
+  assert( label );
+  setNativeObject( env, obj, label );
+}
+
+/*
+ * Sets the text
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtLabelPeer_setText
+(JNIEnv *env, jobject obj, jstring str)
+{
+  QLabel *label = (QLabel *) getNativeObject( env, obj );
+  assert( label );
+
+  QString *qStr = getQString(env, str);
+  mainThread->postEventToMain( new LabelTitle( label, qStr, 0 ) );
+}
+
+/*
+ * Sets the alignment
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtLabelPeer_setAlignment
+(JNIEnv *env, jobject obj, jint align)
+{
+  Qt::Alignment alignment = Qt::AlignVCenter;
+  
+  QLabel *label = (QLabel *) getNativeObject( env, obj );
+  assert( label );
+  
+  switch(align)
+    {
+    case LEFT:
+      alignment |= Qt::AlignLeft;
+      break;
+
+    case RIGHT:
+      alignment |= Qt::AlignRight;
+      break;
+
+    default:
+    case CENTER:
+      alignment |= Qt::AlignHCenter;
+      break;
+    }
+  mainThread->postEventToMain( new LabelTitle( label, NULL, alignment ) );
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtlistpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtlistpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtlistpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtlistpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,210 @@
+/* qtlistpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QWidget>
+#include <QListWidget>
+#include <gnu_java_awt_peer_qt_QtListPeer.h>
+#include "qtcomponent.h"
+#include "qtstrings.h"
+#include "mainthreadinterface.h"
+#include "slotcallbacks.h"
+
+class ListInsert : public AWTEvent {
+  
+ private:
+  QListWidget *widget;
+  QString *string;
+  int index;
+  
+ public:
+  ListInsert(QListWidget *w, QString *s, int i) : AWTEvent()
+  {
+    widget = w;
+    string = s;
+    index = i;
+  }
+
+  void runEvent()
+  {
+    widget->insertItem( index, *string );
+    delete string;
+  }
+};
+
+class SelectEvent : public AWTEvent {
+  
+ private:
+  QListWidget *widget;
+  int index;
+  bool selected;
+
+ public:
+  SelectEvent(QListWidget *w, int i, bool s) : AWTEvent()
+  {
+    widget = w;
+    index = i;
+    selected = s;
+  }
+
+  void runEvent()
+  {
+    widget->setItemSelected ( widget->item(index), selected );
+  }
+};
+
+class ListDelete : public AWTEvent {
+  
+ private:
+  QListWidget *widget;
+  int startIndex, endIndex;
+
+ public:
+  ListDelete(QListWidget *w, int starti, int endi) : AWTEvent()
+  {
+    widget = w;
+    startIndex = starti;
+    endIndex = endi;
+  }
+
+  void runEvent()
+  {
+    for (int i = endIndex; i >= startIndex; i--)
+      delete widget->takeItem(i);
+  }
+};
+
+/*
+ * Construct a QListWidget object
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtListPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *)getParentWidget(env, obj);
+  assert( parentWidget );
+  QListWidget *list = new QListWidget( parentWidget );
+  assert( list );
+      
+  setNativeObject( env, obj, list );
+  connectList(list, env, obj);
+}
+
+/*
+ * Adds an element.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtListPeer_add
+(JNIEnv *env, jobject obj, jstring str, jint index)
+{
+  QListWidget *list = (QListWidget *) getNativeObject( env, obj );
+  assert( list );
+  QString *qStr = getQString(env, str);
+  mainThread->postEventToMain( new ListInsert(list, qStr, index) );
+}
+
+/*
+ * Delete items
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtListPeer_delItems
+(JNIEnv *env, jobject obj, jint startindex, jint endindex)
+{
+  QListWidget *list = (QListWidget *) getNativeObject( env, obj );
+  assert( list );
+  mainThread->postEventToMain( new ListDelete(list, startindex, endindex) );
+}
+
+/*
+ * (De)select an element.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtListPeer_select
+(JNIEnv *env, jobject obj, jint index, jboolean sel)
+{
+  QListWidget *list = (QListWidget *) getNativeObject( env, obj );
+  assert( list );
+
+  mainThread->postEventToMain( new SelectEvent(list, index, 
+  					       (sel == JNI_TRUE)) );
+}
+
+/**
+ * Returns the indices of the selected items.
+ */
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_qt_QtListPeer_getSelectedIndexes
+  (JNIEnv *env, jobject obj)
+{
+  jintArray retArray;
+  jint *arr;
+
+  QListWidget *list = (QListWidget *) getNativeObject( env, obj );
+  assert( list );
+
+  QList<QListWidgetItem *> items = list->selectedItems();
+  retArray = env->NewIntArray( items.count() );
+  arr = env->GetIntArrayElements( retArray, NULL );
+
+  for(int i = 0; i < items.count(); i++)
+    arr[i] = list->row(items.at(i)); 
+
+  env->ReleaseIntArrayElements( retArray, arr, 0 );
+  return retArray;
+}
+
+/*
+ * Sets the current item and makes it visible.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtListPeer_makeVisible
+  (JNIEnv *env, jobject obj, jint index)
+{
+
+  QListWidget *list = (QListWidget *) getNativeObject( env, obj );
+  assert( list );
+
+  list->scrollToItem( list->item(index) );
+}
+
+/*
+ * Set multiple selection mode.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtListPeer_setMultipleMode
+(JNIEnv *env, jobject obj, jboolean allow)
+{
+  QListWidget *list = (QListWidget *) getNativeObject( env, obj );
+  assert( list );
+
+  // FIXME: Multiple selection is buggy in Qt4. Workaround needed.
+  list->setSelectionMode( ((allow == JNI_TRUE) ? QAbstractItemView::MultiSelection : QAbstractItemView::SingleSelection) );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenubarpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenubarpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenubarpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenubarpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,150 @@
+/* qtmenubarpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QMenuBar>
+#include <QToolBar>
+#include <QMenu>
+#include <QList>
+#include <QThread>
+#include <gnu_java_awt_peer_qt_QtMenuBarPeer.h>
+#include "nativewrapper.h"
+#include "qtstrings.h"
+#include "mainthreadinterface.h"
+
+/*
+ * Event wrapper to add a menu to a menu bar
+ */
+class MenuBarAdd : public AWTEvent {
+  
+ private:
+  QMenuBar *widget;
+  QMenu *menu;
+  bool isHelp;
+  
+ public:
+  MenuBarAdd(QMenuBar *w, QMenu *m, bool help) : AWTEvent()
+  {
+    widget = w;
+    menu = m;
+    isHelp = help;
+  }
+
+  void runEvent()
+  {
+    if ( isHelp )
+      widget->addSeparator();
+    QAction *ptr = widget->addMenu( menu );
+  }
+};
+
+/**
+ * Event wrapper to remove a menu from a menu bar.
+ */
+class MenuBarRemove : public AWTEvent {
+  
+ private:
+  QMenuBar *widget;
+  QMenu *menu;
+  
+ public:
+  MenuBarRemove(QMenuBar *w, QMenu *m) : AWTEvent()
+  {
+    widget = w;
+    menu = m;
+  }
+
+  void runEvent()
+  {
+    // FIXME
+  }
+};
+
+
+/*
+ * Constructs a QMenuBar object.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuBarPeer_init
+  (JNIEnv *env, jobject obj)
+{
+  QMenuBar *menubar = new QMenuBar();
+  assert( menubar );
+  setNativeObject( env, obj, menubar );
+}
+
+/*
+ * Adds a menu item.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuBarPeer_addMenu
+(JNIEnv *env, jobject obj, jobject menuPeer)
+{
+  QMenuBar *menubar = (QMenuBar *)getNativeObject(env, obj);
+  assert( menubar );
+  QMenu *menu = (QMenu *)getNativeObject(env, menuPeer);
+  assert( menu );
+  mainThread->postEventToMain( new MenuBarAdd( menubar, menu, false ) );
+}
+
+/*
+ * Add a help menu.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuBarPeer_addHelpMenu
+(JNIEnv *env, jobject obj, jobject menuPeer)
+{
+  QMenuBar *menubar = (QMenuBar *)getNativeObject(env, obj);
+  assert( menubar );
+  QMenu *menu = (QMenu *)getNativeObject(env, menuPeer);
+  assert( menu );
+
+  mainThread->postEventToMain( new MenuBarAdd( menubar, menu, true ) );
+}
+
+/*
+ * Delete a menu.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuBarPeer_delMenu
+(JNIEnv *env, jobject obj, jobject menuPeer)
+{
+  QMenuBar *menubar = (QMenuBar *)getNativeObject(env, obj);
+  assert( menubar );
+  QMenu *menu = (QMenu *)getNativeObject(env, menuPeer);
+  assert( menu );
+
+  // FIXME
+
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenucomponentpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenucomponentpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenucomponentpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenucomponentpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,66 @@
+/* qtmenucomponentpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QWidget>
+#include <gnu_java_awt_peer_qt_QtMenuComponentPeer.h>
+#include "nativewrapper.h"
+#include "componentevent.h"
+
+
+/**
+ * Calls back init() from the main thread.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuComponentPeer_callInit
+(JNIEnv *env, jobject obj)
+{
+  mainThread->postEventToMain( new AWTInitEvent( env, obj ) );
+  // wait for the thing to be created.
+}
+
+/*
+ * Generic disposal.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuComponentPeer_dispose
+(JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *) getNativeObject( env, obj );
+  assert( widget );
+
+  setNativeObject(env, obj, NULL);
+  mainThread->postEventToMain( new AWTDestroyEvent( widget ) );
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenuitempeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenuitempeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenuitempeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenuitempeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,182 @@
+/* qtmenuitempeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QMenu>
+#include <QAction>
+#include <QThread>
+#include <gnu_java_awt_peer_qt_QtMenuItemPeer.h>
+#include "nativewrapper.h"
+#include "qtstrings.h"
+#include "mainthreadinterface.h"
+
+class MenuItemDestroyEvent : public AWTEvent {
+  
+ private:
+  QAction *widget;
+
+ public:
+  MenuItemDestroyEvent(QAction *w)
+  {
+    widget = w;
+  }
+  
+  void runEvent()
+  {
+    delete widget;
+  }
+};
+
+class MenuItemLabelEvent : public AWTEvent {
+  
+ private:
+  QAction *widget;
+  QString *string;
+  
+ public:
+  MenuItemLabelEvent(QAction *w, QString *s) : AWTEvent()
+  {
+    widget = w;
+    string = s;
+  }
+
+  void runEvent()
+  {
+    widget->setText( *string );
+    delete string;
+  }
+};
+
+class MenuItemStatusEvent : public AWTEvent {
+  
+ private:
+  QAction *widget;
+  bool enabled;
+  bool value;
+  
+ public:
+  MenuItemStatusEvent(QAction *w, bool e, bool v) : AWTEvent()
+  {
+    widget = w;
+    enabled = e; 
+    value = v;
+  }
+
+  void runEvent()
+  {
+    if( enabled )
+      widget->setEnabled( value );
+    else
+      widget->setChecked( value );
+  }
+};
+
+/*
+ * Creates a QAction object
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuItemPeer_create
+(JNIEnv *env, jobject obj, jstring label, jboolean isSeperator, jboolean isCheckable)
+{
+  QAction *action;
+  if(label == NULL || isSeperator == JNI_TRUE)
+    {
+      action = new QAction(NULL);
+      action->setSeparator(true);
+      assert( action );
+    } 
+  else
+    {
+      QString *qStr = getQString(env, label);
+      action = new QAction(*qStr, NULL);
+      delete qStr;
+      assert( action );
+      action->setCheckable( (isCheckable == JNI_TRUE) );
+    }
+  
+  setNativeObject( env, obj, action );
+}
+
+/**
+ * Disposal.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuItemPeer_dispose
+(JNIEnv *env, jobject obj)
+{
+  QAction *action = (QAction *)getNativeObject( env, obj );
+  assert( action );
+  mainThread->postEventToMain( new MenuItemDestroyEvent( action ) );
+}
+
+/*
+ * Enables/disables the item
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuItemPeer_setEnabled
+(JNIEnv *env, jobject obj, jboolean enabled)
+{
+  QAction *action = (QAction *)getNativeObject( env, obj );
+  assert( action );
+  mainThread->postEventToMain(new MenuItemStatusEvent(action, true,
+						      (enabled == JNI_TRUE)));
+}
+
+/*
+ * Sets the item label.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuItemPeer_setLabel
+(JNIEnv *env, jobject obj, jstring label)
+{
+  QAction *action = (QAction *)getNativeObject( env, obj );
+  assert( action );
+
+  QString *qStr = getQString(env, label);
+  mainThread->postEventToMain( new MenuItemLabelEvent( action, qStr ) );
+}
+
+/*
+ * Sets the checkbox state.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuItemPeer_setState
+(JNIEnv *env, jobject obj, jboolean state)
+{
+  QAction *action = (QAction *)getNativeObject( env, obj );
+  assert( action );
+  mainThread->postEventToMain(new MenuItemStatusEvent(action, false,
+						      (state == JNI_TRUE)));
+}
+
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenupeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenupeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenupeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtmenupeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,254 @@
+/* qtmenupeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QMenu>
+#include <gnu_java_awt_peer_qt_QtMenuPeer.h>
+#include "nativewrapper.h"
+#include "qtstrings.h"
+#include "mainthreadinterface.h"
+#include "slotcallbacks.h"
+#include "componentevent.h"
+
+typedef enum ActionType {
+  ActionMenu,
+  ActionItem,
+  ActionSeparator
+} ActionType;
+
+// Sets the title, but also tear-off.
+class MenuTitleEvent : public AWTEvent {
+  
+ private:
+  QMenu *widget;
+  QString *string;
+  bool tearOff;
+  
+ public:
+  MenuTitleEvent(QMenu *w, QString *s, bool tear) : AWTEvent()
+  {
+    widget = w;
+    string = s;
+    tearOff = tear;
+  }
+
+  void runEvent()
+  {
+    if (tearOff)
+      widget->setTearOffEnabled( true );
+    else
+      {
+	widget->setTitle( *string );
+	delete string;
+      }
+  }
+};
+
+class MenuAction : public AWTEvent {
+  
+ private:
+  QMenu *menu;
+  QAction *action;
+  ActionType actionType; // type of action to add
+  JavaVM *vm;
+  jobject menuPeer;
+  jobject itemPeer;
+
+public:
+  MenuAction(JNIEnv *env, jobject mp, jobject ip, QMenu *m, QAction *a, 
+	     ActionType actionType) : AWTEvent()
+  {
+    menu = m;
+    action = a;
+    this->actionType = actionType;
+    env->GetJavaVM( &vm );
+    menuPeer = env->NewGlobalRef( mp );
+    if( ip != NULL )
+      itemPeer = env->NewGlobalRef( ip );
+    else
+      itemPeer = NULL;
+  }
+  
+  void runEvent()
+  {
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    if (actionType == ActionMenu)
+      menu->addMenu ((QMenu *) action);
+    else
+      menu->addAction (action);
+
+    jclass menuCls = env->GetObjectClass( menuPeer );
+    jmethodID mid = env->GetMethodID(menuCls, "add", "(J)V");
+    env->DeleteLocalRef(menuCls);
+    env->CallVoidMethod( menuPeer, mid, (jlong)action );
+
+    env->DeleteGlobalRef( menuPeer );
+    if( itemPeer != NULL )
+      {
+	setNativeObject( env, itemPeer, action );
+	connectAction(action, env, itemPeer);
+	env->DeleteGlobalRef( itemPeer );
+      }
+  }
+};
+
+class MenuRemoveAction : public AWTEvent {
+  
+ private:
+  QMenu *menu;
+  QAction *action;
+
+public:
+  MenuRemoveAction(QMenu *m, QAction *a) : AWTEvent()
+  {
+    menu = m;
+    action = a;
+  }
+
+  void runEvent()
+  {
+    if (action)
+      menu->removeAction(action);
+  }
+};
+
+/*
+ * Constructs a QMenu item
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QMenu *menu = new QMenu();
+  assert( menu );
+
+  setNativeObject( env, obj, menu );
+}
+
+/**
+ * Allows tear-off: Only called once, if ever.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuPeer_allowTearOff
+(JNIEnv *env, jobject obj)
+{
+  QMenu *menu = (QMenu *)getNativeObject( env, obj );
+  assert( menu );
+  mainThread->postEventToMain( new MenuTitleEvent( menu, NULL, true ) );
+}
+
+/*
+ * Inserts a seperator.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuPeer_insertSeperator
+(JNIEnv *env, jobject obj)
+{
+  QMenu *menu = (QMenu *)getNativeObject( env, obj );
+  assert( menu );
+  mainThread->postEventToMain( new MenuAction( env, obj, NULL,
+					       menu, NULL, ActionSeparator ) );
+}
+
+/*
+ * Inserts an item.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuPeer_insertItem
+(JNIEnv *env, jobject obj, jobject item)
+{
+  QMenu *menu = (QMenu *)getNativeObject( env, obj );
+  assert( menu );
+
+  QAction *action = (QAction *)getNativeObject( env, item );
+  assert( action );
+
+  mainThread->postEventToMain( new MenuAction( env, obj, item, menu, action, ActionItem ));
+}
+
+/*
+ * Inserts a sub-menu
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuPeer_insertMenu
+(JNIEnv *env, jobject obj, jobject menu)
+{
+  assert( menu );
+  QMenu *thisMenu = (QMenu *)getNativeObject( env, obj );
+  assert( thisMenu );
+  QMenu *insMenu = (QMenu *)getNativeObject(env, menu);
+  assert( insMenu );
+
+  mainThread->postEventToMain( new MenuAction( env, obj, menu, thisMenu, (QAction *)insMenu, ActionMenu ) );
+}
+
+/*
+ * Removes an item at index.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuPeer_delItem
+(JNIEnv *env, jobject obj, jlong ptr)
+{
+  QMenu *menu = (QMenu *)getNativeObject( env, obj );
+  assert( menu );
+  QAction *action = (QAction *)ptr;
+
+  mainThread->postEventToMain( new MenuRemoveAction( menu, action ) );
+}
+
+/*
+ * Enables/Disables the menu.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuPeer_setEnabled
+(JNIEnv *env, jobject obj, jboolean enabled)
+{
+  QMenu *menu = (QMenu *)getNativeObject( env, obj );
+  assert( menu );
+
+  mainThread->postEventToMain(new AWTEnableEvent(menu, (enabled == JNI_TRUE)));
+}
+
+/*
+ * Sets the menu title.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuPeer_setLabel
+(JNIEnv *env, jobject obj, jstring label)
+{
+  if(label == NULL)
+    return;
+
+  QMenu *menu = (QMenu *)getNativeObject( env, obj );
+  assert( menu );
+  QString *qStr = getQString(env, label);
+  mainThread->postEventToMain( new MenuTitleEvent( menu, qStr, false ) );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtpanelpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtpanelpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtpanelpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtpanelpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,77 @@
+/* qtpanelpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <qwidget.h>
+#include <gnu_java_awt_peer_qt_QtPanelPeer.h>
+#include "qtcomponent.h"
+#include "keybindings.h"
+
+class MyPanel : public QWidget
+{
+public:
+  MyPanel(JNIEnv *env, jobject obj, QWidget *parent) : QWidget( parent )
+  {
+    setup(env, obj);
+  }
+
+  ~MyPanel()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QWidget
+#include "eventmethods.h"
+#undef I_KNOW_WHAT_IM_DOING
+#undef PARENT
+};
+
+/**
+ * Init
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtPanelPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *) getParentWidget( env, obj );  
+  QWidget *canvas = new MyPanel( env, obj, parentWidget );
+  assert( canvas );
+  
+  setNativeObject( env, obj, canvas );
+}
+
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtpopupmenupeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtpopupmenupeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtpopupmenupeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtpopupmenupeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,76 @@
+/* qtpopupmenupeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QMenu>
+#include <QPoint>
+#include <QWidget>
+#include <gnu_java_awt_peer_qt_QtPopupMenuPeer.h>
+#include "nativewrapper.h"
+#include "qtstrings.h"
+#include "mainthreadinterface.h"
+
+class PopupMenuShowEvent : public AWTEvent {
+  
+ private:
+  QMenu *menu;
+  int x, y;
+
+ public:
+  PopupMenuShowEvent(QMenu *m, int x0, int y0) : AWTEvent()
+  {
+    menu = m;
+    x = x0;
+    y = y0;
+  }
+
+  void runEvent()
+  {
+    menu->exec( QPoint( x, y ) );
+  }
+};
+
+/*
+ * Shows the menu.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtPopupMenuPeer_showNative
+(JNIEnv *env, jobject obj, jint x, jint y)
+{  
+  QMenu *menu = (QMenu *)getNativeObject( env, obj );
+  assert( menu );
+  mainThread->postEventToMain( new PopupMenuShowEvent(menu, x, y ) );
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscreendevice.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscreendevice.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscreendevice.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscreendevice.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,123 @@
+/* qtscreendevice.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QApplication>
+#include <QDesktopWidget>
+#include <gnu_java_awt_peer_qt_QtScreenDevice.h>
+#include "nativewrapper.h"
+
+extern QApplication *qApplication;
+
+/*
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScreenDevice_init
+(JNIEnv *env, jobject obj, jint id)
+{
+  QWidget *widget = qApplication->desktop()->screen( id );
+  assert( widget );
+  setNativeObject(env, obj, widget);
+}
+
+/*
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScreenDevice_dispose
+(JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *)getNativeObject(env, obj);
+  setNativeObject(env, obj, NULL);
+  if( widget )
+    delete widget;
+}
+
+/*
+ * Returns the bounds
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtScreenDevice_getBounds
+(JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *)getNativeObject(env, obj);
+  assert( widget );
+
+  jclass cls = env->FindClass("java/awt/Rectangle");
+  jmethodID mid = env->GetMethodID(cls, "<init>", "(IIII)V");
+  jvalue values[4];
+
+  int x,y,w,h;
+  widget->geometry().getRect( &x, &y, &w, &h );
+  
+  values[0].i = (jint) x;
+  values[1].i = (jint) y;
+  values[2].i = (jint) w;
+  values[3].i = (jint) h;
+
+  return env->NewObjectA(cls, mid, values);
+}
+
+/*
+ * Returns the X DPI
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtScreenDevice_getDpiX
+(JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *)getNativeObject(env, obj);
+  assert( widget );
+  return widget->logicalDpiX();
+}
+
+/*
+ * Returns the Y DPI
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtScreenDevice_getDpiY
+(JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *)getNativeObject(env, obj);
+  assert( widget );
+  return widget->logicalDpiY();
+}
+
+/*
+ * Returns the bitplane depth
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtScreenDevice_depth
+(JNIEnv *env, jobject obj)
+{
+  QWidget *widget = (QWidget *)getNativeObject(env, obj);
+  assert( widget );
+  return widget->depth();
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscrollbarpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscrollbarpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscrollbarpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscrollbarpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,142 @@
+/* qtscrollbarpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QScrollBar>
+#include <gnu_java_awt_peer_qt_QtScrollbarPeer.h>
+#include "keybindings.h"
+#include "slotcallbacks.h"
+#include "qtcomponent.h"
+
+// Constant fields from java.awt.Scrollbar
+#define HORIZONTAL 0
+#define VERTICAL   1
+
+class MyScrollBar : public QScrollBar
+{
+public:
+  MyScrollBar(JNIEnv *env, jobject obj, QWidget *parent) : QScrollBar( parent )
+  {
+    setup(env, obj);
+  }
+
+  ~MyScrollBar()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QScrollBar
+#include "eventmethods.h"
+};
+
+/*
+ * Construct a QScrollbar object
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollbarPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *)getParentWidget( env, obj );
+  assert( parentWidget );
+  //  QScrollBar *scrollbar = new QScrollBar( parentWidget );
+  MyScrollBar *scrollbar = new MyScrollBar( env, obj, parentWidget );
+  assert( scrollbar );
+      
+  setNativeObject( env, obj, scrollbar );
+  connectScrollBar(scrollbar, env, obj);
+}
+
+/*
+ * Set the line increment.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollbarPeer_setLineIncrement
+(JNIEnv *env, jobject obj, jint inc)
+{
+  QScrollBar *bar = (QScrollBar *) getNativeObject( env, obj );
+  assert( bar );
+
+  bar->setSingleStep(inc);
+}
+
+/**
+ * Sets the orientation of the scrollbar
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollbarPeer_setOrientation
+(JNIEnv *env, jobject obj, jint orientation)
+{
+  QScrollBar *bar = (QScrollBar *) getNativeObject( env, obj );
+  assert( bar );
+
+  switch(orientation)
+    {
+    case HORIZONTAL:
+      bar->setOrientation ( Qt::Horizontal );
+      break;
+      
+    default:
+    case VERTICAL:
+      bar->setOrientation ( Qt::Vertical );
+      break;
+    }
+}
+
+/**
+ * Sets the page increment (equivalent to slider size)
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollbarPeer_setPageIncrement
+(JNIEnv *env, jobject obj, jint inc)
+{
+  QScrollBar *bar = (QScrollBar *) getNativeObject( env, obj );
+  assert( bar );
+
+  bar->setPageStep( inc );
+}
+
+/*
+ * Setvalues.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollbarPeer_setValues
+(JNIEnv *env, jobject obj, jint value, jint visible, jint min, jint max)
+{
+  QScrollBar *bar = (QScrollBar *) getNativeObject( env, obj );
+  assert( bar );
+
+  bar->setValue(value);
+  bar->setPageStep( visible ); // page step and slider size are the same in Qt
+  bar->setRange( min , max );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscrollpanepeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscrollpanepeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscrollpanepeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtscrollpanepeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,214 @@
+/* qtscrollpanepeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QScrollArea>
+#include <QScrollBar>
+#include <gnu_java_awt_peer_qt_QtScrollPanePeer.h>
+#include "qtcomponent.h"
+#include "containers.h"
+#include "mainthreadinterface.h"
+#include "componentevent.h"
+#include "keybindings.h"
+
+// Constants in java.awt.ScrollPane
+#define	SCROLLBARS_AS_NEEDED 	0
+#define SCROLLBARS_ALWAYS 	1
+#define	SCROLLBARS_NEVER 	2
+
+
+class MyScrollArea : public QScrollArea
+{
+public:
+  MyScrollArea(JNIEnv *env, jobject obj, QWidget *parent) : QScrollArea( parent )
+  {
+    setup(env, obj);
+  }
+
+  ~MyScrollArea()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QScrollArea
+#include "eventmethods.h"
+};
+
+
+class ScrollPanePolicy : public AWTEvent {
+  
+ private:
+  QScrollArea *widget;
+  Qt::ScrollBarPolicy policy;
+
+ public:
+  ScrollPanePolicy(QScrollArea *w, Qt::ScrollBarPolicy p) : AWTEvent()
+  {
+    widget = w;
+    policy = p;
+  }
+
+  void runEvent()
+  {
+    widget->setHorizontalScrollBarPolicy(policy);
+    widget->setVerticalScrollBarPolicy(policy);
+  }
+};
+
+/**
+ * Returns the child widget, given the owner Component.
+ */
+QWidget *scrollPaneChildWidget( JNIEnv *env, jobject component )
+{
+  jclass scrollpaneCls = env->FindClass( "java/awt/ScrollPane" );
+  jmethodID getPeerMID = env->GetMethodID( scrollpaneCls,
+					   "getPeer",
+					   "()Ljava/awt/peer/ComponentPeer;");
+  assert(getPeerMID != 0);
+  jobject scrollpanepeerobj = env->CallObjectMethod( component, getPeerMID, NULL );
+  QScrollArea *view = (QScrollArea *) getNativeObject( env, scrollpanepeerobj );
+  assert(view != 0);
+  return view->viewport();
+}
+
+/*
+ * Creates a QScrollArea object.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollPanePeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *) getParentWidget( env, obj );  
+  assert( parentWidget );
+  //  QScrollArea *pane = new MyScrollArea( env, obj, parentWidget );
+  QScrollArea *pane = new QScrollArea( parentWidget );
+  assert( pane );
+  setNativeObject( env, obj, pane );
+}
+
+/*
+ * Resize the child.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollPanePeer_childResized
+(JNIEnv *env, jobject obj, jint w, jint h)
+{  
+  QScrollArea *view = (QScrollArea *) getNativeObject( env, obj );
+  assert( view );
+
+  QWidget *child = view->viewport();
+  assert( child );
+  //  child->setGeometry( 0, 0, w, h );
+//   child->update();
+  mainThread->postEventToMain( new AWTResizeEvent(child, 0, 0, w, h) );
+}
+
+/*
+ * Returns the horizontal scrollbar height.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtScrollPanePeer_getHScrollbarHeight
+(JNIEnv *env, jobject obj)
+{
+  QScrollArea *pane = (QScrollArea *) getNativeObject( env, obj );
+  assert( pane );
+  QScrollBar *hbar = pane->horizontalScrollBar();
+  if(hbar == NULL)
+    return 0;
+  if(!hbar->isVisible())
+    return 0;
+  int height = hbar->height();
+
+  return height;
+}
+
+/*
+ * Returns the vertical scrollbar width.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtScrollPanePeer_getVScrollbarWidth
+(JNIEnv *env, jobject obj)
+{
+  QScrollArea *pane = (QScrollArea *) getNativeObject( env, obj );
+  assert( pane );
+  QScrollBar *vbar = pane->verticalScrollBar();
+  if(vbar == NULL)
+    return 0;
+  if(!vbar->isVisible())
+    return 0;
+  int width = vbar->width();
+
+  return width;
+}
+
+/*
+ * Sets the current upper-left corner to x, y.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollPanePeer_setScrollPosition
+(JNIEnv *env, jobject obj, jint x, jint y)
+{
+  QScrollArea *pane = (QScrollArea *) getNativeObject( env, obj );
+  assert( pane );
+  // pane->scrollContentsBy( x, y );
+}
+
+/*
+ * Sets the scrollbar policy
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollPanePeer_setPolicy
+(JNIEnv *env, jobject obj, jint policy)
+{
+  QScrollArea *pane = (QScrollArea *) getNativeObject( env, obj );
+  assert( pane );
+
+  Qt::ScrollBarPolicy qtpolicy;
+  switch( policy )
+    {
+    case SCROLLBARS_ALWAYS:
+      qtpolicy = Qt::ScrollBarAlwaysOn;
+      break;
+
+    case SCROLLBARS_NEVER:
+      qtpolicy = Qt::ScrollBarAlwaysOff;
+      break;
+
+    default:
+    case SCROLLBARS_AS_NEEDED:
+      qtpolicy = Qt::ScrollBarAsNeeded;
+      break;
+   }
+
+  mainThread->postEventToMain( new ScrollPanePolicy( pane, qtpolicy ) );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtstrings.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtstrings.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtstrings.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtstrings.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,54 @@
+/* qtstrings.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "qtstrings.h"
+
+QString *getQString(JNIEnv *env, jstring str)
+{  
+  QString qStr;
+  {
+    const char *chars = env->GetStringUTFChars( str, NULL );
+    qStr = QString::fromUtf8( chars, env->GetStringLength( str ) );
+    env->ReleaseStringUTFChars( str, chars );
+  }
+  return new QString(qStr);
+}
+
+jstring getJavaString(JNIEnv *env, QString *qstring)
+{
+  return env->NewStringUTF(qstring->toUtf8());
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtstrings.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtstrings.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtstrings.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtstrings.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,10 @@
+#ifndef QTSTRINGS_H
+#define QTSTRINGS_H
+
+#include <jni.h>
+#include <QString>
+
+QString *getQString(JNIEnv *env, jstring str);
+jstring getJavaString(JNIEnv *env, QString *qstring);
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttextareapeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttextareapeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttextareapeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttextareapeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,197 @@
+/* qttextareapeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <time.h>
+#include <QTextEdit>
+#include <QTextCursor>
+#include <gnu_java_awt_peer_qt_QtTextAreaPeer.h>
+#include "mainthreadinterface.h"
+#include "componentevent.h"
+#include "slotcallbacks.h"
+#include "qtcomponent.h"
+#include "qtstrings.h"
+
+class TASetText : public AWTEvent {
+ private:
+  QTextEdit *area;
+  QString *text;
+
+ public:
+  TASetText(QTextEdit *w, QString *t) : AWTEvent()
+  {
+    area = w;
+    text = t;
+  }
+
+  void runEvent()
+  {
+    area->setPlainText( *text );
+    delete text;
+  }
+};
+
+/*
+ * Construct a QTextEdit object
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextAreaPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *)getParentWidget( env, obj );
+  assert( parentWidget );
+  QTextEdit *editor = new QTextEdit( parentWidget );
+  editor->setGeometry( 0, 0, 400, 400 );
+  assert( editor );
+
+  //  setLineWrapColumnOrWidth ( int w );
+  setNativeObject( env, obj, editor );
+
+  // Connect TextChanged events.
+  connectTextEdit(editor, env, obj);
+}
+
+/*
+ * Returns the cursor position.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtTextAreaPeer_getCaretPosition
+(JNIEnv *env, jobject obj)
+{
+  int index;
+  
+  QTextEdit *editor = (QTextEdit *) getNativeObject( env, obj );
+  assert( editor );
+
+  index = editor->textCursor().position();;
+
+  return (jint)index;
+}
+
+/*
+ * Returns the char index at a given screen point
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtTextAreaPeer_getIndexAtPoint
+(JNIEnv *env, jobject obj, jint x, jint y)
+{
+  QPoint *p = new QPoint(x,y);
+  
+  QTextEdit *editor = (QTextEdit *) getNativeObject( env, obj );
+  assert( editor );
+  QTextCursor curs = editor->cursorForPosition( *p );
+  delete p;
+
+  return curs.position();
+}
+
+/*
+ * Returns the start (start = true) or end (start = false) of the selection.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtTextAreaPeer_getSelection
+(JNIEnv *env, jobject obj, jboolean isStart)
+{
+  int start, end;
+  
+  QTextEdit *editor = (QTextEdit *) getNativeObject( env, obj );
+  assert( editor );
+  start = editor->textCursor().selectionStart();
+  end =  editor->textCursor().selectionEnd();
+
+  return ((isStart == JNI_TRUE) ? start : end);
+}
+
+/*
+ * Returns the text.
+ */
+JNIEXPORT jstring JNICALL Java_gnu_java_awt_peer_qt_QtTextAreaPeer_getText
+(JNIEnv *env, jobject obj)
+{
+  QTextEdit *editor = (QTextEdit *) getNativeObject( env, obj );
+  assert( editor );
+  QString text = editor->toPlainText();
+
+  return getJavaString(env, &text);
+}
+
+/*
+ * Sets the editor text.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextAreaPeer_setText
+(JNIEnv *env, jobject obj, jstring str)
+{
+  QTextEdit *editor = (QTextEdit *) getNativeObject( env, obj );
+  assert( editor );
+
+  QString *qStr = getQString(env, str);
+  mainThread->postEventToMain( new TASetText( editor, qStr ) );
+}
+
+/*
+ * Sets the selection.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextAreaPeer_select
+(JNIEnv *env, jobject obj, jint startpos, jint endpos)
+{
+  QTextEdit *editor = (QTextEdit *) getNativeObject( env, obj );
+  assert( editor );
+
+  QTextCursor curs(editor->document());
+  curs.setPosition(startpos);
+  curs.setPosition(endpos, QTextCursor::KeepAnchor);
+  editor->setTextCursor( curs );
+}
+
+/*
+ * Allow or disallow editing.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextAreaPeer_setEditable
+(JNIEnv *env, jobject obj, jboolean editable)
+{
+  QTextEdit *editor = (QTextEdit *) getNativeObject( env, obj );
+  assert( editor );
+  editor->setReadOnly( (editable != JNI_TRUE) );
+}
+
+/*
+ * Sets the cursor position
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextAreaPeer_setCaretPosition
+(JNIEnv *env, jobject obj, jint index)
+{
+  QTextEdit *editor = (QTextEdit *) getNativeObject( env, obj );
+  assert( editor );
+
+  editor->textCursor().setPosition( index );
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttextfieldpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttextfieldpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttextfieldpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttextfieldpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,290 @@
+/* qttextfieldpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QLineEdit>
+#include <QWidget>
+#include <gnu_java_awt_peer_qt_QtTextFieldPeer.h>
+#include "qtcomponent.h"
+#include "qtstrings.h"
+#include "slotcallbacks.h"
+#include "mainthreadinterface.h"
+
+class TFEchoChar : public AWTEvent {
+ private:
+  QLineEdit *line;
+  jchar c;
+
+ public:
+  TFEchoChar(QLineEdit *w, jchar ch) : AWTEvent()
+  {
+    line = w;
+    c = ch;
+  }
+
+  void runEvent()
+  {
+    line->setEchoMode( (c) ? QLineEdit::Password : QLineEdit::Normal );
+  }
+};
+
+class TFEditable : public AWTEvent {
+ private:
+  QLineEdit *line;
+  bool editable;
+
+ public:
+  TFEditable(QLineEdit *w, bool e) : AWTEvent()
+  {
+    line = w;
+    editable = e;
+  }
+
+  void runEvent()
+  {
+    line->setReadOnly( editable );
+  }
+};
+
+class TFSetText : public AWTEvent {
+ private:
+  QLineEdit *line;
+  QString *text;
+
+ public:
+  TFSetText(QLineEdit *w, QString *t) : AWTEvent()
+  {
+    line = w;
+    text = t;
+  }
+
+  void runEvent()
+  {
+    line->setText( *text );
+    delete text;
+  }
+};
+
+class TFSetCursorPos : public AWTEvent {
+ private:
+  QLineEdit *line;
+  int pos;
+
+ public:
+  TFSetCursorPos(QLineEdit *w, int p) : AWTEvent()
+  {
+    line = w;
+    pos = p;
+  }
+
+  void runEvent()
+  {
+    line->setCursorPosition(pos);
+  }
+};
+
+class TFSelect : public AWTEvent {
+ private:
+  QLineEdit *line;
+  int start,end;
+
+ public:
+  TFSelect(QLineEdit *w, int s, int e) : AWTEvent()
+  {
+    line = w;
+    start = s;
+    end = e;
+  }
+
+  void runEvent()
+  {
+    line->setSelection(start, end - start);
+  }
+};
+
+
+/*
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *parentWidget = (QWidget *)getParentWidget(env, obj);
+  assert( parentWidget );
+  QLineEdit *line = new QLineEdit( parentWidget );
+  assert( line );
+  
+  setNativeObject( env, obj, line );
+  connectLineEdit(line, env, obj);
+}
+
+
+/*
+ * Sets the echo char.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_setEchoChar
+(JNIEnv *env, jobject obj, jchar echo)
+{
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+  mainThread->postEventToMain( new TFEchoChar( line, echo ) );
+}
+
+/*
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_getMinimumSizeNative
+(JNIEnv *env, jobject obj, jint columns)
+{
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+
+  // FIXME does this work?
+  int old = line->maxLength();
+  line->setMaxLength(columns);
+  QSize size = line->minimumSizeHint();
+  line->setMaxLength(old);
+
+  return makeDimension(env, &size);
+}
+
+/*
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_getPreferredSizeNative
+(JNIEnv *env, jobject obj, jint columns)
+{
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+
+  int old = line->maxLength();
+  line->setMaxLength(columns);
+  QSize size = line->sizeHint();
+  line->setMaxLength(old);
+
+  return makeDimension(env, &size);
+}
+
+/*
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_setEditable
+(JNIEnv *env, jobject obj, jboolean edit)
+{
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+
+  mainThread->postEventToMain( new TFEditable( line, (edit != JNI_TRUE) ) );
+}
+
+/*
+ * Gets the text.
+ */
+JNIEXPORT jstring JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_getText
+(JNIEnv *env, jobject obj)
+{
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+  QString text = line->text();
+
+  return getJavaString(env, &text);
+}
+
+/*
+ * Sets the text
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_setText
+(JNIEnv *env, jobject obj, jstring text)
+{
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+
+  QString *qStr = getQString(env, text);
+  mainThread->postEventToMain( new TFSetText( line, qStr ) );
+}
+
+/*
+ * Returns the start (start = true) or end (start = false) of the selection.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_getSelection
+(JNIEnv *env, jobject obj, jboolean start)
+{
+  int index, length;
+  
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+  index = line->selectionStart();
+
+  if(start == JNI_TRUE)
+    return index;
+
+  length = (line->selectedText()).length();
+
+  return index + length;
+}
+
+/*
+ * Sets the selection.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_select
+(JNIEnv *env, jobject obj, jint start, jint end)
+{
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+
+  mainThread->postEventToMain( new TFSelect( line, start, end ) );
+}
+
+/*
+ * Sets the cursor position.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_setCaretPosition
+(JNIEnv *env, jobject obj, jint pos)
+{
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+  mainThread->postEventToMain( new TFSetCursorPos( line, (int)pos ) );
+}
+
+/*
+ * Returns the caret position.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtTextFieldPeer_getCaretPosition
+(JNIEnv *env, jobject obj)
+{
+  QLineEdit *line = (QLineEdit *) getNativeObject( env, obj );
+  assert( line );
+
+  return line->cursorPosition();
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttoolkit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttoolkit.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttoolkit.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qttoolkit.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,156 @@
+/* qttoolkit.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QString>
+#include <QStringList>
+#include <QFontDatabase>
+#include <gnu_java_awt_peer_qt_QtToolkit.h>
+#include "qtcomponent.h"
+#include "mainthreadinterface.h"
+#include "qtstrings.h"
+
+extern QApplication *qApplication;
+
+/**
+ * Calls syncX();
+ */
+class AWTSyncEvent : public AWTEvent {
+  
+ private:
+  QApplication *application;
+  
+ public:
+  AWTSyncEvent(QApplication *app) : AWTEvent()
+  {
+    application = app;
+  }
+
+  void runEvent()
+  {
+    application->syncX();
+  }
+};
+
+/*
+ * Causes your machine to beep. Wow.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtToolkit_beep
+(JNIEnv *env, jobject obj)
+{
+  qApplication->beep();
+}
+
+/**
+ * Returns the # of the default screen.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtToolkit_defaultScreen
+(JNIEnv *env, jobject obj)
+{
+  return (jint) qApplication->desktop()->primaryScreen();
+}
+
+/**
+ * Returns the # of screens.
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtToolkit_numScreens
+(JNIEnv *env, jobject obj)
+{ 
+  return (jint) qApplication->desktop()->numScreens();
+}
+
+/*
+ * Returns the screen size.
+ */
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtToolkit_getScreenSize
+(JNIEnv *env, jobject obj)
+{
+  QDesktopWidget *d = QApplication::desktop();
+  QSize s = d->size();
+  return makeDimension( env, &s );
+}
+
+/*
+ * Returns the available fonts
+ */
+JNIEXPORT jobjectArray JNICALL Java_gnu_java_awt_peer_qt_QtToolkit_nativeFontFamilies
+(JNIEnv *env, jobject obj)
+{
+  jobjectArray result_array;
+  jobject *result_array_ptr;
+  QFontDatabase db;
+  QStringList fonts = db.families();
+
+  result_array = env->NewObjectArray(fonts.size(), 
+				     env->FindClass("java/lang/String"),
+				     env->NewStringUTF(""));
+  for (int i = 0; i < fonts.size(); i++)
+    {
+      QString qstr = fonts.at(i);
+      jstring jstr = getJavaString(env, &qstr);
+      env->SetObjectArrayElement( result_array, i, jstr );
+    }
+  return result_array;
+}
+
+
+/*
+ * Returns the screen resolution 
+ */
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_qt_QtToolkit_getScreenResolution
+(JNIEnv *env, jobject obj)
+{
+  QDesktopWidget *d = qApplication->desktop();
+
+  // Java assumes square pixels. Qt, more intelligently, does not.
+  // What to do? Well.. Average them?
+  // FIXME: Weird values?
+  int dpi = (d->logicalDpiX() + d->logicalDpiY()) >> 1;
+
+  return (jint)dpi;
+}
+
+/*
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtToolkit_sync
+(JNIEnv *env, jobject obj)
+{
+  // SyncX needs to be called from the main thread.
+  mainThread->postEventToMain( new AWTSyncEvent( qApplication ) );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtvolatileimage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtvolatileimage.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtvolatileimage.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtvolatileimage.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,347 @@
+/* qtvolatileimage.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QPixmap>
+#include <QImage>
+#include <QColor>
+#include <QMatrix>
+#include <QPainter>
+#include <gnu_java_awt_peer_qt_QtVolatileImage.h>
+#include "qtimage.h"
+#include "qtstrings.h"
+#include "qtgraphics.h"
+#include "nativewrapper.h"
+
+/* The constant fields in java.awt.Image */   
+#define SCALE_DEFAULT      1
+#define SCALE_FAST         2
+#define SCALE_SMOOTH       4
+#define SCALE_REPLICATE    8 
+#define SCALE_AREA_AVERAGING  16
+
+QPixmap *getQtVolatileImage( JNIEnv *env, jobject obj )
+{
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  return (QPixmap *)env->GetLongField( obj, field );
+}
+
+static void setNativePtr( JNIEnv *env, jobject obj, void *value )
+{
+  jlong longValue = (jlong) value; 
+  jclass cls = env->GetObjectClass( obj );
+  jfieldID field = env->GetFieldID( cls, "nativeObject", "J" );
+  env->SetLongField( obj, field, longValue );
+}
+
+/*
+ * Clears the image to zero.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_clear
+(JNIEnv *env, jobject obj)
+{
+  QPixmap *image = getQtVolatileImage(env, obj);
+  assert( image );
+  image->fill();
+}
+
+/*
+ * Returns the pixel data in an int array.
+ */
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_getPixels
+(JNIEnv *env, jobject obj)
+{
+  QPixmap *image = getQtVolatileImage(env, obj);
+  jintArray result_array;
+  jint *result_array_ptr, *dst;
+  int x, y;
+  jint pixel;
+  QRgb current;
+
+  assert( image );
+  QImage im = image->toImage();
+
+  result_array = env->NewIntArray (image->width() * image->height());
+  dst = result_array_ptr = 
+    env->GetIntArrayElements(result_array, NULL);
+
+  // A bit inefficient.
+  for ( y = 0; y < image->height(); y++)
+    for ( x = 0; x < image->width(); x++)
+      {
+	current = im.pixel(x, y);
+	pixel = 0;
+	pixel = (qAlpha(current) & 0xFF) << 24 | 
+	  (qRed(current) & 0xFF) << 16 |
+	  (qGreen(current) & 0xFF) << 8 |
+	  (qBlue(current) & 0xFF);
+	*dst = pixel;
+	dst++;
+      }
+
+  env->ReleaseIntArrayElements (result_array, result_array_ptr, 0);
+  return result_array;
+}
+
+/*
+ * Creates a QImage.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_createImage
+(JNIEnv *env, jobject obj)
+{
+  int width, height;
+  jclass cls;
+  jfieldID field;
+
+  cls = env->GetObjectClass( obj );
+  field = env->GetFieldID (cls, "width", "I");
+  assert (field != 0);
+  width = env->GetIntField(obj, field);
+
+  field = env->GetFieldID(cls, "height", "I");
+  assert (field != 0);
+  height = env->GetIntField(obj, field);
+  
+  QPixmap *image = new QPixmap ( width, height );
+  setNativePtr(env, obj, image);
+}
+
+/*
+ * Frees the image data.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_freeImage
+(JNIEnv *env, jobject obj)
+{
+  QPixmap *image = getQtVolatileImage(env, obj);
+  if ( image )
+    delete image;
+  setNativePtr(env, obj, NULL);
+}
+
+/*
+ * Blits a QImage
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_blit__Lgnu_java_awt_peer_qt_QtImage_2
+(JNIEnv *env, jobject obj, jobject i2)
+{
+  QPixmap *image = getQtVolatileImage(env, obj);
+  assert( image );
+
+  QImage *blit = getQtImage(env, i2);
+  assert( blit );
+
+  QPainter *p = new QPainter( image );
+  assert( p );
+  p->drawImage( 0, 0, *blit );
+
+  delete p;
+}
+
+/*
+ * Blits a QImage
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_blit__Lgnu_java_awt_peer_qt_QtImage_2IIII
+(JNIEnv *env, jobject obj, jobject i2, jint x, jint y, jint w, jint h)
+{
+  QPixmap *image = getQtVolatileImage(env, obj);
+  assert( image );
+
+  QImage *blit = getQtImage(env, i2);
+  assert( blit );
+
+  QPainter *p = new QPainter( image );
+  assert( p );
+  p->drawImage( x, y, *blit, x, y, w, h);
+
+  delete p;
+}
+
+/*
+ * Creates a scaled version.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_createScaledImage
+(JNIEnv *env, jobject obj, jobject src, jint hints)
+{
+  int w,h;
+  jclass cls;
+  jfieldID field;
+
+  cls = env->GetObjectClass( obj );
+  field = env->GetFieldID(cls, "width", "I");
+  assert (field != 0);
+  w = env->GetIntField(obj, field);
+
+  field = env->GetFieldID(cls, "height", "I");
+  assert (field != 0);
+  h = env->GetIntField(obj, field);
+
+  QPixmap *ip = getQtVolatileImage(env, src);
+  assert( ip );
+  QImage image = ip->toImage();
+  QImage imageScaled;
+
+  if (hints == SCALE_SMOOTH || hints == SCALE_AREA_AVERAGING)
+    imageScaled = image.scaled(w, h, 
+			       Qt::IgnoreAspectRatio, 
+			       Qt::SmoothTransformation);
+  else
+    imageScaled = image.scaled(w, h, 
+			       Qt::IgnoreAspectRatio, 
+			       Qt::FastTransformation);
+  QImage *scaledPtr = new QImage( imageScaled );
+  
+  // create new QtImage object
+  setNativePtr( env, obj, scaledPtr );
+}
+
+/*
+ * DrawPixels.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_drawPixels
+(JNIEnv *env, jobject obj, jobject graphics, jint bg_red, jint bg_green, 
+ jint bg_blue, jint x, jint y, jboolean composite)
+{
+  QPixmap *image = getQtVolatileImage(env, obj);
+  assert( image );
+  QPainter *painter = getPainter( env, graphics );
+  assert( painter );
+
+  if(composite == JNI_TRUE)
+    painter->fillRect ( x, y, image->width(), image->height(), 
+			QColor(bg_red, bg_green, bg_blue ) );
+  painter->drawPixmap ( QPoint(x, y), *image );
+}
+
+/*
+ * DrawPixels scaled.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_drawPixelsScaled
+(JNIEnv *env, jobject obj, jobject graphics, 
+ jint bg_red, jint bg_green, jint bg_blue, 
+ jint x, jint y, jint w, jint h, jboolean composite)
+{
+  QPixmap *image = getQtVolatileImage(env, obj);
+  assert( image );
+  QPainter *painter = getPainter( env, graphics );
+  assert( painter );
+
+  if(composite == JNI_TRUE)
+    painter->fillRect ( x, y, w, h, QColor(bg_red, bg_green, bg_blue ) );
+  
+  QRectF *srcRect = new QRectF((qreal)0, (qreal)0,
+			       (qreal)image->width(), (qreal)image->height());
+  QRectF *dstRect = new QRectF((qreal)x, (qreal)y,
+			       (qreal)w, (qreal)h);
+  
+  if(composite == JNI_TRUE)
+    painter->fillRect( *dstRect, QColor(bg_red, bg_green, bg_blue ) );
+
+  painter->drawPixmap( *dstRect, *image, *srcRect);
+
+  delete srcRect;
+  delete dstRect;
+}
+
+/*
+ * Draw pixels transformed.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_drawPixelsTransformed
+(JNIEnv *env, jobject obj, jobject graphics, jobject transform)
+{
+  QPixmap *originalImage = getQtVolatileImage(env, obj);
+  assert( originalImage );
+  QPainter *painter = getPainter( env, graphics );
+  assert( painter );
+  QMatrix *matrix = (QMatrix *)getNativeObject(env, transform);
+  assert( matrix );
+
+  // FIXME : Add rendering hint support here.
+  QPoint p = matrix->map( QPoint(0,0) );
+  QImage image = originalImage->toImage().transformed ( *matrix, Qt::FastTransformation );
+  painter->drawImage(p, image);
+}
+
+
+/**
+ * Draw pixels scaled and flipped
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_drawPixelsScaledFlipped
+(JNIEnv *env, jobject obj, jobject graphics,
+ jint bg_red, jint bg_green, jint bg_blue, 
+ jboolean flipx, jboolean flipy,
+ jint srcx, jint srcy, jint srcwidth, jint srcheight, 
+ jint dstx, jint dsty, jint dstwidth, jint dstheight, 
+ jboolean composite)
+{
+  QPixmap *originalImage = getQtVolatileImage(env, obj);
+  assert( originalImage );
+  QPainter *painter = getPainter( env, graphics );
+  assert( painter );
+
+  QRectF *srcRect = new QRectF((qreal)srcx, (qreal)srcy,
+			       (qreal)srcwidth, (qreal)srcheight);
+  QRectF *dstRect = new QRectF((qreal)dstx, (qreal)dsty,
+			       (qreal)dstwidth, (qreal)dstheight);
+  
+  if(composite == JNI_TRUE)
+    painter->fillRect( *dstRect, QColor(bg_red, bg_green, bg_blue ) );
+
+  if( flipx == JNI_TRUE || flipy == JNI_TRUE )
+    {
+      QImage im = originalImage->toImage().mirrored ( (flipx == JNI_TRUE), 
+						      (flipy == JNI_TRUE) );
+      painter->drawImage ( *dstRect, im, *srcRect);
+    }
+  else
+    painter->drawPixmap ( *dstRect, *originalImage, *srcRect);
+
+  delete srcRect;
+  delete dstRect;
+}
+
+/**
+ * Copies an area of the image (used by Graphics)
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtVolatileImage_copyArea
+(JNIEnv *env, jobject obj , jint x, jint y, jint w, jint h, jint dx, jint dy)
+{
+  QPixmap *image = getQtVolatileImage(env, obj);
+  assert( image );
+
+  // FIXME
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtwindowpeer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtwindowpeer.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtwindowpeer.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/qtwindowpeer.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,157 @@
+/* qtwindowpeer.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <assert.h>
+#include <QWidget>
+#include <qstyle.h>
+#include <gnu_java_awt_peer_qt_QtWindowPeer.h>
+#include "qtcomponent.h"
+#include "keybindings.h"
+#include "qtstrings.h"
+#include "containers.h"
+#include "mainthreadinterface.h"
+
+/*
+ * Our QMainWindow subclass
+ */
+class MyWindow : public QWidget
+{
+public:
+  MyWindow(JNIEnv *env, jobject obj) : QWidget(0, (Qt::Window | Qt::FramelessWindowHint))
+  {
+    setup(env, obj);
+  }
+
+  ~MyWindow()
+  {
+    destroy();
+  }
+
+#define I_KNOW_WHAT_IM_DOING
+#define PARENT QWidget
+#include "eventmethods.h"
+};
+
+
+class RaiseLower : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  bool raise;
+
+ public:
+  RaiseLower(QWidget *w, bool r) : AWTEvent()
+  {
+    widget = w;
+    raise = r;
+  }
+
+  void runEvent()
+  {
+    if (raise)
+      widget->raise();
+    else
+      widget->lower();
+  }
+};
+
+class FrameTitleEvent : public AWTEvent {
+  
+ private:
+  QWidget *widget;
+  QString *string;
+  
+ public:
+  FrameTitleEvent(QWidget *w, QString *s) : AWTEvent()
+  {
+    widget = w;
+    string = s;
+  }
+
+  void runEvent()
+  {
+    widget->setWindowTitle( *string );
+    delete string;
+  }
+};
+
+/*
+ * Constructs a top-level QWidget native object.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtWindowPeer_init
+(JNIEnv *env, jobject obj)
+{
+  QWidget *window = new MyWindow(env, obj);
+  assert( window );
+  //  Qt::WStyle_StaysOnTop
+  setNativeObject( env, obj, window );
+}
+
+/*
+ * Lower the window.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtWindowPeer_toBack
+(JNIEnv *env, jobject obj)
+{
+  QWidget *window = (QWidget *) getNativeObject( env, obj );
+  assert( window );
+  mainThread->postEventToMain( new RaiseLower( window, false ) );
+}
+
+/*
+ * Raise the window.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtWindowPeer_toFront
+(JNIEnv *env, jobject obj)
+{
+  QWidget *window = (QWidget *) getNativeObject( env, obj );
+  assert( window );
+  mainThread->postEventToMain( new RaiseLower( window, true ) );
+}
+
+/*
+ * Title.
+ */
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtWindowPeer_setTitle
+(JNIEnv *env, jobject obj, jstring string)
+{
+  QWidget *frame = (QWidget *) getNativeObject( env, obj );
+  assert( frame );
+  QString *qStr = getQString(env, string);
+  mainThread->postEventToMain( new FrameTitleEvent( frame, qStr ) );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/slotcallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/slotcallbacks.cpp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/slotcallbacks.cpp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/slotcallbacks.cpp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,256 @@
+/* slotcallbacks.cpp --
+   Copyright (C)  2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <QObject>
+#include <QAbstractButton>
+#include <QAbstractSlider>
+#include <QAction>
+#include <QComboBox>
+#include <QListWidget>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QTextEdit>
+#include <gnu_java_awt_peer_qt_QtButtonPeer.h>
+#include "qtcomponent.h"
+#include "qtstrings.h"
+#include "keybindings.h"
+#include "buttonevent.h"
+#include "slotcallbacks.h"
+
+// AdjustmentEvent constants
+#define UNIT_INCREMENT   1
+#define UNIT_DECREMENT   2
+#define BLOCK_DECREMENT  3
+#define BLOCK_INCREMENT  4
+#define TRACK  5
+
+
+class SlotCallback : public QObject {
+  Q_OBJECT;
+
+private:
+  JavaVM* vm;
+  jobject target;
+  jclass componentCls;
+  jmethodID fireEventID;
+
+public:
+  QScrollBar *sb; // used only by the scrollbar method.
+  QListWidget *lw; // used only by the listitemclicked method
+
+  SlotCallback(JNIEnv *env, jobject t)
+  {  
+    env->GetJavaVM(&vm);
+    target = t;
+    target = env->NewGlobalRef(t);
+  }
+  
+  ~SlotCallback()
+  {
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    env->DeleteGlobalRef(target);
+  }
+
+  public slots:
+
+  void buttonClicked()
+  {
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    componentCls = env->GetObjectClass( target );
+    fireEventID = env->GetMethodID( componentCls,
+				    "fireClick", 
+				    "(I)V" );
+    int modifiers = getAEKeyModifiers( QApplication::keyboardModifiers() );
+    env->CallVoidMethod( target, fireEventID, modifiers );
+    env->DeleteLocalRef( componentCls );
+  }
+
+  void buttonToggled(bool checked)
+  {
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    componentCls = env->GetObjectClass( target );
+    fireEventID = env->GetMethodID( componentCls,
+				    "fireToggle", 
+				    "(Z)V" );
+    if(checked)
+      env->CallVoidMethod( target, fireEventID, JNI_TRUE );
+    else
+      env->CallVoidMethod( target, fireEventID, JNI_FALSE );
+    env->DeleteLocalRef( componentCls );
+  }
+
+  // Used for List and Choice
+  void choiceActivated( int index )
+  {
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    componentCls = env->GetObjectClass( target );
+    fireEventID = env->GetMethodID( componentCls,
+				    "fireChoice", 
+				    "(I)V" );
+    env->CallVoidMethod( target, fireEventID, (jint)index );
+    env->DeleteLocalRef( componentCls );
+  }
+
+  void textChanged()
+  {
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    componentCls = env->GetObjectClass( target );
+    fireEventID = env->GetMethodID( componentCls,
+				    "textChanged", 
+				    "()V" );
+    env->CallVoidMethod( target, fireEventID );
+    env->DeleteLocalRef( componentCls );
+  }
+
+  void scrollBarAction( int action )
+  {
+    JNIEnv *env;
+    int type;
+    int index;
+    switch(action)
+      {
+      case QAbstractSlider::SliderNoAction:
+	return;
+      case QAbstractSlider::SliderSingleStepAdd:
+	type = UNIT_INCREMENT;
+	break;
+      case QAbstractSlider::SliderSingleStepSub:
+	type = UNIT_DECREMENT;
+	break;
+      case QAbstractSlider::SliderPageStepAdd:
+	type = BLOCK_INCREMENT;
+	break;
+      case QAbstractSlider::SliderPageStepSub:
+	type = BLOCK_DECREMENT;
+	break;
+      case QAbstractSlider::SliderToMinimum:
+	type = TRACK;
+	break;
+      case QAbstractSlider::SliderToMaximum:
+	type = TRACK;
+	break;
+      case QAbstractSlider::SliderMove:
+	type = TRACK;
+	break;
+      }
+    index = sb->value();
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    componentCls = env->GetObjectClass( target );
+    fireEventID = env->GetMethodID( componentCls,
+				    "fireMoved", 
+				    "(II)V" );
+    env->CallVoidMethod( target, fireEventID, (jint)type, (jint)index );
+    env->DeleteLocalRef( componentCls );
+  }
+
+  void listItemClicked( QListWidgetItem * item )
+  {
+    int index = lw->row( item );
+    JNIEnv *env;
+    vm->GetEnv((void **)&env, JNI_VERSION_1_1);
+    componentCls = env->GetObjectClass( target );
+    fireEventID = env->GetMethodID( componentCls,
+				    "itemDoubleClicked", 
+				    "(II)V" );
+    int modifiers = getAEKeyModifiers( QApplication::keyboardModifiers() );
+    env->CallVoidMethod( target, fireEventID, index, modifiers );
+    env->DeleteLocalRef( componentCls );
+  }
+};
+
+#include "slotcallbacks.moc.h"
+
+void connectButton(QPushButton *button, JNIEnv *env, jobject buttonobj)
+{
+  SlotCallback *scb = new SlotCallback(env, buttonobj);
+  QObject::connect( button, SIGNAL( clicked() ), scb, SLOT( buttonClicked() ) );
+}
+
+void connectChoice(QComboBox *choice, JNIEnv *env, jobject choiceobj)
+{
+  SlotCallback *scb = new SlotCallback(env, choiceobj);
+  QObject::connect( choice, SIGNAL( activated(int) ), scb, SLOT( choiceActivated(int) ) );
+}
+
+void connectList(QListWidget *list, JNIEnv *env, jobject listobj)
+{
+  SlotCallback *scb = new SlotCallback(env, listobj);
+  scb->lw = list;
+  QObject::connect( list, SIGNAL( currentRowChanged(int) ), 
+		    scb, SLOT( choiceActivated(int) ) );
+  QObject::connect( list, SIGNAL( itemDoubleClicked( QListWidgetItem * )), 
+		    scb, SLOT( listItemClicked( QListWidgetItem * )));
+}
+
+void connectAction(QAction *action, JNIEnv *env, jobject obj)
+{
+  SlotCallback *scb = new SlotCallback(env, obj);
+  QObject::connect( action, SIGNAL( triggered() ), scb, SLOT( buttonClicked() ) );
+}
+
+void connectToggle(QAbstractButton *action, JNIEnv *env, jobject obj)
+{
+  SlotCallback *scb = new SlotCallback(env, obj);
+  QObject::connect( action, SIGNAL( toggled(bool) ), scb, SLOT( buttonToggled(bool) ) );
+}
+
+void connectScrollBar(QScrollBar *scroll, JNIEnv *env, jobject obj)
+{
+  SlotCallback *scb = new SlotCallback(env, obj);
+  scb->sb = scroll;
+  QObject::connect( scroll, SIGNAL( actionTriggered(int) ), scb, SLOT( scrollBarAction(int) ) );
+}
+
+void connectTextEdit(QTextEdit *edit, JNIEnv *env, jobject obj)
+{
+  SlotCallback *scb = new SlotCallback(env, obj);
+  QObject::connect( edit, SIGNAL( textChanged() ), 
+		    scb, SLOT( textChanged() ) );
+}
+
+void connectLineEdit(QLineEdit *edit, JNIEnv *env, jobject obj)
+{
+  SlotCallback *scb = new SlotCallback(env, obj);
+  QObject::connect( edit, SIGNAL(textChanged( QString ) ), 
+		    scb, SLOT( textChanged() ) );
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/slotcallbacks.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/slotcallbacks.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/slotcallbacks.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/qt-peer/slotcallbacks.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,24 @@
+#ifndef SLOTCALLBACKS_H
+#define SLOTCALLBACKS_H
+
+#include <QAbstractButton>
+#include <QAbstractSlider>
+#include <QAction>
+#include <QComboBox>
+#include <QListWidget>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QScrollBar>
+#include <QTextEdit>
+#include <jni.h>
+
+void connectButton(QPushButton *button, JNIEnv *env, jobject buttonobj);
+void connectChoice(QComboBox *choice, JNIEnv *env, jobject choiceobj);
+void connectAction(QAction *action, JNIEnv *env, jobject obj);
+void connectToggle(QAbstractButton *action, JNIEnv *env, jobject obj);
+void connectScrollBar(QScrollBar *scroll, JNIEnv *env, jobject obj);
+void connectList(QListWidget *list, JNIEnv *env, jobject choiceobj);
+void connectTextEdit(QTextEdit *edit, JNIEnv *env, jobject obj);
+void connectLineEdit(QLineEdit *edit, JNIEnv *env, jobject obj);
+
+#endif

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/BUGS
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/BUGS?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/BUGS (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/BUGS Thu Nov  8 16:56:19 2007
@@ -0,0 +1,35 @@
+GNU Jaxp
+------------------------------------------------------------------------
+
+These bugs are for the gnu.xml.libxmlj package.
+
+CAVEAT: LibxmlJ's current incarnation is incomplete and partly
+incorrect. Highly experimental.
+
+- Thread-safe, but effectively runs single-threaded.
+
+- Native code passes incorrect URIs to URIResolver.resolve.
+
+- Default output properties accessible through JAXP always assume XML
+  output (in violation of the XSLT 1.0 specification, section 16)
+  Correction: LibxmlJ always assumes XML output.
+
+- OutputProperties are not properly implemented, compare code and API
+  documentation.
+
+- TransformerFactory.getAttribute() and
+  TransformerFactory.setAttribute() not implemented, i.e. low-level
+  libxslt settings can currently not be accessed from Java.
+
+- TransformerFactory.getFeature() not implemented, i.e. currently no
+  low-level features of libxslt are advertised.
+
+FIXME:
+
+- Make LRU caching configurable.
+
+- Check whether <?xml encoding="..."?> headers are honored.
+
+- DefaultURIResolver uses naive approach.
+
+- TransformerFactory.getAssociatedStyleSheet() unfinished.

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,27 @@
+nativeexeclib_LTLIBRARIES = libxmlj.la
+
+libxmlj_la_SOURCES = \
+xmlj_dom.c \
+xmlj_dom.h \
+xmlj_error.c \
+xmlj_error.h \
+xmlj_io.c \
+xmlj_io.h \
+xmlj_node.c \
+xmlj_node.h \
+xmlj_sax.c \
+xmlj_sax.h \
+xmlj_transform.c \
+xmlj_util.c \
+xmlj_util.h \
+xmlj_xpath.c
+
+libxmlj_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
+
+AM_LDFLAGS = @CLASSPATH_MODULE@ @XML_LIBS@ @XSLT_LIBS@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+
+# Don't enable ERROR flags. Code isn't warning free yet.
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @XML_CFLAGS@ @XSLT_CFLAGS@
+
+EXTRA_DIST = BUGS

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,618 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/xmlj
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libxmlj_la_DEPENDENCIES = $(top_builddir)/native/jni/classpath/jcl.lo
+am_libxmlj_la_OBJECTS = xmlj_dom.lo xmlj_error.lo xmlj_io.lo \
+	xmlj_node.lo xmlj_sax.lo xmlj_transform.lo xmlj_util.lo \
+	xmlj_xpath.lo
+libxmlj_la_OBJECTS = $(am_libxmlj_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libxmlj_la_SOURCES)
+DIST_SOURCES = $(libxmlj_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libxmlj.la
+libxmlj_la_SOURCES = \
+xmlj_dom.c \
+xmlj_dom.h \
+xmlj_error.c \
+xmlj_error.h \
+xmlj_io.c \
+xmlj_io.h \
+xmlj_node.c \
+xmlj_node.h \
+xmlj_sax.c \
+xmlj_sax.h \
+xmlj_transform.c \
+xmlj_util.c \
+xmlj_util.h \
+xmlj_xpath.c
+
+libxmlj_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo
+AM_LDFLAGS = @CLASSPATH_MODULE@ @XML_LIBS@ @XSLT_LIBS@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+
+# Don't enable ERROR flags. Code isn't warning free yet.
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @XML_CFLAGS@ @XSLT_CFLAGS@
+EXTRA_DIST = BUGS
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/jni/xmlj/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/jni/xmlj/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libxmlj.la: $(libxmlj_la_OBJECTS) $(libxmlj_la_DEPENDENCIES) 
+	$(LINK) -rpath $(nativeexeclibdir) $(libxmlj_la_LDFLAGS) $(libxmlj_la_OBJECTS) $(libxmlj_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmlj_dom.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmlj_error.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmlj_io.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmlj_node.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmlj_sax.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmlj_transform.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmlj_util.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xmlj_xpath.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_dom.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_dom.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_dom.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_dom.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,2617 @@
+/* xmlj_dom.c - 
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "xmlj_dom.h"
+#include "xmlj_error.h"
+#include "xmlj_io.h"
+#include "xmlj_node.h"
+#include "xmlj_sax.h"
+#include "xmlj_util.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+JNIEnv *dom_cb_env;
+jobject dom_cb_obj;
+
+typedef struct
+{
+  int index;
+  int count;
+  xmlNodePtr node;
+}
+xmljHashScanData;
+
+/* Prototypes for local functions */
+
+void
+xmljAddAttribute (xmlNodePtr node, xmlAttrPtr attr);
+
+void
+xmljHashScanner (void *payload, void *vdata, xmlChar *name);
+
+xmlChar *
+xmljGetNodeValue (xmlNodePtr node);
+
+/*
+ * Determines whether a child node is suitable for insertion in the list of
+ * children for a given parent node.
+ * Returns 0 on success, a DOMException code otherwise.
+ */
+void
+xmljValidateChildNode (JNIEnv *env, xmlNodePtr parent, xmlNodePtr child)
+{
+  xmlNodePtr cur;
+  
+  if (child == NULL || parent == NULL)
+    {
+      xmljThrowDOMException (env, 8, NULL); /* NOT_FOUND_ERR */
+      return;
+    }
+  if (child->doc != parent->doc)
+    {
+      xmljThrowDOMException (env, 4, NULL); /* WRONG_DOCUMENT_ERR */
+      return;
+    }
+  /* Check that new parent is of an allowed type */
+  switch (parent->type)
+    {
+    case XML_CDATA_SECTION_NODE:
+    case XML_COMMENT_NODE:
+    case XML_TEXT_NODE:
+    case XML_ENTITY_NODE:
+    case XML_ENTITY_REF_NODE:
+    case XML_NOTATION_NODE:
+    case XML_PI_NODE:
+      /* these can't have any children */
+      /* HIERARCHY_REQUEST_ERR */
+      xmljThrowDOMException (env, 3, "parent type does not allow children");
+      return;
+    case XML_ATTRIBUTE_NODE:
+      if (child->type != XML_TEXT_NODE &&
+          child->type != XML_ENTITY_REF_NODE)
+        {
+          /* HIERARCHY_REQUEST_ERR */
+          xmljThrowDOMException (env, 3, "attributes may only contain text or entity reference nodes");
+          return;
+        }
+      break;
+    case XML_DOCUMENT_FRAG_NODE:
+    case XML_ELEMENT_NODE:
+      if (child->type == XML_DTD_NODE ||
+          child->type == XML_DOCUMENT_TYPE_NODE ||
+          child->type == XML_ENTITY_NODE ||
+          child->type == XML_NOTATION_NODE ||
+          child->type == XML_PI_NODE)
+        {
+          /* HIERARCHY_REQUEST_ERR */
+          xmljThrowDOMException (env, 3, "parent type does not allow child of this type");
+          return;
+        }
+      /* fall through */
+    default:
+      if (child->type == XML_ATTRIBUTE_NODE ||
+          child->type == XML_DOCUMENT_NODE ||
+          child->type == XML_DOCUMENT_FRAG_NODE)
+        {
+          /* HIERARCHY_REQUEST_ERR */
+          xmljThrowDOMException (env, 3, "node type may not be a child");
+          return;
+        }
+      /* TODO others? */
+    }
+  /* Check that new parent is not self or an ancestor */
+  for (cur = parent; cur != NULL; cur = cur->parent)
+    {
+      if (cur == child)
+        {
+          /* HIERARCHY_REQUEST_ERR */
+          xmljThrowDOMException (env, 3, "child cannot be an ancestor of itself");
+          return;
+        }
+    }
+  /* Check that new parent does not add a second doctype or root element
+   * to a document parent */
+  if (parent->type == XML_DOCUMENT_NODE)
+    {
+      cur = parent->children;
+      while (cur != NULL)
+        {
+          if (cur->type == XML_DTD_NODE ||
+              cur->type == XML_DOCUMENT_TYPE_NODE ||
+              (cur->type == XML_ELEMENT_NODE &&
+               parent->type == XML_DOCUMENT_NODE))
+            {
+              if (child->type == cur->type && child != cur)
+                {
+                  /* HIERARCHY_REQUEST_ERR */
+                  xmljThrowDOMException (env, 3, "cannot add a second doctype or root element");
+                  return;
+                }
+            }
+          cur = cur->next;
+        }
+    }
+}
+
+/*
+ * Adds the specified attribute node to the list of attributes for the given
+ * element.
+ */
+void
+xmljAddAttribute (xmlNodePtr node, xmlAttrPtr attr)
+{
+  xmlAttrPtr cur = node->properties;
+  
+  if (cur == NULL)
+    {
+      node->properties = attr;
+      attr->prev = NULL;
+      attr->next = NULL;
+      attr->parent = node;
+      attr->doc = node->doc;
+    }
+  else
+    {
+      while (cur->next != NULL)
+        {
+          cur = cur->next;
+        }
+      cur->next = attr;
+      attr->prev = cur;
+      attr->next = NULL;
+      attr->parent = node;
+      attr->doc = node->doc;
+    }
+}
+
+/* -- GnomeAttr -- */
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeAttr_getSpecified (JNIEnv * env, jobject self)
+{
+  xmlAttrPtr attr;
+
+  attr = (xmlAttrPtr) xmljGetNodeID (env, self);
+  return (attr->atype != 0);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeAttr_getValue (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+  xmlChar *text;
+  jstring ret;
+
+  node = xmljGetNodeID (env, self);
+  text = xmlNodeGetContent (node);
+  ret = xmljNewString (env, (const xmlChar *) text);
+  if (text != NULL)
+    {
+      xmlFree (text);
+    }
+  return ret;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeAttr_setValue (JNIEnv * env,
+                                             jobject self, jstring value)
+{
+  xmlNodePtr node;
+  const xmlChar *s_value;
+
+  node = xmljGetNodeID (env, self);
+  s_value = xmljGetStringChars (env, value);
+  xmlNodeSetContent (node, s_value);
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeAttr_xmljIsId (JNIEnv * env, jobject self)
+{
+  xmlAttrPtr attr;
+
+  attr = (xmlAttrPtr) xmljGetNodeID (env, self);
+  return (attr->atype == XML_ATTRIBUTE_ID);
+}
+
+/* -- GnomeDocument -- */
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_free (JNIEnv * env,
+                                             jobject self
+					     __attribute__ ((__unused__)),
+					     jobject id)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljAsPointer (env, id);
+  xmljFreeDoc (env, doc);
+  xmlFree (doc);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_getDoctype (JNIEnv * env, jobject self)
+{
+  xmlDocPtr doc;
+  xmlDtdPtr dtd;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  dtd = doc->extSubset;
+  if (dtd == NULL)
+    {
+      dtd = doc->intSubset;
+    }
+  return xmljGetNodeInstance (env, (xmlNodePtr) dtd);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_getDocumentElement (JNIEnv * env,
+                                                           jobject self)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  return xmljGetNodeInstance (env, xmlDocGetRootElement (doc));
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_createDocumentType (JNIEnv * env,
+                                                           jobject self,
+                                                           jstring name,
+                                                           jstring publicId,
+                                                           jstring systemId)
+{
+  xmlDocPtr doc;
+  xmlDtdPtr dtd;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  dtd = xmlNewDtd (doc,
+                   xmljGetStringChars (env, name),
+                   xmljGetStringChars (env, publicId),
+                   xmljGetStringChars (env, systemId));
+  return xmljGetNodeInstance (env, (xmlNodePtr) dtd);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_createDocumentFragment (JNIEnv * env,
+                                                               jobject self)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  return xmljGetNodeInstance (env, xmlNewDocFragment (doc));
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_createTextNode (JNIEnv * env,
+                                                       jobject self,
+                                                       jstring data)
+{
+  xmlDocPtr doc;
+  xmlNodePtr text;
+  const xmlChar *s_data;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  s_data = xmljGetStringChars (env, data);
+  text = xmlNewDocText (doc, s_data);
+  return xmljGetNodeInstance (env, text);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_createComment (JNIEnv * env,
+                                                      jobject self,
+                                                      jstring data)
+{
+  xmlDocPtr doc;
+  xmlNodePtr comment;
+  const xmlChar *s_data;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  s_data = xmljGetStringChars (env, data);
+  comment = xmlNewDocComment (doc, s_data);
+  return xmljGetNodeInstance (env, comment);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_createCDATASection (JNIEnv * env,
+                                                           jobject self,
+                                                           jstring data)
+{
+  xmlDocPtr doc;
+  xmlNodePtr cdata;
+  const xmlChar *s_data;
+  int len;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  s_data = xmljGetStringChars (env, data);
+  len = xmlStrlen (s_data);
+  cdata = xmlNewCDataBlock (doc, s_data, len);
+  return xmljGetNodeInstance (env, cdata);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_createProcessingInstruction (JNIEnv *
+                                                                    env,
+                                                                    jobject
+                                                                    self,
+                                                                    jstring
+                                                                    target,
+                                                                    jstring
+                                                                    data)
+{
+  xmlDocPtr doc;
+  xmlNodePtr pi;
+  const xmlChar *s_target;
+  const xmlChar *s_data;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  s_target = xmljGetStringChars (env, target);
+  s_data = xmljGetStringChars (env, data);
+  pi = xmlNewPI (s_target, s_data);
+  pi->doc = doc;
+  return xmljGetNodeInstance (env, pi);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_createEntityReference (JNIEnv * env,
+                                                              jobject self,
+                                                              jstring name)
+{
+  xmlDocPtr doc;
+  xmlNodePtr ref;
+  const xmlChar *s_name;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  s_name = xmljGetStringChars (env, name);
+  ref = xmlNewReference (doc, s_name);
+  return xmljGetNodeInstance (env, ref);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_xmljImportNode (JNIEnv * env,
+                                                       jobject self,
+                                                       jobject importedNode,
+                                                       jboolean deep)
+{
+  xmlDocPtr doc;
+  xmlNodePtr node;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  node = xmljGetNodeID (env, importedNode);
+  if (node == NULL)
+    {
+      xmljThrowDOMException (env, 8, NULL); /* NOT_FOUND_ERR */
+      return NULL;
+    }
+  if (node->type == XML_DOCUMENT_NODE ||
+      node->type == XML_DOCUMENT_TYPE_NODE)
+    {
+      xmljThrowDOMException (env, 9, NULL); /* NOT_SUPPORTED_ERR */
+      return NULL;
+    }
+  node = xmlDocCopyNode (node, doc, deep);
+  return xmljGetNodeInstance (env, node);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_createElementNS (JNIEnv * env,
+                                                        jobject self,
+                                                        jstring uri,
+                                                        jstring qName)
+{
+  xmlDocPtr doc;
+  xmlNodePtr element;
+  xmlNsPtr ns = NULL;
+  const xmlChar *s_uri;
+  const xmlChar *s_qName;
+  const xmlChar *s_prefix;
+  const xmlChar *s_localName;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  s_qName = xmljGetStringChars (env, qName);
+  if (xmlValidateQName (s_qName, 0))
+    {
+      xmljThrowDOMException (env, 5, NULL); /* INVALID_CHARACTER_ERR */
+      return NULL;
+    }
+  if (uri != NULL)
+    {
+      s_uri = xmljGetStringChars (env, uri);
+      s_prefix = xmljGetPrefix (s_qName);
+      s_localName = xmljGetLocalName (s_qName);
+      ns = xmlNewNs ((xmlNodePtr) doc, s_uri, s_prefix);
+    }
+  element = xmlNewDocNode (doc, ns, s_qName, NULL);
+  return xmljGetNodeInstance (env, element);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_createAttributeNS (JNIEnv * env,
+                                                          jobject self,
+                                                          jstring uri,
+                                                          jstring qName)
+{
+  xmlDocPtr doc;
+  xmlNodePtr attr;
+  xmlNsPtr ns = NULL;
+  const xmlChar *s_uri;
+  const xmlChar *s_qName;
+  const xmlChar *s_prefix;
+  const xmlChar *s_localName;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  s_qName = xmljGetStringChars (env, qName);
+  if (xmlValidateQName (s_qName, 0))
+    {
+      xmljThrowDOMException (env, 5, NULL); /* INVALID_CHARACTER_ERR */
+      return NULL;
+    }
+  if (uri != NULL)
+    {
+      s_uri = xmljGetStringChars (env, uri);
+      s_prefix = xmljGetPrefix (s_qName);
+      s_localName = xmljGetLocalName (s_qName);
+      ns = xmlNewNs ((xmlNodePtr) doc, s_uri, s_prefix);
+    }
+  attr = (xmlNodePtr) xmlNewNsProp ((xmlNodePtr) doc, ns, s_qName, NULL);
+  attr->parent = NULL;
+  return xmljGetNodeInstance (env, attr);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_xmljGetElementById (JNIEnv * env,
+                                                           jobject self,
+                                                           jstring elementId)
+{
+  xmlDocPtr doc;
+  xmlNodePtr ctx, tmp;
+  xmlAttrPtr attr;
+  const xmlChar *id;
+  const xmlChar *val;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  id = xmljGetStringChars (env, elementId);
+
+  ctx = xmlDocGetRootElement (doc);
+  while (ctx && ctx != (xmlNodePtr) doc)
+    {
+      if (ctx->type == XML_ELEMENT_NODE)
+        {
+          for (attr = ctx->properties; attr;
+               attr = (xmlAttrPtr) attr->next)
+            {
+              if (xmlIsID (doc, ctx, attr))
+                {
+                  val = xmlGetProp (ctx, attr->name);
+                  if (val && xmlStrEqual (id, val))
+                    {
+                      return xmljGetNodeInstance (env, ctx);
+                    }
+                }
+            }
+        }
+      if (ctx->children)
+        {
+          ctx = ctx->children;
+        }
+      else
+        {
+          tmp = ctx->next;
+          if (tmp)
+            {
+              ctx = tmp;
+            }
+          else
+            {
+              do
+                {
+                  tmp = ctx->parent;
+                  if (!tmp)
+                    {
+                      return NULL;
+                    }
+                  ctx = tmp;
+                  tmp = ctx->next;
+                }
+              while (!tmp);
+              ctx = tmp;
+            }
+        }
+    }
+  return NULL;
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_getInputEncoding (JNIEnv * env,
+                                                         jobject self)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  if (doc->encoding)
+    {
+      return xmljNewString (env, doc->encoding);
+    }
+  switch (doc->charset)
+    {
+    case XML_CHAR_ENCODING_ASCII:
+      return xmljNewString (env, BAD_CAST "US-ASCII");
+    case XML_CHAR_ENCODING_UTF16LE:
+      return xmljNewString (env, BAD_CAST "UTF-16LE");
+    case XML_CHAR_ENCODING_UTF16BE:
+      return xmljNewString (env, BAD_CAST "UTF-16BE");
+    case XML_CHAR_ENCODING_8859_1:
+      return xmljNewString (env, BAD_CAST "ISO-8859-1");
+      /* TODO others */
+    default:
+      return xmljNewString (env, BAD_CAST "UTF-8");
+    }
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_getXmlEncoding (JNIEnv * env,
+                                                       jobject self)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  return (doc->encoding == NULL) ? 
+    xmljNewString (env, BAD_CAST "UTF-8") :
+    xmljNewString (env, doc->encoding);
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_getXmlStandalone (JNIEnv * env,
+                                                         jobject self)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  return doc->standalone;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_setXmlStandalone (JNIEnv * env,
+                                                         jobject self,
+                                                         jboolean xmlStandalone)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  doc->standalone = xmlStandalone;
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_getXmlVersion (JNIEnv * env,
+                                                      jobject self)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  return (doc->version == NULL) ?
+    xmljNewString (env, BAD_CAST "1.0") :
+    xmljNewString (env, doc->version);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_setXmlVersion (JNIEnv * env,
+                                                      jobject self,
+                                                      jstring xmlVersion)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  if (xmlVersion == NULL)
+    {
+      doc->version = NULL;
+    }
+  else
+    {
+      const xmlChar *version = xmljGetStringChars (env, xmlVersion);
+      if (!xmlStrEqual (version, BAD_CAST "1.0") &&
+          !xmlStrEqual (version, BAD_CAST "1.1"))
+        {
+          xmljThrowDOMException (env, 9, NULL); /* NOT_SUPPORTED_ERR */
+          return;
+        }
+      doc->version = version;
+    }
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_getDocumentURI (JNIEnv * env,
+                                                       jobject self)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  return (doc->name == NULL) ? NULL :
+    xmljNewString (env, (const xmlChar *) doc->URL);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_setDocumentURI (JNIEnv * env,
+                                                       jobject self,
+                                                       jstring documentURI)
+{
+  xmlDocPtr doc;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  if (documentURI == NULL)
+    {
+      doc->URL = NULL;
+    }
+  else
+    {
+      doc->URL = xmljGetStringChars (env, documentURI);
+    }
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_xmljAdoptNode (JNIEnv *env,
+                                                      jobject self,
+                                                      jobject jnode)
+{
+  xmlDocPtr doc;
+  xmlNodePtr node;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, self);
+  node = xmljGetNodeID (env, jnode);
+
+  if (node == NULL)
+    {
+      xmljThrowDOMException (env, 8, NULL); /* NOT_FOUND_ERR */
+      return NULL;
+    }
+  if (node->type == XML_DOCUMENT_NODE ||
+      node->type == XML_DOCUMENT_TYPE_NODE ||
+      node->type == XML_ENTITY_NODE ||
+      node->type == XML_NOTATION_NODE)
+    {
+      xmljThrowDOMException (env, 9, NULL); /* NOT_SUPPORTED_ERR */
+      return NULL;
+    }
+  xmlUnlinkNode (node);
+  node = xmlDocCopyNode (node, doc, 1);
+  return xmljGetNodeInstance (env, node);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_renameNode (JNIEnv * env,
+                                                   jobject self
+						   __attribute__ ((__unused__)),
+                                                   jobject n
+ 						   __attribute__ ((__unused__)),
+                                                   jstring namespaceURI
+						   __attribute__ ((__unused__)),
+                                                   jstring qName
+						   __attribute__ ((__unused__)))
+{
+  xmlNodePtr node;
+  xmlNsPtr ns;
+  const xmlChar *s_qName;
+  const xmlChar *href;
+  const xmlChar *prefix;
+  int *len;
+
+  node = xmljGetNodeID (env, n);
+  if (node == NULL)
+    {
+      xmljThrowDOMException (env, 8, NULL); /* NOT_FOUND_ERR */
+      return NULL;
+    }
+  s_qName = xmljGetStringChars (env, qName);
+  if (xmlValidateQName (s_qName, 0))
+    {
+      xmljThrowDOMException (env, 5, NULL); /* INVALID_CHARACTER_ERR */
+      return NULL;
+    }
+  xmlNodeSetName (node, s_qName);
+  
+  href = xmljGetStringChars (env, namespaceURI);
+  len = (int *) malloc (sizeof (int));
+  prefix = xmlSplitQName3 (s_qName, len);
+  ns = node->ns;
+  if (ns == NULL)
+    {
+      if (href != NULL)
+        {
+          ns = xmlNewNs (node, href, prefix);
+          xmlSetNs (node, ns);
+        }
+    }
+  else
+    {
+      node->ns = NULL;
+      /*xmlFreeNs (ns); FIXME this can segfault (?) */
+      if (href != NULL)
+        {
+          ns = xmlNewNs (node, href, prefix);
+          xmlSetNs (node, ns);
+        }
+    }
+  free (len);
+  return n;
+}
+
+/* -- GnomeDocumentBuilder -- */
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocumentBuilder_parseStream (JNIEnv * env,
+                                                           jobject self,
+                                                           jobject in,
+                                                           jbyteArray
+                                                           detectBuffer,
+                                                           jstring publicId,
+                                                           jstring systemId,
+                                                           jstring base,
+                                                           jboolean validate,
+                                                           jboolean coalesce,
+                                                           jboolean
+                                                           expandEntities,
+                                                           jboolean
+                                                           entityResolver,
+                                                           jboolean
+                                                           errorHandler)
+{
+  xmlDocPtr doc;
+
+  doc = xmljParseDocument(env,
+                          self,
+                          in,
+                          detectBuffer,
+                          publicId,
+                          systemId,
+                          base,
+                          validate,
+                          coalesce,
+                          expandEntities,
+                          0,
+                          0,
+                          entityResolver,
+                          errorHandler,
+                          0,
+                          0,
+                          1);
+  return xmljCreateDocument (env, self, doc);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocumentBuilder_createDocument
+(JNIEnv * env,
+ jobject self,
+ jstring namespaceURI,
+ jstring qualifiedName,
+ jobject doctype)
+{
+  xmlDocPtr doc;
+  xmlNodePtr root;
+  xmlNsPtr ns;
+  const xmlChar *href;
+  const xmlChar *prefix;
+  const xmlChar *qName;
+
+  qName = xmljGetStringChars (env, qualifiedName);
+  href = xmljGetStringChars (env, namespaceURI);
+  if (qName == NULL)
+    {
+      prefix = NULL;
+    }
+  else
+    {
+      int *len;
+      
+      len = (int *) malloc (sizeof (int));
+      prefix = xmlSplitQName3 (qName, len);
+      free (len);
+    }
+  
+  /* Create the document node */
+  doc = xmlNewDoc (BAD_CAST "1.0");
+
+  /* doctype */
+  if (doctype != NULL)
+    {
+      jclass cls;
+      jmethodID method;
+      jstring ret;
+      const xmlChar *name;
+      const xmlChar *publicId;
+      const xmlChar *systemId;
+      const xmlChar *internalSubset;
+      xmlDtdPtr dtd;
+
+      cls = (*env)->FindClass (env, "org/w3c/dom/DocumentType");
+      if (cls == NULL)
+        {
+          return NULL;
+        }
+      /* name */
+      method = (*env)->GetMethodID (env, cls, "getName",
+                                    "()Ljava/lang/String;");
+      if (method == NULL)
+        {
+          return NULL;
+        }
+      ret = (jstring) (*env)->CallObjectMethod (env, doctype, method);
+      name = xmljGetStringChars (env, ret);
+      
+      /* publicId */
+      method = (*env)->GetMethodID (env, cls, "getPublicId",
+                                    "()Ljava/lang/String;");
+      if (method == NULL)
+        {
+          return NULL;
+        }
+      ret = (jstring) (*env)->CallObjectMethod (env, doctype, method);
+      publicId = xmljGetStringChars (env, ret);
+
+      /* systemId */
+      method = (*env)->GetMethodID (env, cls, "getSystemId",
+                                    "()Ljava/lang/String;");
+      if (method == NULL)
+        {
+          return NULL;
+        }
+      ret = (jstring) (*env)->CallObjectMethod (env, doctype, method);
+      systemId = xmljGetStringChars (env, ret);
+
+      /* internalSubset */
+      method = (*env)->GetMethodID (env, cls, "getInternalSubset",
+                                    "()Ljava/lang/String;");
+      if (method == NULL)
+        {
+          return NULL;
+        }
+      ret = (jstring) (*env)->CallObjectMethod (env, doctype, method);
+      internalSubset = xmljGetStringChars (env, ret);
+
+      /* TODO notations */
+      /* TODO entities */
+      if (internalSubset == NULL)
+        {
+          dtd = xmlNewDtd (doc, name, publicId, systemId);
+        }
+      else
+        {
+          dtd = xmlCreateIntSubset (doc, name, publicId, systemId);
+          /* TODO parse internal subset? */
+          xmljThrowDOMException (env, 9, NULL); /* NOT_SUPPORTED_ERR */
+          return NULL;
+        }
+    }
+  
+  /* Create the root element */
+  root = xmlNewNode (NULL, qName);
+  xmlDocSetRootElement (doc, root);
+  ns = xmlNewNs (root, href, prefix);
+  xmlSetNs (root, ns);
+  
+  return xmljCreateDocument (env, self, doc);
+}
+
+/* -- GnomeDocumentType -- */
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocumentType_getPublicId (JNIEnv * env,
+                                                        jobject self)
+{
+  xmlDtdPtr dtd;
+
+  dtd = (xmlDtdPtr) xmljGetNodeID (env, self);
+  return xmljNewString (env, dtd->ExternalID);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocumentType_getSystemId (JNIEnv * env,
+                                                        jobject self)
+{
+  xmlDtdPtr dtd;
+
+  dtd = (xmlDtdPtr) xmljGetNodeID (env, self);
+  return xmljNewString (env, dtd->SystemID);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocumentType_getInternalSubset (JNIEnv * env,
+                                                             jobject self
+							     __attribute__ ((__unused__)))
+{
+  /* TODO */
+  xmljThrowDOMException (env, 9, NULL); /* NOT_SUPPORTED_ERR */
+  return NULL;
+}
+
+/* -- GnomeElement -- */
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_getAttribute (JNIEnv * env,
+                                                    jobject self,
+                                                    jstring name)
+{
+  xmlNodePtr node;
+  const xmlChar *s_name;
+  const xmlChar *s_value;
+  
+  node = xmljGetNodeID (env, self);
+  s_name = xmljGetStringChars (env, name);
+  s_value = xmlGetProp (node, s_name);
+  xmlFree ((xmlChar *) s_name);
+  return (s_value == NULL) ?
+    xmljNewString (env, BAD_CAST "") :
+    xmljNewString (env, s_value);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_setAttribute (JNIEnv * env,
+                                                    jobject self,
+                                                    jstring name,
+                                                    jstring value)
+{
+  xmlNodePtr node;
+  const xmlChar *s_name;
+  const xmlChar *s_value;
+  
+  node = xmljGetNodeID (env, self);
+  s_name = xmljGetStringChars (env, name);
+  if (xmlValidateName (s_name, 0))
+    {
+      xmljThrowDOMException (env, 5, NULL); /* INVALID_CHARACTER_ERR */
+      return;
+    }
+  s_value = xmljGetStringChars (env, value);
+  xmlSetProp (node, s_name, s_value);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_getAttributeNode (JNIEnv * env,
+                                                        jobject self,
+                                                        jstring name)
+{
+  xmlNodePtr node;
+  const xmlChar *s_name;
+  xmlAttrPtr attr;
+
+  node = xmljGetNodeID (env, self);
+  s_name = xmljGetStringChars (env, name);
+  attr = xmlHasProp (node, s_name);
+  if (attr == NULL)
+    {
+      return NULL;
+    }
+  xmlFree ((xmlChar *) s_name);
+  return xmljGetNodeInstance (env, (xmlNodePtr) attr);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_setAttributeNode (JNIEnv * env,
+                                                        jobject self,
+                                                        jobject newAttr)
+{
+  xmlNodePtr node;
+  xmlAttrPtr new_attr;
+  xmlAttrPtr old_attr;
+
+  node = xmljGetNodeID (env, self);
+  new_attr = (xmlAttrPtr) xmljGetNodeID (env, newAttr);
+  if (new_attr->parent != NULL)
+    {
+      xmljThrowDOMException (env, 10, NULL); /* INUSE_ATTRIBUTE_ERR */
+      return NULL;
+    }
+  if (new_attr->doc != node->doc)
+    {
+      xmljThrowDOMException (env, 4, NULL); /* WRONG_DOCUMENT_ERR */
+      return NULL;
+    }
+  old_attr = xmlHasProp (node, new_attr->name);
+  if (old_attr)
+    {
+      xmlUnlinkNode ((xmlNodePtr) old_attr);
+    }
+  xmljAddAttribute (node, new_attr);
+  return xmljGetNodeInstance (env, (xmlNodePtr) old_attr);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_removeAttributeNode (JNIEnv * env,
+                                                           jobject self
+							   __attribute__ ((__unused__)),
+                                                           jobject oldAttr)
+{
+  xmlNodePtr attr;
+
+  attr = xmljGetNodeID (env, oldAttr);
+  xmlUnlinkNode (attr);
+  return oldAttr;
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_getAttributeNS (JNIEnv * env,
+                                                      jobject self,
+                                                      jstring uri,
+                                                      jstring localName)
+{
+  xmlNodePtr node;
+  const xmlChar *s_uri;
+  const xmlChar *s_localName;
+  const xmlChar *s_value;
+
+  node = xmljGetNodeID (env, self);
+  s_localName = xmljGetStringChars (env, localName);
+  if (uri == NULL)
+    {
+      s_value = xmlGetNoNsProp (node, s_localName);
+    }
+  else
+    {
+      s_uri = xmljGetStringChars (env, uri);
+      s_value = xmlGetNsProp (node, s_localName, s_uri);
+      xmlFree ((xmlChar *) s_uri);
+    }
+  xmlFree ((xmlChar *) s_localName);
+  return (s_value == NULL) ?
+    xmljNewString (env, BAD_CAST "") :
+    xmljNewString (env, s_value);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_setAttributeNS (JNIEnv * env,
+                                                      jobject self,
+                                                      jstring uri,
+                                                      jstring qName,
+                                                      jstring value)
+{
+  xmlNodePtr node;
+  xmlNsPtr ns;
+  const xmlChar *s_uri;
+  const xmlChar *s_qName;
+  const xmlChar *s_prefix;
+  const xmlChar *s_localName;
+  const xmlChar *s_value;
+
+  node = xmljGetNodeID (env, self);
+  s_qName = xmljGetStringChars (env, qName);
+  if (xmlValidateQName (s_qName, 0))
+    {
+      xmljThrowDOMException (env, 5, NULL); /* INVALID_CHARACTER_ERR */
+      return;
+    }
+  s_value = xmljGetStringChars (env, value);
+  if (uri == NULL)
+    {
+      xmlSetProp (node, s_qName, s_value);
+    }
+  else
+    {
+      s_prefix = xmljGetPrefix (s_qName);
+      s_localName = xmljGetLocalName (s_qName);
+      s_uri = xmljGetStringChars (env, uri);
+      ns = xmlNewNs (node, s_uri, s_prefix);
+      xmlSetNsProp (node, ns, s_localName, s_value);
+    }
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_getAttributeNodeNS (JNIEnv * env,
+                                                          jobject self,
+                                                          jstring uri,
+                                                          jstring localName)
+{
+  xmlNodePtr node;
+  xmlAttrPtr attr;
+  const xmlChar *s_uri;
+  const xmlChar *s_localName;
+
+  node = xmljGetNodeID (env, self);
+  attr = node->properties;
+  s_uri = xmljGetStringChars (env, uri);
+  s_localName = xmljGetStringChars (env, localName);
+  while (attr != NULL)
+    {
+      if (uri == NULL)
+        {
+          if (xmljMatch (s_localName, (xmlNodePtr) attr))
+            break;
+        }
+      else
+        {
+          if (xmljMatchNS (s_uri, s_localName, (xmlNodePtr) attr))
+            break;
+        }
+      attr = attr->next;
+    }
+  xmlFree ((xmlChar *) s_uri);
+  xmlFree ((xmlChar *) s_localName);
+  return xmljGetNodeInstance (env, (xmlNodePtr) attr);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_setAttributeNodeNS (JNIEnv * env,
+                                                          jobject self,
+                                                          jobject newAttr)
+{
+  xmlNodePtr node;
+  xmlAttrPtr new_attr;
+  xmlAttrPtr old_attr;
+  const xmlChar *uri;
+
+  node = xmljGetNodeID (env, self);
+  new_attr = (xmlAttrPtr) xmljGetNodeID (env, newAttr);
+  if (new_attr->parent != NULL)
+    {
+      xmljThrowDOMException (env, 10, NULL); /* INUSE_ATTRIBUTE_ERR */
+      return NULL;
+    }
+  if (new_attr->doc != node->doc)
+    {
+      xmljThrowDOMException (env, 4, NULL); /* WRONG_DOCUMENT_ERR */
+      return NULL;
+    }
+  uri = (new_attr->ns != NULL) ? new_attr->ns->href : NULL;
+  old_attr = xmlHasNsProp (node, new_attr->name, uri);
+  if (old_attr)
+    {
+      xmlUnlinkNode ((xmlNodePtr) old_attr);
+    }
+  xmljAddAttribute (node, new_attr);
+  return xmljGetNodeInstance (env, (xmlNodePtr) old_attr);
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_hasAttribute (JNIEnv * env,
+                                                    jobject self,
+                                                    jstring name)
+{
+  xmlNodePtr node;
+  const xmlChar *s_name;
+  const xmlChar *s_value;
+  
+  node = xmljGetNodeID (env, self);
+  s_name = xmljGetStringChars (env, name);
+  s_value = xmlGetProp (node, s_name);
+  xmlFree ((xmlChar *) s_name);
+  return (s_value != NULL);
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_hasAttributeNS (JNIEnv * env,
+                                                      jobject self,
+                                                      jstring uri,
+                                                      jstring localName)
+{
+  xmlNodePtr node;
+  const xmlChar *s_uri;
+  const xmlChar *s_localName;
+  const xmlChar *s_value;
+
+  node = xmljGetNodeID (env, self);
+  s_localName = xmljGetStringChars (env, localName);
+  if (uri == NULL)
+    {
+      s_value = xmlGetNoNsProp (node, s_localName);
+    }
+  else
+    {
+      s_uri = xmljGetStringChars (env, uri);
+      s_value = xmlGetNsProp (node, s_localName, s_uri);
+      xmlFree ((xmlChar *) s_uri);
+    }
+  xmlFree ((xmlChar *) s_localName);
+  return (s_value != NULL);
+}
+
+/* -- GnomeEntity -- */
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeEntity_getPublicId (JNIEnv * env, jobject self)
+{
+  xmlEntityPtr entity;
+
+  entity = (xmlEntityPtr) xmljGetNodeID (env, self);
+  return xmljNewString (env, entity->ExternalID);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeEntity_getSystemId (JNIEnv * env, jobject self)
+{
+  xmlEntityPtr entity;
+
+  entity = (xmlEntityPtr) xmljGetNodeID (env, self);
+  return xmljNewString (env, entity->SystemID);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeEntity_getNotationName (JNIEnv * env,
+                                                      jobject self
+						      __attribute__ ((__unused__)))
+{
+  /* TODO */
+  xmljThrowDOMException (env, 9, NULL); /* NOT_SUPPORTED_ERR */
+  return NULL;
+}
+
+/* -- GnomeNamedNodeMap -- */
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNamedNodeMap_getNamedItem (JNIEnv * env,
+                                                         jobject self,
+                                                         jstring name)
+{
+  jclass cls;
+  jfieldID field;
+  jint type;
+
+  cls = (*env)->GetObjectClass (env, self);
+  field = (*env)->GetFieldID (env, cls, "type", "I");
+  type = (*env)->GetIntField (env, self, field);
+
+  if (type == 0)
+    {
+      xmlAttrPtr attr;
+      
+      attr = xmljGetNamedItem (env, self, name);
+      return xmljGetNodeInstance (env, (xmlNodePtr) attr);
+    }
+  else
+    {
+      xmlDtdPtr dtd;
+      xmlHashTablePtr hash;
+      const xmlChar *s_name;
+      xmlNodePtr ret;
+
+      dtd = (xmlDtdPtr) xmljGetNodeID (env, self);
+      hash = (xmlHashTablePtr) ((type == 1) ? dtd->entities : dtd->notations);
+      if (hash == NULL)
+        {
+          return NULL;
+        }
+      s_name = xmljGetStringChars (env, name);
+      ret = (xmlNodePtr) xmlHashLookup (hash, s_name);
+      xmlFree ((xmlChar *) s_name);
+      return xmljGetNodeInstance (env, ret);
+    }
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNamedNodeMap_setNamedItem (JNIEnv * env,
+                                                         jobject self,
+                                                         jobject arg)
+{
+  jclass cls;
+  jfieldID field;
+  jint type;
+  xmlNodePtr node;
+  xmlNodePtr argNode;
+
+  cls = (*env)->GetObjectClass (env, self);
+  field = (*env)->GetFieldID (env, cls, "type", "I");
+  type = (*env)->GetIntField (env, self, field);
+
+  node = xmljGetNodeID (env, self);
+  argNode = xmljGetNodeID (env, arg);
+
+  if (argNode->doc != node->doc)
+    {
+      xmljThrowDOMException (env, 4, NULL);	/* WRONG_DOCUMENT_ERR */
+    }
+  xmljValidateChildNode (env, node, argNode);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return NULL;
+    }
+  if (type == 0)
+    {
+      if (argNode->parent != NULL)
+        {
+          xmljThrowDOMException (env, 10, NULL);  /* INUSE_ATTRIBUTE_ERR */
+          return NULL;
+        }
+      xmlAddChild (node, argNode);
+    }
+  else
+    {
+      xmlDtdPtr dtd;
+      xmlHashTablePtr hash;
+
+      dtd = (xmlDtdPtr) xmljGetNodeID (env, self);
+      hash = (xmlHashTablePtr) ((type == 1) ? dtd->entities : dtd->notations);
+      if (hash == NULL)
+        {
+          hash = xmlHashCreate (10);
+          if (type == 1)
+            {
+              dtd->entities = hash;
+            }
+          else
+            {
+              dtd->notations = hash;
+            }
+        }
+      xmlHashAddEntry (hash, argNode->name, argNode);
+    }
+  return arg;
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNamedNodeMap_removeNamedItem (JNIEnv * env,
+                                                            jobject self,
+                                                            jstring name)
+{
+  jclass cls;
+  jfieldID field;
+  jint type;
+
+  cls = (*env)->GetObjectClass (env, self);
+  field = (*env)->GetFieldID (env, cls, "type", "I");
+  type = (*env)->GetIntField (env, self, field);
+
+  if (type == 0)
+    {
+      xmlAttrPtr attr;
+
+      attr = xmljGetNamedItem (env, self, name);
+      if (attr == NULL)
+        {
+          xmljThrowDOMException (env, 8, NULL);	/* NOT_FOUND_ERR */
+          return NULL;
+        }
+      xmlUnlinkNode ((xmlNodePtr) attr);
+      return xmljGetNodeInstance (env, (xmlNodePtr) attr);
+    }
+  else
+    {
+      xmlDtdPtr dtd;
+      xmlHashTablePtr hash;
+      const xmlChar *s_name;
+      xmlNodePtr ret;
+
+      dtd = (xmlDtdPtr) xmljGetNodeID (env, self);
+      hash = (xmlHashTablePtr) ((type == 1) ? dtd->entities : dtd->notations);
+      if (hash == NULL)
+        {
+          return NULL;
+        }
+      s_name = xmljGetStringChars (env, name);
+      ret = (xmlNodePtr) xmlHashLookup (hash, s_name);
+      if (ret != NULL)
+        {
+          xmlHashRemoveEntry (hash, s_name, NULL);
+        }
+      xmlFree ((xmlChar *) s_name);
+      return xmljGetNodeInstance (env, ret);
+    }
+}
+
+void
+xmljHashScanner (void *payload, void *vdata, xmlChar *name)
+{
+  xmljHashScanData *data;
+
+  data = (xmljHashScanData *) vdata;
+  if (data->count <= data->index)
+    {
+      data->node = (xmlNodePtr) payload;
+    }
+  data->count++;
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNamedNodeMap_item (JNIEnv * env,
+                                                 jobject self, jint index)
+{
+  jclass cls;
+  jfieldID field;
+  jint type;
+
+  cls = (*env)->GetObjectClass (env, self);
+  field = (*env)->GetFieldID (env, cls, "type", "I");
+  type = (*env)->GetIntField (env, self, field);
+
+  if (type == 0)
+    {
+      xmlNodePtr node;
+      xmlAttrPtr attr;
+      jint count;
+      
+      node = xmljGetNodeID (env, self);
+      switch (node->type)
+        {
+        case XML_ELEMENT_NODE:
+          attr = node->properties;
+          for (count = 0; attr != NULL && count < index; count++)
+            {
+              attr = attr->next;
+            }
+          if (attr == NULL)
+            {
+              char msg[1024];
+              sprintf (msg, "No attribute at index %d\n", (int) index);
+              xmljThrowException (env, "java/lang/NullPointerException", msg);
+              return NULL;
+            }
+          return xmljGetNodeInstance (env, (xmlNodePtr) attr);
+        default:
+          return NULL;
+        }
+    }
+  else
+    {
+      xmlDtdPtr dtd;
+      xmlHashTablePtr hash;
+      xmljHashScanData *data;
+      xmlNodePtr ret;
+
+      dtd = (xmlDtdPtr) xmljGetNodeID (env, self);
+      hash = (xmlHashTablePtr) ((type == 1) ? dtd->entities : dtd->notations);
+      if (hash == NULL)
+        {
+          return NULL;
+        }
+      data = (xmljHashScanData *) malloc (sizeof (xmljHashScanData));
+      if (data == NULL)
+        {
+          return NULL;
+        }
+      data->index = index;
+      data->count = 0;
+      data->node = NULL;
+      xmlHashScan (hash, xmljHashScanner, data);
+      ret = data->node;
+      free (data);
+      return xmljGetNodeInstance (env, ret);
+    }
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNamedNodeMap_getLength (JNIEnv * env,
+                                                      jobject self)
+{
+  jclass cls;
+  jfieldID field;
+  jint type;
+
+  cls = (*env)->GetObjectClass (env, self);
+  field = (*env)->GetFieldID (env, cls, "type", "I");
+  type = (*env)->GetIntField (env, self, field);
+
+  if (type == 0)
+    {
+      xmlNodePtr node;
+      xmlAttrPtr attr;
+      jint count;
+      
+      node = xmljGetNodeID (env, self);
+      switch (node->type)
+        {
+        case XML_ELEMENT_NODE:
+          count = 0;
+          attr = node->properties;
+          while (attr != NULL)
+            {
+              count++;
+              attr = attr->next;
+            }
+          return count;
+        default:
+          return -1;
+        }
+    }
+  else
+    {
+      xmlDtdPtr dtd;
+      xmlHashTablePtr hash;
+      xmljHashScanData *data;
+      jint ret;
+
+      dtd = (xmlDtdPtr) xmljGetNodeID (env, self);
+      hash = (xmlHashTablePtr) ((type == 1) ? dtd->entities : dtd->notations);
+      if (hash == NULL)
+        {
+          return 0;
+        }
+      data = (xmljHashScanData *) malloc (sizeof (xmljHashScanData));
+      if (data == NULL)
+        {
+          return 0;
+        }
+      data->index = -1;
+      data->count = 0;
+      data->node = NULL;
+      xmlHashScan (hash, xmljHashScanner, data);
+      ret = data->count;
+      free (data);
+      return ret;
+    }
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNamedNodeMap_getNamedItemNS (JNIEnv * env,
+                                                           jobject self,
+                                                           jstring uri,
+                                                           jstring localName)
+{
+  jclass cls;
+  jfieldID field;
+  jint type;
+
+  cls = (*env)->GetObjectClass (env, self);
+  field = (*env)->GetFieldID (env, cls, "type", "I");
+  type = (*env)->GetIntField (env, self, field);
+
+  if (type == 0)
+    {
+      xmlAttrPtr attr;
+
+      attr = xmljGetNamedItemNS (env, self, uri, localName);
+      return xmljGetNodeInstance (env, (xmlNodePtr) attr);
+    }
+  else
+    {
+      return NULL;
+    }
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNamedNodeMap_setNamedItemNS (JNIEnv * env,
+                                                           jobject self,
+                                                           jobject arg)
+{
+  return Java_gnu_xml_libxmlj_dom_GnomeNamedNodeMap_setNamedItem (env, self,
+                                                                  arg);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNamedNodeMap_removeNamedItemNS (JNIEnv * env,
+                                                              jobject self,
+                                                              jstring uri,
+                                                              jstring
+                                                              localName)
+{
+  jclass cls;
+  jfieldID field;
+  jint type;
+
+  cls = (*env)->GetObjectClass (env, self);
+  field = (*env)->GetFieldID (env, cls, "type", "I");
+  type = (*env)->GetIntField (env, self, field);
+
+  if (type == 0)
+    {
+      xmlAttrPtr attr;
+      
+      attr = xmljGetNamedItemNS (env, self, uri, localName);
+      if (attr == NULL)
+        {
+          xmljThrowDOMException (env, 8, NULL);	/* NOT_FOUND_ERR */
+          return NULL;
+        }
+      else
+        {
+          xmlUnlinkNode ((xmlNodePtr) attr);
+          return xmljGetNodeInstance (env, (xmlNodePtr) attr);
+        }
+    }
+  else
+    {
+      return NULL;
+    }
+}
+
+/* -- GnomeNode -- */
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getNodeName (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  if (node == NULL)
+    {
+      return NULL;
+    }
+  return xmljNewString (env, node->name);
+}
+
+xmlChar *
+xmljGetNodeValue (xmlNodePtr node)
+{
+  /* If not character data, return null */
+  switch (node->type)
+    {
+    case XML_TEXT_NODE:
+    case XML_CDATA_SECTION_NODE:
+    case XML_COMMENT_NODE:
+    case XML_ATTRIBUTE_NODE:
+      return xmlNodeGetContent (node);
+    default:
+      return NULL;
+    }
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getNodeValue (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+  xmlChar *text;
+  jstring ret;
+
+  node = xmljGetNodeID (env, self);
+  text = xmljGetNodeValue (node);
+  ret = xmljNewString (env, (const xmlChar *) text);
+  if (text != NULL)
+    {
+      xmlFree (text);
+    }
+  return ret;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_setNodeValue (JNIEnv * env,
+                                                 jobject self,
+                                                 jstring nodeValue)
+{
+  xmlNodePtr node;
+  const xmlChar *s_nodeValue;
+
+  node = xmljGetNodeID (env, self);
+
+  /* If not character data, return */
+  if (node->type != XML_TEXT_NODE &&
+      node->type != XML_CDATA_SECTION_NODE && node->type != XML_COMMENT_NODE)
+    return;
+
+  s_nodeValue = xmljGetStringChars (env, nodeValue);
+  xmlNodeSetContent (node, s_nodeValue);
+}
+
+JNIEXPORT jshort JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getNodeType (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  switch (node->type)
+    {
+    case XML_DTD_NODE:
+      return XML_DOCUMENT_TYPE_NODE;
+    case XML_ATTRIBUTE_DECL:
+      return XML_ATTRIBUTE_NODE;
+    case XML_ENTITY_DECL:
+      return XML_ENTITY_NODE;
+    default:
+      return node->type;
+    }
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getParentNode (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  return xmljGetNodeInstance (env, node->parent);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getFirstChild (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  return xmljGetNodeInstance (env, node->children);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getLastChild (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  return xmljGetNodeInstance (env, node->last);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getPreviousSibling (JNIEnv * env,
+                                                       jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  return xmljGetNodeInstance (env, node->prev);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getNextSibling (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  return xmljGetNodeInstance (env, node->next);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getOwnerDocument (JNIEnv * env,
+                                                     jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  return xmljGetNodeInstance (env, (xmlNodePtr) node->doc);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_xmljInsertBefore (JNIEnv * env,
+                                                     jobject self,
+                                                     jobject newChild,
+                                                     jobject refChild)
+{
+  xmlNodePtr node;
+  xmlNodePtr newChildNode;
+  xmlNodePtr refChildNode;
+
+  node = xmljGetNodeID (env, self);
+  newChildNode = xmljGetNodeID (env, newChild);
+  refChildNode = xmljGetNodeID (env, refChild);
+
+  /* Is refChildNode a child of this node? */
+  if (refChildNode == NULL ||
+      refChildNode->parent == NULL ||
+      refChildNode->parent != node)
+    {
+      xmljThrowDOMException (env, 8, NULL);	/* NOT_FOUND_ERR */
+      return NULL;
+    }
+  /* Check new child */
+  xmljValidateChildNode (env, node, newChildNode);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return NULL;
+    }
+
+  newChildNode = xmlAddPrevSibling (refChildNode, newChildNode);
+  return xmljGetNodeInstance (env, newChildNode);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_xmljReplaceChild (JNIEnv * env,
+                                                     jobject self,
+                                                     jobject newChild,
+                                                     jobject oldChild)
+{
+  xmlNodePtr node;
+  xmlNodePtr newChildNode;
+  xmlNodePtr oldChildNode;
+
+  node = xmljGetNodeID (env, self);
+  newChildNode = xmljGetNodeID (env, newChild);
+  oldChildNode = xmljGetNodeID (env, oldChild);
+
+  /* Is oldChildNode a child of this node? */
+  if (oldChildNode == NULL ||
+      oldChildNode->parent == NULL ||
+      oldChildNode->parent != node)
+    {
+      xmljThrowDOMException (env, 8, NULL);	/* NOT_FOUND_ERR */
+      return NULL;
+    }
+  /* Check new child */
+  xmljValidateChildNode (env, node, newChildNode);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return NULL;
+    }
+  
+  newChildNode = xmlReplaceNode (oldChildNode, newChildNode);
+  return xmljGetNodeInstance (env, newChildNode);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_xmljRemoveChild (JNIEnv * env,
+                                                    jobject self,
+                                                    jobject oldChild)
+{
+  xmlNodePtr node;
+  xmlNodePtr oldChildNode;
+
+  node = xmljGetNodeID (env, self);
+  oldChildNode = xmljGetNodeID (env, oldChild);
+
+  if (oldChildNode == NULL ||
+      oldChildNode->parent == NULL ||
+      oldChildNode->parent != node)
+    {
+      xmljThrowDOMException (env, 8, NULL);	/* NOT_FOUND_ERR */
+      return NULL;
+    }
+  xmlUnlinkNode (oldChildNode);
+  return oldChild;
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_xmljAppendChild (JNIEnv * env,
+                                                    jobject self,
+                                                    jobject newChild)
+{
+  xmlNodePtr node;
+  xmlNodePtr newChildNode;
+
+  node = xmljGetNodeID (env, self);
+  newChildNode = xmljGetNodeID (env, newChild);
+  
+  /* Check new child */
+  xmljValidateChildNode (env, node, newChildNode);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return NULL;
+    }
+
+  newChildNode = xmlAddChild (node, newChildNode);
+  return xmljGetNodeInstance (env, newChildNode);
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_hasChildNodes (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  return (node->children != NULL);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_xmljCloneNode (JNIEnv * env,
+                                                  jobject self, jboolean deep)
+{
+  xmlNodePtr node;
+  xmlNodePtr clone;
+
+  node = xmljGetNodeID (env, self);
+  clone = xmlCopyNode (node, deep);
+  clone->parent = NULL;
+  clone->doc = node->doc;
+  return xmljGetNodeInstance (env, clone);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_normalize (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  xmljNormalizeNode (node);
+}
+
+void
+xmljNormalizeNode (xmlNodePtr node)
+{
+  xmlNodePtr cur;
+  xmlNodePtr last = NULL;
+
+  cur = node->children;
+  while (cur != NULL)
+    {
+      switch (cur->type)
+        {
+        case XML_CDATA_SECTION_NODE:
+        case XML_TEXT_NODE:
+          if (xmlIsBlankNode (cur))
+            {
+              xmlNodePtr next = cur->next;
+              xmlUnlinkNode (cur);
+              xmlFreeNode (cur);
+              cur = next;
+              continue;
+            }
+          if (last != NULL)
+            {
+              last = xmlTextMerge (last, cur);
+              xmlUnlinkNode (cur);
+              xmlFreeNode (cur);
+              cur = last;
+            }
+          else
+            {
+              last = cur;
+            }
+          break;
+        default:
+          last = NULL;
+          xmljNormalizeNode (cur);
+        }
+      cur = cur->next;
+    }
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getNamespaceURI (JNIEnv * env,
+                                                    jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  if (node->type != XML_ELEMENT_NODE &&
+      node->type != XML_ATTRIBUTE_NODE)
+    {
+      return NULL;
+    }
+  if (node->ns == NULL)
+    {
+      return NULL;
+    }
+  return xmljNewString (env, node->ns->href);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getPrefix (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  if (node->type != XML_ELEMENT_NODE &&
+      node->type != XML_ATTRIBUTE_NODE)
+    {
+      return NULL;
+    }
+  if (node->ns == NULL)
+    {
+      return NULL;
+    }
+  return xmljNewString (env, node->ns->prefix);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_setPrefix (JNIEnv * env,
+                                              jobject self, jstring prefix)
+{
+  xmlNodePtr node;
+  const xmlChar *s_prefix;
+
+  s_prefix = xmljGetStringChars (env, prefix);
+  if (xmlValidateName (s_prefix, 0))
+    {
+      xmljThrowDOMException (env, 5, NULL);	/* INVALID_CHARACTER_ERR */
+    }
+  node = xmljGetNodeID (env, self);
+  if (node->type != XML_ELEMENT_NODE &&
+      node->type != XML_ATTRIBUTE_NODE)
+    {
+      xmljThrowDOMException (env, 3, NULL);	/* HIERARCHY_REQUEST_ERR */
+      return;
+    }
+  if (node->ns == NULL)
+    {
+      xmljThrowDOMException (env, 14, NULL);	/* NAMESPACE_ERR */
+      return;
+    }
+  node->ns->prefix = s_prefix;
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getLocalName (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+  int *len;
+  jstring ret;
+
+  node = xmljGetNodeID (env, self);
+  if (node->name == NULL)
+    {
+      return NULL;
+    }
+  len = (int *) malloc (sizeof (int));
+  if (xmlSplitQName3 (node->name, len) != NULL)
+    {
+      ret = xmljNewString (env, node->name + (*len));
+    }
+  else
+    {
+      ret = xmljNewString (env, node->name);
+    }
+  free (len);
+  return ret;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_hasAttributes (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+
+  node = xmljGetNodeID (env, self);
+  return (node->properties != NULL);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_getBaseURI (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+  xmlChar *baseURI;
+  jstring ret;
+  
+  node = xmljGetNodeID (env, self);
+  baseURI = xmlNodeGetBase (node->doc, node);
+  ret = xmljNewString (env, (const xmlChar *) baseURI);
+  if (baseURI != NULL)
+    {
+      xmlFree (baseURI);
+    }
+  return ret;
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_lookupPrefix (JNIEnv * env, jobject self,
+                                                 jstring namespaceURI)
+{
+  xmlNodePtr node;
+  xmlNsPtr ns;
+  xmlDocPtr doc;
+  const xmlChar *s_uri;
+  
+  node = xmljGetNodeID (env, self);
+  doc = node->doc;
+  /* If this is a document node, search from the root element */
+  if (node->type == XML_DOCUMENT_NODE)
+    {
+      doc = (xmlDocPtr) node;
+      node = xmlDocGetRootElement (doc);
+    }
+  s_uri = xmljGetStringChars (env, namespaceURI);
+  ns = xmlSearchNsByHref (doc, node, s_uri);
+  xmlFree ((xmlChar *) s_uri);
+  if (ns == NULL)
+    {
+      return NULL;
+    }
+  return xmljNewString (env, ns->prefix);
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_isDefaultNamespace (JNIEnv * env,
+                                                       jobject self,
+                                                       jstring namespaceURI)
+{
+  xmlNodePtr node;
+  xmlNsPtr ns;
+  const xmlChar *s_uri;
+  
+  node = xmljGetNodeID (env, self);
+  s_uri = xmljGetStringChars (env, namespaceURI);
+  ns = xmlSearchNsByHref (node->doc, node, s_uri);
+  xmlFree ((xmlChar *) s_uri);
+  if (ns == NULL)
+    {
+      return 0;
+    }
+  return (ns->prefix == NULL || xmlStrlen (ns->prefix) == 0);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_lookupNamespaceURI (JNIEnv * env,
+                                                       jobject self,
+                                                       jstring prefix)
+{
+  xmlNodePtr node;
+  xmlDocPtr doc;
+  xmlNsPtr ns;
+  const xmlChar *s_prefix;
+  
+  node = xmljGetNodeID (env, self);
+  doc = node->doc;
+  /* If this is a document node, search from the root element */
+  if (node->type == XML_DOCUMENT_NODE)
+    {
+      doc = (xmlDocPtr) node;
+      node = xmlDocGetRootElement (doc);
+    }
+  s_prefix = xmljGetStringChars (env, prefix);
+  ns = xmlSearchNs (doc, node, s_prefix);
+  xmlFree ((xmlChar *) s_prefix);
+  if (ns == NULL)
+    {
+      return NULL;
+    }
+  return xmljNewString (env, ns->href);
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_xmljCompareTo (JNIEnv * env,
+                                                  jobject self,
+                                                  jobject other)
+{
+  xmlNodePtr n1, n2, x;
+  int d1, d2, delta, c;
+
+  n1 = xmljGetNodeID (env, self);
+  n2 = xmljGetNodeID (env, other);
+  if (n1->doc != n2->doc)
+    {
+      return 0;
+    }
+  if (n1->type == XML_ATTRIBUTE_NODE || n2->type == XML_ATTRIBUTE_NODE)
+    {
+      return 0;
+    }
+  d1 = 0;
+  for (x = n1->parent; x && x->type != XML_DOCUMENT_NODE; x = x->parent)
+    {
+      d1++;
+    }
+  d2 = 0;
+  for (x = n2->parent; x && x->type != XML_DOCUMENT_NODE; x = x->parent)
+    {
+      d2++;
+    }
+  delta = d1 - d2;
+  while (d1 > d2)
+    {
+      n1 = n1->parent;
+      d1--;
+    }
+  while (d2 > d1)
+    {
+      n2 = n2->parent;
+      d2--;
+    }
+  c = xmljCompare (n1, n2);
+  return (c != 0) ? c : delta;
+}
+
+/* Compare at same level */
+int
+xmljCompare (xmlNodePtr n1, xmlNodePtr n2)
+{
+  int c, i1, i2;
+  
+  if (n1->parent == NULL || n1->type == XML_DOCUMENT_NODE ||
+      n2->parent == NULL || n2->type == XML_DOCUMENT_NODE ||
+      n1 == n2)
+    {
+      return 0;
+    }
+  c = xmljCompare (n1->parent, n2->parent);
+  if (c != 0)
+    {
+      return c;
+    }
+  i1 = 0;
+  for (n1 = n1->prev; n1; n1 = n1->prev)
+    {
+      i1++;
+    }
+  i2 = 0;
+  for (n2 = n2->prev; n2; n2 = n2->prev)
+    {
+      i2++;
+    }
+  return i1 - i2;
+}
+
+int
+xmljIsEqualNodeList (xmlNodePtr node1, xmlNodePtr node2)
+{
+  while (node1 != NULL)
+    {
+      if (!xmljIsEqualNode (node1, node2))
+        {
+          return 0;
+        }
+      node1 = node1->next;
+      node2 = node2->next;
+    }
+  return 1;
+}
+
+int
+xmljIsEqualNode (xmlNodePtr node1, xmlNodePtr node2)
+{
+  const xmlChar *val1;
+  const xmlChar *val2;
+  
+  if (node1 == node2)
+    {
+      return 1;
+    }
+  if (node1 == NULL || node2 == NULL)
+    {
+      return 0;
+    }
+  /* Check node type */
+  if (node1->type != node2->type)
+    {
+      return 0;
+    }
+  /* Check node name */
+  if (!xmlStrEqual (node1->name, node2->name))
+    {
+      return 0;
+    }
+  /* Check node namespace */
+  if (node1->type == XML_ELEMENT_NODE ||
+      node1->type == XML_ATTRIBUTE_NODE)
+    {
+      xmlNsPtr ns1, ns2;
+      
+      ns1 = node1->ns;
+      if (ns1 != NULL)
+        {
+          ns2 = node2->ns;
+          if (ns2 == NULL)
+            {
+              return 0;
+            }
+          val1 = ns1->href;
+          val2 = ns2->href;
+          if (!xmlStrEqual (val1, val2))
+            {
+              return 0;
+            }
+        }
+    }
+  /* Check node value */
+  val1 = xmljGetNodeValue (node1);
+  val2 = xmljGetNodeValue (node2);
+  if (!xmlStrEqual (val1, val2))
+    {
+      return 0;
+    }
+  /* Check attributes */
+  if (node1->type == XML_ELEMENT_NODE &&
+      !xmljIsEqualNodeList ((xmlNodePtr) node1->properties,
+                            (xmlNodePtr) node2->properties))
+    {
+      return 0;
+    }
+  /* Check doctype */
+  if (node1->type == XML_DOCUMENT_NODE)
+    {
+      xmlDocPtr doc1 = (xmlDocPtr) node1;
+      xmlDocPtr doc2 = (xmlDocPtr) node2;
+
+      if (!xmljIsEqualNode ((xmlNodePtr) doc1->intSubset,
+                            (xmlNodePtr) doc2->intSubset) ||
+          !xmljIsEqualNode ((xmlNodePtr) doc1->extSubset,
+                            (xmlNodePtr) doc2->extSubset))
+        {
+          return 0;
+        }
+    }
+  /* Check child nodes */
+  if (!xmljIsEqualNodeList (node1->children, node2->children))
+    {
+      return 0;
+    }
+  return 1;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNode_isEqualNode (JNIEnv * env,
+                                                jobject self,
+                                                jobject arg)
+{
+  xmlNodePtr node1;
+  xmlNodePtr node2;
+
+  node1 = xmljGetNodeID (env, self);
+  node2 = xmljGetNodeID (env, arg);
+  return xmljIsEqualNode (node1, node2);
+}
+
+/* -- GnomeNodeList -- */
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNodeList_item (JNIEnv * env,
+                                             jobject self, jint index)
+{
+  xmlNodePtr node;
+  jint count;
+
+  node = xmljGetNodeID (env, self);
+  node = node->children;
+  count = 0;
+  for (count = 0; node != NULL && count < index; count++)
+    {
+      node = node->next;
+    }
+  return xmljGetNodeInstance (env, node);
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNodeList_getLength (JNIEnv * env, jobject self)
+{
+  xmlNodePtr node;
+  jint count;
+
+  node = xmljGetNodeID (env, self);
+  count = 0;
+  node = node->children;
+  while (node != NULL)
+    {
+      count++;
+      node = node->next;
+    }
+  return count;
+}
+
+/* -- GnomeNotation -- */
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNotation_getPublicId (JNIEnv * env,
+                                                    jobject self)
+{
+  xmlNotationPtr notation;
+
+  notation = (xmlNotationPtr) xmljGetNodeID (env, self);
+  if (notation->PublicID == NULL)
+    {
+      return NULL;
+    }
+  return xmljNewString (env, notation->PublicID);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeNotation_getSystemId (JNIEnv * env,
+                                                    jobject self)
+{
+  xmlNotationPtr notation;
+
+  notation = (xmlNotationPtr) xmljGetNodeID (env, self);
+  if (notation->SystemID == NULL)
+    {
+      return NULL;
+    }
+  return xmljNewString (env, notation->SystemID);
+}
+
+/* -- GnomeProcessingInstruction -- */
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeProcessingInstruction_getData (JNIEnv * env,
+                                                             jobject self)
+{
+  xmlNodePtr node;
+  xmlChar *text;
+  jstring ret;
+
+  node = xmljGetNodeID (env, self);
+  text = xmlNodeGetContent (node);
+  ret = xmljNewString (env, (const xmlChar *) text);
+  if (text != NULL)
+    {
+      xmlFree (text);
+    }
+  return ret;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeProcessingInstruction_setData (JNIEnv * env,
+                                                             jobject self,
+                                                             jstring data)
+{
+  xmlNodePtr node;
+  const xmlChar *s_data;
+
+  node = xmljGetNodeID (env, self);
+  s_data = xmljGetStringChars (env, data);
+  xmlNodeSetContent (node, s_data);
+}
+
+/* -- GnomeTypeInfo -- */
+
+xmlDtdPtr xmljGetDtd (xmlDocPtr doc)
+{
+  xmlNodePtr ctx;
+
+  for (ctx = doc->children; ctx; ctx = ctx->next)
+    {
+      if (ctx->type == XML_DOCUMENT_TYPE_NODE)
+        {
+          return (xmlDtdPtr) ctx;
+        }
+    }
+  return NULL;
+}
+
+JNIEXPORT jstring JNICALL 
+Java_gnu_xml_libxmlj_dom_GnomeTypeInfo_getTypeName (JNIEnv *env, jobject self)
+{
+  xmlNodePtr node;
+  xmlDtdPtr dtd;
+  xmlAttributePtr attribute;
+  
+  node = xmljGetNodeID (env, self);
+  dtd = xmljGetDtd (node->doc);
+  if (dtd)
+    {
+      switch (node->type)
+        {
+        case XML_ATTRIBUTE_NODE:
+          attribute = xmlGetDtdAttrDesc (dtd, node->parent->name, node->name);
+          if (attribute)
+            {
+              switch (attribute->type)
+                {
+                case XML_ATTRIBUTE_CDATA:
+                  return xmljNewString (env, BAD_CAST "CDATA");
+                case XML_ATTRIBUTE_ID:
+                  return xmljNewString (env, BAD_CAST "ID");
+                case XML_ATTRIBUTE_IDREF:
+                  return xmljNewString (env, BAD_CAST "IDREF");
+                case XML_ATTRIBUTE_IDREFS:
+                  return xmljNewString (env, BAD_CAST "IDREFS");
+                case XML_ATTRIBUTE_ENTITY:
+                  return xmljNewString (env, BAD_CAST "ENTITY");
+                case XML_ATTRIBUTE_ENTITIES:
+                  return xmljNewString (env, BAD_CAST "ENTITIES");
+                case XML_ATTRIBUTE_NMTOKEN:
+                  return xmljNewString (env, BAD_CAST "NMTOKEN");
+                case XML_ATTRIBUTE_NMTOKENS:
+                  return xmljNewString (env, BAD_CAST "NMTOKENS");
+                default:
+                  return NULL;
+                }
+            }
+          return NULL;
+        default:
+          return NULL;
+        }
+    }
+  /* TODO when XML Schema support is available */
+  return NULL;
+}
+
+JNIEXPORT jstring JNICALL 
+Java_gnu_xml_libxmlj_dom_GnomeTypeInfo_getTypeNamespace (JNIEnv *env,
+                                                         jobject self)
+{
+  xmlNodePtr node;
+  xmlDtdPtr dtd;
+  xmlAttributePtr attribute;
+  
+  node = xmljGetNodeID (env, self);
+  dtd = xmljGetDtd (node->doc);
+  if (dtd)
+    {
+      switch (node->type)
+        {
+        case XML_ATTRIBUTE_NODE:
+          attribute = xmlGetDtdAttrDesc (dtd, node->parent->name, node->name);
+          if (attribute)
+            {
+              return xmljNewString (env,
+                                    BAD_CAST "http://www.w3.org/TR/REC-xml");
+            }
+          return NULL;
+        default:
+          return NULL;
+        }
+    }
+  /* TODO when XML Schema support is available */
+  return NULL;
+}
+
+JNIEXPORT jboolean JNICALL 
+Java_gnu_xml_libxmlj_dom_GnomeTypeInfo_isDerivedFrom (JNIEnv *env
+						      __attribute__ ((__unused__)),
+                                                      jobject self
+						      __attribute__ ((__unused__)),
+                                                      jstring typeNS
+						      __attribute__ ((__unused__)),
+                                                      jstring typeName
+						      __attribute__ ((__unused__)),
+                                                      jint method
+						      __attribute__ ((__unused__)))
+{
+  /* TODO when XML Schema support is available */
+  return 0;
+}
+
+/* -- Utility -- */
+
+/*
+ * Create GnomeDocument object from the given xmlDocPtr
+ */
+jobject
+xmljCreateDocument (JNIEnv * env, jobject self, xmlDocPtr doc)
+{
+  jclass cls;
+  jfieldID field;
+  jobject ret;
+
+  if (!doc)
+    {
+      return NULL;
+    }
+
+  /* Get document object */
+  ret = xmljGetNodeInstance (env, (xmlNodePtr) doc);
+
+  /* Set DOM implementation field */
+  cls = (*env)->FindClass (env, "gnu/xml/libxmlj/dom/GnomeDocument");
+  field = (*env)->GetFieldID (env, cls, "dom",
+                              "Lorg/w3c/dom/DOMImplementation;");
+  (*env)->SetObjectField (env, ret, field, self);
+  return ret;
+}
+
+xmlAttrPtr
+xmljGetNamedItem (JNIEnv * env, jobject self, jstring name)
+{
+  xmlNodePtr node;
+  xmlAttrPtr attr;
+  const xmlChar *s_name;
+
+  s_name = xmljGetStringChars (env, name);
+
+  node = xmljGetNodeID (env, self);
+  attr = node->properties;
+  while (attr != NULL)
+    {
+      if (xmljMatch (s_name, (xmlNodePtr) attr))
+        break;
+      attr = attr->next;
+    }
+  xmlFree ((xmlChar *) s_name);
+
+  return attr;
+}
+
+xmlAttrPtr
+xmljGetNamedItemNS (JNIEnv * env, jobject self, jstring uri, jstring localName)
+{
+  xmlNodePtr node;
+  xmlAttrPtr attr;
+  const xmlChar *s_uri;
+  const xmlChar *s_localName;
+
+  s_uri = xmljGetStringChars (env, uri);
+  s_localName = xmljGetStringChars (env, localName);
+
+  node = xmljGetNodeID (env, self);
+  attr = node->properties;
+  while (attr != NULL)
+    {
+      if (xmljMatchNS (s_uri, s_localName, (xmlNodePtr) attr))
+        break;
+      attr = attr->next;
+    }
+  xmlFree ((xmlChar *) s_uri);
+  xmlFree ((xmlChar *) s_localName);
+
+  return attr;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_dom.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_dom.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_dom.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_dom.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* xmlj_dom.h -
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef XMLJ_DOM_H
+#define XMLJ_DOM_H
+
+#include "gnu_xml_libxmlj_dom_GnomeAttr.h"
+#include "gnu_xml_libxmlj_dom_GnomeDocument.h"
+#include "gnu_xml_libxmlj_dom_GnomeDocumentBuilder.h"
+#include "gnu_xml_libxmlj_dom_GnomeDocumentType.h"
+#include "gnu_xml_libxmlj_dom_GnomeElement.h"
+#include "gnu_xml_libxmlj_dom_GnomeEntity.h"
+#include "gnu_xml_libxmlj_dom_GnomeNamedNodeMap.h"
+#include "gnu_xml_libxmlj_dom_GnomeNode.h"
+#include "gnu_xml_libxmlj_dom_GnomeNodeList.h"
+#include "gnu_xml_libxmlj_dom_GnomeNotation.h"
+#include "gnu_xml_libxmlj_dom_GnomeProcessingInstruction.h"
+#include "gnu_xml_libxmlj_dom_GnomeTypeInfo.h"
+
+#include <libxml/parser.h>
+#include <libxml/valid.h>
+
+void xmljValidateChildNode (JNIEnv *env, xmlNodePtr parent, xmlNodePtr child);
+int xmljIsEqualNode (xmlNodePtr node1, xmlNodePtr node2);
+int xmljIsEqualNodeList (xmlNodePtr node1, xmlNodePtr node2);
+void xmljNormalizeNode (xmlNodePtr node);
+xmlDtdPtr xmljGetDtd (xmlDocPtr doc);
+int xmljCompare (xmlNodePtr n1, xmlNodePtr n2);
+
+/* Utility */
+jobject xmljCreateDocument (JNIEnv * env, jobject self, xmlDocPtr doc);
+xmlAttrPtr xmljGetNamedItem (JNIEnv * env, jobject self, jstring name);
+xmlAttrPtr xmljGetNamedItemNS (JNIEnv * env, jobject self, jstring uri,
+			   jstring localName);
+
+#endif /* !defined XMLJ_DOM_H */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_error.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_error.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_error.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_error.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,169 @@
+/* xmlj_error.c -
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "xmlj_error.h"
+#include "xmlj_io.h"
+#include "xmlj_util.h"
+
+void
+xmljXsltErrorFunc (void *ctx, const char *msg, ...)
+{
+  if (NULL != ctx)
+    {
+      SAXParseContext *sax = ((SAXParseContext *) ctx);
+      
+      if (NULL != sax)
+        {
+          JNIEnv *env = sax->env;
+          
+          if (!(*env)->ExceptionOccurred (env))
+            {
+              jobject target = sax->obj;
+              xmlChar *x_msg;
+              jstring j_msg;
+              va_list args;
+              
+              if (sax->error == NULL)
+                {
+                  sax->error =
+                    xmljGetMethodID (env,
+                                     target,
+                                     "error",
+                                 "(Ljava/lang/String;IILjava/lang/String;Ljava/lang/String;)V");
+                  if (sax->error == NULL)
+                    {
+                      return;
+                    }
+                }
+              
+              va_start (args, msg);
+              x_msg = (msg == NULL) ? NULL : xmlCharStrdup (msg);
+              va_end (args);
+              j_msg = xmljNewString (env, x_msg);
+              
+              (*env)->CallVoidMethod (env,
+                                      target,
+                                      sax->error,
+                                      j_msg,
+                                      -1,
+                                      -1,
+                                      NULL,
+                                      NULL);
+            }
+        }
+    }
+  else
+    {
+      va_list va;
+      va_start (va, msg);
+      fprintf (stderr, "libxslt error: ");
+      vfprintf (stderr, msg, va);
+      fflush (stderr);
+      va_end (va);
+    }
+}
+
+void
+xmljThrowException (JNIEnv *env,
+                    const char *classname,
+                    const char *message)
+{
+  jclass cls;
+  jmethodID method;
+  jthrowable ex;
+  jstring jmsg;
+
+  /*fprintf(stderr, "Throwing exception %s %s\n", classname, message);*/
+  cls = (*env)->FindClass (env, classname);
+  if (cls == NULL)
+    {
+      fprintf (stderr, "Can't find class %s\n", classname);
+      fflush (stderr);
+      return;
+    }
+  method = (*env)->GetMethodID (env, cls, "<init>", "(Ljava/lang/String;)V");
+  if (method == NULL)
+    {
+      fprintf (stderr, "Can't find method %s.<init>\n", classname);
+      fflush (stderr);
+      return;
+    }
+  jmsg = (message == NULL) ? NULL : (*env)->NewStringUTF (env, message);
+  ex = (jthrowable) (*env)->NewObject (env, cls, method, jmsg);
+  if (ex == NULL)
+    {
+      fprintf (stderr, "Can't instantiate new %s\n", classname);
+      fflush (stderr);
+      return;
+    }
+  (*env)->Throw (env, ex);
+}
+
+void
+xmljThrowDOMException (JNIEnv *env,
+                       int code,
+                       const char *message)
+{
+  jclass cls;
+  jmethodID method;
+  jthrowable ex;
+  jstring jmsg;
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  cls = (*env)->FindClass (env, "gnu/xml/libxmlj/dom/GnomeDOMException");
+  if (cls == NULL)
+    {
+      fprintf (stderr, "Can't find DOMException class!\n");
+      fflush (stderr);
+      return;
+    }
+  method = (*env)->GetMethodID (env, cls, "<init>", "(SLjava/lang/String;)V");
+  if (method == NULL)
+    {
+      fprintf (stderr, "Can't find DOMException constructor!\n");
+      fflush (stderr);
+      return;
+    }
+  jmsg = (message == NULL) ? NULL : (*env)->NewStringUTF (env, message);
+  ex = (jthrowable) (*env)->NewObject (env, cls, method, code, jmsg);
+  (*env)->Throw (env, ex);
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_error.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_error.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_error.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_error.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,85 @@
+/* xmlj_error.h -
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef XMLJ_ERROR_H
+#define XMLJ_ERROR_H
+
+#include <jni.h>  
+#include <libxml/xmlIO.h>
+
+/*
+typedef struct SaxErrorContext_ 
+{
+  JNIEnv * env;
+  jobject saxErrorAdapter;
+  jmethodID saxCommentMethodID;
+  jmethodID saxWarningMethodID;
+  jmethodID saxErrorMethodID;
+  jmethodID saxFatalErrorMethodID;
+  jclass sourceLocatorClass;
+  jmethodID sourceLocatorConstructor;
+  xmlSAXLocatorPtr locator;
+  jstring publicId;
+  jstring systemId;
+  const char *publicIdCstr;
+  const char *systemIdCstr;
+  jmethodID resolveURIMethodID;
+  jmethodID resolveURIAndOpenMethodID;
+  jmethodID getInputStreamMethodID;
+  jmethodID xsltGenericErrorMethodID;
+  jobject theTransformerException;
+  jmethodID getNativeHandleMethodID;
+} SaxErrorContext;
+
+SaxErrorContext * xmljCreateSaxErrorContext (JNIEnv * env,
+					       jobject errorContext,
+					       jstring systemId,
+					       jstring publicId);
+
+void xmljFreeSaxErrorContext (SaxErrorContext * errorContext);
+
+void xmljInitErrorHandling (xmlSAXHandler * saxHandler);
+*/
+
+void xmljXsltErrorFunc (void *ctx, const char *msg, ...);
+
+void xmljThrowException (JNIEnv *, const char *classname, const char *message);
+
+void xmljThrowDOMException (JNIEnv *, int code, const char *message);
+
+#endif	/* !defined XMLJ_ERROR_H */
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_io.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_io.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_io.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_io.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,799 @@
+/* xmlj_io.c -
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "xmlj_io.h"
+#include "xmlj_error.h"
+#include "xmlj_node.h"
+#include "xmlj_sax.h"
+#include "xmlj_util.h"
+
+#include <math.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <libxml/xmlIO.h>
+#include <libxml/parserInternals.h>
+
+#include <pthread.h>
+
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define UNSIGN(a) (((a) < 0) ? ((a) + 0x100) : (a))
+
+#define DETECT_BUFFER_SIZE 50
+
+typedef struct _OutputStreamContext
+{
+
+  JNIEnv *env;
+  jobject outputStream;
+  jmethodID outputStreamWriteFunc;
+  jmethodID outputStreamCloseFunc;
+
+}
+OutputStreamContext;
+
+typedef struct _InputStreamContext
+{
+
+  JNIEnv *env;
+  jobject inputStream;
+  jmethodID inputStreamReadFunc;
+  jmethodID inputStreamCloseFunc;
+  jobject bufferByteArray;
+  jint bufferLength;
+
+}
+InputStreamContext;
+
+InputStreamContext *xmljNewInputStreamContext (JNIEnv * env,
+                                               jobject inputStream);
+
+void xmljFreeInputStreamContext (InputStreamContext * inContext);
+
+int xmljInputReadCallback (void *context, char *buffer, int len);
+
+int xmljInputCloseCallback (void *context);
+
+int xmljOutputWriteCallback (void *context, const char *buffer, int len);
+
+int xmljOutputCloseCallback (void *context);
+
+OutputStreamContext *xmljNewOutputStreamContext (JNIEnv * env,
+                                                 jobject outputStream);
+
+void
+xmljFreeOutputStreamContext (OutputStreamContext * outContext);
+
+xmlCharEncoding
+xmljDetectCharEncoding (JNIEnv * env, jbyteArray buffer);
+
+int
+xmljOutputWriteCallback (void *context, const char *buffer, int len)
+{
+  OutputStreamContext *outContext;
+  JNIEnv *env;
+  jbyteArray byteArray;
+
+  outContext = (OutputStreamContext *) context;
+  env = outContext->env;
+  byteArray = (*env)->NewByteArray (env, len);
+
+  if (0 != byteArray)
+    {
+      (*env)->SetByteArrayRegion (env, byteArray, 0, len, (jbyte *) buffer);
+
+      (*env)->CallVoidMethod (env,
+                              outContext->outputStream,
+                              outContext->outputStreamWriteFunc, byteArray);
+
+      (*env)->DeleteLocalRef (env, byteArray);
+
+      return (*env)->ExceptionOccurred (env) ? -1 : len;
+    }
+  else
+    {
+      /* Out of memory, signal error */
+      return -1;
+    }
+}
+
+int
+xmljOutputCloseCallback (void *context)
+{
+  OutputStreamContext *outContext;
+  JNIEnv *env;
+
+  outContext = (OutputStreamContext *) context;
+  env = outContext->env;
+  (*env)->CallVoidMethod (env,
+                          outContext->outputStream,
+                          outContext->outputStreamCloseFunc);
+
+  return (*env)->ExceptionOccurred (env) ? -1 : 0;
+}
+
+int
+xmljInputReadCallback (void *context, char *buffer, int len)
+{
+  InputStreamContext *inContext;
+  JNIEnv *env;
+  jint nread;
+  int offset;
+
+  inContext = (InputStreamContext *) context;
+  env = inContext->env;
+  nread = 0;
+
+  for (offset = 0; offset < len && nread >= 0;)
+    {
+      nread = (*env)->CallIntMethod (env,
+                                     inContext->inputStream,
+                                     inContext->inputStreamReadFunc,
+                                     inContext->bufferByteArray,
+                                     0, MIN (len - offset,
+                                             inContext->bufferLength));
+
+      if (nread > 0)
+        {
+          (*env)->GetByteArrayRegion (env,
+                                      inContext->bufferByteArray,
+                                      0, nread, ((jbyte *) buffer) + offset);
+
+          offset += nread;
+        }
+    }
+
+  return (*env)->ExceptionOccurred (env) ? -1 : offset;
+}
+
+int
+xmljInputCloseCallback (void *context)
+{
+  InputStreamContext *inContext;
+  JNIEnv *env;
+
+  inContext = (InputStreamContext *) context;
+  env = inContext->env;
+  (*env)->CallVoidMethod (env, inContext->inputStream,
+                          inContext->inputStreamCloseFunc);
+
+  return (*env)->ExceptionOccurred (env) ? -1 : 0;
+}
+
+InputStreamContext *
+xmljNewInputStreamContext (JNIEnv * env, jobject inputStream)
+{
+  jclass inputStreamClass;
+  InputStreamContext *result;
+
+  inputStreamClass = (*env)->FindClass (env, "java/io/InputStream");
+  if (inputStreamClass == NULL)
+    {
+      return NULL;
+    }
+  result = (InputStreamContext *) malloc (sizeof (InputStreamContext));
+  if (result == NULL)
+    {
+      return NULL;
+    }
+
+  result->env = env;
+  result->inputStream = inputStream;
+  result->inputStreamReadFunc =
+    (*env)->GetMethodID (env, inputStreamClass, "read", "([BII)I");
+  result->inputStreamCloseFunc =
+    (*env)->GetMethodID (env, inputStreamClass, "close", "()V");
+  result->bufferLength = 4096;
+  result->bufferByteArray = (*env)->NewByteArray (env, result->bufferLength);
+  return result;
+}
+
+void
+xmljFreeInputStreamContext (InputStreamContext * inContext)
+{
+  JNIEnv *env;
+
+  env = inContext->env;
+  (*env)->DeleteLocalRef (env, inContext->bufferByteArray);
+  free (inContext);
+}
+
+OutputStreamContext *
+xmljNewOutputStreamContext (JNIEnv * env, jobject outputStream)
+{
+  jclass outputStreamClass;
+  OutputStreamContext *result;
+
+  outputStreamClass = (*env)->FindClass (env, "java/io/OutputStream");
+  if (outputStreamClass == NULL)
+    {
+      return NULL;
+    }
+  result = (OutputStreamContext *) malloc (sizeof (OutputStreamContext));
+  if (result == NULL)
+    {
+      return NULL;
+    }
+
+  result->env = env;
+  result->outputStream = outputStream;
+  result->outputStreamWriteFunc =
+    (*env)->GetMethodID (env, outputStreamClass, "write", "([B)V");
+  result->outputStreamCloseFunc =
+    (*env)->GetMethodID (env, outputStreamClass, "close", "()V");
+  return result;
+}
+
+
+void
+xmljFreeOutputStreamContext (OutputStreamContext * outContext)
+{
+  free (outContext);
+}
+
+SAXParseContext *
+xmljNewSAXParseContext (JNIEnv * env, jobject obj, xmlParserCtxtPtr ctx,
+                        jstring publicId, jstring systemId)
+{
+  SAXParseContext *ret;
+  
+  ret = (SAXParseContext *) malloc (sizeof (SAXParseContext));
+  ret->env = env;
+  ret->obj = obj;
+  ret->ctx = ctx;
+  ret->sax = ctx->sax;
+  ret->loc = NULL;
+  ret->publicId = publicId;
+  ret->systemId = systemId;
+  
+  ret->startDTD = NULL;
+  ret->externalEntityDecl = NULL;
+  ret->internalEntityDecl = NULL;
+  ret->resolveEntity = NULL;
+  ret->notationDecl = NULL;
+  ret->attributeDecl = NULL;
+  ret->elementDecl = NULL;
+  ret->unparsedEntityDecl = NULL;
+  ret->setDocumentLocator = NULL;
+  ret->startDocument = NULL;
+  ret->endDocument = NULL;
+  ret->startElement = NULL;
+  ret->endElement = NULL;
+  ret->characters = NULL;
+  ret->ignorableWhitespace = NULL;
+  ret->processingInstruction = NULL;
+  ret->comment = NULL;
+  ret->cdataBlock = NULL;
+  ret->warning = NULL;
+  ret->error = NULL;
+  ret->fatalError = NULL;
+
+  ret->resolveURIAndOpen = NULL;
+  ret->stringClass = NULL; 
+  return ret;
+}
+
+void
+xmljFreeSAXParseContext (SAXParseContext * saxCtx)
+{
+  free (saxCtx);
+}
+
+xmlCharEncoding
+xmljDetectCharEncoding (JNIEnv * env, jbyteArray buffer)
+{
+  xmlCharEncoding ret;
+  jint nread;
+
+  if (buffer == NULL)
+    {
+      return XML_CHAR_ENCODING_ERROR;
+    }
+  nread = (*env)->GetArrayLength (env, buffer);
+  if (nread >= 5)
+    {
+      jbyte nativeBuffer[DETECT_BUFFER_SIZE + 1];
+      unsigned char converted[DETECT_BUFFER_SIZE + 1];
+      int i;
+
+      memset (nativeBuffer, 0, DETECT_BUFFER_SIZE + 1);
+      (*env)->GetByteArrayRegion (env, buffer, 0, nread, nativeBuffer);
+      /* Convert from signed to unsigned */
+      for (i = 0; i < DETECT_BUFFER_SIZE + 1; i++)
+        {
+          converted[i] = UNSIGN (nativeBuffer[i]);
+        }
+      ret = xmlDetectCharEncoding (converted, nread);
+    }
+  else
+    {
+      ret = XML_CHAR_ENCODING_NONE;
+    }
+  return ret;
+}
+
+xmlParserCtxtPtr
+xmljNewParserContext (JNIEnv * env,
+                      jobject inputStream,
+                      jbyteArray detectBuffer,
+                      jstring publicId,
+                      jstring systemId,
+                      jstring base,
+                      jboolean validate,
+                      jboolean coalesce,
+                      jboolean expandEntities,
+                      jboolean loadEntities)
+{
+  InputStreamContext *inputContext;
+  xmlCharEncoding encoding;
+  xmlParserCtxtPtr ctx;
+  int options;
+
+  encoding = xmljDetectCharEncoding (env, detectBuffer);
+  if (encoding != XML_CHAR_ENCODING_ERROR)
+    {
+      inputContext = xmljNewInputStreamContext (env, inputStream);
+      if (NULL != inputContext)
+        {
+          /* NOTE: userdata must be NULL for DOM to work */
+          ctx = xmlCreateIOParserCtxt (NULL,
+                                       NULL,
+                                       xmljInputReadCallback,
+                                       xmljInputCloseCallback,
+                                       inputContext,
+                                       encoding);
+          if (NULL != ctx)
+            {
+              ctx->userData = ctx;
+              
+              /* Set parsing options */
+              options = 0;
+              if (validate)
+                {
+                  options |= XML_PARSE_DTDVALID;
+                }
+              if (coalesce)
+                {
+                  options |= XML_PARSE_NOCDATA;
+                }
+              if (expandEntities)
+                {
+                  options |= XML_PARSE_NOENT;
+                }
+              if (loadEntities)
+                {
+                  options |= XML_PARSE_DTDLOAD;
+                }
+              if (xmlCtxtUseOptions (ctx, options))
+                {
+                  xmljThrowException (env,
+                                      "java/lang/RuntimeException",
+                                      "Unable to set xmlParserCtxtPtr options");
+                }
+              if (base != NULL)
+                {
+                  ctx->input->directory =
+                    (*env)->GetStringUTFChars (env, base, 0);
+                }
+              return ctx;
+            }
+          xmljFreeInputStreamContext (inputContext);
+        }
+    }
+  return NULL;
+}
+
+void
+xmljFreeParserContext (xmlParserCtxtPtr ctx)
+{
+  InputStreamContext *inputStreamContext = NULL;
+
+  if (ctx->input != NULL && ctx->input->buf != NULL)
+    {
+      inputStreamContext
+        = (InputStreamContext *) ctx->input->buf->context;
+      
+    }
+  xmlFreeParserCtxt (ctx);
+  if (inputStreamContext != NULL)
+    {
+      xmljFreeInputStreamContext (inputStreamContext);
+    }
+}
+
+xmlDocPtr
+xmljParseDocument (JNIEnv * env,
+                   jobject self,
+                   jobject in,
+                   jbyteArray detectBuffer,
+                   jstring publicId,
+                   jstring systemId,
+                   jstring base,
+                   jboolean validate,
+                   jboolean coalesce,
+                   jboolean expandEntities,
+                   jboolean contentHandler,
+                   jboolean dtdHandler,
+                   jboolean entityResolver,
+                   jboolean errorHandler,
+                   jboolean declarationHandler,
+                   jboolean lexicalHandler,
+                   int mode)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *saxCtx;
+  xmlSAXHandlerPtr sax;
+
+  ctx = xmljNewParserContext (env, in, detectBuffer, publicId, systemId, base,
+                              validate, coalesce, expandEntities,
+                              entityResolver);
+  if (ctx != NULL)
+    {
+      saxCtx = xmljNewSAXParseContext (env, self, ctx, publicId, systemId);
+      if (saxCtx != NULL)
+        {
+          sax = xmljNewSAXHandler (contentHandler,
+                                   dtdHandler,
+                                   entityResolver,
+                                   errorHandler,
+                                   declarationHandler,
+                                   lexicalHandler);
+          if (sax != NULL)
+            {
+              return xmljParseDocument2 (env,
+                                         ctx,
+                                         saxCtx,
+                                         sax,
+                                         mode);
+            }
+          xmljFreeSAXParseContext (saxCtx);
+        }
+      xmljFreeParserContext (ctx);
+    }
+  if (!(*env)->ExceptionOccurred (env))
+    {
+      xmljThrowException (env, "java/io/IOException",
+                          "Unable to create parser context");
+    }
+  return NULL;
+}
+
+xmlDocPtr
+xmljParseDocument2 (JNIEnv * env,
+                    xmlParserCtxtPtr ctx,
+                    SAXParseContext *saxCtx,
+                    xmlSAXHandlerPtr sax,
+                    int mode)
+{
+  xmlSAXHandlerPtr orig;
+  xmlDocPtr doc;
+  int ret;
+  
+  ctx->_private = saxCtx;
+  ctx->userData = ctx;
+  orig = ctx->sax;
+  ctx->sax = sax;
+  
+  xmljSetThreadContext (saxCtx);
+
+  ret = xmlParseDocument (ctx);
+  doc = ctx->myDoc;
+  if (ret || !doc)
+    {
+      const char *msg = ctx->lastError.message;
+      switch (mode)
+        {
+        case 0:
+          xmljSAXFatalError (ctx, msg);
+          break;
+        case 1:
+          xmljThrowDOMException (env, ret, msg);
+          break;
+        case 2:
+          xmljThrowException (env,
+                              "javax/xml/transform/TransformerException",
+                              msg);
+        }
+    }
+  
+  xmljClearThreadContext ();
+              
+  ctx->sax = orig;
+  free(sax);
+  xmljFreeSAXParseContext (saxCtx);
+  xmljFreeParserContext (ctx);
+  xmljClearStringCache ();
+  return doc;
+}
+
+xmlParserInputPtr
+xmljNewParserInput (JNIEnv * env,
+                    jobject inputStream,
+                    jbyteArray detectBuffer,
+                    xmlParserCtxtPtr parserContext)
+{
+  xmlParserInputPtr ret;
+  xmlParserInputBufferPtr input;
+  xmlCharEncoding encoding;
+
+  encoding = xmljDetectCharEncoding (env, detectBuffer);
+  if (encoding != XML_CHAR_ENCODING_ERROR)
+    {
+      input = xmljNewParserInputBuffer (env, inputStream, encoding);
+      if (input != NULL)
+        {
+          ret = xmlNewIOInputStream (parserContext, input, encoding);
+          return ret;
+        }
+      xmlFreeParserInputBuffer (input);
+    }
+  return NULL;
+}
+
+xmlParserInputBufferPtr
+xmljNewParserInputBuffer (JNIEnv * env,
+                          jobject inputStream, xmlCharEncoding encoding)
+{
+  xmlParserInputBufferPtr ret;
+  InputStreamContext *inputContext;
+
+  inputContext = xmljNewInputStreamContext (env, inputStream);
+  if (NULL != inputContext)
+    {
+      ret = xmlParserInputBufferCreateIO (&xmljInputReadCallback,
+                                          &xmljInputCloseCallback,
+                                          inputContext, encoding);
+      if (ret != NULL)
+        return ret;
+      xmljFreeInputStreamContext (inputContext);
+    }
+  return NULL;
+}
+
+void
+xmljSaveFileToJavaOutputStream (JNIEnv * env, jobject outputStream,
+                                xmlDocPtr tree,
+                                const char *outputEncodingName)
+{
+  OutputStreamContext *outputContext =
+    xmljNewOutputStreamContext (env, outputStream);
+
+  xmlCharEncoding outputEncoding = xmlParseCharEncoding (outputEncodingName);
+
+  xmlOutputBufferPtr outputBuffer =
+    xmlOutputBufferCreateIO (xmljOutputWriteCallback,
+                             xmljOutputCloseCallback,
+                             outputContext,
+                             xmlGetCharEncodingHandler (outputEncoding));
+
+  /* Write result to output stream */
+
+  xmlSaveFileTo (outputBuffer, tree, outputEncodingName);
+
+  xmljFreeOutputStreamContext (outputContext);
+}
+
+/*
+jobject
+xmljResolveURI (SaxErrorContext * saxErrorContext,
+                const char *URL, const char *ID)
+{
+  JNIEnv *env = saxErrorContext->env;
+
+  jstring hrefString = (*env)->NewStringUTF (env, URL);
+  jstring baseString = saxErrorContext->systemId;
+
+  jobject sourceWrapper = (*env)->CallObjectMethod (env,
+                                                    saxErrorContext->
+                                                    saxErrorAdapter,
+                                                    saxErrorContext->
+                                                    resolveURIMethodID,
+                                                    hrefString,
+                                                    baseString);
+  (*env)->DeleteLocalRef (env, hrefString);
+
+  if (NULL == sourceWrapper)
+    {
+      return NULL;
+    }
+  else
+    {
+      jobject sourceInputStream = (*env)->CallObjectMethod (env,
+                                                            sourceWrapper,
+                                                            saxErrorContext->
+                                                            getInputStreamMethodID);
+
+      (*env)->DeleteLocalRef (env, sourceWrapper);
+
+      if ((*env)->ExceptionOccurred (env))
+        {
+          -* Report to ErrorAdapter here? *-
+          return NULL;
+        }
+
+      return sourceInputStream;
+    }
+}*/
+
+xmlDocPtr
+xmljResolveURIAndOpen (SAXParseContext *saxContext,
+                       const char *URL,
+                       const char *ID)
+{
+  jobject libxmlDocument;
+  xmlDocPtr doc;
+  JNIEnv *env = saxContext->env;
+
+  jstring hrefString = (*env)->NewStringUTF (env, URL);
+  jstring baseString = saxContext->systemId;
+
+  if (saxContext->resolveURIAndOpen == NULL)
+    {
+      jclass cls = (*env)->GetObjectClass (env, saxContext->obj);
+      saxContext->resolveURIAndOpen =
+        (*env)->GetMethodID (env, cls, "resolveURIAndOpen",
+                             "Ljava/lang/String;Ljava/lang/String)Lgnu/xml/libxmlj/transform/LibxmlDocument;");
+    }
+  libxmlDocument =
+    (*env)->CallObjectMethod (env,
+                              saxContext->obj,
+                              saxContext->resolveURIAndOpen,
+                              hrefString,
+                              baseString);
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, libxmlDocument);
+
+  (*env)->DeleteLocalRef (env, libxmlDocument);
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      /* Report to ErrorAdapter here? */
+      return NULL;
+    }
+  else
+    {
+      return doc;
+    }
+}
+
+/*xmlParserInputPtr
+xmljLoadExternalEntity (const char *URL, const char *ID,
+                        xmlParserCtxtPtr ctxt)
+{
+  SaxErrorContext *saxErrorContext = xmljGetThreadContext ();
+
+  JNIEnv *env = saxErrorContext->env;
+
+  jstring hrefString = (*env)->NewStringUTF (env, URL);
+  jstring baseString = saxErrorContext->systemId;
+
+  jobject sourceWrapper = (*env)->CallObjectMethod (env,
+                                                    saxErrorContext->
+                                                    saxErrorAdapter,
+                                                    saxErrorContext->
+                                                    resolveURIMethodID,
+                                                    hrefString,
+                                                    baseString);
+
+  (*env)->DeleteLocalRef (env, hrefString);
+
+  if (NULL == sourceWrapper)
+    {
+      return NULL;
+    }
+  else
+    {
+      InputStreamContext *inputContext;
+      xmlParserInputBufferPtr inputBuffer;
+      xmlParserInputPtr inputStream;
+
+      jobject sourceInputStream = (*env)->CallObjectMethod (env,
+                                                            sourceWrapper,
+                                                            saxErrorContext->
+                                                            getInputStreamMethodID);
+
+      (*env)->DeleteLocalRef (env, sourceWrapper);
+
+      if ((*env)->ExceptionOccurred (env))
+        {
+          -* Report to ErrorAdapter *-
+          return NULL;
+        }
+
+      inputContext = xmljNewInputStreamContext (env, sourceInputStream);
+
+      inputBuffer
+        = xmlParserInputBufferCreateIO (xmljInputReadCallback,
+                                        xmljInputCloseCallback,
+                                        inputContext, XML_CHAR_ENCODING_NONE);
+
+      inputStream = xmlNewInputStream (ctxt);
+      if (inputStream == NULL)
+        {
+          return (NULL);
+        }
+
+      inputStream->filename = NULL;
+      inputStream->directory = NULL;
+      inputStream->buf = inputBuffer;
+
+      inputStream->base = inputStream->buf->buffer->content;
+      inputStream->cur = inputStream->buf->buffer->content;
+      inputStream->end = &inputStream->base[inputStream->buf->buffer->use];
+      if ((ctxt->directory == NULL) && (inputStream->directory != NULL))
+        ctxt->directory =
+          (char *) xmlStrdup ((const xmlChar *) inputStream->directory);
+      return (inputStream);
+    }
+}*/
+
+/* Key for the thread-specific buffer */
+static pthread_key_t thread_context_key;
+
+/* Once-only initialisation of the key */
+static pthread_once_t thread_context_once = PTHREAD_ONCE_INIT;
+
+static void
+thread_context_key_alloc (void);
+
+/* Allocate the key */
+static void
+thread_context_key_alloc ()
+{
+  pthread_key_create (&thread_context_key, NULL);
+}
+
+void
+xmljSetThreadContext (SAXParseContext * context)
+{
+  pthread_once (&thread_context_once, thread_context_key_alloc);
+  pthread_setspecific (thread_context_key, context);
+}
+
+void
+xmljClearThreadContext (void)
+{
+  pthread_setspecific (thread_context_key, NULL);
+}
+
+/* Return the thread-specific buffer */
+SAXParseContext *
+xmljGetThreadContext (void)
+{
+  return (SAXParseContext *) pthread_getspecific (thread_context_key);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_io.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_io.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_io.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_io.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,170 @@
+/* xmlj_io.h -
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef XMLJ_IO_H
+#define XMLJ_IO_H
+
+#include <jni.h>
+#include <libxml/xmlIO.h>
+#include "xmlj_error.h"
+
+typedef struct _SAXParseContext
+{
+
+  JNIEnv *env; /* Current JNI environment */
+  jobject obj; /* The gnu.xml.libxmlj.sax.GnomeXmlReader instance */
+  xmlParserCtxtPtr ctx; /* libxml2 parser context */
+  xmlSAXLocatorPtr loc; /* libxml2 SAX locator */
+  xmlSAXHandlerPtr sax; /* pristine SAX handler */
+  jstring publicId;
+  jstring systemId;
+
+  jmethodID startDTD;
+  jmethodID externalEntityDecl;
+  jmethodID internalEntityDecl;
+  jmethodID resolveEntity;
+  jmethodID notationDecl;
+  jmethodID attributeDecl;
+  jmethodID elementDecl;
+  jmethodID unparsedEntityDecl;
+  jmethodID setDocumentLocator;
+  jmethodID startDocument;
+  jmethodID endDocument;
+  jmethodID startElement;
+  jmethodID endElement;
+  jmethodID characters;
+  jmethodID ignorableWhitespace;
+  jmethodID processingInstruction;
+  jmethodID comment;
+  jmethodID cdataBlock;
+  jmethodID warning;
+  jmethodID error;
+  jmethodID fatalError;
+
+  jmethodID resolveURIAndOpen; /* JavaProxy */
+  jclass stringClass; 
+}
+SAXParseContext;
+
+SAXParseContext *
+xmljNewSAXParseContext (JNIEnv * env, jobject obj, xmlParserCtxtPtr ctx,
+                        jstring publicId, jstring systemId);
+
+void
+xmljFreeSAXParseContext (SAXParseContext * saxCtx);
+
+xmlParserCtxtPtr
+xmljNewParserContext (JNIEnv * env,
+                      jobject inputStream,
+                      jbyteArray detectBuffer,
+                      jstring publicId,
+                      jstring systemId,
+                      jstring base,
+                      jboolean validate,
+                      jboolean coalesce,
+                      jboolean expandEntities,
+                      jboolean loadEntities);
+
+void
+xmljFreeParserContext (xmlParserCtxtPtr parserContext);
+
+xmlDocPtr
+xmljParseDocument (JNIEnv * env,
+                   jobject self,
+                   jobject in,
+                   jbyteArray detectBuffer,
+                   jstring publicId,
+                   jstring systemId,
+                   jstring base,
+                   jboolean validate,
+                   jboolean coalesce,
+                   jboolean expandEntities,
+                   jboolean contentHandler,
+                   jboolean dtdHandler,
+                   jboolean entityResolver,
+                   jboolean errorHandler,
+                   jboolean declarationHandler,
+                   jboolean lexicalHandler,
+                   int saxMode);
+
+xmlDocPtr
+xmljParseDocument2 (JNIEnv * env,
+                    xmlParserCtxtPtr ctx,
+                    SAXParseContext *saxCtx,
+                    xmlSAXHandlerPtr sax,
+                    int saxMode);
+
+xmlParserInputPtr
+xmljNewParserInput (JNIEnv * env,
+		    jobject inputStream,
+                    jbyteArray detectBuffer,
+                    xmlParserCtxtPtr parserContext);
+
+xmlParserInputBufferPtr
+xmljNewParserInputBuffer (JNIEnv * env,
+			  jobject inputStream,
+                          xmlCharEncoding encoding);
+
+void
+xmljSaveFileToJavaOutputStream (JNIEnv * env, jobject outputStream,
+                                xmlDocPtr tree,
+                                const char *outputEncoding);
+
+/*
+xmlParserInputPtr
+xmljLoadExternalEntity (const char *URL, const char *ID,
+					  xmlParserCtxtPtr ctxt);
+
+jobject
+xmljResolveURI (SaxErrorContext * saxErrorContext, const char *URL,
+			const char *ID);
+*/
+xmlDocPtr
+xmljResolveURIAndOpen (SAXParseContext *saxContext,
+		       const char *URL, const char *ID);
+
+
+void
+xmljSetThreadContext (SAXParseContext * ctxt);
+
+SAXParseContext *
+xmljGetThreadContext (void);
+
+void
+xmljClearThreadContext (void);
+
+#endif /* !defined XMLJ_IO_H */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_node.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_node.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_node.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_node.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,203 @@
+/* xmlj_node.c -
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "xmlj_error.h"
+#include "xmlj_node.h"
+#include "xmlj_util.h"
+#include <libxml/xmlstring.h>
+
+/*
+ * Returns the node ID for the given GnomeNode object.
+ */
+xmlNodePtr
+xmljGetNodeID (JNIEnv * env, jobject self)
+{
+  jclass cls;
+  jfieldID field;
+  jobject id;
+  xmlNodePtr node;
+
+  if (self == NULL)
+    {
+      xmljThrowDOMException (env, 8, NULL);     /* NOT_FOUND_ERR */
+      return NULL;
+    }
+  cls = (*env)->GetObjectClass (env, self);
+  if (cls == NULL)
+    {
+      return NULL;
+    }
+  field = (*env)->GetFieldID (env, cls, "id", "Ljava/lang/Object;");
+  if (field == NULL)
+    {
+      return NULL;
+    }
+  id = (*env)->GetObjectField (env, self, field);
+  node = (xmlNodePtr) xmljAsPointer (env, id);
+  if (node == NULL)
+    {
+      xmljThrowDOMException (env, 8, NULL);	/* NOT_FOUND_ERR */
+    }
+  return node;
+}
+
+/*
+ * Returns the Java node instanced corresponding to the specified node ID.
+ */
+jobject
+xmljGetNodeInstance (JNIEnv * env, xmlNodePtr node)
+{
+  jclass cls;
+  jmethodID method;
+  xmlElementType type;
+
+  if (node == NULL)
+    return NULL;
+
+  /* Invoke the GnomeNode.newInstance class method */
+  cls = (*env)->FindClass (env, "gnu/xml/libxmlj/dom/GnomeNode");
+  if (cls == NULL)
+    {
+      return NULL;
+    }
+  method = (*env)->GetStaticMethodID (env, cls, "newInstance",
+                                      "(Ljava/lang/Object;Ljava/lang/Object;I)Lgnu/xml/libxmlj/dom/GnomeNode;");
+  
+  if (method == NULL)
+    {
+      return NULL;
+    }
+  type = node->type;
+  switch (type)
+    {
+    case XML_DTD_NODE:
+      type = XML_DOCUMENT_TYPE_NODE;
+      break;
+    case XML_ATTRIBUTE_DECL:
+      type = XML_ATTRIBUTE_NODE;
+      break;
+    case XML_ENTITY_DECL:
+      type = XML_ENTITY_NODE;
+      break;
+    default:
+      break;
+    }
+  return (*env)->CallStaticObjectMethod (env, cls, method,
+                                         xmljAsField (env, node->doc),
+                                         xmljAsField (env, node),
+                                         type);
+}
+
+void
+xmljFreeDoc (JNIEnv * env, xmlDocPtr doc)
+{
+  jclass cls;
+  jmethodID method;
+
+  /* Invoke the GnomeNode.freeDocument class method */
+  cls = (*env)->FindClass (env, "gnu/xml/libxmlj/dom/GnomeNode");
+  if (cls == NULL)
+    {
+      return;
+    }
+  method = (*env)->GetStaticMethodID (env, cls, "freeDocument",
+                                      "(Ljava/lang/Object;)V");
+  if (method == NULL)
+    {
+      return;
+    }
+  (*env)->CallStaticVoidMethod (env, cls, method, xmljAsField (env, doc));
+}
+
+int
+xmljMatch (const xmlChar * name, xmlNodePtr node)
+{
+  switch (node->type)
+    {
+    case XML_ELEMENT_NODE:
+    case XML_ATTRIBUTE_NODE:
+      return xmlStrcmp (node->name, name);
+    default:
+      return 1;
+    }
+}
+
+int
+xmljMatchNS (const xmlChar * uri, const xmlChar * localName, xmlNodePtr node)
+{
+  xmlNsPtr ns;
+  const xmlChar *nodeLocalName;
+  int *len;
+  int ret;
+
+  switch (node->type)
+    {
+    case XML_ELEMENT_NODE:
+    case XML_ATTRIBUTE_NODE:
+      len = (int *) malloc (sizeof (int));
+      if (xmlSplitQName3 (node->name, len) != NULL)
+        {
+          nodeLocalName = node->name + (*len);
+        }
+      else
+        {
+          nodeLocalName = node->name;
+        }
+      free (len);
+      ns = node->ns;
+      if (ns == NULL || ns->href == NULL)
+        {
+          if (uri != NULL)
+            {
+              return 0;
+            }
+          ret = xmlStrcmp (localName, nodeLocalName);
+        }
+      else
+        {
+          if (uri == NULL)
+            {
+              return 0;
+            }
+          ret = (xmlStrcmp (localName, nodeLocalName) &&
+                 xmlStrcmp (uri, ns->href));
+        }
+      return ret;
+    default:
+      return 1;
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_node.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_node.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_node.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_node.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,72 @@
+/* xmlj_node.h -
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef XMLJ_NODE_H
+#define XMLJ_NODE_H
+
+#include <jni.h>
+#include <libxml/tree.h>
+
+/* -- Utility method definitions -- */
+
+/*
+ * Returns the node for the given Java node instance
+ */
+xmlNodePtr xmljGetNodeID (JNIEnv *, jobject);
+
+/*
+ * Returns the Java node instance for the given node
+ */
+jobject xmljGetNodeInstance (JNIEnv *, xmlNodePtr);
+
+/*
+ * Frees the specified document pointer,
+ * releasing all its nodes from the cache.
+ */
+void xmljFreeDoc (JNIEnv *, xmlDocPtr);
+
+/*
+ * Match a node name
+ */
+int xmljMatch (const xmlChar *, xmlNodePtr);
+
+/*
+ * Match a node name and namespace
+ */
+int xmljMatchNS (const xmlChar *, const xmlChar *, xmlNodePtr);
+
+#endif /* !defined XMLJ_NODE_H */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_sax.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_sax.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_sax.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_sax.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1445 @@
+/* xmlj_sax.c -
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "xmlj_sax.h"
+#include "xmlj_io.h"
+#include "xmlj_util.h"
+#include <unistd.h>
+#include <string.h>
+
+xmlExternalEntityLoader defaultLoader = NULL;
+
+void
+xmljDispatchError (xmlParserCtxtPtr ctx,
+                   xmlSAXLocatorPtr loc,
+                   JNIEnv *env,
+                   jobject target,
+                   jmethodID method,
+                   const char *msg,
+                   va_list args);
+
+/* -- GnomeLocator -- */
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_sax_GnomeLocator_publicId (JNIEnv * env,
+                                                jobject self
+						__attribute__((__unused__)),
+                                                jobject j_ctx,
+                                                jobject j_loc)
+{
+  xmlParserCtxtPtr ctx;
+  xmlSAXLocatorPtr loc;
+  SAXParseContext *sax;
+
+  ctx = (xmlParserCtxtPtr) xmljAsPointer (env, j_ctx);
+  loc = (xmlSAXLocatorPtr) xmljAsPointer (env, j_loc);
+  sax = (SAXParseContext *) ctx->_private;
+  
+  return sax->publicId;
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_sax_GnomeLocator_systemId (JNIEnv * env,
+                                                jobject self
+						__attribute__((__unused__)),
+                                                jobject j_ctx,
+                                                jobject j_loc)
+{
+  xmlParserCtxtPtr ctx;
+  xmlSAXLocatorPtr loc;
+  SAXParseContext *sax;
+
+  ctx = (xmlParserCtxtPtr) xmljAsPointer (env, j_ctx);
+  loc = (xmlSAXLocatorPtr) xmljAsPointer (env, j_loc);
+  sax = (SAXParseContext *) ctx->_private;
+  
+  return sax->systemId;
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_xml_libxmlj_sax_GnomeLocator_lineNumber (JNIEnv * env,
+                                                  jobject self
+						  __attribute__((__unused__)),
+                                                  jobject j_ctx,
+                                                  jobject j_loc)
+{
+  xmlParserCtxtPtr ctx;
+  xmlSAXLocatorPtr loc;
+
+  ctx = (xmlParserCtxtPtr) xmljAsPointer (env, j_ctx);
+  loc = (xmlSAXLocatorPtr) xmljAsPointer (env, j_loc);
+  if (ctx == NULL || ctx->input == NULL)
+    {
+      return -1;
+    }
+  return ctx->input->line;
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_xml_libxmlj_sax_GnomeLocator_columnNumber (JNIEnv * env,
+                                                    jobject self
+						    __attribute__((__unused__)),
+                                                    jobject j_ctx,
+                                                    jobject j_loc)
+{
+  xmlParserCtxtPtr ctx;
+  xmlSAXLocatorPtr loc;
+
+  ctx = (xmlParserCtxtPtr) xmljAsPointer (env, j_ctx);
+  loc = (xmlSAXLocatorPtr) xmljAsPointer (env, j_loc);
+  if (ctx == NULL || ctx->input == NULL)
+    {
+      return -1;
+    }
+  return ctx->input->col;
+}
+
+/* -- GnomeXMLReader -- */
+
+/*
+ * Entry point for SAX parsing.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_sax_GnomeXMLReader_parseStream (JNIEnv * env,
+                                                     jobject self,
+                                                     jobject in,
+                                                     jbyteArray detectBuffer,
+                                                     jstring publicId,
+                                                     jstring systemId,
+                                                     jstring base,
+                                                     jboolean validate,
+                                                     jboolean contentHandler,
+                                                     jboolean dtdHandler,
+                                                     jboolean entityResolver,
+                                                     jboolean errorHandler,
+                                                     jboolean
+                                                     declarationHandler,
+                                                     jboolean lexicalHandler)
+{
+  xmljParseDocument (env,
+                     self,
+                     in,
+                     detectBuffer,
+                     publicId,
+                     systemId,
+                     base,
+                     validate,
+                     0,
+                     0,
+                     contentHandler,
+                     dtdHandler,
+                     entityResolver,
+                     errorHandler,
+                     declarationHandler,
+                     lexicalHandler,
+                     0);
+}
+
+xmlParserInputPtr
+xmljExternalEntityLoader (const char *url, const char *id,
+                          xmlParserCtxtPtr ctx)
+{
+  const xmlChar *systemId;
+  const xmlChar *publicId;
+  xmlParserInputPtr ret;
+
+  systemId = xmlCharStrdup (url);
+  publicId = xmlCharStrdup (id);
+  /* TODO convert systemId to absolute URI */
+  ret = xmljSAXResolveEntity (ctx, publicId, systemId);
+  if (ret == NULL)
+    {
+      ret = defaultLoader (url, id, ctx);
+    }
+  return ret;
+}
+
+/*
+ * Allocates and configures a SAX handler that can report the various
+ * classes of callback.
+ */
+xmlSAXHandlerPtr
+xmljNewSAXHandler (jboolean contentHandler,
+                   jboolean dtdHandler,
+                   jboolean entityResolver,
+                   jboolean errorHandler,
+                   jboolean declarationHandler,
+                   jboolean lexicalHandler)
+{
+  xmlSAXHandlerPtr sax;
+
+  sax = (xmlSAXHandlerPtr) malloc (sizeof (xmlSAXHandler));
+  if (sax == NULL)
+    {
+      return NULL;
+    }
+  memset (sax, 0, sizeof (xmlSAXHandler));
+  xmlSAXVersion (sax, 1); /* TODO SAX2 */
+
+  if (dtdHandler)
+    {
+      sax->internalSubset = &xmljSAXInternalSubset;
+    }
+  if (defaultLoader == NULL)
+    {
+      defaultLoader = xmlGetExternalEntityLoader ();
+      xmlSetExternalEntityLoader (xmljExternalEntityLoader);
+    }
+  if (entityResolver)
+    {
+      sax->resolveEntity = &xmljSAXResolveEntity;
+    }
+
+  if (declarationHandler)
+    {
+      sax->entityDecl = &xmljSAXEntityDecl;
+      sax->notationDecl = &xmljSAXNotationDecl;
+      sax->attributeDecl = &xmljSAXAttributeDecl;
+      sax->elementDecl = &xmljSAXElementDecl;
+      sax->unparsedEntityDecl = &xmljSAXUnparsedEntityDecl;
+    }
+
+  /* We always listen for the locator callback */
+  sax->setDocumentLocator = &xmljSAXSetDocumentLocator;
+  if (contentHandler)
+    {
+      sax->startDocument = &xmljSAXStartDocument;
+      sax->endDocument = &xmljSAXEndDocument;
+      sax->startElement = &xmljSAXStartElement;
+      sax->endElement = &xmljSAXEndElement;
+      sax->characters = &xmljSAXCharacters;
+      sax->ignorableWhitespace = &xmljSAXIgnorableWhitespace;
+      sax->processingInstruction = &xmljSAXProcessingInstruction;
+    }
+
+  /* We always intercept getEntity */
+  /* TODO this should only be if lexicalHandler */
+  sax->getEntity = &xmljSAXGetEntity;
+  if (lexicalHandler)
+    {
+      sax->getEntity = &xmljSAXGetEntity;
+      sax->reference = &xmljSAXReference;
+      sax->comment = &xmljSAXComment;
+      sax->cdataBlock = &xmljSAXCDataBlock;
+    }
+  else if (contentHandler)
+    {
+      sax->cdataBlock = &xmljSAXCharacters;
+    }
+
+  if (errorHandler)
+    {
+      sax->warning = &xmljSAXWarning;
+      sax->error = &xmljSAXError;
+      sax->fatalError = &xmljSAXFatalError;
+    }
+  
+  return sax;
+}
+
+/* -- Callback functions -- */
+
+void
+xmljSAXInternalSubset (void *vctx,
+                       const xmlChar * name,
+                       const xmlChar * publicId, const xmlChar * systemId)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_name;
+  jstring j_publicId;
+  jstring j_systemId;
+
+  xmlSAX2InternalSubset (vctx, name, publicId, systemId);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->startDTD == NULL)
+    {
+      sax->startDTD =
+        xmljGetMethodID (env,
+                         target,
+                         "startDTD",
+                         "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
+      if (sax->startDTD == NULL)
+        {
+          return;
+        }
+    }
+
+  j_name = xmljNewString (env, name);
+  j_publicId = xmljNewString (env, publicId);
+  j_systemId = xmljNewString (env, systemId);
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->startDTD,
+                          j_name,
+                          j_publicId,
+                          j_systemId);
+}
+
+xmlParserInputPtr
+xmljSAXResolveEntity (void *vctx,
+                      const xmlChar * publicId, const xmlChar * systemId)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_publicId;
+  jstring j_systemId;
+  jobject inputStream;
+
+  /* xmlSAX2ResolveEntity (vctx, publicId, systemId); */
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  if (ctx->_private == NULL)
+    {
+      /* Not in Kansas */
+      return NULL;
+    }
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return NULL;
+    }
+
+  if (sax->resolveEntity == NULL)
+    {
+      sax->resolveEntity =
+        xmljGetMethodID (env,
+                         target,
+                         "resolveEntity",
+                         "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;");
+      if (sax->resolveEntity == NULL)
+        {
+          return NULL;
+        }
+    }
+
+  j_publicId = xmljNewString (env, publicId);
+  j_systemId = xmljNewString (env, systemId);
+
+  inputStream = (*env)->CallObjectMethod (env,
+                                          target,
+                                          sax->resolveEntity,
+                                          j_publicId,
+                                          j_systemId,
+                                          sax->systemId);
+
+  /* Return an xmlParserInputPtr corresponding to the input stream */
+  if (inputStream != NULL)
+    {
+      jbyteArray detectBuffer;
+      jmethodID getDetectBuffer;
+
+      /* Get the detect buffer from the NamedInputStream */
+      getDetectBuffer = xmljGetMethodID (env, inputStream, "getDetectBuffer",
+                                         "()[B");
+      if (getDetectBuffer == NULL)
+        {
+          return NULL;
+        }
+      detectBuffer = (*env)->CallObjectMethod (env, inputStream,
+                                               getDetectBuffer);
+      
+      return xmljNewParserInput (env, inputStream, detectBuffer, ctx);
+    }
+  else
+    {
+      return NULL;
+    }
+}
+
+xmlEntityPtr
+xmljSAXGetEntity (void *vctx __attribute__((__unused__)), const xmlChar * name)
+{
+  xmlEntityPtr ret;
+  
+  /* TODO */
+  /* ret = xmlSAX2GetEntity (vctx, name); */
+  ret = NULL;
+  return ret;
+}
+
+void
+xmljSAXEntityDecl (void *vctx,
+                   const xmlChar * name,
+                   int type,
+                   const xmlChar * publicId,
+                   const xmlChar * systemId,
+                   xmlChar * content)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_name;
+  jstring j_publicId;
+  jstring j_systemId;
+  jstring j_value;
+
+  xmlSAX2EntityDecl (vctx, name, type, publicId, systemId, content);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  j_name = xmljNewString (env, name);
+  switch (type)
+    {
+    case XML_INTERNAL_GENERAL_ENTITY:
+    case XML_INTERNAL_PARAMETER_ENTITY:
+    case XML_INTERNAL_PREDEFINED_ENTITY:
+      if (sax->internalEntityDecl == NULL)
+        {
+          sax->internalEntityDecl =
+            xmljGetMethodID (env,
+                             target,
+                             "internalEntityDecl",
+                             "(Ljava/lang/String;Ljava/lang/String;)V");
+          if (sax->internalEntityDecl == NULL)
+            {
+              return;
+            }
+        }
+      j_value = xmljNewString (env, content);
+      (*env)->CallVoidMethod (env,
+                              target,
+                              sax->internalEntityDecl,
+                              j_name,
+                              j_value);
+      break;
+    default:
+      if (sax->externalEntityDecl == NULL)
+        {
+          sax->externalEntityDecl =
+            xmljGetMethodID (env,
+                             target,
+                             "externalEntityDecl",
+                             "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
+          if (sax->externalEntityDecl == NULL)
+            {
+              return;
+            }
+        }
+      j_publicId = xmljNewString (env, publicId);
+      j_systemId = xmljNewString (env, systemId);
+      (*env)->CallVoidMethod (env,
+                              target,
+                              sax->externalEntityDecl,
+                              j_name,
+                              j_publicId,
+                              j_systemId);
+    }
+}
+
+void
+xmljSAXNotationDecl (void *vctx,
+                     const xmlChar * name,
+                     const xmlChar * publicId,
+                     const xmlChar * systemId)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_name;
+  jstring j_publicId;
+  jstring j_systemId;
+
+  xmlSAX2NotationDecl (vctx, name, publicId, systemId);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->notationDecl == NULL)
+    {
+      sax->notationDecl =
+        xmljGetMethodID (env,
+                         target,
+                         "notationDecl",
+                         "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
+      if (sax->notationDecl == NULL)
+        {
+          return;
+        }
+    }
+
+  j_name = xmljNewString (env, name);
+  j_publicId = xmljNewString (env, publicId);
+  j_systemId = xmljNewString (env, systemId);
+
+  /* Invoke the method */
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->notationDecl,
+                          j_name,
+                          j_publicId,
+                          j_systemId);
+}
+
+void
+xmljSAXAttributeDecl (void *vctx,
+                      const xmlChar * elem,
+                      const xmlChar * fullName,
+                      int type,
+                      int def,
+                      const xmlChar * defaultValue,
+                      xmlEnumerationPtr tree)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_eName;
+  jstring j_aName;
+  jstring j_type;
+  jstring j_mode;
+  jstring j_value;
+
+  xmlSAX2AttributeDecl (vctx, elem, fullName, type, def, defaultValue, tree);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->attributeDecl == NULL)
+    {
+      sax->attributeDecl =
+        xmljGetMethodID (env,
+                         target,
+                         "attributeDecl",
+                         "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
+      if (sax->attributeDecl == NULL)
+        {
+          return;
+        }
+    }
+
+  j_eName = xmljNewString (env, elem);
+  j_aName = xmljNewString (env, fullName);
+  j_type = xmljAttributeTypeName (env, type);
+  j_mode = xmljAttributeModeName (env, def);
+  j_value = xmljNewString (env, defaultValue);
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->attributeDecl,
+                          j_eName,
+                          j_aName,
+                          j_type,
+                          j_mode,
+                          j_value);
+}
+
+void
+xmljSAXElementDecl (void *vctx,
+                    const xmlChar * name,
+                    int type,
+                    xmlElementContentPtr content)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_name;
+  jstring j_model;
+
+  xmlSAX2ElementDecl (vctx, name, type, content);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->elementDecl == NULL)
+    {
+      sax->elementDecl =
+        xmljGetMethodID (env,
+                         target,
+                         "elementDecl",
+                         "(Ljava/lang/String;Ljava/lang/String;)V");
+      if (sax->elementDecl == NULL)
+        {
+          return;
+        }
+    }
+
+  j_name = xmljNewString (env, name);
+  j_model = NULL;		/* TODO */
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->elementDecl,
+                          j_name,
+                          j_model);
+}
+
+void
+xmljSAXUnparsedEntityDecl (void *vctx,
+                           const xmlChar * name,
+                           const xmlChar * publicId,
+                           const xmlChar * systemId,
+                           const xmlChar * notationName)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_name;
+  jstring j_publicId;
+  jstring j_systemId;
+  jstring j_notationName;
+
+  xmlSAX2UnparsedEntityDecl (vctx, name, publicId, systemId, notationName);
+  
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->unparsedEntityDecl == NULL)
+    {
+      sax->unparsedEntityDecl =
+        xmljGetMethodID (env,
+                         target,
+                         "unparsedEntityDecl",
+                         "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
+      if (sax->unparsedEntityDecl == NULL)
+        {
+          return;
+        }
+    }
+
+  j_name = xmljNewString (env, name);
+  j_publicId = xmljNewString (env, publicId);
+  j_systemId = xmljNewString (env, systemId);
+  j_notationName = xmljNewString (env, notationName);
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->unparsedEntityDecl,
+                          j_name,
+                          j_publicId,
+                          j_systemId,
+                          j_notationName);
+}
+
+void
+xmljSAXSetDocumentLocator (void *vctx, xmlSAXLocatorPtr loc)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+
+  xmlSAX2SetDocumentLocator (vctx, loc);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  if (target == NULL)
+    {
+      /* No Java parse context */
+      return;
+    }
+
+  /* Update locator on sax context */
+  sax->loc = loc;
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->setDocumentLocator == NULL)
+    {
+      sax->setDocumentLocator = xmljGetMethodID (env,
+                                                 target,
+                                                 "setDocumentLocator",
+                                                 "(Ljava/lang/Object;Ljava/lang/Object;)V");
+      if (sax->setDocumentLocator == NULL)
+        {
+          return;
+        }
+    }
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->setDocumentLocator,
+                          xmljAsField (env, ctx),
+                          xmljAsField (env, loc));
+}
+
+void
+xmljSAXStartDocument (void *vctx)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+
+  xmlSAX2StartDocument (vctx);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->startDocument == NULL)
+    {
+      sax->startDocument = xmljGetMethodID (env,
+                                            target,
+                                            "startDocument",
+                                            "(Z)V");
+      if (sax->startDocument == NULL)
+        {
+          return;
+        }
+    }
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->startDocument,
+                          ctx->standalone);
+}
+
+void
+xmljSAXEndDocument (void *vctx)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+
+  xmlSAX2EndDocument (vctx);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->endDocument == NULL)
+    {
+      sax->endDocument = xmljGetMethodID (env,
+                                          target,
+                                          "endDocument",
+                                          "()V");
+      if (sax->endDocument == NULL)
+        {
+          return;
+        }
+    }
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->endDocument);
+}
+
+void
+xmljSAXStartElement (void *vctx,
+                     const xmlChar * name,
+                     const xmlChar ** attrs)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_name;
+  jobjectArray j_attrs;
+  jstring j_attr;
+  jsize len;
+
+  xmlSAX2StartElement (vctx, name, attrs);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->startElement == NULL)
+    {
+      sax->startElement =
+        xmljGetMethodID (env,
+                         target,
+                         "startElement",
+                         "(Ljava/lang/String;[Ljava/lang/String;)V");
+      if (sax->startElement == NULL)
+        {
+          return;
+        }
+    }
+
+  j_name = xmljNewString (env, name);
+  /* build attributes array */
+  len = 0;
+  for (len = 0; attrs && attrs[len]; len++)
+    {
+    }
+  if (len)
+    {
+      if (sax->stringClass == NULL)
+        {
+          sax->stringClass = (*env)->FindClass (env, "java/lang/String");
+          if (sax->stringClass == NULL)
+            {
+              fprintf (stderr, "Can't find java.lang.String class!\n");
+              return;
+            }
+        }
+      j_attrs = (*env)->NewObjectArray (env, len, sax->stringClass, NULL);
+      if (j_attrs == NULL)
+        {
+          fprintf (stderr, "Can't allocate attributes array!\n");
+          return;
+        }
+      len = 0;
+      for (len = 0; attrs && attrs[len]; len++)
+        {
+          j_attr = xmljNewString (env, attrs[len]);
+          (*env)->SetObjectArrayElement (env, j_attrs, len, j_attr);
+        }
+      
+      (*env)->CallVoidMethod (env,
+                              target,
+                              sax->startElement,
+                              j_name,
+                              j_attrs);
+      (*env)->DeleteLocalRef (env, j_attrs);
+    }
+  else
+    {
+      (*env)->CallVoidMethod (env,
+                              target,
+                              sax->startElement,
+                              j_name,
+                              NULL);
+      
+    }
+}
+
+void
+xmljSAXEndElement (void *vctx,
+                   const xmlChar * name)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_name;
+
+  xmlSAX2EndElement (vctx, name);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->endElement == NULL)
+    {
+      sax->endElement = xmljGetMethodID (env,
+                                         target,
+                                         "endElement",
+                                         "(Ljava/lang/String;)V");
+      if (sax->endElement == NULL)
+        {
+          return;
+        }
+    }
+
+  j_name = xmljNewString (env, name);
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->endElement,
+                          j_name);
+}
+
+void
+xmljSAXReference (void *vctx,
+                  const xmlChar * name)
+{
+  xmlSAX2Reference (vctx, name);
+}
+
+void
+xmljSAXCharacters (void *vctx,
+                   const xmlChar * ch,
+                   int len)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_ch;
+  xmlChar *dup;
+
+  xmlSAX2Characters (vctx, ch, len);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->characters == NULL)
+    {
+      sax->characters = xmljGetMethodID (env,
+                                         target,
+                                         "characters",
+                                         "(Ljava/lang/String;)V");
+      if (sax->characters == NULL)
+        {
+          return;
+        }
+    }
+
+  dup = xmlStrndup (ch, len);
+  j_ch = xmljNewString (env, dup);
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->characters,
+                          j_ch);
+  xmlFree (dup);
+}
+
+void
+xmljSAXIgnorableWhitespace (void *vctx,
+                            const xmlChar * ch,
+                            int len)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_ch;
+  xmlChar *dup;
+
+  xmlSAX2IgnorableWhitespace (vctx, ch, len);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->ignorableWhitespace == NULL)
+    {
+      sax->ignorableWhitespace = xmljGetMethodID (env,
+                                                  target,
+                                                  "ignorableWhitespace",
+                                                  "(Ljava/lang/String;)V");
+      if (sax->ignorableWhitespace == NULL)
+        {
+          return;
+        }
+    }
+
+  dup = xmlStrndup (ch, len);
+  j_ch = xmljNewString (env, dup);
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->ignorableWhitespace,
+                          j_ch);
+  xmlFree (dup);
+}
+
+void
+xmljSAXProcessingInstruction (void *vctx,
+                              const xmlChar * targ,
+                              const xmlChar * data)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_targ;
+  jstring j_data;
+
+  xmlSAX2ProcessingInstruction (vctx, targ, data);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->processingInstruction == NULL)
+    {
+      sax->processingInstruction =
+        xmljGetMethodID (env,
+                         target,
+                         "processingInstruction",
+                         "(Ljava/lang/String;Ljava/lang/String;)V");
+      if (sax->processingInstruction == NULL)
+        {
+          return;
+        }
+    }
+
+  j_targ = xmljNewString (env, targ);
+  j_data = xmljNewString (env, data);
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->processingInstruction,
+                          j_targ,
+                          j_data);
+}
+
+void
+xmljSAXComment (void *vctx,
+                const xmlChar * value)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_text;
+
+  xmlSAX2Comment (vctx, value);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->comment == NULL)
+    {
+      sax->comment =
+        xmljGetMethodID (env,
+                         target,
+                         "comment",
+                         "(Ljava/lang/String;)V");
+      if (sax->comment == NULL)
+        {
+          return;
+        }
+    }
+
+  j_text = xmljNewString (env, value);
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->comment,
+                          j_text);
+}
+
+void
+xmljSAXCDataBlock (void *vctx,
+                   const xmlChar * ch,
+                   int len)
+{
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  JNIEnv *env;
+  jobject target;
+  jstring j_ch;
+  xmlChar *dup;
+
+  xmlSAX2CDataBlock (vctx, ch, len);
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  env = sax->env;
+  target = sax->obj;
+
+  xmljCheckWellFormed (ctx);
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+
+  if (sax->cdataBlock == NULL)
+    {
+      sax->cdataBlock =
+        xmljGetMethodID (env,
+                         target,
+                         "cdataBlock",
+                         "(Ljava/lang/String;)V");
+      if (sax->cdataBlock == NULL)
+        {
+          return;
+        }
+    }
+
+  dup = xmlStrndup (ch, len);
+  j_ch = xmljNewString (env, dup);
+
+  (*env)->CallVoidMethod (env,
+                          target,
+                          sax->cdataBlock,
+                          j_ch);
+  xmlFree (dup);
+}
+
+void
+xmljDispatchError (xmlParserCtxtPtr ctx,
+                   xmlSAXLocatorPtr loc,
+                   JNIEnv *env,
+                   jobject target,
+                   jmethodID method,
+                   const char *msg,
+                   va_list args)
+{
+  jint lineNumber;
+  jint columnNumber;
+  jstring publicId;
+  jstring systemId;
+  char buffer[2048] = "";
+
+  if (msg != NULL)
+    {
+      vsnprintf (buffer, sizeof buffer, msg, args);
+    }
+  lineNumber = loc->getLineNumber (ctx);
+  columnNumber = loc->getColumnNumber (ctx);
+  publicId = xmljNewString (env, loc->getPublicId (ctx));
+  systemId = xmljNewString (env, loc->getSystemId (ctx));
+  (*env)->CallVoidMethod (env,
+                          target,
+                          method,
+                          (*env)->NewStringUTF (env, buffer),
+                          lineNumber,
+                          columnNumber,
+                          publicId,
+                          systemId);
+}
+
+void
+xmljSAXWarning (void *vctx,
+                const char *msg,
+                ...)
+{
+  va_list args;
+
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  xmlSAXLocatorPtr loc;
+  JNIEnv *env;
+  jobject target;
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  loc = (xmlSAXLocatorPtr) sax->loc;
+  env = sax->env;
+  target = sax->obj;
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+  if (sax->warning == NULL)
+    {
+      sax->warning =
+        xmljGetMethodID (env,
+                         target,
+                         "warning",
+                         "(Ljava/lang/String;IILjava/lang/String;Ljava/lang/String;)V");
+      if (sax->warning == NULL)
+        {
+          return;
+        }
+    }
+
+  va_start (args, msg);
+  /* xmlParserWarning (vctx, msg, args); */
+  xmljDispatchError (ctx, loc, env, target, sax->warning, msg, args);
+  va_end (args);
+}
+
+void
+xmljSAXError (void *vctx,
+              const char *msg,
+              ...)
+{
+  va_list args;
+
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  xmlSAXLocatorPtr loc;
+  JNIEnv *env;
+  jobject target;
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  loc = (xmlSAXLocatorPtr) sax->loc;
+  env = sax->env;
+  target = sax->obj;
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+  if (sax->error == NULL)
+    {
+      sax->error =
+        xmljGetMethodID (env,
+                         target,
+                         "error",
+                         "(Ljava/lang/String;IILjava/lang/String;Ljava/lang/String;)V");
+      if (sax->error == NULL)
+        {
+          return;
+        }
+    }
+
+  va_start (args, msg);
+  /* xmlParserError (vctx, msg, args); */
+  xmljDispatchError (ctx, loc, env, target, sax->error, msg, args);
+  va_end (args);
+}
+
+void
+xmljSAXFatalError (void *vctx,
+                   const char *msg,
+                   ...)
+{
+  va_list args;
+
+  xmlParserCtxtPtr ctx;
+  SAXParseContext *sax;
+  xmlSAXLocatorPtr loc;
+  JNIEnv *env;
+  jobject target;
+
+  ctx = (xmlParserCtxtPtr) vctx;
+  sax = (SAXParseContext *) ctx->_private;
+  loc = (xmlSAXLocatorPtr) sax->loc;
+  env = sax->env;
+  target = sax->obj;
+
+  if ((*env)->ExceptionOccurred (env))
+    {
+      return;
+    }
+  if (sax->fatalError == NULL)
+    {
+      sax->fatalError =
+        xmljGetMethodID (env,
+                         target,
+                         "fatalError",
+                         "(Ljava/lang/String;IILjava/lang/String;Ljava/lang/String;)V");
+      if (sax->fatalError == NULL)
+        {
+          return;
+        }
+    }
+  
+  va_start (args, msg);
+  /* xmlParserError (vctx, msg, args); */
+  xmljDispatchError (ctx, loc, env, target, sax->fatalError, msg, args);
+  va_end (args);
+}
+
+void
+xmljCheckWellFormed (xmlParserCtxtPtr ctx)
+{
+  if (!ctx->wellFormed)
+    {
+      xmljSAXFatalError (ctx, "document is not well-formed");
+    }
+  if (ctx->validate && !ctx->valid)
+    {
+      xmljSAXFatalError (ctx, "document is not valid");
+    }
+}
+
+/*
+ * Convert a libxml2 attribute type to a string.
+ */
+jstring
+xmljAttributeTypeName (JNIEnv * env, int type)
+{
+  const char *text;
+
+  switch (type)
+    {
+    case XML_ATTRIBUTE_CDATA:
+      text = "CDATA";
+      break;
+    case XML_ATTRIBUTE_ID:
+      text = "ID";
+      break;
+    case XML_ATTRIBUTE_IDREF:
+      text = "IDREF";
+      break;
+    case XML_ATTRIBUTE_IDREFS:
+      text = "IDREFS";
+      break;
+    case XML_ATTRIBUTE_NMTOKEN:
+      text = "NMTOKEN";
+      break;
+    case XML_ATTRIBUTE_NMTOKENS:
+      text = "NMTOKENS";
+      break;
+    case XML_ATTRIBUTE_ENTITY:
+      text = "ID";
+      break;
+    case XML_ATTRIBUTE_ENTITIES:
+      text = "ID";
+      break;
+    default:
+      return NULL;
+    }
+
+  return (*env)->NewStringUTF (env, text);
+}
+
+/*
+ * Convert a libxml2 attribute default value type to a string.
+ */
+jstring
+xmljAttributeModeName (JNIEnv * env, int type)
+{
+  const char *text;
+
+  switch (type)
+    {
+    case XML_ATTRIBUTE_IMPLIED:
+      text = "#IMPLIED";
+      break;
+    case XML_ATTRIBUTE_REQUIRED:
+      text = "#REQUIRED";
+      break;
+    case XML_ATTRIBUTE_FIXED:
+      text = "#FIXED";
+      break;
+    default:
+      return NULL;
+    }
+
+  return (*env)->NewStringUTF (env, text);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_sax.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_sax.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_sax.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_sax.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,160 @@
+/* xmlj_sax.h -
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef XMLJ_SAX_H
+#define XMLJ_SAX_H
+
+#include "gnu_xml_libxmlj_sax_GnomeLocator.h"
+#include "gnu_xml_libxmlj_sax_GnomeXMLReader.h"
+
+#include <libxml/SAX.h>
+#include <libxml/parser.h>
+
+xmlSAXHandlerPtr
+xmljNewSAXHandler (jboolean contentHandler,
+                   jboolean dtdHandler,
+                   jboolean entityResolver,
+                   jboolean errorHandler,
+                   jboolean declarationHandler,
+                   jboolean lexicalHandler);
+
+xmlParserInputPtr
+xmljExternalEntityLoader (const char *systemId, const char *publicId,
+                          xmlParserCtxtPtr context);
+
+/* -- Function declarations for callback functions -- */
+
+void xmljSAXInternalSubset(void *ctx,
+                           const xmlChar *name,
+                           const xmlChar *publicId,
+                           const xmlChar *systemId);
+
+xmlParserInputPtr xmljSAXResolveEntity(void *ctx,
+                                       const xmlChar *publicId,
+                                       const xmlChar *systemId);
+
+xmlEntityPtr xmljSAXGetEntity(void *ctx,
+                              const xmlChar *name);
+
+void xmljSAXEntityDecl(void *ctx,
+                       const xmlChar *name,
+                       int type,
+                       const xmlChar *publicId,
+                       const xmlChar *systemId,
+                       xmlChar *content);
+
+void xmljSAXNotationDecl(void *ctx,
+                         const xmlChar *name,
+                         const xmlChar *publicId,
+                         const xmlChar *systemId);
+
+void xmljSAXAttributeDecl(void *ctx,
+                          const xmlChar *elem,
+                          const xmlChar *fullName,
+                          int type,
+                          int def,
+                          const xmlChar *defaultValue,
+                          xmlEnumerationPtr tree);
+
+void xmljSAXElementDecl(void *ctx,
+                        const xmlChar *name,
+                        int type,
+                        xmlElementContentPtr content);
+
+void xmljSAXUnparsedEntityDecl(void *ctx,
+                               const xmlChar *name,
+                               const xmlChar *publicId, 
+                               const xmlChar *systemId,
+                               const xmlChar *notationName);
+
+void xmljSAXSetDocumentLocator(void *ctx,
+                               xmlSAXLocatorPtr loc);
+
+void xmljSAXStartDocument(void *ctx);
+
+void xmljSAXEndDocument(void *ctx);
+
+void xmljSAXStartElement(void *ctx,
+                         const xmlChar *name,
+                         const xmlChar **atts);
+
+void xmljSAXEndElement(void *ctx,
+                       const xmlChar *name);
+
+void xmljSAXReference(void *ctx,
+                      const xmlChar *name);
+
+void xmljSAXCharacters(void *ctx,
+                       const xmlChar *ch,
+                       int len);
+
+void xmljSAXIgnorableWhitespace(void *ctx,
+                                const xmlChar *ch,
+                                int len);
+
+void xmljSAXProcessingInstruction(void *ctx,
+                                  const xmlChar *target,
+                                  const xmlChar *data);
+
+void xmljSAXComment(void *ctx,
+                    const xmlChar *value);
+
+void xmljSAXCDataBlock(void *ctx,
+                       const xmlChar *ch,
+                       int len);
+
+void xmljSAXWarning(void *ctx,
+                    const char *msg,
+                    ...);
+
+void xmljSAXError(void *ctx,
+                  const char *msg,
+                  ...);
+
+void xmljSAXFatalError(void *ctx,
+                       const char *msg,
+                       ...);
+
+void xmljCheckWellFormed(xmlParserCtxtPtr ctx);
+
+jstring xmljAttributeTypeName (JNIEnv *env,
+                               int type);
+
+jstring xmljAttributeModeName (JNIEnv *env,
+                               int type);
+
+#endif /* !defined XMLJ_SAX_H */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_transform.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_transform.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_transform.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_transform.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,868 @@
+/* xmlj_transform.c -
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "gnu_xml_libxmlj_transform_GnomeTransformerFactory.h"
+#include "gnu_xml_libxmlj_transform_GnomeTransformer.h"
+
+#include "xmlj_dom.h"
+#include "xmlj_io.h"
+#include "xmlj_error.h"
+#include "xmlj_node.h"
+#include "xmlj_sax.h"
+#include "xmlj_util.h"
+
+#include <math.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <libxml/xmlmemory.h>
+#include <libxml/debugXML.h>
+#include <libxml/xmlIO.h>
+#include <libxml/xinclude.h>
+#include <libxml/parser.h>
+#include <libxml/catalog.h>
+#include <libxslt/keys.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
+#include <libxslt/functions.h>
+#include <libxslt/extensions.h>
+#include <libxslt/documents.h>
+
+/* Local function prototypes */
+
+void
+xmljDocumentFunction (xmlXPathParserContextPtr ctxt, int nargs);
+
+xsltStylesheetPtr
+xmljGetStylesheetID (JNIEnv * env, jobject transformer);
+
+jobject
+xmljGetTransformerProperties (JNIEnv *env, jobject transformer);
+
+const xmlChar *
+xmljBooleanToString (int value);
+
+void
+xmljSetOutputProperties (JNIEnv *env, jobject transformer,
+                         xsltStylesheetPtr stylesheet);
+
+jobjectArray
+xmljGetParameterArray (JNIEnv *env, jobject transformer);
+
+const char **
+xmljGetParameters (JNIEnv *env, jobjectArray pa);
+
+void
+xmljFreeParameters (JNIEnv *env, jobjectArray pa, const char **parameters);
+
+xmlDocPtr
+xmljTransform (JNIEnv *env, jobject transformer, xmlDocPtr source);
+
+void
+xmljTransformToSAX (JNIEnv *env, jobject transformer, xmlDocPtr source,
+                    jobject callback);
+
+xmlDocPtr
+xmljDocLoader (const xmlChar *uri, xmlDictPtr dict, int options,
+               void *ctxt, xsltLoadType type);
+
+/* HACK: store stylesheet URL as context for resolving URIs in xmljDocLoader */
+static jstring stylesheetURL = NULL;
+
+/*
+ * --------------------------------------------------------------------------
+ * 
+ * Native implementation for class
+ * gnu.xml.libxmlj.transform.GnomeTransformer follows.
+ */
+
+static void
+xmljSetProperty (JNIEnv * env, jobject outputProperties,
+		 jmethodID setPropertyMethodID, const char *name,
+		 const xmlChar * value)
+{
+  if (NULL != value)
+    {
+      jstring nameString = (*env)->NewStringUTF (env, name);
+      jstring valueString = (*env)->NewStringUTF (env, (const char *) value);
+
+      jobject prevValue = (*env)->CallObjectMethod (env, outputProperties,
+						    setPropertyMethodID,
+						    nameString, valueString);
+      if (NULL != prevValue)
+	{
+	  (*env)->DeleteLocalRef (env, prevValue);
+	}
+
+      (*env)->DeleteLocalRef (env, nameString);
+      (*env)->DeleteLocalRef (env, valueString);
+    }
+}
+
+typedef struct CdataSectionScannerInfo_
+{
+  JNIEnv *env;
+  jobject stringBuffer;
+  jmethodID appendMethodID;
+  int isFirst;
+} CdataSectionScannerInfo;
+
+static void
+cdataSectionScanner (void *payload, void *data, xmlChar * name)
+{
+  CdataSectionScannerInfo *info = (CdataSectionScannerInfo *) data;
+  JNIEnv *env = info->env;
+  jstring nameString = (*env)->NewStringUTF (env, (const char *) name);
+  jstring blankString = (*env)->NewStringUTF (env, " ");
+  jobject stringBuffer;
+  if (!info->isFirst)
+    {
+      stringBuffer
+	= (*env)->CallObjectMethod (env,
+				    info->stringBuffer,
+				    info->appendMethodID, blankString);
+      (*env)->DeleteLocalRef (env, stringBuffer);
+    }
+  info->isFirst = 0;
+  stringBuffer
+    = (*env)->CallObjectMethod (env,
+				info->stringBuffer,
+				info->appendMethodID, nameString);
+  (*env)->DeleteLocalRef (env, stringBuffer);
+  (*env)->DeleteLocalRef (env, blankString);
+  (*env)->DeleteLocalRef (env, nameString);
+}
+
+void
+xmljDocumentFunction (xmlXPathParserContextPtr ctxt, int nargs)
+{
+  xmlXPathObjectPtr obj, obj2 = NULL;
+
+  if ((nargs < 1) || (nargs > 2))
+    {
+      xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, NULL,
+			  "document() : invalid number of args %d\n", nargs);
+      ctxt->error = XPATH_INVALID_ARITY;
+      return;
+    }
+  if (ctxt->value == NULL)
+    {
+      xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, NULL,
+			  "document() : invalid arg value\n");
+      ctxt->error = XPATH_INVALID_TYPE;
+      return;
+    }
+
+  if (nargs == 2)
+    {
+      if (ctxt->value->type != XPATH_NODESET)
+	{
+	  xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, NULL,
+			      "document() : invalid arg expecting a nodeset\n");
+	  ctxt->error = XPATH_INVALID_TYPE;
+	  return;
+	}
+
+      obj2 = valuePop (ctxt);
+    }
+
+  if (ctxt->value->type == XPATH_NODESET)
+    {
+      int i;
+      xmlXPathObjectPtr newobj, ret;
+
+      obj = valuePop (ctxt);
+      ret = xmlXPathNewNodeSet (NULL);
+
+      if (obj->nodesetval)
+	{
+	  for (i = 0; i < obj->nodesetval->nodeNr; i++)
+	    {
+	      valuePush (ctxt,
+			 xmlXPathNewNodeSet (obj->nodesetval->nodeTab[i]));
+	      xmlXPathStringFunction (ctxt, 1);
+	      if (nargs == 2)
+		{
+		  valuePush (ctxt, xmlXPathObjectCopy (obj2));
+		}
+	      else
+		{
+		  valuePush (ctxt,
+			     xmlXPathNewNodeSet (obj->nodesetval->
+						 nodeTab[i]));
+		}
+	      xsltDocumentFunction (ctxt, 2);
+	      newobj = valuePop (ctxt);
+	      ret->nodesetval = xmlXPathNodeSetMerge (ret->nodesetval,
+						      newobj->nodesetval);
+	      xmlXPathFreeObject (newobj);
+	    }
+	}
+
+      xmlXPathFreeObject (obj);
+      if (obj2 != NULL)
+        {
+          xmlXPathFreeObject (obj2);
+        }
+      valuePush (ctxt, ret);
+      return;
+    }
+  /*
+   * Make sure it's converted to a string
+   */
+  xmlXPathStringFunction (ctxt, 1);
+  if (ctxt->value->type != XPATH_STRING)
+    {
+      xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, NULL,
+			  "document() : invalid arg expecting a string\n");
+      ctxt->error = XPATH_INVALID_TYPE;
+      if (obj2 != NULL)
+	xmlXPathFreeObject (obj2);
+      return;
+    }
+  obj = valuePop (ctxt);
+  if (obj->stringval == NULL)
+    {
+      valuePush (ctxt, xmlXPathNewNodeSet (NULL));
+    }
+  else
+    {
+
+      xsltTransformContextPtr tctxt;
+
+      tctxt = xsltXPathGetTransformContext (ctxt);
+
+      {
+        SAXParseContext *saxContext =
+          (SAXParseContext *) tctxt->style->_private;
+
+        xmlDocPtr tree = xmljResolveURIAndOpen (saxContext,
+                                                (const char*)obj->stringval, 
+                                                NULL);
+
+        xsltNewDocument (tctxt, tree);	/* FIXME - free at a later point */
+
+        valuePush (ctxt, xmlXPathNewNodeSet ((xmlNodePtr) tree));
+      }
+    }
+  xmlXPathFreeObject (obj);
+  if (obj2 != NULL) {
+    xmlXPathFreeObject (obj2);
+  }
+}
+
+/*
+ * Returns the stylesheet pointer for the given GnomeTransformer.
+ */
+xsltStylesheetPtr
+xmljGetStylesheetID (JNIEnv * env, jobject transformer)
+{
+  jclass cls;
+  jfieldID field;
+  jobject id;
+  xsltStylesheetPtr stylesheet;
+
+  if (transformer == NULL)
+    {
+      xmljThrowException (env, "javax/xml/transform/TransformerException",
+                          "Transformer is null");
+      return NULL;
+    }
+  cls = (*env)->GetObjectClass (env, transformer);
+  if (cls == NULL)
+    {
+      return NULL;
+    }
+  field = (*env)->GetFieldID (env, cls, "stylesheet", "Ljava/lang/Object;");
+  if (field == NULL)
+    {
+      return NULL;
+    }
+  id = (*env)->GetObjectField (env, transformer, field);
+  stylesheet = (xsltStylesheetPtr) xmljAsPointer (env, id);
+  if (stylesheet == NULL)
+    {
+      xmljThrowException (env, "javax/xml/transform/TransformerException",
+                          "Stylesheet is null");
+      return NULL;
+    }
+  return stylesheet;
+}
+
+jobject
+xmljGetTransformerProperties (JNIEnv *env, jobject transformer)
+{
+  jclass cls;
+  jfieldID field;
+  
+  cls = (*env)->GetObjectClass (env, transformer);
+  if (cls == NULL)
+    {
+      return NULL;
+    }
+  field = (*env)->GetFieldID (env, cls, "outputProperties",
+                              "Ljava/util/Properties;");
+  if (field == NULL)
+    {
+      return NULL;
+    }
+  return (*env)->GetObjectField (env, transformer, field);
+}
+
+const xmlChar *
+xmljBooleanToString (int value)
+{
+  return value ? BAD_CAST "yes" : BAD_CAST "no";
+}
+
+/*
+ * Sets the output properties for the given transformer,
+ * based on its stylesheet.
+ */
+void
+xmljSetOutputProperties (JNIEnv *env, jobject transformer,
+                         xsltStylesheetPtr stylesheet)
+{
+  jobject outputProperties;
+  jclass propertiesClass;
+  jmethodID setPropertyMethod;
+
+  outputProperties = xmljGetTransformerProperties (env, transformer);
+  if (outputProperties == NULL)
+    {
+      return;
+    }
+  propertiesClass = (*env)->FindClass (env, "java/util/Properties");
+  if (propertiesClass == NULL)
+    {
+      return;
+    }
+  setPropertyMethod =
+    (*env)->GetMethodID (env, propertiesClass, "setProperty",
+                         "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;");
+  if (setPropertyMethod == NULL)
+    {
+      return;
+    }
+  
+  xmljSetProperty (env, outputProperties, setPropertyMethod,
+                   "encoding", stylesheet->encoding);
+  
+  xmljSetProperty (env, outputProperties, setPropertyMethod,
+                   "media-type", stylesheet->mediaType);
+  
+  xmljSetProperty (env, outputProperties, setPropertyMethod,
+                   "doctype-public", stylesheet->doctypePublic);
+  
+  xmljSetProperty (env, outputProperties, setPropertyMethod,
+                   "doctype-system", stylesheet->doctypeSystem);
+  
+  xmljSetProperty (env, outputProperties, setPropertyMethod,
+                   "indent", xmljBooleanToString (stylesheet->indent));
+  
+  xmljSetProperty (env, outputProperties, setPropertyMethod,
+                   "method", stylesheet->method);
+  
+  xmljSetProperty (env, outputProperties, setPropertyMethod,
+                   "standalone", xmljBooleanToString (stylesheet->standalone));
+  
+  xmljSetProperty (env, outputProperties, setPropertyMethod,
+                   "version", stylesheet->version);
+  
+  xmljSetProperty (env, outputProperties, setPropertyMethod,
+                   "omit-xml-declaration",
+                   xmljBooleanToString (stylesheet->omitXmlDeclaration));
+  
+    {
+      CdataSectionScannerInfo info;
+      jclass stringBufferClass
+        =
+        (*env)->FindClass (env,
+                           "java/lang/StringBuffer");
+      jmethodID stringBufferConstructorID =
+        (*env)->GetMethodID (env, stringBufferClass,
+                             "<init>", "()V");
+      jmethodID toStringMethodID =
+        (*env)->GetMethodID (env, stringBufferClass,
+                             "toString",
+                             "()Ljava/lang/String;");
+      info.env = env;
+      info.isFirst = 1;
+      info.stringBuffer
+        = (*env)->AllocObject (env, stringBufferClass);
+      (*env)->CallVoidMethod (env, info.stringBuffer,
+                              stringBufferConstructorID);
+      info.appendMethodID =
+        (*env)->GetMethodID (env, stringBufferClass,
+                             "append",
+                             "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
+      
+      xmlHashScan (stylesheet->cdataSection,
+                   cdataSectionScanner, &info);
+      
+        {
+          jstring result = (jstring)
+            (*env)->CallObjectMethod (env,
+                                      info.stringBuffer,
+                                      toStringMethodID);
+          
+          jstring nameString =
+            (*env)->NewStringUTF (env,
+                                  "cdata-section-elements");
+          
+          jobject prevValue
+            =
+            (*env)->CallObjectMethod (env,
+                                      outputProperties,
+                                      setPropertyMethod,
+                                      nameString, result);
+          if (NULL != prevValue)
+            {
+              (*env)->DeleteLocalRef (env, prevValue);
+            }
+          (*env)->DeleteLocalRef (env, nameString);
+        }
+      
+      (*env)->DeleteLocalRef (env, info.stringBuffer);
+    }
+}
+
+/*
+ * Returns the parameter array for the given GnomeTransformer.
+ */
+jobjectArray
+xmljGetParameterArray (JNIEnv *env, jobject transformer)
+{
+  jclass cls;
+  jmethodID method;
+
+  cls = (*env)->GetObjectClass (env, transformer);
+  if (cls == NULL)
+    {
+      return NULL;
+    }
+  method = (*env)->GetMethodID (env, cls, "getParameterArray",
+                                "()[Ljava/lang/String;");
+  if (method == NULL)
+    {
+      return NULL;
+    }
+  return (jobjectArray) (*env)->CallObjectMethod (env, transformer, method);
+}
+
+/* Convert parameter array to xmlChar ** */
+const char **
+xmljGetParameters (JNIEnv *env, jobjectArray pa)
+{
+  int i, len;
+  const char **parameters;
+
+  len = (*env)->GetArrayLength (env, pa);
+  parameters = (const char **) malloc ((len + 2) * sizeof (const char *));
+  if (parameters == NULL)
+    {
+      return NULL;
+    }
+  
+  for (i = 0; i < len; i++)
+    {
+      jstring string = (jstring) (*env)->GetObjectArrayElement (env, pa, i);
+      
+      if (string != NULL)
+        {
+          parameters[i] = (*env)->GetStringUTFChars (env, string, NULL);
+        }
+      else
+        {
+          parameters[i] = NULL;
+        }
+    }
+  
+  parameters[len] = 0;
+  parameters[len + 1] = 0;
+  return parameters;
+}
+  
+/* Release parameter strings */
+void
+xmljFreeParameters (JNIEnv *env, jobjectArray pa, const char **parameters)
+{ 
+  int i, len;
+  
+  len = (*env)->GetArrayLength (env, pa);
+  for (i = 0; i < len; i++)
+    {
+      jstring string = (jstring) (*env)->GetObjectArrayElement (env, pa, i);
+      if (string != NULL)
+        {
+          (*env)->ReleaseStringUTFChars (env, string, parameters[i]);
+        }
+    }
+  
+  free (parameters);
+}
+
+xmlDocPtr
+xmljTransform (JNIEnv *env, jobject transformer, xmlDocPtr source)
+{
+  xsltStylesheetPtr stylesheet;
+  xmlDocPtr result;
+  jobjectArray pa;
+  const char **parameters;
+
+  stylesheet = xmljGetStylesheetID (env, transformer);
+  pa = xmljGetParameterArray (env, transformer);
+  parameters = xmljGetParameters (env, pa);
+  if (parameters == NULL)
+    {
+      xmljThrowException (env, "javax/xml/transform/TransformerException",
+                          "Couldn't allocate memory for parameters");
+      return NULL;
+    }
+  result = xsltApplyStylesheet (stylesheet, source, parameters);
+  xmljFreeParameters (env, pa, parameters);
+  if (result == NULL)
+    {
+      xmljThrowException (env, "javax/xml/transform/TransformerException",
+                          "XSLT transformation failed");
+    }
+  return result;
+}
+
+void
+xmljTransformToSAX (JNIEnv *env, jobject transformer, xmlDocPtr source,
+                    jobject callback)
+{
+  xsltStylesheetPtr stylesheet;
+  int ret;
+  jobjectArray pa;
+  const char **parameters;
+  xmlSAXHandlerPtr sax;
+
+  stylesheet = xmljGetStylesheetID (env, transformer);
+  pa = xmljGetParameterArray (env, transformer);
+  parameters = xmljGetParameters (env, pa);
+  if (parameters == NULL)
+    {
+      xmljThrowException (env, "javax/xml/transform/TransformerException",
+                          "Couldn't allocate memory for parameters");
+      return;
+    }
+  sax = NULL; /* TODO link up sax and callback */
+  ret = xsltRunStylesheet (stylesheet, source, parameters, NULL, sax, NULL);
+  xmljFreeParameters (env, pa, parameters);
+  if (ret == -1)
+    {
+      xmljThrowException (env, "javax/xml/transform/TransformerException",
+                          "XSLT transformation failed");
+    }
+}
+
+xmlDocPtr
+xmljDocLoader (const xmlChar *uri, xmlDictPtr dict, int options,
+               void *ctxt, xsltLoadType type)
+{
+  JNIEnv *env;
+  jclass xmljClass;
+  jclass inputStreamClass;
+  jmethodID getInputStream;
+  jmethodID getDetectBuffer;
+  jstring systemId;
+  jobject inputStream;
+  jbyteArray detectBuffer;
+
+  fflush(stdout);
+  env = xmljGetJNIEnv ();
+  if (!env)
+    {
+      return NULL;
+    }
+  xmljClass = (*env)->FindClass (env, "gnu/xml/libxmlj/util/XMLJ");
+  if (!xmljClass)
+    {
+      return NULL;
+    }
+  getInputStream =
+    (*env)->GetStaticMethodID (env, xmljClass, "xmljGetInputStream",
+                               "(Ljava/lang/String;Ljava/lang/String;)Lgnu/xml/libxmlj/util/NamedInputStream;");
+  if (!getInputStream)
+    {
+      return NULL;
+    }
+  systemId = xmljNewString (env, uri);
+  inputStream = (*env)->CallStaticObjectMethod (env, xmljClass, getInputStream,
+                                                stylesheetURL, systemId);
+  if (!inputStream)
+    {
+      return NULL;
+    }
+  inputStreamClass = (*env)->GetObjectClass (env, inputStream);
+  if (!inputStreamClass)
+    {
+      return NULL;
+    }
+  getDetectBuffer = (*env)->GetMethodID (env, inputStreamClass,
+                                         "getDetectBuffer", "()[B");
+  if (!getDetectBuffer)
+    {
+      return NULL;
+    }
+  detectBuffer = (*env)->CallObjectMethod (env, inputStream, getDetectBuffer);
+  if (!detectBuffer)
+    {
+      return NULL;
+    }
+  return xmljParseDocument (env, NULL, inputStream, detectBuffer,
+                            NULL, systemId, stylesheetURL,
+                            0, 0, 0, 0, 0, 0, 0, 0, 0, 2);
+}
+
+/* GnomeTransformer.newStylesheet */
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_newStylesheet (JNIEnv *env,
+                                                               jobject self)
+{
+  xsltStylesheetPtr stylesheet;
+  jobject ret;
+
+  stylesheetURL = NULL;
+  xsltSetLoaderFunc (xmljDocLoader);
+  stylesheet = xsltNewStylesheet ();
+  xmljSetOutputProperties (env, self, stylesheet);
+  ret = xmljAsField (env, stylesheet);
+  if (ret == NULL)
+    {
+      xmljThrowException (env,
+                          "javax/xml/transform/TransformerConfigurationException",
+                          "Can't create Java object for stylesheet");
+    }
+  return ret;
+}
+
+/* GnomeTransformer.newStylesheetFromStream */
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_newStylesheetFromStream
+(JNIEnv *env, jobject self, jobject in, jbyteArray detectBuffer,
+ jstring publicId, jstring systemId, jstring base,
+ jboolean entityResolver, jboolean errorHandler)
+{
+  xmlDocPtr doc;
+  xsltStylesheetPtr stylesheet;
+  jobject ret;
+
+  doc = xmljParseDocument (env, self, in, detectBuffer, publicId, systemId,
+                           base, 0, 0, 0, 0, 0, 
+                           entityResolver, errorHandler, 0, 0, 2);
+  if (doc == NULL)
+    {
+      return NULL;
+    }
+  stylesheetURL = systemId;
+  xsltSetLoaderFunc (xmljDocLoader);
+  stylesheet = xsltParseStylesheetDoc (doc);
+  if (stylesheet == NULL)
+    {
+      xmljThrowException (env,
+                          "javax/xml/transform/TransformerConfigurationException",
+                          "Error parsing XSLT stylesheet");
+      return NULL;
+    }
+  xmljSetOutputProperties (env, self, stylesheet);
+  ret =  xmljAsField (env, stylesheet);
+  if (ret == NULL)
+    {
+      xmljThrowException (env,
+                          "javax/xml/transform/TransformerConfigurationException",
+                          "Can't create Java object for stylesheet");
+    }
+  return ret;
+}
+
+/* GnomeTransformer.newStylesheetFromDoc */
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_newStylesheetFromDoc
+(JNIEnv *env, jobject self, jobject in)
+{
+  xmlDocPtr doc;
+  xsltStylesheetPtr stylesheet;
+  jobject ret;
+
+  doc = (xmlDocPtr) xmljGetNodeID (env, in);
+  if (doc == NULL)
+    {
+      return NULL;
+    }
+  stylesheetURL = xmljNewString (env, doc->URL);
+  xsltSetLoaderFunc (xmljDocLoader);
+  stylesheet = xsltParseStylesheetDoc (doc);
+  if (stylesheet == NULL)
+    {
+      xmljThrowException (env,
+                          "javax/xml/transform/TransformerConfigurationException",
+                          "Error parsing XSLT stylesheet");
+    }
+  xmljSetOutputProperties (env, self, stylesheet);
+  ret =  xmljAsField (env, stylesheet);
+  if (ret == NULL)
+    {
+      xmljThrowException (env,
+                          "javax/xml/transform/TransformerConfigurationException",
+                          "Can't create Java object for stylesheet");
+    }
+  return ret;
+}
+
+/* GnomeTransformer.transformStreamToStream */
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_transformStreamToStream
+(JNIEnv *env, jobject self, jobject in, jbyteArray detectBuffer,
+ jstring publicId, jstring systemId, jstring base,
+ jboolean entityResolver, jboolean errorHandler, jobject out)
+{
+  xmlDocPtr source;
+  xmlDocPtr result;
+
+  source = xmljParseDocument (env, self, in, detectBuffer, publicId, systemId,
+                              base, 0, 0, 0, 0, 0, 
+                              entityResolver, errorHandler, 0, 0, 2);
+  result = xmljTransform (env, self, source);
+  xmljSaveFileToJavaOutputStream (env, out, result,
+                                  (const char*) result->encoding);
+  xmlFreeDoc (result);
+}
+
+/* GnomeTransformer.transformStreamToDoc */
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_transformStreamToDoc
+(JNIEnv *env, jobject self, jobject in, jbyteArray detectBuffer,
+ jstring publicId, jstring systemId, jstring base,
+ jboolean entityResolver, jboolean errorHandler)
+{
+  xmlDocPtr source;
+  xmlDocPtr result;
+
+  source = xmljParseDocument (env, self, in, detectBuffer, publicId, systemId,
+                              base, 0, 0, 0, 0, 0, 
+                              entityResolver, errorHandler, 0, 0, 2);
+  result = xmljTransform (env, self, source);
+  return xmljGetNodeInstance (env, (xmlNodePtr) result);
+}
+
+/* GnomeTransformer.transformStreamToSAX */
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_transformStreamToSAX
+(JNIEnv *env, jobject self, jobject in, jbyteArray detectBuffer,
+ jstring publicId, jstring systemId, jstring base,
+ jboolean entityResolver, jboolean errorHandler, jobject callback)
+{
+  xmlDocPtr source;
+
+  source = xmljParseDocument (env, self, in, detectBuffer, publicId, systemId,
+                              base, 0, 0, 0, 0, 0, 
+                              entityResolver, errorHandler, 0, 0, 2);
+  xmljTransformToSAX (env, self, source, callback);
+}
+
+/* GnomeTransformer.transformDocToStream */
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_transformDocToStream
+(JNIEnv *env, jobject self, jobject doc, jobject out)
+{
+  xmlDocPtr source;
+  xmlDocPtr result;
+
+  source = (xmlDocPtr) xmljGetNodeID (env, doc);
+  result = xmljTransform (env, self, source);
+  xmljSaveFileToJavaOutputStream (env, out, result,
+                                  (const char*) result->encoding);
+  xmlFreeDoc (result);
+}
+
+/* GnomeTransformer.transformDocToDoc */
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_transformDocToDoc
+(JNIEnv *env, jobject self, jobject doc)
+{
+  xmlDocPtr source;
+  xmlDocPtr result;
+
+  source = (xmlDocPtr) xmljGetNodeID (env, doc);
+  result = xmljTransform (env, self, source);
+  return xmljGetNodeInstance (env, (xmlNodePtr) result);
+}
+
+/* GnomeTransformer.transformDocToSAX */
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_transformDocToSAX
+(JNIEnv *env, jobject self, jobject doc, jobject callback)
+{
+  xmlDocPtr source;
+
+  source = (xmlDocPtr) xmljGetNodeID (env, doc);
+  xmljTransformToSAX (env, self, source, callback);
+}
+
+/* GnomeTransformer.free */
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformer_free (JNIEnv *env,
+                                                      jobject self)
+{
+  xsltStylesheetPtr stylesheet;
+
+  stylesheet = xmljGetStylesheetID (env, self);
+  xsltFreeStylesheet (stylesheet);
+}
+
+/*
+ * --------------------------------------------------------------------------
+ * Native implementation for class
+ * gnu.xml.libxmlj.transform.GnomeTransformerFactory follows.
+ */
+
+/* GnomeTransformerFactory.freeLibxsltGlobal */
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_transform_GnomeTransformerFactory_freeLibxsltGlobal (
+  JNIEnv *env __attribute__((__unused__)),
+  jclass clazz __attribute__((__unused__)))
+{
+  xsltCleanupGlobals ();
+  xmlCleanupParser ();
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_util.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_util.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_util.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_util.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,280 @@
+/* xmlj_util.c
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "xmlj_util.h"
+#include "xmlj_error.h"
+#include <libxml/tree.h>
+#include <unistd.h>
+#include <jcl.h>
+
+/* xmlChar->jstring cache */
+#ifdef XMLJ_STRING_CACHE
+#define XMLJ_STRING_CACHE_SIZE 1024
+xmlHashTablePtr xmljStringCache = NULL;
+
+void
+xmljHashDeallocate (void *data, xmlChar *name);
+
+void
+xmljHashDeallocate (void *data, xmlChar *name)
+{
+  /* NOOP */
+}
+#endif /* XMLJ_STRING_CACHE */
+
+jstring
+xmljNewString (JNIEnv * env, const xmlChar * text)
+{
+  jstring ret;
+
+  if (text == NULL || (*env)->ExceptionOccurred (env))
+    {
+      return NULL;
+    }
+#ifdef XMLJ_STRING_CACHE
+  if (xmljStringCache == NULL) /* Init cache */
+    {
+      xmljStringCache = xmlHashCreate (XMLJ_STRING_CACHE_SIZE);
+    }
+  ret = (jstring) xmlHashLookup (xmljStringCache, text);
+  if (ret == NULL)
+    {
+      ret = (*env)->NewStringUTF (env, (char *) text);
+      if (ret == NULL) /* Why? */
+        {
+          fprintf(stderr, "xmljNewString: ERROR: NewStringUTF returned null for \"%s\"\n", text);
+          fflush (stderr);
+        }
+      else
+        {
+          xmlHashAddEntry (xmljStringCache, text, ret);
+        }
+    }
+#else
+  ret = (*env)->NewStringUTF (env, (char *) text);
+  if (ret == NULL) /* Why? */
+    {
+      printf("xmljNewString: ERROR: NewStringUTF returned null for \"%s\"\n", text);
+    }
+#endif /* XMLJ_STRING_CACHE */
+  return ret;
+}
+
+void
+xmljClearStringCache ()
+{
+#ifdef XMLJ_STRING_CACHE
+  if (xmljStringCache != NULL)
+    {
+      xmlHashFree (xmljStringCache, &xmljHashDeallocate);
+    }
+#endif /* XMLJ_STRING_CACHE */
+}
+
+const xmlChar *
+xmljGetStringChars (JNIEnv * env, jstring text)
+{
+  const char *s_text;
+  xmlChar *x_text;
+
+  if (text == NULL)
+    {
+      return NULL;
+    }
+
+  s_text = (*env)->GetStringUTFChars (env, text, 0);
+  x_text = (s_text == NULL) ? NULL : xmlCharStrdup (s_text);
+  if (s_text != NULL && x_text == NULL)
+    {
+      /* TODO raise exception */
+    }
+  (*env)->ReleaseStringUTFChars (env, text, s_text);
+  return x_text;
+}
+
+const xmlChar *
+xmljGetPrefix (const xmlChar * qName)
+{
+  const xmlChar *localName;
+  const xmlChar *ret;
+  xmlChar **prefix;
+
+  prefix = (xmlChar **) malloc (sizeof (xmlChar *));
+  localName = xmlSplitQName2 (qName, prefix);
+  if (localName == NULL)
+    {
+      return NULL;
+    }
+  ret = *prefix;
+  free (prefix);
+  return ret;
+}
+
+const xmlChar *
+xmljGetLocalName (const xmlChar * qName)
+{
+  const xmlChar *localName;
+  xmlChar **prefix;
+
+  prefix = (xmlChar **) malloc (sizeof (xmlChar *));
+  localName = xmlSplitQName2 (qName, prefix);
+  if (localName == NULL)
+    {
+      return qName;
+    }
+  free (prefix);
+  return localName;
+}
+
+jmethodID xmljGetMethodID (JNIEnv *env,
+                           jobject target,
+                           const char *name,
+                           const char *signature)
+{
+  jclass cls;
+  jmethodID ret;
+
+  cls = (*env)->GetObjectClass (env, target);
+  if (cls == NULL)
+    {
+      xmljThrowException (env,
+                          "java/lang/ClassNotFoundException",
+                          NULL);
+      return NULL;
+    }
+  ret = (*env)->GetMethodID (env,
+                             cls,
+                             name,
+                             signature);
+  if (ret == NULL)
+    {
+      jclass clscls;
+      jmethodID nm;
+      jstring clsname;
+      const char *c_clsName;
+      char cat[512] = "[method signature too long]";
+      
+      clscls = (*env)->FindClass (env, "java/lang/Class");
+      if (clscls == NULL)
+        {
+          return NULL;
+        }
+      nm = (*env)->GetMethodID (env, clscls, "getName",
+                                "()Ljava/lang/String;");
+      if (nm == NULL)
+        {
+          return NULL;
+        }
+      clsname = (jstring) (*env)->CallObjectMethod (env,
+                                                    (jobject)cls,
+                                                    nm);
+      if (clsname == NULL)
+        {
+          return NULL;
+        }
+      c_clsName = (*env)->GetStringUTFChars (env, clsname, 0);
+      sprintf (cat, "%s.%s %s", c_clsName, name, signature);
+      xmljThrowException (env,
+                          "java/lang/NoSuchMethodException",
+                          cat);
+      (*env)->ReleaseStringUTFChars (env, clsname, c_clsName);
+    }
+  return ret;
+}
+
+void *
+xmljAsPointer (JNIEnv *env, jobject ptr)
+{
+  return JCL_GetRawData(env, ptr);
+}
+
+jobject
+xmljAsField (JNIEnv *env, void * ptr)
+{
+  return JCL_NewRawDataObject(env, ptr);
+}
+
+JNIEnv *
+xmljGetJNIEnv ()
+{
+  JavaVM **jvms;
+  jsize *jvm_count;
+  JavaVM *jvm;
+  JNIEnv **envs;
+  JNIEnv *env;
+
+  jvms = (JavaVM **) malloc (sizeof (JavaVM *));
+  if (!jvms)
+    {
+      return NULL;
+    }
+  jvm_count = (jsize *) malloc (sizeof (jsize));
+  if (!jvm_count)
+    {
+      free (jvms);
+      return NULL;
+    }
+  if (JNI_GetCreatedJavaVMs (jvms, 1, jvm_count))
+    {
+      free (jvms);
+      free (jvm_count);
+      return NULL;
+    }
+  jvm = *jvms;
+  envs = (JNIEnv **) malloc (sizeof (JNIEnv *));
+  if (!envs)
+    {
+      free (jvms);
+      free (jvm_count);
+      return NULL;
+    }
+  (*jvm)->AttachCurrentThread (jvm, (void **) envs, NULL);
+  (*jvm)->GetEnv (jvm, (void **) envs, JNI_VERSION_1_2);
+  if (envs)
+    {
+      env = *envs;
+      free (envs);
+    }
+  else
+    {
+      env = NULL;
+    }
+  free (jvms);
+  free (jvm_count);
+  return env;
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_util.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_util.h?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_util.h (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_util.h Thu Nov  8 16:56:19 2007
@@ -0,0 +1,65 @@
+/* xmlj_util.h -
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef XMLJ_UTIL_H
+#define XMLJ_UTIL_H
+
+#include <jni.h>
+#include <libxml/xmlstring.h>
+
+jstring xmljNewString (JNIEnv *, const xmlChar *);
+
+void xmljClearStringCache (void);
+
+const xmlChar *xmljGetStringChars (JNIEnv *, jstring);
+
+const xmlChar *xmljGetPrefix (const xmlChar * qName);
+
+const xmlChar *xmljGetLocalName (const xmlChar * qName);
+
+jmethodID xmljGetMethodID (JNIEnv *env,
+                           jobject target,
+                           const char *name,
+                           const char *signature);
+
+void * xmljAsPointer (JNIEnv *env, jobject field);
+
+jobject xmljAsField (JNIEnv *env, void * ptr);
+
+JNIEnv * xmljGetJNIEnv (void);
+
+#endif /* !defined XMLJ_UTIL_H */

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_xpath.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_xpath.c?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_xpath.c (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/jni/xmlj/xmlj_xpath.c Thu Nov  8 16:56:19 2007
@@ -0,0 +1,625 @@
+/* xmlj_xpath.c -
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "gnu_xml_libxmlj_dom_GnomeDocument.h"
+#include "gnu_xml_libxmlj_dom_GnomeElement.h"
+#include "gnu_xml_libxmlj_dom_GnomeXPathExpression.h"
+#include "gnu_xml_libxmlj_dom_GnomeXPathNodeList.h"
+#include "gnu_xml_libxmlj_dom_GnomeXPathNSResolver.h"
+#include "gnu_xml_libxmlj_dom_GnomeXPathResult.h"
+#include "xmlj_node.h"
+#include "xmlj_util.h"
+#include <libxml/xpath.h>
+
+/* Local function prototypes */
+
+xmlXPathContextPtr
+xmljCreateXPathContextPtr (xmlNodePtr node);
+
+jobject
+xmljGetXPathResult (JNIEnv *env, xmlXPathObjectPtr obj);
+
+jobject
+xmljGetXPathNodeList (JNIEnv *env, xmlXPathObjectPtr obj);
+
+xmlXPathObjectPtr
+xmljGetXPathObjectID (JNIEnv *env, jobject obj);
+
+/**
+ * Creates an XPath context for the given node.
+ */
+xmlXPathContextPtr
+xmljCreateXPathContextPtr (xmlNodePtr node)
+{
+  xmlXPathContextPtr ctx;
+
+  ctx = xmlXPathNewContext (node->doc);
+  ctx->node = node;
+  return ctx;
+}
+
+/**
+ * Converts an xmlXPathObjectPtr to a Java XPathResult.
+ */
+jobject
+xmljGetXPathResult (JNIEnv *env, xmlXPathObjectPtr obj)
+{
+  jclass cls;
+  jmethodID method;
+  jobject ret;
+  jobject val;
+  
+  if (obj == NULL)
+    {
+      return NULL;
+    }
+  cls = (*env)->FindClass (env, "gnu/xml/libxmlj/dom/GnomeXPathResult");
+  if (cls == NULL)
+    {
+      return NULL;
+    }
+  method = (*env)->GetMethodID (env, cls, "<init>", "(Ljava/lang/Object;)V");
+  if (method == NULL)
+    {
+      return NULL;
+    }
+  val = xmljAsField (env, obj);
+  ret = (*env)->NewObject (env, cls, method, val);
+  
+  return ret;
+}
+
+/**
+ * Converts an xmlXPathObjectPtr to a Java XPathNodeList.
+ */
+jobject
+xmljGetXPathNodeList (JNIEnv *env, xmlXPathObjectPtr obj)
+{
+  jclass cls;
+  jmethodID method;
+  jobject ret;
+  jobject val;
+  
+  if (obj == NULL)
+    {
+      return NULL;
+    }
+  cls = (*env)->FindClass (env, "gnu/xml/libxmlj/dom/GnomeXPathNodeList");
+  if (cls == NULL)
+    {
+      return NULL;
+    }
+  method = (*env)->GetMethodID (env, cls, "<init>", "(Ljava/lang/Object;)V");
+  if (method == NULL)
+    {
+      return NULL;
+    }
+  val = xmljAsField (env, obj);
+  ret = (*env)->NewObject (env, cls, method, val);
+  
+  return ret;
+}
+
+xmlXPathObjectPtr
+xmljGetXPathObjectID (JNIEnv *env, jobject obj)
+{
+  jclass cls;
+  jfieldID field;
+  jobject val;
+  xmlXPathObjectPtr ret;
+
+  cls = (*env)->GetObjectClass (env, obj);
+  if (cls == NULL)
+    {
+      return NULL;
+    }
+  field = (*env)->GetFieldID (env, cls, "obj", "Ljava/lang/Object;");
+  if (field == NULL)
+    {
+      return NULL;
+    }
+  val = (*env)->GetObjectField (env, obj, field);
+  ret = (xmlXPathObjectPtr) xmljAsPointer (env, val);
+
+  return ret;
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_evaluate (JNIEnv *env,
+                                                 jobject self
+						 __attribute__((__unused__)),
+                                                 jstring expression,
+                                                 jobject contextNode,
+                                                 jobject resolver,
+                                                 jshort type,
+                                                 jobject result)
+{
+  const xmlChar *str;
+  xmlNodePtr node;
+  xmlXPathContextPtr ctx;
+  xmlXPathObjectPtr eval = NULL;
+  
+  str = xmljGetStringChars (env, expression);
+  node = xmljGetNodeID (env, contextNode);
+  if (node == NULL)
+    {
+      return NULL;
+    }
+  ctx = xmljCreateXPathContextPtr (node);
+  if (ctx != NULL)
+    {
+      eval = xmlXPathEval (str, ctx);
+      xmlXPathFreeContext (ctx);
+    }
+  xmlFree ((xmlChar *) str);
+  return xmljGetXPathResult (env, eval);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathExpression_init (JNIEnv *env,
+                                                    jobject self
+						    __attribute__((__unused__)),
+                                                    jstring expression)
+{
+  const xmlChar *str;
+  xmlXPathCompExprPtr ptr;
+
+  str = xmljGetStringChars (env, expression);
+  ptr = xmlXPathCompile (str);
+  xmlFree ((xmlChar *) str);
+  return xmljAsField (env, ptr);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathExpression_free (JNIEnv *env,
+                                                    jobject self
+						    __attribute__((__unused__)),
+                                                    jobject ptr)
+{
+  xmlXPathCompExprPtr expr;
+
+  expr = (xmlXPathCompExprPtr) xmljAsPointer (env, ptr);
+  xmlXPathFreeCompExpr (expr);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathExpression_doEvaluate (JNIEnv *env,
+                                                          jobject self
+							  __attribute__((__unused__)),
+                                                          jobject ptr,
+                                                          jobject contextNode,
+                                                          jshort type,
+                                                          jobject result)
+{
+  xmlXPathCompExprPtr expr;
+  xmlNodePtr node;
+  xmlXPathContextPtr ctx;
+  xmlXPathObjectPtr eval = NULL;
+
+  expr = (xmlXPathCompExprPtr) xmljAsPointer (env, ptr);
+  node = xmljGetNodeID (env, contextNode);
+  if (node == NULL)
+    {
+      return NULL;
+    }
+  ctx = xmljCreateXPathContextPtr (node);
+  if (ctx != NULL)
+    {
+      eval = xmlXPathCompiledEval (expr, ctx);
+      xmlXPathFreeContext (ctx);
+    }
+  return xmljGetXPathResult (env, eval);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_free (JNIEnv *env,
+                                                jobject self
+						__attribute__((__unused__)),
+                                                jobject obj)
+{
+  xmlXPathFreeObject ((xmlXPathObjectPtr) xmljAsPointer (env, obj));
+}
+
+JNIEXPORT jshort JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_getResultType (JNIEnv *env,
+                                                         jobject self)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  switch (obj->type)
+    {
+    case XPATH_UNDEFINED:
+      return 0; /* ANY_TYPE */
+    case XPATH_NUMBER:
+      return 1; /* NUMBER_TYPE */
+    case XPATH_STRING:
+      return 2; /* STRING_TYPE */
+    case XPATH_BOOLEAN:
+      return 3; /* BOOLEAN_TYPE */
+    case XPATH_NODESET:
+      return 6; /* UNORDERED_NODE_SNAPSHOT_TYPE */
+    case XPATH_POINT:
+    case XPATH_RANGE:
+    case XPATH_LOCATIONSET:
+    case XPATH_USERS:
+    case XPATH_XSLT_TREE:
+      /* TODO */
+    default:
+      return -1; /* TODO */
+    }
+}
+
+JNIEXPORT jdouble JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_getNumberValue (JNIEnv *env,
+                                                          jobject self)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  if (obj == NULL)
+    {
+      return 0.0;
+    }
+  return obj->floatval;
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_getStringValue (JNIEnv *env,
+                                                          jobject self)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  if (obj == NULL)
+    {
+      return NULL;
+    }
+  return xmljNewString (env, obj->stringval);
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_getBooleanValue (JNIEnv *env,
+                                                           jobject self)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  return obj->boolval;
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_getSingleNodeValue (JNIEnv *env,
+                                                              jobject self)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  if (obj == NULL)
+    {
+      return NULL;
+    }
+  if (obj->nodesetval == NULL)
+    {
+      return NULL;
+    }
+  if (obj->nodesetval->nodeNr > 0)
+    {
+      return xmljGetNodeInstance (env, obj->nodesetval->nodeTab[0]);
+    }
+  else
+    {
+      return NULL;
+    }
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_getInvalidIteratorState (JNIEnv *env,
+                                                                   jobject self)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  return 0; /* TODO */
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_getSnapshotLength (JNIEnv *env,
+                                                             jobject self)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  if (obj == NULL)
+    {
+      return -1;
+    }
+  if (obj->nodesetval == NULL)
+    {
+      return -1;
+    }
+  return obj->nodesetval->nodeNr;
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_iterateNext (JNIEnv *env,
+                                                       jobject self)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  return NULL; /* TODO */
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathResult_snapshotItem (JNIEnv *env,
+                                                        jobject self,
+                                                        jint index)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  if (obj == NULL)
+    {
+      return NULL;
+    }
+  if (obj->nodesetval == NULL)
+    {
+      return NULL;
+    }
+  if (obj->nodesetval->nodeNr > 0)
+    {
+      return xmljGetNodeInstance (env, obj->nodesetval->nodeTab[index]);
+    }
+  else
+    {
+      return NULL;
+    }
+}
+
+/* -- GnomeXPathNodeList -- */
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_getElementsByTagName (JNIEnv *env,
+                                                             jobject self,
+                                                             jstring name)
+{
+  return Java_gnu_xml_libxmlj_dom_GnomeElement_getElementsByTagName (env,
+                                                                     self,
+                                                                     name);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_getElementsByTagName (JNIEnv *env,
+                                                             jobject self,
+                                                             jstring name)
+{
+  const xmlChar *s_name;
+  const xmlChar *format;
+  xmlChar expr[256];
+  xmlNodePtr node;
+  xmlXPathContextPtr ctx;
+  xmlXPathObjectPtr eval = NULL;
+  
+  node = xmljGetNodeID (env, self);
+  if (node == NULL)
+    {
+      return NULL;
+    }
+  s_name = xmljGetStringChars (env, name);
+  if (xmlStrEqual (s_name, BAD_CAST "*"))
+    {
+      format = xmlCharStrdup ("descendant-or-self::*[node-type()=1]");
+      if (xmlStrPrintf (expr, 256, format) == -1)
+        {
+          return NULL;
+        }
+    }
+  else
+    {
+      format = xmlCharStrdup ("descendant-or-self::*[name()='%s']");
+      if (xmlStrPrintf (expr, 256, format, s_name) == -1)
+        {
+          return NULL;
+        }
+    }
+  xmlFree ((xmlChar *) s_name);
+  ctx = xmljCreateXPathContextPtr (node);
+  if (ctx != NULL)
+    {
+      eval = xmlXPathEval (expr, ctx);
+      xmlXPathFreeContext (ctx);
+    }
+  return xmljGetXPathNodeList (env, eval);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeDocument_getElementsByTagNameNS (JNIEnv *env,
+                                                               jobject self,
+                                                               jstring uri,
+                                                               jstring localName)
+{
+  return Java_gnu_xml_libxmlj_dom_GnomeElement_getElementsByTagNameNS (env,
+                                                                       self,
+                                                                       uri,
+                                                                       localName);
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeElement_getElementsByTagNameNS (JNIEnv *env,
+                                                               jobject self,
+                                                               jstring uri,
+                                                               jstring localName)
+{
+  const xmlChar *s_uri;
+  const xmlChar *s_localName;
+  const xmlChar *format;
+  xmlChar expr[256];
+  xmlNodePtr node;
+  xmlXPathContextPtr ctx;
+  xmlXPathObjectPtr eval = NULL;
+  
+  node = xmljGetNodeID (env, self);
+  if (node == NULL)
+    {
+      return NULL;
+    }
+  s_uri = xmljGetStringChars (env, uri);
+  s_localName = xmljGetStringChars (env, localName);
+  if (uri == NULL)
+    {
+      /* namespace URI is empty */
+      if (xmlStrEqual (s_localName, BAD_CAST "*"))
+        {
+          format = xmlCharStrdup ("descendant-or-self::*[namespace-uri()='' and node-type()=1]");
+          if (xmlStrPrintf (expr, 256, format) == -1)
+            {
+              return NULL;
+            }
+        }
+      else
+        {
+          format = xmlCharStrdup ("descendant-or-self::*[namespace-uri()='' and local-name()='%s']");
+          if (xmlStrPrintf (expr, 256, format, s_localName) == -1)
+            {
+              return NULL;
+            }
+        }
+    }
+  else if (xmlStrEqual (s_uri, BAD_CAST "*"))
+    {
+      /* matches all namespaces */
+      if (xmlStrEqual (s_localName, BAD_CAST "*"))
+        {
+          format = xmlCharStrdup ("descendant-or-self::*[node-type()=1]");
+          if (xmlStrPrintf (expr, 256, format) == -1)
+            {
+              return NULL;
+            }
+        }
+      else
+        {
+          format = xmlCharStrdup ("descendant-or-self::*[local-name()='%s']");
+          if (xmlStrPrintf (expr, 256, format, s_localName) == -1)
+            {
+              return NULL;
+            }
+        }
+    }
+  else
+    {
+      if (xmlStrEqual (s_localName, BAD_CAST "*"))
+        {
+          format = xmlCharStrdup ("descendant-or-self::*[namespace-uri()='%s' and node-type()=1]");
+          if (xmlStrPrintf (expr, 256, format, s_uri) == -1)
+            {
+              return NULL;
+            }
+        }
+      else
+        {
+          format = xmlCharStrdup ("descendant-or-self::*[namespace-uri()='%s' and local-name()='%s']");
+          if (xmlStrPrintf (expr, 256, format, s_uri, s_localName) == -1)
+            {
+              return NULL;
+            }
+        }
+    }
+  xmlFree ((xmlChar *) s_uri);
+  xmlFree ((xmlChar *) s_localName);
+  ctx = xmljCreateXPathContextPtr (node);
+  if (ctx != NULL)
+    {
+      eval = xmlXPathEval (expr, ctx);
+      xmlXPathFreeContext (ctx);
+    }
+  return xmljGetXPathNodeList (env, eval);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathNodeList_free (JNIEnv *env,
+                                                  jobject self
+						  __attribute__((__unused__)),
+                                                  jobject obj)
+{
+  xmlXPathFreeObject ((xmlXPathObjectPtr) xmljAsPointer (env, obj));
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathNodeList_getLength (JNIEnv *env,
+                                                       jobject self)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  if (obj == NULL)
+    {
+      return 0;
+    }
+  if (obj->nodesetval == NULL)
+    {
+      return 0;
+    }
+  return obj->nodesetval->nodeNr;
+}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_xml_libxmlj_dom_GnomeXPathNodeList_item (JNIEnv *env,
+                                                  jobject self,
+                                                  jint index)
+{
+  xmlXPathObjectPtr obj;
+  
+  obj = xmljGetXPathObjectID (env, self);
+  if (obj == NULL)
+    {
+      return NULL;
+    }
+  if (obj->nodesetval == NULL)
+    {
+      return NULL;
+    }
+  if (obj->nodesetval->nodeNr > 0)
+    {
+      return xmljGetNodeInstance (env, obj->nodesetval->nodeTab[index]);
+    }
+  else
+    {
+      return NULL;
+    }
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/.cvsignore
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/.cvsignore?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/.cvsignore (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/.cvsignore Thu Nov  8 16:56:19 2007
@@ -0,0 +1,6 @@
+Makefile.in
+.deps
+.libs
+libgcjwebplugin_la-gcjwebplugin.lo
+libgcjwebplugin.la
+Makefile

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,18 @@
+nativeexeclib_LTLIBRARIES = libgcjwebplugin.la
+
+libgcjwebplugin_la_SOURCES = gcjwebplugin.cc
+
+libgcjwebplugin_la_CXXFLAGS = \
+	-Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/gappletviewer\"" \
+	$(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS)
+
+libgcjwebplugin_la_LDFLAGS = -avoid-version \
+	$(GLIB_LIBS) $(GTK_LIBS) \
+	-lstdc++
+
+install-plugin: $(nativeexeclib_LTLIBRARIES)
+	$(INSTALL) -d -m0755 $(DESTDIR)$(PLUGIN_DIR)
+	$(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)$(PLUGIN_DIR)
+
+uninstall-plugin:
+	rm -f $(DESTDIR)$(PLUGIN_DIR)/libgcjwebplugin.so

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/Makefile.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,609 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/plugin
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/lead-dot.m4 \
+	$(top_srcdir)/../../config/multi.m4 \
+	$(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
+	$(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+	$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libgcjwebplugin_la_LIBADD =
+am_libgcjwebplugin_la_OBJECTS = libgcjwebplugin_la-gcjwebplugin.lo
+libgcjwebplugin_la_OBJECTS = $(am_libgcjwebplugin_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgcjwebplugin_la_SOURCES)
+DIST_SOURCES = $(libgcjwebplugin_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
+CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
+CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@
+CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@
+CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FASTJAR = @FASTJAR@
+FIND = @FIND@
+FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
+FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+JIKESWARNINGS = @JIKESWARNINGS@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
+USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
+VERSION = @VERSION@
+VM_BINARY = @VM_BINARY@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libgcjwebplugin.la
+libgcjwebplugin_la_SOURCES = gcjwebplugin.cc
+libgcjwebplugin_la_CXXFLAGS = \
+	-Wall -DAPPLETVIEWER_EXECUTABLE="\"$(bindir)/gappletviewer\"" \
+	$(MOZILLA_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS)
+
+libgcjwebplugin_la_LDFLAGS = -avoid-version \
+	$(GLIB_LIBS) $(GTK_LIBS) \
+	-lstdc++
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  native/plugin/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  native/plugin/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-nativeexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
+	done
+
+clean-nativeexeclibLTLIBRARIES:
+	-test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+	@list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libgcjwebplugin.la: $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_DEPENDENCIES) 
+	$(CXXLINK) -rpath $(nativeexeclibdir) $(libgcjwebplugin_la_LDFLAGS) $(libgcjwebplugin_la_OBJECTS) $(libgcjwebplugin_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgcjwebplugin_la-gcjwebplugin.Plo at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+ at am__fastdepCXX_TRUE@	if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+
+libgcjwebplugin_la-gcjwebplugin.lo: gcjwebplugin.cc
+ at am__fastdepCXX_TRUE@	if $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgcjwebplugin_la_CXXFLAGS) $(CXXFLAGS) -MT libgcjwebplugin_la-gcjwebplugin.lo -MD -MP -MF "$(DEPDIR)/libgcjwebplugin_la-gcjwebplugin.Tpo" -c -o libgcjwebplugin_la-gcjwebplugin.lo `test -f 'gcjwebplugin.cc' || echo '$(srcdir)/'`gcjwebplugin.cc; \
+ at am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/libgcjwebplugin_la-gcjwebplugin.Tpo" "$(DEPDIR)/libgcjwebplugin_la-gcjwebplugin.Plo"; else rm -f "$(DEPDIR)/libgcjwebplugin_la-gcjwebplugin.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='gcjwebplugin.cc' object='libgcjwebplugin_la-gcjwebplugin.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgcjwebplugin_la_CXXFLAGS) $(CXXFLAGS) -c -o libgcjwebplugin_la-gcjwebplugin.lo `test -f 'gcjwebplugin.cc' || echo '$(srcdir)/'`gcjwebplugin.cc
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-nativeexeclibLTLIBRARIES install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-nativeexeclibLTLIBRARIES
+
+
+install-plugin: $(nativeexeclib_LTLIBRARIES)
+	$(INSTALL) -d -m0755 $(DESTDIR)$(PLUGIN_DIR)
+	$(INSTALL) .libs/libgcjwebplugin.so $(DESTDIR)$(PLUGIN_DIR)
+
+uninstall-plugin:
+	rm -f $(DESTDIR)$(PLUGIN_DIR)/libgcjwebplugin.so
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/gcjwebplugin.cc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/gcjwebplugin.cc?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/gcjwebplugin.cc (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/plugin/gcjwebplugin.cc Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1780 @@
+/* gcjwebplugin.cc -- web browser plugin to execute Java applets
+   Copyright (C) 2003, 2004, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+// System includes.
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+// Netscape plugin API includes.
+#include <npapi.h>
+#include <npupp.h>
+
+// GLib includes.
+#include <glib.h>
+#include <glib/gstdio.h>
+
+// GTK includes.
+#include <gtk/gtk.h>
+
+// gcjwebplugin includes.
+#include "config.h"
+
+// Documentbase retrieval includes.
+#include <nsIPluginInstance.h>
+#include <nsIPluginInstancePeer.h>
+#include <nsIPluginTagInfo2.h>
+
+// Debugging macros.
+#define PLUGIN_DEBUG(message)                                           \
+  g_print ("GCJ PLUGIN: thread %p: %s\n", g_thread_self (), message)
+
+#define PLUGIN_DEBUG_TWO(first, second)                                 \
+  g_print ("GCJ PLUGIN: thread %p: %s %s\n", g_thread_self (),          \
+           first, second)
+
+// Error reporting macros.
+#define PLUGIN_ERROR(message)                                       \
+  g_printerr ("%s:%d: thread %p: Error: %s\n", __FILE__, __LINE__,  \
+              g_thread_self (), message)
+
+#define PLUGIN_ERROR_TWO(first, second)                                 \
+  g_printerr ("%s:%d: thread %p: Error: %s: %s\n", __FILE__, __LINE__,  \
+              g_thread_self (), first, second)
+
+#define PLUGIN_ERROR_THREE(first, second, third)                        \
+  g_printerr ("%s:%d: thread %p: Error: %s: %s: %s\n", __FILE__,        \
+              __LINE__, g_thread_self (), first, second, third)
+
+// Plugin information passed to about:plugins.
+#define PLUGIN_NAME "GCJ Web Browser Plugin"
+#define PLUGIN_DESC "The " PLUGIN_NAME " executes Java applets."
+#define PLUGIN_MIME_DESC                                           \
+  "application/x-java-vm:class,jar:GCJ;"                           \
+  "application/x-java-applet:class,jar:GCJ;"                       \
+  "application/x-java-applet;version=1.1:class,jar:GCJ;"           \
+  "application/x-java-applet;version=1.1.1:class,jar:GCJ;"         \
+  "application/x-java-applet;version=1.1.2:class,jar:GCJ;"         \
+  "application/x-java-applet;version=1.1.3:class,jar:GCJ;"         \
+  "application/x-java-applet;version=1.2:class,jar:GCJ;"           \
+  "application/x-java-applet;version=1.2.1:class,jar:GCJ;"         \
+  "application/x-java-applet;version=1.2.2:class,jar:GCJ;"         \
+  "application/x-java-applet;version=1.3:class,jar:GCJ;"           \
+  "application/x-java-applet;version=1.3.1:class,jar:GCJ;"         \
+  "application/x-java-applet;version=1.4:class,jar:GCJ;"           \
+  "application/x-java-applet;version=1.4.1:class,jar:GCJ;"         \
+  "application/x-java-applet;version=1.4.2:class,jar:GCJ;"         \
+  "application/x-java-applet;jpi-version=1.4.2_01:class,jar:GCJ;"  \
+  "application/x-java-bean:class,jar:GCJ;"                         \
+  "application/x-java-bean;version=1.1:class,jar:GCJ;"             \
+  "application/x-java-bean;version=1.1.1:class,jar:GCJ;"           \
+  "application/x-java-bean;version=1.1.2:class,jar:GCJ;"           \
+  "application/x-java-bean;version=1.1.3:class,jar:GCJ;"           \
+  "application/x-java-bean;version=1.2:class,jar:GCJ;"             \
+  "application/x-java-bean;version=1.2.1:class,jar:GCJ;"           \
+  "application/x-java-bean;version=1.2.2:class,jar:GCJ;"           \
+  "application/x-java-bean;version=1.3:class,jar:GCJ;"             \
+  "application/x-java-bean;version=1.3.1:class,jar:GCJ;"           \
+  "application/x-java-bean;version=1.4:class,jar:GCJ;"             \
+  "application/x-java-bean;version=1.4.1:class,jar:GCJ;"           \
+  "application/x-java-bean;version=1.4.2:class,jar:GCJ;"           \
+  "application/x-java-bean;jpi-version=1.4.2_01:class,jar:GCJ;"
+#define PLUGIN_URL NS_INLINE_PLUGIN_CONTRACTID_PREFIX NS_JVM_MIME_TYPE
+#define PLUGIN_MIME_TYPE "application/x-java-vm"
+#define PLUGIN_FILE_EXTS "class,jar,zip"
+#define PLUGIN_MIME_COUNT 1
+
+// Security dialog messages.
+#define RESPONSE_TRUST_APPLET "Trust Applet"
+#define RESPONSE_TRUST_APPLET_ADD_TO_LIST "Trust Applet and Add to Whitelist"
+#define SECURITY_WARNING                                        \
+  "%s wants to load an applet.\n"                               \
+  "GNU Classpath's security implementation is not complete.\n"  \
+  "HOSTILE APPLETS WILL STEAL AND/OR DESTROY YOUR DATA!\n"
+#define SECURITY_DESCRIPTION                                            \
+  "Click \"Cancel\" if you do not trust the source of this applet.\n"   \
+  "Click \"Trust Applet\" to load and run this applet now.\n"           \
+  "Click \"Trust Applet and Add To Whitelist\" to always load"          \
+  " and run this applet from now on, without asking.\n"                 \
+  "The whitelist is a list of the URLs from which you trust"            \
+  " applets.\n"                                                         \
+  "Your whitelist file is \" %s \"."
+#define FAILURE_MESSAGE                                                 \
+  "This page wants to load an applet.\n"                                \
+  "The appletviewer is missing or not installed properly in \""         \
+  APPLETVIEWER_EXECUTABLE "\"."        
+
+// Documentbase retrieval required definition.
+static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
+
+// Browser function table.
+static NPNetscapeFuncs browserFunctions;
+
+// Data directory for plugin.
+static gchar* data_directory;
+
+// Whitelist filename
+static gchar* whitelist_filename;
+
+// Keeps track of initialization. NP_Initialize should only be
+// called once.
+gboolean initialized = false;
+
+// GCJPluginData stores all the data associated with a single plugin
+// instance.  A separate plugin instance is created for each <APPLET>
+// tag.  For now, each plugin instance spawns its own applet viewer
+// process but this may need to change if we find pages containing
+// multiple applets that expect to be running in the same VM.
+struct GCJPluginData
+{
+  // A unique identifier for this plugin window.
+  gchar* instance_string;
+  // Applet viewer input pipe name.
+  gchar* in_pipe_name;
+  // Applet viewer input channel.
+  GIOChannel* in_from_appletviewer;
+  // Applet viewer input watch source.
+  gint in_watch_source;
+  // Applet viewer output pipe name.
+  gchar* out_pipe_name;
+  // Applet viewer output channel.
+  GIOChannel* out_to_appletviewer;
+  // Applet viewer output watch source.
+  gint out_watch_source;
+  // Mutex to protect appletviewer_alive.
+  GMutex* appletviewer_mutex;
+  // Back-pointer to the plugin instance to which this data belongs.
+  // This should not be freed but instead simply set to NULL.
+  NPP owner;
+  // FALSE if the applet viewer process has died.  All code
+  // communicating with the applet viewer should check this flag
+  // before attempting to read from/write to the applet viewer pipes.
+  gboolean appletviewer_alive;
+  // The address of the plugin window.  This should not be freed but
+  // instead simply set to NULL.
+  gpointer window_handle;
+  // The last plugin window width sent to us by the browser.
+  guint32 window_width;
+  // The last plugin window height sent to us by the browser.
+  guint32 window_height;
+};
+
+// Documentbase retrieval type-punning union.
+typedef union
+{
+  void** void_field;
+  nsIPluginTagInfo2** info_field;
+} info_union;
+
+// Static instance helper functions.
+// Have the browser allocate a new GCJPluginData structure.
+static void plugin_data_new (GCJPluginData** data);
+// Documentbase retrieval.
+static gchar* plugin_get_documentbase (NPP instance);
+// plugin failure handling.
+static bool plugin_failed ();
+// Whitelist handling.
+static bool plugin_user_trusts_documentbase (char* documentbase);
+static bool plugin_ask_user_about_documentbase (char* documentbase);
+static void plugin_add_documentbase_to_whitelist (char* documentbase);
+// Callback used to monitor input pipe status.
+static gboolean plugin_in_pipe_callback (GIOChannel* source,
+                                         GIOCondition condition,
+                                         gpointer plugin_data);
+// Callback used to monitor output pipe status.
+static gboolean plugin_out_pipe_callback (GIOChannel* source,
+                                          GIOCondition condition,
+                                          gpointer plugin_data);
+static NPError plugin_start_appletviewer (GCJPluginData* data);
+static gchar* plugin_create_applet_tag (int16 argc, char* argn[],
+                                        char* argv[]);
+static void plugin_send_message_to_appletviewer (GCJPluginData* data,
+                                                 gchar const* message);
+static void plugin_stop_appletviewer (GCJPluginData* data);
+// Uninitialize GCJPluginData structure and delete pipes.
+static void plugin_data_destroy (GCJPluginData** data);
+
+// Global instance counter.
+// Mutex to protect plugin_instance_counter.
+static GMutex* plugin_instance_mutex = NULL;
+// A counter used to create uniquely named pipes.
+static gulong plugin_instance_counter = 0;
+// The user's documentbase whitelist.
+static GIOChannel* whitelist_file = NULL;
+// A global variable for reporting GLib errors.  This must be free'd
+// and set to NULL after each use.
+static GError* channel_error = NULL;
+
+// Functions prefixed by GCJ_ are instance functions.  They are called
+// by the browser and operate on instances of GCJPluginData.
+// Functions prefixed by plugin_ are static helper functions.
+// Functions prefixed by NP_ are factory functions.  They are called
+// by the browser and provide functionality needed to create plugin
+// instances.
+
+// INSTANCE FUNCTIONS
+
+// Creates a new gcjwebplugin instance.  This function creates a
+// GCJPluginData* and stores it in instance->pdata.  The following
+// GCJPluginData fiels are initialized: instance_string, in_pipe_name,
+// in_from_appletviewer, in_watch_source, out_pipe_name,
+// out_to_appletviewer, out_watch_source, appletviewer_mutex, owner,
+// appletviewer_alive.  In addition two pipe files are created.  All
+// of those fields must be properly destroyed, and the pipes deleted,
+// by GCJ_Destroy.  If an error occurs during initialization then this
+// function will free anything that's been allocated so far, set
+// instance->pdata to NULL and return an error code.
+NPError
+GCJ_New (NPMIMEType pluginType, NPP instance, uint16 mode,
+         int16 argc, char* argn[], char* argv[],
+         NPSavedData* saved)
+{
+  PLUGIN_DEBUG ("GCJ_New");
+
+  NPError np_error = NPERR_NO_ERROR;
+  GCJPluginData* data = NULL;
+
+  gchar* documentbase = NULL;
+  gchar* read_message = NULL;
+  gchar* applet_tag = NULL;
+  gchar* tag_message = NULL;
+
+  if (!instance)
+    {
+      PLUGIN_ERROR ("Browser-provided instance pointer is NULL.");
+      np_error = NPERR_INVALID_INSTANCE_ERROR;
+      goto cleanup_done;
+    }
+
+  // Initialize threads (needed for mutexes).
+  if (!g_thread_supported ())
+    g_thread_init (NULL);
+
+  // data
+  plugin_data_new (&data);
+  if (data == NULL)
+    {
+      PLUGIN_ERROR ("Failed to allocate plugin data.");
+      np_error = NPERR_OUT_OF_MEMORY_ERROR;
+      goto cleanup_done;
+    }
+
+  // Initialize data->instance_string.
+  //
+  // instance_string should be unique for this process so we use a
+  // combination of getpid and plugin_instance_counter.
+  //
+  // Critical region.  Reference and increment plugin_instance_counter
+  // global.
+  g_mutex_lock (plugin_instance_mutex);
+
+  // data->instance_string
+  data->instance_string = g_strdup_printf ("instance-%d-%ld",
+                                           getpid (),
+                                           plugin_instance_counter++);
+
+  g_mutex_unlock (plugin_instance_mutex);
+
+  // data->appletviewer_mutex
+  data->appletviewer_mutex = g_mutex_new ();
+
+  // Documentbase retrieval.
+  documentbase = plugin_get_documentbase (instance);
+  if (!documentbase)
+    {
+      PLUGIN_ERROR ("Documentbase retrieval failed."
+                    " Browser not Mozilla-based?");
+      goto cleanup_appletviewer_mutex;
+    }
+    
+  // Open the user's documentbase whitelist.
+  whitelist_file = g_io_channel_new_file (whitelist_filename,
+                                          "a+", &channel_error);
+  if (!whitelist_file)
+    {
+      if (channel_error)
+        {
+          PLUGIN_ERROR_THREE ("Failed to open whitelist file",
+                              whitelist_filename,
+                              channel_error->message);
+          g_error_free (channel_error);
+          channel_error = NULL;
+        }
+      else
+        PLUGIN_ERROR_TWO ("Failed to open whitelist file",
+                          whitelist_filename);
+
+      return NPERR_GENERIC_ERROR;
+    }
+    
+  if (!plugin_user_trusts_documentbase (documentbase))
+    {
+      PLUGIN_ERROR ("User does not trust applet.");
+      np_error = NPERR_GENERIC_ERROR;
+      goto cleanup_appletviewer_mutex;
+    }
+    
+  // Create appletviewer-to-plugin pipe which we refer to as the input
+  // pipe.
+
+  // data->in_pipe_name
+  data->in_pipe_name = g_strdup_printf ("%s/gcj-%s-appletviewer-to-plugin", 
+                                         data_directory, data->instance_string);
+  if (!data->in_pipe_name)
+    {
+      PLUGIN_ERROR ("Failed to create input pipe name.");
+      np_error = NPERR_OUT_OF_MEMORY_ERROR;
+      // If data->in_pipe_name is NULL then the g_free at
+      // cleanup_in_pipe_name will simply return.
+      goto cleanup_in_pipe_name;
+    }
+
+  if (mkfifo (data->in_pipe_name, 0700) == -1 && errno != EEXIST)
+    {
+      PLUGIN_ERROR_TWO ("Failed to create input pipe", strerror (errno));
+      np_error = NPERR_GENERIC_ERROR;
+      goto cleanup_in_pipe_name;
+    }
+
+  // Create plugin-to-appletviewer pipe which we refer to as the
+  // output pipe.
+
+  // data->out_pipe_name
+  data->out_pipe_name = g_strdup_printf ("%s/gcj-%s-plugin-to-appletviewer", 
+                                         data_directory, data->instance_string);
+
+  if (!data->out_pipe_name)
+    {
+      PLUGIN_ERROR ("Failed to create output pipe name.");
+      np_error = NPERR_OUT_OF_MEMORY_ERROR;
+      goto cleanup_out_pipe_name;
+    }
+
+  if (mkfifo (data->out_pipe_name, 0700) == -1 && errno != EEXIST)
+    {
+      PLUGIN_ERROR_TWO ("Failed to create output pipe", strerror (errno));
+      np_error = NPERR_GENERIC_ERROR;
+      goto cleanup_out_pipe_name;
+    }
+
+  // Start a separate appletviewer process for each applet, even if
+  // there are multiple applets in the same page.  We may need to
+  // change this behaviour if we find pages with multiple applets that
+  // rely on being run in the same VM.
+
+  // Critical region.  Hold appletviewer_mutex while we start the
+  // appletviewer, create the IO channels and install the channel
+  // watch callbacks.
+  g_mutex_lock (data->appletviewer_mutex);
+  
+  np_error = plugin_start_appletviewer (data);
+  
+  // If the appletviewer is not installed, then a dialog box will
+  // show up and the plugin will be killed.
+  if (np_error != NPERR_NO_ERROR)
+    {
+      if (plugin_failed ())
+        goto cleanup_applet_failure; 
+  	}
+  
+  // Create plugin-to-appletviewer channel.  The default encoding for
+  // the file is UTF-8.
+  // data->out_to_appletviewer
+  data->out_to_appletviewer = g_io_channel_new_file (data->out_pipe_name,
+                                                     "w", &channel_error);
+  if (!data->out_to_appletviewer)
+    {
+      if (channel_error)
+        {
+          PLUGIN_ERROR_TWO ("Failed to create output channel",
+                            channel_error->message);
+          g_error_free (channel_error);
+          channel_error = NULL;
+        }
+      else
+        PLUGIN_ERROR ("Failed to create output channel");
+        
+      np_error = NPERR_GENERIC_ERROR;
+      goto cleanup_out_to_appletviewer;
+    }
+
+  // Watch for hangup and error signals on the output pipe.
+  data->out_watch_source =
+    g_io_add_watch (data->out_to_appletviewer,
+                    (GIOCondition) (G_IO_ERR | G_IO_HUP),
+                    plugin_out_pipe_callback, (gpointer) data);
+
+  // Create appletviewer-to-plugin channel.  The default encoding for
+  // the file is UTF-8.
+  // data->in_from_appletviewer
+  data->in_from_appletviewer = g_io_channel_new_file (data->in_pipe_name,
+                                                      "r", &channel_error);
+  if (!data->in_from_appletviewer)
+    {
+      if (channel_error)
+        {
+          PLUGIN_ERROR_TWO ("Failed to create input channel",
+                            channel_error->message);
+          g_error_free (channel_error);
+          channel_error = NULL;
+        }
+      else
+        PLUGIN_ERROR ("Failed to create input channel");
+        
+      np_error = NPERR_GENERIC_ERROR;
+      goto cleanup_in_from_appletviewer;
+    }
+
+  // Watch for hangup and error signals on the input pipe.
+  data->in_watch_source =
+    g_io_add_watch (data->in_from_appletviewer,
+                    (GIOCondition) (G_IO_IN | G_IO_ERR | G_IO_HUP),
+                    plugin_in_pipe_callback, (gpointer) data);
+
+  // Wait until we receive confirmation that the appletviewer has
+  // started.
+  if (g_io_channel_read_line (data->in_from_appletviewer,
+                              &read_message, NULL, NULL,
+                              &channel_error)
+      != G_IO_STATUS_NORMAL)
+    {
+      if (channel_error)
+        {
+          PLUGIN_ERROR_TWO ("Receiving confirmation from appletviewer failed",
+                            channel_error->message);
+          g_error_free (channel_error);
+          channel_error = NULL;
+        }
+      else
+        PLUGIN_ERROR ("Receiving confirmation from appletviewer failed");
+          
+      np_error = NPERR_GENERIC_ERROR;
+      goto cleanup_in_watch_source;
+    }
+
+  PLUGIN_DEBUG ("GCJ_New: got confirmation that appletviewer is running.");
+  data->appletviewer_alive = TRUE;
+
+  // Send applet tag message to appletviewer.
+  applet_tag = plugin_create_applet_tag (argc, argn, argv);
+  tag_message = g_strconcat ("tag ", documentbase, " ", applet_tag, NULL);
+
+  plugin_send_message_to_appletviewer (data, data->instance_string);
+  plugin_send_message_to_appletviewer (data, tag_message);
+
+  g_mutex_unlock (data->appletviewer_mutex);
+
+  // If initialization succeeded entirely then we store the plugin
+  // data in the instance structure and return.  Otherwise we free the
+  // data we've allocated so far and set instance->pdata to NULL.
+
+  // Set back-pointer to owner instance.
+  data->owner = instance;
+  instance->pdata = data;
+  goto cleanup_done;
+
+  // An error occurred while initializing the plugin data or spawning
+  // the appletviewer so we free the data we've already allocated.
+
+ cleanup_in_watch_source:
+  // Removing a source is harmless if it fails since it just means the
+  // source has already been removed.
+  g_source_remove (data->in_watch_source);
+  data->in_watch_source = 0;
+
+ cleanup_in_from_appletviewer:
+  if (data->in_from_appletviewer)
+    g_io_channel_unref (data->in_from_appletviewer);
+  data->in_from_appletviewer = NULL;
+
+  // cleanup_out_watch_source:
+  g_source_remove (data->out_watch_source);
+  data->out_watch_source = 0;
+
+ cleanup_out_to_appletviewer:
+  if (data->out_to_appletviewer)
+    g_io_channel_unref (data->out_to_appletviewer);
+  data->out_to_appletviewer = NULL;
+
+  // cleanup_out_pipe:
+  // Delete output pipe.
+  unlink (data->out_pipe_name);
+ 
+ cleanup_applet_failure:
+ cleanup_out_pipe_name:
+  g_free (data->out_pipe_name);
+  data->out_pipe_name = NULL;
+
+  // cleanup_in_pipe:
+  // Delete input pipe.
+  unlink (data->in_pipe_name);
+
+ cleanup_in_pipe_name:
+  g_free (data->in_pipe_name);
+  data->in_pipe_name = NULL;
+
+ cleanup_appletviewer_mutex:
+  g_free (data->appletviewer_mutex);
+  data->appletviewer_mutex = NULL;
+
+  // cleanup_instance_string:
+  g_free (data->instance_string);
+  data->instance_string = NULL;
+
+  // cleanup_data:
+  // Eliminate back-pointer to plugin instance.
+  data->owner = NULL;
+  (*browserFunctions.memfree) (data);
+  data = NULL;
+
+  // Initialization failed so return a NULL pointer for the browser
+  // data.
+  instance->pdata = NULL;
+
+ cleanup_done:
+  g_free (tag_message);
+  tag_message = NULL;
+  g_free (applet_tag);
+  applet_tag = NULL;
+  g_free (read_message);
+  read_message = NULL;
+  g_free (documentbase);
+  documentbase = NULL;
+
+  PLUGIN_DEBUG ("GCJ_New return");
+
+  return np_error;
+}
+
+NPError
+GCJ_GetValue (NPP instance, NPPVariable variable, void* value)
+{
+  PLUGIN_DEBUG ("GCJ_GetValue");
+
+  NPError np_error = NPERR_NO_ERROR;
+
+  switch (variable)
+    {
+    // This plugin needs XEmbed support.
+    case NPPVpluginNeedsXEmbed:
+      {
+        PLUGIN_DEBUG ("GCJ_GetValue: returning TRUE for NeedsXEmbed.");
+        PRBool* bool_value = (PRBool*) value;
+        *bool_value = PR_TRUE;
+      }
+      break;
+
+    default:
+      PLUGIN_ERROR ("Unknown plugin value requested.");
+      np_error = NPERR_GENERIC_ERROR;
+      break;
+    }
+
+  PLUGIN_DEBUG ("GCJ_GetValue return");
+
+  return np_error;
+}
+
+NPError
+GCJ_Destroy (NPP instance, NPSavedData** save)
+{
+  PLUGIN_DEBUG ("GCJ_Destroy");
+
+  GCJPluginData* data = (GCJPluginData*) instance->pdata;
+
+  if (data)
+    {
+      // Critical region.  Stop the appletviewer.
+      g_mutex_lock (data->appletviewer_mutex);
+
+      // Tell the appletviewer to destroy its embedded plugin window.
+      plugin_send_message_to_appletviewer (data, "destroy");
+      // Shut down the appletviewer.
+      plugin_stop_appletviewer (data);
+
+      g_mutex_unlock (data->appletviewer_mutex);
+
+      // Free plugin data.
+      plugin_data_destroy (&data);
+    }
+
+  PLUGIN_DEBUG ("GCJ_Destroy return");
+
+  return NPERR_NO_ERROR;
+}
+
+NPError
+GCJ_SetWindow (NPP instance, NPWindow* window)
+{
+  PLUGIN_DEBUG ("GCJ_SetWindow");
+
+  if (instance == NULL)
+    {
+      PLUGIN_ERROR ("Invalid instance.");
+
+      return NPERR_INVALID_INSTANCE_ERROR;
+    }
+
+  GCJPluginData* data = (GCJPluginData*) instance->pdata;
+
+  // Simply return if we receive a NULL window.
+  if ((window == NULL) || (window->window == NULL))
+    {
+      PLUGIN_DEBUG ("GCJ_SetWindow: got NULL window.");
+
+      return NPERR_NO_ERROR;
+    }
+
+  if (data->window_handle)
+    {
+      // The window already exists.
+      if (data->window_handle == window->window)
+	{
+          // The parent window is the same as in previous calls.
+          PLUGIN_DEBUG ("GCJ_SetWindow: window already exists.");
+
+          // Critical region.  Read data->appletviewer_mutex and send
+          // a message to the appletviewer.
+          g_mutex_lock (data->appletviewer_mutex);
+
+	  if (data->appletviewer_alive)
+	    {
+	      // The window is the same as it was for the last
+	      // SetWindow call.
+	      if (window->width != data->window_width)
+		{
+                  PLUGIN_DEBUG ("GCJ_SetWindow: window width changed.");
+		  // The width of the plugin window has changed.
+
+                  // Send the new width to the appletviewer.
+		  plugin_send_message_to_appletviewer (data,
+                                                       data->instance_string);
+                  gchar* width_message = g_strdup_printf ("width %d",
+                                                          window->width);
+		  plugin_send_message_to_appletviewer (data, width_message);
+                  g_free (width_message);
+                  width_message = NULL;
+
+                  // Store the new width.
+                  data->window_width = window->width;
+		}
+
+	      if (window->height != data->window_height)
+		{
+                  PLUGIN_DEBUG ("GCJ_SetWindow: window height changed.");
+		  // The height of the plugin window has changed.
+
+                  // Send the new height to the appletviewer.
+		  plugin_send_message_to_appletviewer (data,
+                                                       data->instance_string);
+                  gchar* height_message = g_strdup_printf ("height %d",
+                                                           window->height);
+		  plugin_send_message_to_appletviewer (data, height_message);
+                  g_free (height_message);
+                  height_message = NULL;
+
+                  // Store the new height.
+                  data->window_height = window->height;
+		}
+	    }
+	  else
+	    {
+              // The appletviewer is not running.
+	      PLUGIN_DEBUG ("GCJ_SetWindow: appletviewer is not running.");
+	    }
+
+          g_mutex_unlock (data->appletviewer_mutex);
+	}
+      else
+	{
+	  // The parent window has changed.  This branch does run but
+	  // doing nothing in response seems to be sufficient.
+	  PLUGIN_DEBUG ("GCJ_SetWindow: parent window changed.");
+	}
+    }
+  else
+    {
+      PLUGIN_DEBUG ("GCJ_SetWindow: setting window.");
+
+      // Critical region.  Send messages to appletviewer.
+      g_mutex_lock (data->appletviewer_mutex);
+
+      plugin_send_message_to_appletviewer (data, data->instance_string);
+      gchar *window_message = g_strdup_printf ("handle %ld",
+                                               (gulong) window->window);
+      plugin_send_message_to_appletviewer (data, window_message);
+      g_free (window_message);
+      window_message = NULL;
+
+      g_mutex_unlock (data->appletviewer_mutex);
+
+      // Store the window handle.
+      data->window_handle = window->window;
+    }
+
+  PLUGIN_DEBUG ("GCJ_SetWindow return");
+
+  return NPERR_NO_ERROR;
+}
+
+NPError
+GCJ_NewStream (NPP instance, NPMIMEType type, NPStream* stream,
+               NPBool seekable, uint16* stype)
+{
+  PLUGIN_DEBUG ("GCJ_NewStream");
+
+  PLUGIN_DEBUG ("GCJ_NewStream return");
+
+  return NPERR_NO_ERROR;
+}
+
+void
+GCJ_StreamAsFile (NPP instance, NPStream* stream, const char* filename)
+{
+  PLUGIN_DEBUG ("GCJ_StreamAsFile");
+
+  PLUGIN_DEBUG ("GCJ_StreamAsFile return");
+}
+
+NPError
+GCJ_DestroyStream (NPP instance, NPStream* stream, NPReason reason)
+{
+  PLUGIN_DEBUG ("GCJ_DestroyStream");
+
+  PLUGIN_DEBUG ("GCJ_DestroyStream return");
+
+  return NPERR_NO_ERROR;
+}
+
+int32
+GCJ_WriteReady (NPP instance, NPStream* stream)
+{
+  PLUGIN_DEBUG ("GCJ_WriteReady");
+
+  PLUGIN_DEBUG ("GCJ_WriteReady return");
+
+  return 0;
+}
+
+int32
+GCJ_Write (NPP instance, NPStream* stream, int32 offset, int32 len,
+           void* buffer)
+{
+  PLUGIN_DEBUG ("GCJ_Write");
+
+  PLUGIN_DEBUG ("GCJ_Write return");
+
+  return 0;
+}
+
+void
+GCJ_Print (NPP instance, NPPrint* platformPrint)
+{
+  PLUGIN_DEBUG ("GCJ_Print");
+
+  PLUGIN_DEBUG ("GCJ_Print return");
+}
+
+int16
+GCJ_HandleEvent (NPP instance, void* event)
+{
+  PLUGIN_DEBUG ("GCJ_HandleEvent");
+
+  PLUGIN_DEBUG ("GCJ_HandleEvent return");
+
+  return 0;
+}
+
+void
+GCJ_URLNotify (NPP instance, const char* url, NPReason reason,
+               void* notifyData)
+{
+  PLUGIN_DEBUG ("GCJ_URLNotify");
+
+  PLUGIN_DEBUG ("GCJ_URLNotify return");
+}
+
+jref
+GCJ_GetJavaClass (void)
+{
+  PLUGIN_DEBUG ("GCJ_GetJavaClass");
+
+  PLUGIN_DEBUG ("GCJ_GetJavaClass return");
+
+  return 0;
+}
+
+// HELPER FUNCTIONS
+
+static void
+plugin_data_new (GCJPluginData** data)
+{
+  PLUGIN_DEBUG ("plugin_data_new");
+
+  *data = (GCJPluginData*)
+    (*browserFunctions.memalloc) (sizeof (struct GCJPluginData));
+
+  // appletviewer_alive is false until the applet viewer is spawned.
+  if (*data)
+    memset (*data, 0, sizeof (struct GCJPluginData));
+
+  PLUGIN_DEBUG ("plugin_data_new return");
+}
+
+// Documentbase retrieval.  This function gets the current document's
+// documentbase.  This function relies on browser-private data so it
+// will only work when the plugin is loaded in a Mozilla-based
+// browser.  We could not find a way to retrieve the documentbase
+// using the original Netscape plugin API so we use the XPCOM API
+// instead.
+static gchar*
+plugin_get_documentbase (NPP instance)
+{
+  PLUGIN_DEBUG ("plugin_get_documentbase");
+
+  nsIPluginInstance* xpcom_instance = NULL;
+  nsIPluginInstancePeer* peer = NULL;
+  nsresult result = 0;
+  nsIPluginTagInfo2* pluginTagInfo2 = NULL;
+  info_union u = { NULL };
+  char const* documentbase = NULL;
+  gchar* documentbase_copy = NULL;
+
+  xpcom_instance = (nsIPluginInstance*) (instance->ndata);
+  if (!xpcom_instance)
+    {
+      PLUGIN_ERROR ("xpcom_instance is NULL.");
+      goto cleanup_done;
+    }
+
+  xpcom_instance->GetPeer (&peer);
+  if (!peer)
+    {
+      PLUGIN_ERROR ("peer is NULL.");
+      goto cleanup_done;
+    }
+
+  u.info_field = &pluginTagInfo2;
+
+  result = peer->QueryInterface (kIPluginTagInfo2IID,
+                                 u.void_field);
+  if (result || !pluginTagInfo2)
+    {
+      PLUGIN_ERROR ("pluginTagInfo2 retrieval failed.");
+      goto cleanup_peer;
+    }
+
+  pluginTagInfo2->GetDocumentBase (&documentbase);
+
+  if (!documentbase)
+    {
+      PLUGIN_ERROR ("documentbase is NULL.");
+      goto cleanup_plugintaginfo2;
+    }
+
+  documentbase_copy = g_strdup (documentbase);
+
+  // Release references.
+ cleanup_plugintaginfo2:
+  NS_RELEASE (pluginTagInfo2);
+
+ cleanup_peer:
+  NS_RELEASE (peer);
+
+ cleanup_done:
+  PLUGIN_DEBUG ("plugin_get_documentbase return");
+
+  return documentbase_copy;
+}
+
+// This function shows a error message if the appletviewer has
+// not been installed. It returns true, if the user presses the
+// ok button.
+static bool
+plugin_failed ()
+{
+  GtkWidget* dialog = NULL;
+  GtkWidget* ok_button = NULL;
+
+  dialog = gtk_message_dialog_new (NULL,
+                                   GTK_DIALOG_MODAL,
+                                   GTK_MESSAGE_WARNING,
+                                   GTK_BUTTONS_NONE,
+                                   FAILURE_MESSAGE);
+  ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+                                     GTK_STOCK_OK,
+                                     GTK_RESPONSE_OK);
+  gtk_widget_show_all (dialog);
+  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
+    {
+      gtk_widget_destroy (dialog);
+      return true;	  
+    }
+  return false;
+}
+
+// plugin_user_trusts_documentbase returns true if the given
+// documentbase is in the documentbase whitelist.  Otherwise it asks
+// the user if he trusts the given documentbase by calling
+// plugin_ask_user_about_documentbase.
+static bool
+plugin_user_trusts_documentbase (char* documentbase)
+{
+  bool applet_in_whitelist = false;
+
+  // Check if documentbase is in whitelist.
+  while (true)
+    {
+      gchar* whitelist_entry = NULL;
+      gchar* newline_documentbase = NULL;
+
+      // If reading fails, break out of this loop with
+      // applet_in_whitelist still set to false.
+      if (g_io_channel_read_line (whitelist_file, &whitelist_entry,
+                                  NULL, NULL, &channel_error)
+          != G_IO_STATUS_NORMAL)
+        {
+          if (channel_error)
+            {
+              PLUGIN_ERROR_TWO ("Failed to read line from whitelist file",
+                                channel_error->message);
+              g_error_free (channel_error);
+              channel_error = NULL;
+            }
+          else
+            PLUGIN_ERROR ("Failed to read line from whitelist file.");
+          g_free (whitelist_entry);
+          whitelist_entry = NULL;
+          break;
+        }
+
+      newline_documentbase = g_strdup_printf ("%s\n", documentbase);
+      if (!strcmp (newline_documentbase, whitelist_entry))
+        {
+          applet_in_whitelist = true;
+          g_free (newline_documentbase);
+          newline_documentbase = NULL;
+          g_free (whitelist_entry);
+          whitelist_entry = NULL;
+          break;
+        }
+      g_free (whitelist_entry);
+      whitelist_entry = NULL;
+      g_free (newline_documentbase);
+      newline_documentbase = NULL;
+    }
+
+  return applet_in_whitelist ? true
+    : plugin_ask_user_about_documentbase (documentbase);
+}
+
+// plugin_add_documentbase_to_whitelist adds the given documentbase to
+// the user's documentbase whitelist.
+static void
+plugin_add_documentbase_to_whitelist (char* documentbase)
+{
+  gsize bytes_written = 0;
+  char* newline_documentbase = NULL;
+  GIOStatus status = G_IO_STATUS_NORMAL;
+
+  newline_documentbase = g_strdup_printf ("%s\n", documentbase);
+  status = g_io_channel_write_chars (whitelist_file,
+                                     newline_documentbase, -1, &bytes_written,
+                                     &channel_error);
+  g_free (newline_documentbase);
+  newline_documentbase = NULL;
+
+  if (status != G_IO_STATUS_NORMAL)
+    {
+      if (channel_error)
+        {
+          PLUGIN_ERROR_TWO ("Error writing to whitelist file",
+                            channel_error->message);
+          g_error_free (channel_error);
+          channel_error = NULL;
+        }
+      else
+        PLUGIN_ERROR ("Error writing to whitelist file.");
+    }
+
+  if (g_io_channel_flush (whitelist_file, &channel_error)
+      != G_IO_STATUS_NORMAL)
+    {
+      if (channel_error)
+        {
+          PLUGIN_ERROR_TWO ("Failed to write whitelist file",
+                            channel_error->message);
+          g_error_free (channel_error);
+          channel_error = NULL;
+        }
+      else
+        PLUGIN_ERROR ("Failed to write whitelist file.");
+    }
+
+  if (g_io_channel_shutdown (whitelist_file, TRUE, &channel_error)
+      != G_IO_STATUS_NORMAL)
+    {
+      if (channel_error)
+        {
+          PLUGIN_ERROR_TWO ("Failed to close whitelist file",
+                            channel_error->message);
+          g_error_free (channel_error);
+          channel_error = NULL;
+        }
+      else
+        PLUGIN_ERROR ("Failed to close whitelist file.");
+    }
+}
+
+// plugin_ask_user_about_documentbase puts up a dialog box that asks if the
+// user trusts applets from this documentbase.  The user has three
+// options: "Cancel", "Trust Applet" and "Trust Applet and Add to
+// Whitelist".  If the user selects Cancel (the default) then a
+// generic error code is returned from GCJ_New, telling the browser
+// that the applet failed to load.  If the user selects "Trust Applet"
+// then plugin loading proceeds.  If the user selects "Trust Applet
+// and Add to Whitelist" then this documentbase is added to the user's
+// applet whitelist and plugin loading proceeds.
+static bool
+plugin_ask_user_about_documentbase (char* documentbase)
+{
+  GtkWidget* dialog = NULL;
+  GtkWidget* ok_button = NULL;
+  GtkWidget* cancel_button = NULL;
+  GtkWidget* whitelist_button = NULL;
+  gint dialog_response = GTK_RESPONSE_NONE;
+
+  dialog = gtk_message_dialog_new (NULL,
+                                   GTK_DIALOG_MODAL,
+                                   GTK_MESSAGE_WARNING,
+                                   GTK_BUTTONS_NONE,
+                                   SECURITY_WARNING,
+                                   documentbase);
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                            SECURITY_DESCRIPTION, whitelist_filename);
+
+  cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+                                         GTK_STOCK_CANCEL,
+                                         GTK_RESPONSE_CANCEL);
+  ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+                                     RESPONSE_TRUST_APPLET,
+                                     GTK_RESPONSE_OK);
+  whitelist_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+                                            RESPONSE_TRUST_APPLET_ADD_TO_LIST,
+                                            GTK_RESPONSE_APPLY);
+  gtk_widget_grab_focus (cancel_button);
+
+  gtk_widget_show_all (dialog);
+  dialog_response = gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+  if (dialog_response == GTK_RESPONSE_CANCEL)
+    {
+      // The user does not trust this documentbase.
+      return false;
+    }
+  else if (dialog_response == GTK_RESPONSE_APPLY)
+    {
+      // The user wants this documentbase added to his documentbase
+      // whitelist.
+      plugin_add_documentbase_to_whitelist (documentbase);
+    }
+  // The user trusts this documentbase.
+  return true;
+}
+
+// plugin_in_pipe_callback is called when data is available on the
+// input pipe, or when the appletviewer crashes or is killed.  It may
+// be called after data has been destroyed in which case it simply
+// returns FALSE to remove itself from the glib main loop.
+static gboolean
+plugin_in_pipe_callback (GIOChannel* source,
+                         GIOCondition condition,
+                         gpointer plugin_data)
+{
+  PLUGIN_DEBUG ("plugin_in_pipe_callback");
+
+  GCJPluginData* data = (GCJPluginData*) plugin_data;
+  gboolean keep_installed = TRUE;
+
+  // If data is NULL then GCJ_Destroy has already been called and
+  // plugin_in_pipe_callback is being called after plugin
+  // destruction.  In that case all we need to do is return FALSE so
+  // that the plugin_in_pipe_callback watch is removed.
+  if (data)
+    {
+      // Critical region. Set or clear data->appletviewer_alive.
+      g_mutex_lock (data->appletviewer_mutex);
+
+      if (condition & G_IO_IN)
+        {
+          gchar* message = NULL;
+
+          if (g_io_channel_read_line (data->in_from_appletviewer,
+                                      &message, NULL, NULL,
+                                      &channel_error)
+              != G_IO_STATUS_NORMAL)
+            {
+              if (channel_error)
+                {
+                  PLUGIN_ERROR_TWO ("Failed to read line from input channel",
+                                    channel_error->message);
+                  g_error_free (channel_error);
+                  channel_error = NULL;
+                }
+              else
+                PLUGIN_ERROR ("Failed to read line from input channel");
+            }
+          else
+            {
+              if (g_str_has_prefix (message, "url "))
+                {
+                  gchar** parts = g_strsplit (message, " ", 3);
+                  PLUGIN_DEBUG_TWO ("plugin_in_pipe_callback:"
+                                    " opening URL", parts[1]);
+                  PLUGIN_DEBUG_TWO ("plugin_in_pipe_callback:"
+                                    " URL target", parts[2]);
+                  // Open the URL in a new browser window.
+                  NPError np_error =
+                    (*browserFunctions.geturl) (data->owner, parts[1], parts[2]);
+                  if (np_error != NPERR_NO_ERROR)
+                    PLUGIN_ERROR ("Failed to load URL.");
+                  g_strfreev (parts);
+                  parts = NULL;
+                }
+              else if (g_str_has_prefix (message, "status "))
+                {
+                  gchar** parts = g_strsplit (message, " ", 2);
+
+                  PLUGIN_DEBUG_TWO ("plugin_in_pipe_callback:"
+                                    " setting status", parts[1]);
+                  (*browserFunctions.status) (data->owner, parts[1]);
+                  g_strfreev (parts);
+                  parts = NULL;
+                }
+              g_print ("  PIPE: plugin read %s\n", message);
+            }
+
+          g_free (message);
+          message = NULL;
+
+          keep_installed = TRUE;
+        }
+
+      if (condition & (G_IO_ERR | G_IO_HUP))
+        {
+          PLUGIN_DEBUG ("appletviewer has stopped.");
+          data->appletviewer_alive = FALSE;
+          keep_installed = FALSE;
+        }
+      g_mutex_unlock (data->appletviewer_mutex);
+    }
+
+  PLUGIN_DEBUG ("plugin_in_pipe_callback return");
+
+  return keep_installed;
+}
+
+// plugin_out_pipe_callback is called when the appletviewer crashes or
+// is killed.  It may be called after data has been destroyed in which
+// case it simply returns FALSE to remove itself from the glib main
+// loop.
+static gboolean
+plugin_out_pipe_callback (GIOChannel* source,
+                          GIOCondition condition,
+                          gpointer plugin_data)
+{
+  PLUGIN_DEBUG ("plugin_out_pipe_callback");
+
+  GCJPluginData* data = (GCJPluginData*) plugin_data;
+
+  // If data is NULL then GCJ_Destroy has already been called and
+  // plugin_out_pipe_callback is being called after plugin
+  // destruction.  In that case all we need to do is return FALSE so
+  // that the plugin_out_pipe_callback watch is removed.
+  if (data)
+    {
+      // Critical region.  Clear data->appletviewer_alive.
+      g_mutex_lock (data->appletviewer_mutex);
+
+      PLUGIN_DEBUG ("plugin_out_pipe_callback: appletviewer has stopped.");
+      data->appletviewer_alive = FALSE;
+
+      g_mutex_unlock (data->appletviewer_mutex);
+    }
+
+  PLUGIN_DEBUG ("plugin_out_pipe_callback return");
+
+  return FALSE;
+}
+
+static NPError
+plugin_start_appletviewer (GCJPluginData* data)
+{
+  PLUGIN_DEBUG ("plugin_start_appletviewer");
+  NPError error = NPERR_NO_ERROR;
+  
+  if (!data->appletviewer_alive)
+    {
+      gchar* command_line[3] = { NULL, NULL, NULL };
+
+      command_line[0] = g_strdup (APPLETVIEWER_EXECUTABLE);
+      // Output from plugin's perspective is appletviewer's input.
+      // Input from plugin's perspective is appletviewer's output.
+      command_line[1] = g_strdup_printf ("--plugin=%s,%s",
+                                         data->out_pipe_name,
+                                         data->in_pipe_name);
+      command_line[2] = NULL;
+
+      if (!g_spawn_async (NULL, command_line, NULL, (GSpawnFlags) 0,
+                          NULL, NULL, NULL, &channel_error))
+        {
+          if (channel_error)
+            {
+              PLUGIN_ERROR_TWO ("Failed to spawn applet viewer",
+                                channel_error->message);
+              g_error_free (channel_error);
+              channel_error = NULL;
+            }
+          else
+            PLUGIN_ERROR ("Failed to spawn applet viewer");
+          error = NPERR_GENERIC_ERROR;
+          goto cleanup;
+        }
+
+    cleanup:
+      g_free (command_line[0]);
+      command_line[0] = NULL;
+      g_free (command_line[1]);
+      command_line[1] = NULL;
+      g_free (command_line[2]);
+      command_line[2] = NULL;
+    }
+
+  PLUGIN_DEBUG ("plugin_start_appletviewer return");
+  return error;
+}
+
+// Build up the applet tag string that we'll send to the applet
+// viewer.
+static gchar*
+plugin_create_applet_tag (int16 argc, char* argn[], char* argv[])
+{
+  PLUGIN_DEBUG ("plugin_create_applet_tag");
+
+  gchar* applet_tag = g_strdup ("<EMBED ");
+  gchar* parameters = g_strdup ("");
+
+  for (int16 i = 0; i < argc; i++)
+    {
+      if (!g_ascii_strcasecmp (argn[i], "code"))
+        {
+          gchar* code = g_strdup_printf ("CODE=\"%s\" ", argv[i]);
+	  applet_tag = g_strconcat (applet_tag, code, NULL);
+          g_free (code);
+          code = NULL;
+	}
+      else if (!g_ascii_strcasecmp (argn[i], "codebase"))
+	{
+          gchar* codebase = g_strdup_printf ("CODEBASE=\"%s\" ", argv[i]);
+	  applet_tag = g_strconcat (applet_tag, codebase, NULL);
+          g_free (codebase);
+          codebase = NULL;
+	}
+      else if (!g_ascii_strcasecmp (argn[i], "archive"))
+	{
+          gchar* archive = g_strdup_printf ("ARCHIVE=\"%s\" ", argv[i]);
+	  applet_tag = g_strconcat (applet_tag, archive, NULL);
+          g_free (archive);
+          archive = NULL;
+	}
+      else if (!g_ascii_strcasecmp (argn[i], "width"))
+	{
+          gchar* width = g_strdup_printf ("WIDTH=\"%s\" ", argv[i]);
+	  applet_tag = g_strconcat (applet_tag, width, NULL);
+          g_free (width);
+          width = NULL;
+	}
+      else if (!g_ascii_strcasecmp (argn[i], "height"))
+	{
+          gchar* height = g_strdup_printf ("HEIGHT=\"%s\" ", argv[i]);
+	  applet_tag = g_strconcat (applet_tag, height, NULL);
+          g_free (height);
+          height = NULL;
+	}
+      else
+        {
+          // Escape the parameter value so that line termination
+          // characters will pass through the pipe.
+          if (argv[i] != '\0')
+            {
+              gchar* escaped = NULL;
+
+              escaped = g_strescape (argv[i], NULL);
+              parameters = g_strconcat (parameters, "<PARAM NAME=\"", argn[i],
+                                        "\" VALUE=\"", escaped, "\">", NULL);
+
+              g_free (escaped);
+              escaped = NULL;
+            }
+        }
+    }
+
+  applet_tag = g_strconcat (applet_tag, ">", parameters, "</EMBED>", NULL);
+
+  g_free (parameters);
+  parameters = NULL;
+
+  PLUGIN_DEBUG ("plugin_create_applet_tag return");
+
+  return applet_tag;
+}
+
+// plugin_send_message_to_appletviewer must be called while holding
+// data->appletviewer_mutex.
+static void
+plugin_send_message_to_appletviewer (GCJPluginData* data, gchar const* message)
+{
+  PLUGIN_DEBUG ("plugin_send_message_to_appletviewer");
+
+  if (data->appletviewer_alive)
+    {
+      gchar* newline_message = NULL;
+      gsize bytes_written = 0;
+
+      // Send message to appletviewer.
+      newline_message = g_strdup_printf ("%s\n", message);
+
+      // g_io_channel_write_chars will return something other than
+      // G_IO_STATUS_NORMAL if not all the data is written.  In that
+      // case we fail rather than retrying.
+      if (g_io_channel_write_chars (data->out_to_appletviewer,
+                                    newline_message, -1, &bytes_written,
+                                    &channel_error)
+            != G_IO_STATUS_NORMAL)
+        {
+          if (channel_error)
+            {
+              PLUGIN_ERROR_TWO ("Failed to write bytes to output channel",
+                                channel_error->message);
+              g_error_free (channel_error);
+              channel_error = NULL;
+            }
+          else
+            PLUGIN_ERROR ("Failed to write bytes to output channel");
+        }            
+
+      if (g_io_channel_flush (data->out_to_appletviewer, &channel_error)
+          != G_IO_STATUS_NORMAL)
+        {
+          if (channel_error)
+            {
+              PLUGIN_ERROR_TWO ("Failed to flush bytes to output channel",
+                                channel_error->message);
+              g_error_free (channel_error);
+              channel_error = NULL;
+            }
+          else
+            PLUGIN_ERROR ("Failed to flush bytes to output channel");
+        }
+      g_free (newline_message);
+      newline_message = NULL;
+
+      g_print ("  PIPE: plugin wrote %s\n", message);
+    }
+
+  PLUGIN_DEBUG ("plugin_send_message_to_appletviewer return");
+}
+
+// Stop the appletviewer process.  When this is called the
+// appletviewer can be in any of three states: running, crashed or
+// hung.  If the appletviewer is running then sending it "shutdown"
+// will cause it to exit.  This will cause
+// plugin_out_pipe_callback/plugin_in_pipe_callback to be called and
+// the input and output channels to be shut down.  If the appletviewer
+// has crashed then plugin_out_pipe_callback/plugin_in_pipe_callback
+// would already have been called and data->appletviewer_alive cleared
+// in which case this function simply returns.  If the appletviewer is
+// hung then this function will be successful and the input and output
+// watches will be removed by plugin_data_destroy.
+// plugin_stop_appletviewer must be called with
+// data->appletviewer_mutex held.
+static void
+plugin_stop_appletviewer (GCJPluginData* data)
+{
+  PLUGIN_DEBUG ("plugin_stop_appletviewer");
+
+  if (data->appletviewer_alive)
+    {
+      // Shut down the appletviewer.
+      gsize bytes_written = 0;
+
+      if (data->out_to_appletviewer)
+        {
+          if (g_io_channel_write_chars (data->out_to_appletviewer, "shutdown",
+                                        -1, &bytes_written, &channel_error)
+              != G_IO_STATUS_NORMAL)
+            {
+              if (channel_error)
+                {
+                  PLUGIN_ERROR_TWO ("Failed to write shutdown message to"
+                                    " appletviewer", channel_error->message);
+                  g_error_free (channel_error);
+                  channel_error = NULL;
+                }
+              else
+                PLUGIN_ERROR ("Failed to write shutdown message to");
+            }
+
+          if (g_io_channel_flush (data->out_to_appletviewer, &channel_error)
+              != G_IO_STATUS_NORMAL)
+            {
+              if (channel_error)
+                {
+                  PLUGIN_ERROR_TWO ("Failed to write shutdown message to"
+                                    " appletviewer", channel_error->message);
+                  g_error_free (channel_error);
+                  channel_error = NULL;
+                }
+              else
+                PLUGIN_ERROR ("Failed to write shutdown message to");
+            }
+
+          if (g_io_channel_shutdown (data->out_to_appletviewer,
+                                     TRUE, &channel_error)
+              != G_IO_STATUS_NORMAL)
+            {
+              if (channel_error)
+                {
+                  PLUGIN_ERROR_TWO ("Failed to shut down appletviewer"
+                                    " output channel", channel_error->message);
+                  g_error_free (channel_error);
+                  channel_error = NULL;
+                }
+              else
+                PLUGIN_ERROR ("Failed to shut down appletviewer");
+            }
+        }
+
+      if (data->in_from_appletviewer)
+        {
+          if (g_io_channel_shutdown (data->in_from_appletviewer,
+                                     TRUE, &channel_error)
+              != G_IO_STATUS_NORMAL)
+            {
+              if (channel_error)
+                {
+                  PLUGIN_ERROR_TWO ("Failed to shut down appletviewer"
+                                    " input channel", channel_error->message);
+                  g_error_free (channel_error);
+                  channel_error = NULL;
+                }
+              else
+                PLUGIN_ERROR ("Failed to shut down appletviewer");
+            }
+        }
+    }
+
+  PLUGIN_DEBUG ("plugin_stop_appletviewer return");
+}
+
+static void
+plugin_data_destroy (GCJPluginData** data)
+{
+  PLUGIN_DEBUG ("plugin_data_destroy");
+
+  GCJPluginData* tofree = *data;
+
+  tofree->window_handle = NULL;
+  tofree->window_height = 0;
+  tofree->window_width = 0;
+
+  // Copied from GCJ_New.
+
+  // cleanup_in_watch_source:
+  // Removing a source is harmless if it fails since it just means the
+  // source has already been removed.
+  g_source_remove (tofree->in_watch_source);
+  tofree->in_watch_source = 0;
+
+  // cleanup_in_from_appletviewer:
+  if (tofree->in_from_appletviewer)
+    g_io_channel_unref (tofree->in_from_appletviewer);
+  tofree->in_from_appletviewer = NULL;
+
+  // cleanup_out_watch_source:
+  g_source_remove (tofree->out_watch_source);
+  tofree->out_watch_source = 0;
+
+  // cleanup_out_to_appletviewer:
+  if (tofree->out_to_appletviewer)
+    g_io_channel_unref (tofree->out_to_appletviewer);
+  tofree->out_to_appletviewer = NULL;
+
+  // cleanup_out_pipe:
+  // Delete output pipe.
+  unlink (tofree->out_pipe_name);
+
+  // cleanup_out_pipe_name:
+  g_free (tofree->out_pipe_name);
+  tofree->out_pipe_name = NULL;
+
+  // cleanup_in_pipe:
+  // Delete input pipe.
+  unlink (tofree->in_pipe_name);
+
+  // cleanup_in_pipe_name:
+  g_free (tofree->in_pipe_name);
+  tofree->in_pipe_name = NULL;
+
+  // cleanup_appletviewer_mutex:
+  g_free (tofree->appletviewer_mutex);
+  tofree->appletviewer_mutex = NULL;
+
+  // cleanup_instance_string:
+  g_free (tofree->instance_string);
+  tofree->instance_string = NULL;
+
+  // cleanup_data:
+  // Eliminate back-pointer to plugin instance.
+  tofree->owner = NULL;
+  (*browserFunctions.memfree) (tofree);
+  tofree = NULL;
+
+  PLUGIN_DEBUG ("plugin_data_destroy return");
+}
+
+// FACTORY FUNCTIONS
+
+// Provides the browser with pointers to the plugin functions that we
+// implement and initializes a local table with browser functions that
+// we may wish to call.  Called once, after browser startup and before
+// the first plugin instance is created.
+// The field 'initialized' is set to true once this function has
+// finished. If 'initialized' is already true at the beginning of
+// this function, then it is evident that NP_Initialize has already
+// been called. There is no need to call this function more than once and
+// this workaround avoids any duplicate calls.
+NPError
+NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable)
+{
+  PLUGIN_DEBUG ("NP_Initialize");
+  
+  if (initialized)
+    return NPERR_NO_ERROR;
+  else if ((browserTable == NULL) || (pluginTable == NULL))
+    {
+      PLUGIN_ERROR ("Browser or plugin function table is NULL.");
+
+      return NPERR_INVALID_FUNCTABLE_ERROR;
+    }
+  
+  // Ensure that the major version of the plugin API that the browser
+  // expects is not more recent than the major version of the API that
+  // we've implemented.
+  if ((browserTable->version >> 8) > NP_VERSION_MAJOR)
+    {
+      PLUGIN_ERROR ("Incompatible version.");
+
+      return NPERR_INCOMPATIBLE_VERSION_ERROR;
+    }
+
+  // Ensure that the plugin function table we've received is large
+  // enough to store the number of functions that we may provide.
+  if (pluginTable->size < sizeof (NPPluginFuncs))      
+    {
+      PLUGIN_ERROR ("Invalid plugin function table.");
+
+      return NPERR_INVALID_FUNCTABLE_ERROR;
+    }
+
+  // Ensure that the browser function table is large enough to store
+  // the number of browser functions that we may use.
+  if (browserTable->size < sizeof (NPNetscapeFuncs))
+    {
+      PLUGIN_ERROR ("Invalid browser function table.");
+
+      return NPERR_INVALID_FUNCTABLE_ERROR;
+    }
+
+  data_directory = g_strconcat(getenv("HOME"), "/.gcjwebplugin", NULL);
+  whitelist_filename = g_strconcat (data_directory, "/whitelist.txt", NULL);
+  // Make sure the plugin data directory exists, creating it if
+  // necessary.
+  if (!g_file_test (data_directory,
+                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+    {
+      int file_error = 0;
+
+      file_error = g_mkdir (data_directory, 0700);
+      if (file_error != 0)
+        {
+          PLUGIN_ERROR_THREE ("Failed to create data directory",
+                              data_directory,
+                              strerror (errno));
+          return NPERR_GENERIC_ERROR;
+        }
+    }
+
+  // Store in a local table the browser functions that we may use.
+  browserFunctions.version = browserTable->version;
+  browserFunctions.size = browserTable->size;
+  browserFunctions.posturl = browserTable->posturl;
+  browserFunctions.geturl = browserTable->geturl;
+  browserFunctions.geturlnotify = browserTable->geturlnotify;
+  browserFunctions.requestread = browserTable->requestread;
+  browserFunctions.newstream = browserTable->newstream;
+  browserFunctions.write = browserTable->write;
+  browserFunctions.destroystream = browserTable->destroystream;
+  browserFunctions.status = browserTable->status;
+  browserFunctions.uagent = browserTable->uagent;
+  browserFunctions.memalloc = browserTable->memalloc;
+  browserFunctions.memfree = browserTable->memfree;
+  browserFunctions.memflush = browserTable->memflush;
+  browserFunctions.reloadplugins = browserTable->reloadplugins;
+  browserFunctions.getvalue = browserTable->getvalue;
+
+  // Return to the browser the plugin functions that we implement.
+  pluginTable->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
+  pluginTable->size = sizeof (NPPluginFuncs);
+  pluginTable->newp = NewNPP_NewProc (GCJ_New);
+  pluginTable->destroy = NewNPP_DestroyProc (GCJ_Destroy);
+  pluginTable->setwindow = NewNPP_SetWindowProc (GCJ_SetWindow);
+  pluginTable->newstream = NewNPP_NewStreamProc (GCJ_NewStream);
+  pluginTable->destroystream = NewNPP_DestroyStreamProc (GCJ_DestroyStream);
+  pluginTable->asfile = NewNPP_StreamAsFileProc (GCJ_StreamAsFile);
+  pluginTable->writeready = NewNPP_WriteReadyProc (GCJ_WriteReady);
+  pluginTable->write = NewNPP_WriteProc (GCJ_Write);
+  pluginTable->print = NewNPP_PrintProc (GCJ_Print);
+  pluginTable->urlnotify = NewNPP_URLNotifyProc (GCJ_URLNotify);
+  pluginTable->getvalue = NewNPP_GetValueProc (GCJ_GetValue);
+  
+  initialized = true;
+  plugin_instance_mutex = g_mutex_new ();
+
+  PLUGIN_DEBUG ("NP_Initialize: using " APPLETVIEWER_EXECUTABLE ".");
+
+  PLUGIN_DEBUG ("NP_Initialize return");
+
+  return NPERR_NO_ERROR;
+}
+
+// Returns a string describing the MIME type that this plugin
+// handles.
+char*
+NP_GetMIMEDescription (void)
+{
+  PLUGIN_DEBUG ("NP_GetMIMEDescription");
+
+  PLUGIN_DEBUG ("NP_GetMIMEDescription return");
+
+  return (char*) PLUGIN_MIME_DESC;
+}
+
+// Returns a value relevant to the plugin as a whole.  The browser
+// calls this function to obtain information about the plugin.
+NPError
+NP_GetValue (void* future, NPPVariable variable, void* value)
+{
+  PLUGIN_DEBUG ("NP_GetValue");
+
+  NPError result = NPERR_NO_ERROR;
+  gchar** char_value = (gchar**) value;
+
+  switch (variable)
+    {
+    case NPPVpluginNameString:
+      PLUGIN_DEBUG ("NP_GetValue: returning plugin name.");
+      *char_value = g_strdup (PLUGIN_NAME " " PACKAGE_VERSION);
+      break;
+
+    case NPPVpluginDescriptionString:
+      PLUGIN_DEBUG ("NP_GetValue: returning plugin description.");
+      *char_value = g_strdup (PLUGIN_DESC);
+      break;
+
+    default:
+      PLUGIN_ERROR ("Unknown plugin value requested.");
+      result = NPERR_GENERIC_ERROR;
+      break;
+    }
+
+  PLUGIN_DEBUG ("NP_GetValue return");
+
+  return result;
+}
+
+// Shuts down the plugin.  Called after the last plugin instance is
+// destroyed.
+NPError
+NP_Shutdown (void)
+{
+  PLUGIN_DEBUG ("NP_Shutdown");
+
+  // Free mutex.
+  if (plugin_instance_mutex)
+    {
+      g_mutex_free (plugin_instance_mutex);
+      plugin_instance_mutex = NULL;
+    }
+
+  if (whitelist_file)
+    {
+      g_io_channel_close (whitelist_file);
+      whitelist_file = NULL;
+    }
+    
+  if (data_directory)
+    {
+      g_free (data_directory);
+      data_directory = NULL;
+    }
+    
+  if (whitelist_filename)
+    {
+      g_free (whitelist_filename);
+      whitelist_filename = NULL;
+    }
+  
+  initialized = false;
+  
+  PLUGIN_DEBUG ("NP_Shutdown return");
+
+  return NPERR_NO_ERROR;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/native/target/Linux/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/native/target/Linux/Makefile.am?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/native/target/Linux/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/native/target/Linux/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,10 @@
+## Input file for automake to generate the Makefile.in used by configure
+
+EXTRA_DIST = \
+target_native_io.h \
+target_native_misc.h \
+target_native.h \
+target_native_math_float.h \
+target_native_network.h \
+target_native_file.h \
+target_native_math_int.h





More information about the llvm-commits mailing list