[llvm-commits] [llvm-gcc-4.2] r43913 [15/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/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/configure.ac?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/configure.ac (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/configure.ac Thu Nov  8 16:56:19 2007
@@ -0,0 +1,872 @@
+dnl Process this file with autoconf to produce a configure script.
+
+dnl -----------------------------------------------------------
+dnl Turning off cache for debug reasons
+dnl -----------------------------------------------------------
+dnl define([AC_CACHE_LOAD], )dnl
+dnl define([AC_CACHE_SAVE], )dnl
+
+AC_INIT([GNU Classpath],[0.92],[classpath at gnu.org],[classpath])
+AC_CONFIG_SRCDIR(java/lang/System.java)
+
+AC_CANONICAL_TARGET
+
+# Find the rest of the source tree framework.
+AM_ENABLE_MULTILIB(, ../..)
+
+dnl -----------------------------------------------------------
+dnl Fold all IA-32 CPU architectures into "x86"
+dnl -----------------------------------------------------------
+if expr ${target_cpu} : '.*86' > /dev/null; then target_cpu=x86; fi
+
+dnl -----------------------------------------------------------
+dnl We will not track/change lib version until we reach version 1.0
+dnl at which time we'll have to be more anal about such things
+dnl -----------------------------------------------------------
+AC_SUBST(LIBVERSION, "0:0:0")
+case "$host_os" in
+     darwin*)
+	cp_module=""
+	;;
+	*)
+	cp_module="-module"
+	;;
+esac
+
+CLASSPATH_MODULE="${cp_module} -version-info ${LIBVERSION} -no-undefined"
+AC_SUBST(CLASSPATH_MODULE)
+
+CLASSPATH_CONVENIENCE="-no-undefined"
+AC_SUBST(CLASSPATH_CONVENIENCE)
+
+AC_PREREQ(2.59)
+AM_INIT_AUTOMAKE([1.9.0 gnu std-options tar-ustar])
+AC_CONFIG_HEADERS([include/config.h])
+AC_PREFIX_DEFAULT(/usr/local/classpath)
+
+dnl -----------------------------------------------------------
+dnl Enable collections.jar (disabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([collections],
+              [AS_HELP_STRING(--enable-collections,create collections.jar [default=no])],
+              [case x"${enableval}" in
+                xyes) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"gnu/java/util/collections\"" ;;
+                xno) COMPILE_COLLECTIONS=no ;;
+		x) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"gnu/java/util/collections\"" ;;
+                *) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"${enableval}\"" ;;
+              esac],
+              [COMPILE_COLLECTIONS=no])
+AM_CONDITIONAL(CREATE_COLLECTIONS, test "x${COMPILE_COLLECTIONS}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl Enable JNI libraries (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([jni],
+              [AS_HELP_STRING(--enable-jni,compile JNI source [default=yes])],
+              [case "${enableval}" in 
+                yes) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
+                no) COMPILE_JNI=no ;;
+                *) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
+              esac],
+              [COMPILE_JNI=yes])
+AM_CONDITIONAL(CREATE_JNI_LIBRARIES, test "x${COMPILE_JNI}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl Enable core JNI libraries (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([core-jni],
+              [AS_HELP_STRING(--enable-core-jni,
+	                      compile JNI sources for core [default=yes])],
+              [case "${enableval}" in 
+                yes) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
+                no) COMPILE_CORE_JNI=no ;;
+                *) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
+              esac],
+              [COMPILE_CORE_JNI=yes])
+AM_CONDITIONAL(CREATE_CORE_JNI_LIBRARIES, test "x${COMPILE_CORE_JNI}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl Default Preference Backend
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE(default-preferences-peer,
+  AS_HELP_STRING([--enable-default-preferences-peer],
+                 [fully qualified class name of default Preferences API Backend]))
+DEFAULT_PREFS_PEER=$enable_default_preferences_peer
+if test "$DEFAULT_PREFS_PEER" = ""; then
+   DEFAULT_PREFS_PEER=gnu.java.util.prefs.FileBasedFactory
+fi
+dnl AC_SUBST(DEFAULT_PREFS_PEER)
+
+dnl -----------------------------------------------------------
+dnl GConf native peer (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([gconf-peer],
+              [AS_HELP_STRING(--disable-gconf-peer,compile GConf native peers (disabled by --disable-jni) [default=yes])],
+              [case "${enableval}" in
+                yes) COMPILE_GCONF_PEER=yes ;;
+                no) COMPILE_GCONF_PEER=no ;;
+                *) COMPILE_GCONF_PEER=yes ;;
+              esac],
+              [COMPILE_GCONF_PEER=yes])
+AM_CONDITIONAL(CREATE_GCONF_PEER_LIBRARIES, test "x${COMPILE_GCONF_PEER}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl GTK native peer error checking
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([gconf-peers],,AC_MSG_ERROR([No --enable-gconf-peers (or --disable-gconf-peers) option; you want --enable-gconf-peer]))
+
+dnl ------------------------------------------------------------
+dnl Whether to compile with -Werror or not (disabled by default)
+dnl ------------------------------------------------------------
+AC_ARG_ENABLE([Werror],
+              [AS_HELP_STRING(--enable-Werror,whether to compile C code with -Werror which turns any compiler warning into a compilation failure [default=no])],
+              [case "${enableval}" in
+                yes) ENABLE_WERROR=yes ;;
+                no) ENABLE_WERROR=no ;;
+                *) ENABLE_WERROR=no ;;
+              esac],
+              [ENABLE_WERROR=no])
+
+dnl -----------------------------------------------------------
+dnl Default AWT toolkit
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE(default-toolkit,
+  AS_HELP_STRING([--enable-default-toolkit],
+                 [fully qualified class name of default AWT toolkit]))
+default_toolkit=$enable_default_toolkit
+if test "$default_toolkit" = ""; then
+   default_toolkit=gnu.java.awt.peer.gtk.GtkToolkit
+fi
+AC_SUBST(default_toolkit)
+
+dnl -----------------------------------------------------------
+dnl Native libxml/xslt library (disabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([xmlj],
+              [AS_HELP_STRING(--enable-xmlj,compile native libxml/xslt library [default=no])],
+              [case "${enableval}" in
+                yes) COMPILE_XMLJ=yes ;;
+                no) COMPILE_XMLJ=no ;;
+                *) COMPILE_XMLJ=no ;;
+              esac],
+              [COMPILE_XMLJ=no])
+AM_CONDITIONAL(CREATE_XMLJ_LIBRARY, test "x${COMPILE_XMLJ}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl ALSA code (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([alsa],
+              [AS_HELP_STRING(--disable-alsa,compile ALSA providers (enable by --enable-alsa) [default=yes])],
+              [case "${enableval}" in
+                yes) COMPILE_ALSA=yes ;;
+                no) COMPILE_ALSA=no ;;
+                *) COMPILE_ALSA=yes ;;
+              esac],
+	      [AC_CHECK_HEADERS([alsa/asoundlib.h],
+				[AC_CHECK_LIB([asound], [snd_seq_open], COMPILE_ALSA=yes,COMPILE_ALSA=no)],
+				COMPILE_ALSA=no)])
+AM_CONDITIONAL(CREATE_ALSA_LIBRARIES, test "x${COMPILE_ALSA}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl DSSI code (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([dssi],
+              [AS_HELP_STRING(--disable-dssi,compile DSSI providers (enable by --enable-dssi) [default=yes])],
+              [case "${enableval}" in
+                yes) COMPILE_DSSI=yes ;;
+                no) COMPILE_DSSI=no ;;
+                *) COMPILE_DSSI=yes ;;
+              esac],
+              [AC_CHECK_HEADERS([dssi.h],COMPILE_DSSI=yes,COMPILE_DSSI=no)])
+AM_CONDITIONAL(CREATE_DSSI_LIBRARIES, test "x${COMPILE_DSSI}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl GTK native peer (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([gtk-peer],
+              [AS_HELP_STRING(--disable-gtk-peer,compile GTK native peers (disabled by --disable-jni) [default=yes])],
+              [case "${enableval}" in
+                yes) COMPILE_GTK_PEER=yes ;;
+                no) COMPILE_GTK_PEER=no ;;
+                *) COMPILE_GTK_PEER=yes ;;
+              esac],
+              [COMPILE_GTK_PEER=yes])
+AM_CONDITIONAL(CREATE_GTK_PEER_LIBRARIES, test "x${COMPILE_GTK_PEER}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl GTK native peer error checking 
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([gtk-peers],,AC_MSG_ERROR([No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer]))
+
+dnl -----------------------------------------------------------
+dnl Qt native peer (disabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([qt-peer],
+              [AS_HELP_STRING(--enable-qt-peer,compile Qt4 native peers (disabled by --disable-jni) [default=no])],
+              [case "${enableval}" in
+                yes) COMPILE_QT_PEER=yes ;;
+                no) COMPILE_QT_PEER=no ;;
+                *) COMPILE_QT_PEER=yes ;;
+              esac],
+              [COMPILE_QT_PEER=no])
+AM_CONDITIONAL(CREATE_QT_PEER_LIBRARIES, test "x${COMPILE_QT_PEER}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl Plugin (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([plugin],
+              [AS_HELP_STRING(--disable-plugin,compile gcjwebplugin (disabled by --disable-plugin) [default=yes])],
+              [case "${enableval}" in
+                yes) COMPILE_PLUGIN=yes ;;
+                no) COMPILE_PLUGIN=no ;;
+                *) COMPILE_PLUGIN=yes ;;
+              esac],
+              [COMPILE_PLUGIN=yes])
+AM_CONDITIONAL(CREATE_PLUGIN, test "x${COMPILE_PLUGIN}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl GCJ LOCAL: Calculates and substitutes toolexeclibdir.  $libdir is
+dnl defined to the same value for all multilibs.  We define toolexeclibdir
+dnl so that we can refer to the multilib installation directories from
+dnl classpath's build files.
+dnl -----------------------------------------------------------
+CLASSPATH_TOOLEXECLIBDIR
+
+dnl -----------------------------------------------------------
+dnl Sets the native libraries installation dir
+dnl -----------------------------------------------------------
+dnl GCJ LOCAL: default to ${toolexeclibdir}/gcj-${gcc_version}
+AC_ARG_WITH([native-libdir],
+	    [AS_HELP_STRING(--with-native-libdir,sets the installation directory for native libraries [default='${libdir}/${PACKAGE}'])],
+	    [
+	     nativeexeclibdir=${withval}
+	    ],
+	    [
+	     nativeexeclibdir='${toolexeclibdir}/gcj-'`cat ${srcdir}/../../gcc/BASE-VER`
+	    ])
+
+AC_SUBST(nativeexeclibdir)
+
+dnl -----------------------------------------------------------
+dnl Sets the Java library installation dir.
+dnl -----------------------------------------------------------
+AC_ARG_WITH([glibj-dir],
+	    [AS_HELP_STRING(--with-glibj-dir,sets the installation directory for glibj.zip [default='${libdir}/${PACKAGE}'])],
+	    [
+	     glibjdir=${withval}
+	    ],
+	    [
+	     glibjdir='${datadir}/${PACKAGE}'
+	    ])
+
+AC_SUBST(glibjdir)
+
+dnl -----------------------------------------------------------
+dnl Sets the VM name for use in tool wrapper scripts
+dnl -----------------------------------------------------------
+AC_ARG_WITH([vm],
+	    [AS_HELP_STRING(--with-vm,sets the VM binary name [default='${prefix}/bin/jamvm'])],
+	    [
+	     VM_BINARY=${withval}
+	    ],
+	    [
+	     VM_BINARY='${prefix}/bin/jamvm'
+	    ])
+
+AC_SUBST(VM_BINARY)
+AM_CONDITIONAL(FOUND_CACAO, test "x`basename $VM_BINARY`" = xcacao)
+
+dnl -----------------------------------------------------------
+dnl Regenerate headers at build time (disabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([regen-headers],
+              [AS_HELP_STRING(--enable-regen-headers,automatically regenerate JNI headers [default=no])],
+              [case "${enableval}" in
+                yes) REGENERATE_JNI_HEADERS=yes ;;
+                no) REGENERATE_JNI_HEADERS=no ;;
+                *) REGENERATE_JNI_HEADERS=no ;;
+              esac],
+              [REGENERATE_JNI_HEADERS=no])
+AM_CONDITIONAL(CREATE_JNI_HEADERS, test "x${REGENERATE_JNI_HEADERS}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl Enable tool wrapper binaries (disabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([tool-wrappers],
+              [AS_HELP_STRING(--enable-tool-wrappers,create tool wrapper binaries [default=no])],
+              [case x"${enableval}" in
+                xyes) COMPILE_WRAPPERS=yes ;;
+                xno) COMPILE_WRAPPERS=no ;;
+		x) COMPILE_WRAPPERS=yes ;;
+                *) COMPILE_WRAPPERS=yes ;;
+              esac],
+              [COMPILE_WRAPPERS=no])
+AM_CONDITIONAL(CREATE_WRAPPERS, test "x${COMPILE_WRAPPERS}" = xyes)
+
+AC_PROG_LN_S
+AC_PROG_INSTALL
+
+dnl -----------------------------------------------------------
+dnl Checks for programs.
+dnl -----------------------------------------------------------
+AC_PROG_CXX
+dnl Initialize libtool
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+dnl AC_PROG_AWK
+AC_PROG_CC
+AC_PROG_CPP
+
+if test "x${COMPILE_COLLECTIONS}" = xyes; then
+  AC_PATH_PROG(PERL, [perl])
+  AC_SUBST(PERL)
+  AC_SUBST(COLLECTIONS_PREFIX)
+  AC_CONFIG_FILES([lib/mkcollections.pl])
+  AC_CONFIG_COMMANDS([mkcollections.pl],[chmod 755 lib/mkcollections.pl])
+fi
+
+if test "x${COMPILE_JNI}" = xyes; then
+  AC_HEADER_STDC
+
+  dnl Checking sizeof void * is needed for fdlibm to work properly on ppc64, 
+  dnl at least. 
+  AC_COMPILE_CHECK_SIZEOF(void *)
+
+  dnl Checking for endianess.
+  AC_C_BIGENDIAN_CROSS
+  
+  dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
+  dnl On that system, sys/ioctl.h will not include sys/filio.h unless
+  dnl BSD_COMP is defined; just including sys/filio.h is simpler.
+  dnl Check for crt_externs.h on Darwin.
+  AC_CHECK_HEADERS([unistd.h sys/types.h sys/config.h sys/ioctl.h \
+		    asm/ioctls.h \
+		    inttypes.h stdint.h utime.h sys/utime.h sys/filio.h \
+		    sys/time.h \
+		    sys/select.h \
+		    crt_externs.h \
+                    fcntl.h \
+		    sys/mman.h \
+		    magic.h])
+
+  AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
+  AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
+  AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
+  AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
+
+  AC_CHECK_FUNCS([ftruncate fsync select \
+		  gethostname socket strerror fork pipe execve open close \
+		  lseek fstat read write htonl memset htons connect \
+		  getsockname getpeername bind listen accept \
+		  recvfrom send sendto setsockopt getsockopt time mktime \
+		  localtime_r \
+		  strerror_r \
+                  fcntl \
+		  mmap munmap mincore msync madvise getpagesize sysconf \
+		  lstat readlink \
+		  ])
+
+  LIBMAGIC=
+  AC_CHECK_LIB(magic, magic_open, LIBMAGIC=-lmagic)
+  AC_SUBST(LIBMAGIC)
+
+  AC_HEADER_TIME
+  AC_STRUCT_TM
+  AC_STRUCT_TIMEZONE
+
+  AC_MSG_CHECKING([for tm_gmtoff in struct tm])
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],[[struct tm tim; tim.tm_gmtoff = 0;]])],
+  [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
+   AC_MSG_RESULT(yes)],
+  [AC_MSG_RESULT(no)
+   AC_MSG_CHECKING([for global timezone variable])
+   dnl FIXME: we don't want a link check here because that won't work
+   dnl when cross-compiling.  So instead we make an assumption that
+   dnl the header file will mention timezone if it exists.
+   dnl Don't find the win32 function timezone
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
+     [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
+      AC_MSG_RESULT(yes)],
+     [AC_MSG_RESULT(no)
+       AC_MSG_CHECKING([for global _timezone variable])
+       dnl FIXME: As above, don't want link check
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
+         [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
+            [Define if your platform has the global _timezone variable.])
+          AC_MSG_RESULT(yes)],
+          [AC_MSG_RESULT(no)])])])
+
+  AC_C_CONST
+  AC_C_ATTRIBUTE
+
+  dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
+  AM_ICONV
+
+  dnl When using gcc we want warnings, lots of warnings :-)
+  if test "x${GCC}" = xyes; then
+    dnl We want ISO C90 pedantic ansi, but with longlong (jlong) support
+    dnl and modern POSIX and BSD C library functions/prototypes.
+
+    dnl Warning flags for (almost) everybody.
+    dnl Should probably be configurable
+    WARNING_CFLAGS='-pedantic -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long'
+    AC_SUBST(WARNING_CFLAGS)
+
+    dnl Strict warning flags which not every module uses.
+    dnl Should probably be configurable.
+    STRICT_WARNING_CFLAGS=-Wstrict-prototypes
+    AC_SUBST(STRICT_WARNING_CFLAGS)
+
+    dnl Whether or not to add -Werror, also not used by all modueles.
+    dnl Can be configured by --disable-Werror
+    ERROR_CFLAGS=
+    if test "x${ENABLE_WERROR}" = xyes; then
+       ERROR_CFLAGS='-Werror'
+    fi
+    AC_SUBST(ERROR_CFLAGS)
+  fi
+
+  dnl Check for libxml and libxslt libraries (when xmlj is enabled).
+  if test "x${COMPILE_XMLJ}" = xyes; then
+    PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.6.8)
+    PKG_CHECK_MODULES(XSLT, libxslt >= 1.1.11)
+    AC_SUBST(XML_LIBS)
+    AC_SUBST(XML_CFLAGS)
+    AC_SUBST(XSLT_LIBS)
+    AC_SUBST(XSLT_CFLAGS)
+  fi
+
+  dnl Check for AWT related gthread/gtk
+  if test "x${COMPILE_GTK_PEER}" = xyes; then
+    AC_PATH_XTRA
+    if test "$no_x" = yes; then
+        AC_MSG_ERROR([GTK+ peers requested but no X library available])
+    fi
+    dnl We explicitly want the XTest Extension for Robot support.
+    AC_CHECK_LIB([Xtst], [XTestQueryExtension],
+    		 [XTEST_LIBS="$XTEST_LIBS -lX11 -lXtst"],
+		 [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
+		 [${X_LIBS}])
+
+    PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
+    PKG_CHECK_MODULES(FREETYPE2, freetype2)
+    PKG_CHECK_MODULES(PANGOFT2, pangoft2)
+    dnl Check if we can link against the XRender library and set
+    dnl HAVE_XRENDER accordingly.
+    AC_CHECK_LIB([Xrender], [XRenderQueryExtension],
+		 [AC_DEFINE(HAVE_XRENDER, 1, [Define to 1 if you have libXrender.])[X_EXTRA_LIBS="$X_EXTRA_LIBS -lXrender"]],
+		 [true],
+		 [${X_LIBS}])
+
+    dnl Check if we can link against the XRandR library and set
+    dnl HAVE_XRANDR accordingly.
+    AC_CHECK_LIB([Xrandr], [XRRQueryExtension],
+                 [AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have libXrandr.])[X_EXTRA_LIBS="$X_EXTRA_LIBS -lXrandr"]],
+                 [true],
+                 [${X_LIBS}])
+
+    AC_SUBST(GTK_CFLAGS)
+    AC_SUBST(GTK_LIBS)
+    AC_SUBST(FREETYPE2_LIBS)
+    AC_SUBST(FREETYPE2_CFLAGS)
+    AC_SUBST(PANGOFT2_LIBS)
+    AC_SUBST(PANGOFT2_CFLAGS)
+    AC_SUBST(XTEST_LIBS)
+  fi
+
+  dnl gconf-peer
+  if  test "x${COMPILE_GCONF_PEER}" = xyes; then
+    PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.11.2)
+    AC_SUBST(GCONF_CFLAGS)
+    AC_SUBST(GCONF_LIBS)
+    dnl we also need gdk for locking
+    PKG_CHECK_MODULES(GDK, gdk-2.0 >= 2.8)
+    AC_SUBST(GDK_CFLAGS)
+    AC_SUBST(GDK_LIBS)
+    dnl check if the config value was given form the command line,
+    dnl if not, overwrite the default if we have the gconf backend
+    dnl compiled in
+    USE_GCONF_PREFS_PEER=$enable_default_preferences_peer
+    if test "$USE_GCONF_PREFS_PEER" = ""; then
+   	DEFAULT_PREFS_PEER=gnu.java.util.prefs.GConfBasedFactory
+    fi
+  fi
+
+  dnl Check for AWT related Qt4
+  if test "x${COMPILE_QT_PEER}" = xyes; then
+    PKG_CHECK_MODULES(QT, QtCore QtGui >= 4.1.0, HAVE_QT4="yes", HAVE_QT4="no")
+    if test "x$HAVE_QT4" = "xyes"; then
+      dnl Check needed because in some cases the QtGui includedir
+      dnl doesn't contain the subsystem dir.
+      QT_INCLUDE_DIR=`$PKG_CONFIG --variable=includedir QtGui`
+      EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
+      AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
+      AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
+      AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
+	QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
+	AC_MSG_WARN([QWidget not found])))
+	AC_CHECK_PROG(MOC, [moc], [moc])
+	AC_CHECK_PROG(MOC, [moc-qt4], [moc-qt4])
+    fi
+    if test "x$HAVE_QT4" = "xno"; then
+      AC_MSG_NOTICE([Looking for QT_CFLAGS and QT_LIBS without pkg-config])
+      case "$host_os" in
+  	darwin*)
+  	  AC_ARG_WITH([qt4dir],
+  	    [AS_HELP_STRING([--with-qt4dir=DIR],
+  	    [Qt4 installation directory used for OS-X.
+  	    For other systems use pkg-config.])],
+  	    [QT4DIR=$withval]
+  	    )
+  	  if test x"$QT4DIR" = x ; then
+  	    AC_MSG_ERROR([*** No path for Qt4 --with-qt4dir option given])
+  	  fi
+  	  AC_MSG_RESULT([QT4DIR... $QT4DIR])
+  	  AC_CHECK_PROG(MOC, [moc], [$QT4DIR/bin/moc], [], $QT4DIR/bin)
+  	  if test x"$MOC" = x; then
+  	    AC_MSG_ERROR([*** This is not the right Qt installation])
+  	  fi
+  	  QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
+  	  QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
+  	  QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
+  	  QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
+  	  ;;
+  	*)
+  	  AC_MSG_ERROR([*** Please check PKG_CONFIG_PATH or the version
+  	  of your installed Qt4 installation.])
+  	  ;;
+      esac
+    fi
+    AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
+    AC_SUBST(QT_CFLAGS)
+    AC_SUBST(QT_LIBS)
+  fi
+
+  dnl Check for plugin support headers and libraries.
+  if test "x${COMPILE_PLUGIN}" = xyes; then
+    PKG_CHECK_MODULES(MOZILLA, mozilla-plugin, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
+    if test "x${MOZILLA_FOUND}" = xno; then
+      PKG_CHECK_MODULES(MOZILLA, firefox-plugin, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
+    fi
+    if test "x${MOZILLA_FOUND}" = xno; then
+      PKG_CHECK_MODULES(MOZILLA, xulrunner-plugin, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
+    fi
+    if test "x${MOZILLA_FOUND}" = xno; then
+      PKG_CHECK_MODULES(MOZILLA, mozilla-firefox-plugin, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
+    fi
+    PKG_CHECK_MODULES(GLIB, glib-2.0)
+
+    AC_SUBST(MOZILLA_CFLAGS)
+    AC_SUBST(MOZILLA_LIBS)
+    AC_SUBST(GLIB_CFLAGS)
+    AC_SUBST(GLIB_LIBS)
+
+    AC_SUBST(PLUGIN_DIR, $HOME/.mozilla/plugins/)
+  fi
+fi
+
+CLASSPATH_WITH_JAVAH
+
+dnl ----------------------------------------------------------- 
+dnl Add the include files for the native abstraction layer.
+dnl Used by AM_CPPFLAGS in the different modules.
+dnl -----------------------------------------------------------
+CLASSPATH_INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/native/jni/classpath -I\$(top_srcdir)/native/target/Linux -I\$(top_srcdir)/native/target/generic"
+AC_SUBST(CLASSPATH_INCLUDES)
+
+dnl -----------------------------------------------------------
+if test "x${COMPILE_JNI}" = xyes; then
+  AC_MSG_CHECKING(jni_md.h support)
+  if test -f ${srcdir}/include/jni_md-${target_cpu}-${target_os}.h; then
+    AC_MSG_RESULT(yes)
+  else
+    target_cpu=x86
+    target_os=linux-gnu 
+    AC_MSG_WARN(no, using x86-linux-gnu)
+  fi
+  ac_sources="include/jni_md-${target_cpu}-${target_os}.h"
+  ac_dests="include/jni_md.h"
+  while test -n "$ac_sources"; do
+    set $ac_dests; ac_dest=$1; shift; ac_dests=$*
+    set $ac_sources; ac_source=$1; shift; ac_sources=$*
+    ac_config_links_1="$ac_config_links_1 $ac_dest:$ac_source"
+  done
+  AC_CONFIG_LINKS([$ac_config_links_1])
+fi
+
+CLASSPATH_FIND_JAVAC
+
+CLASSPATH_WITH_CLASSLIB
+
+dnl -----------------------------------------------------------
+dnl Initialize maintainer mode
+dnl -----------------------------------------------------------
+AM_MAINTAINER_MODE
+
+dnl -----------------------------------------------------------
+dnl Enable debugging statements at compile time.  By default
+dnl these statements should be optimized out of the bytecode
+dnl produced by an optimizing Java compiler and not hinder 
+dnl performance because debugging is turned off by default.
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([debug],
+              [AS_HELP_STRING(--enable-debug,enable runtime debugging code)],
+              [case "${enableval}" in 
+                yes) 
+              	LIBDEBUG="true"
+                AC_DEFINE(DEBUG, 1, [Define to 1 if you want native library runtime debugging code enabled]) 
+              	;;
+                no)   LIBDEBUG="false" ;;
+                *) 	AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
+              esac],
+              [LIBDEBUG="false"])
+AC_SUBST(LIBDEBUG)
+
+dnl -----------------------------------------------------------
+dnl Enable execution of all static initializer loadLibrary() 
+dnl calls at compile time.  By default most people will not
+dnl want to disable this, but some VMs (gcj) don't need or want 
+dnl them.
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([load-library],
+              [AS_HELP_STRING(--enable-load-library,enable to use JNI native methods [default=yes])],
+              [case "${enableval}" in 
+                yes) INIT_LOAD_LIBRARY="true" ;;
+                no) INIT_LOAD_LIBRARY="false" ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --enable-load-library) ;;
+              esac],
+              [INIT_LOAD_LIBRARY="true"])
+AC_SUBST(INIT_LOAD_LIBRARY)
+
+
+dnl -----------------------------------------------------------
+dnl Should the VM explicitly run class initialization subfunctions for
+dnl java.lang.System?   (default is false -- the subfunctions will be run 
+dnl automatically by the class initializer)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([java-lang-system-explicit-initialization],
+              [AS_HELP_STRING(--enable-java-lang-system-explicit-initialization,will the VM explicitly invoke java.lang.System's static initialization methods [default=no])],
+              [case "${enableval}" in 
+                yes|true) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="true" ;;
+                no|false) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false" ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --enable-java-lang-system-explicit-initialization) ;;
+              esac],
+              [JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false"])
+AC_SUBST(JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION)
+
+
+dnl -----------------------------------------------------------
+dnl avoiding automake complaints
+dnl -----------------------------------------------------------
+REMOVE=""
+AC_SUBST(REMOVE)
+
+dnl -----------------------------------------------------------
+dnl This is probably useless.
+dnl -----------------------------------------------------------
+AC_PATH_PROG(MKDIR, mkdir)
+AC_PATH_PROG(CP, cp)
+AC_PATH_PROG(DATE, date)
+
+dnl -----------------------------------------------------------
+dnl According to the GNU coding guide, we shouldn't require find, 
+dnl and zip, however GNU provides both so it should be okay 
+dnl -----------------------------------------------------------
+AC_PATH_PROG(FIND, find)
+
+dnl -----------------------------------------------------------
+dnl Specify what to install (install only glibj.zip by default)
+dnl -----------------------------------------------------------
+CLASSPATH_WITH_GLIBJ
+
+dnl -----------------------------------------------------------
+dnl Enable API documentation generation (disabled by default)
+dnl -----------------------------------------------------------
+CLASSPATH_WITH_GJDOC
+
+dnl -----------------------------------------------------------
+dnl Whether to use jay to regenerate parsers.
+dnl -----------------------------------------------------------
+REGEN_WITH_JAY
+
+dnl -----------------------------------------------------------
+dnl This sets the build-time default, which can now be overridden 
+dnl by setting the system property gnu.classpath.awt.gtk.portable.native.sync
+dnl to "true" or "false".
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([portable-native-sync],
+              [AS_HELP_STRING(--enable-portable-native-sync,synchronize VM threads portably)],
+              [case "${enableval}" in 
+                yes) 
+                     AC_DEFINE(PORTABLE_NATIVE_SYNC, 1, [Define if you want to synchronize VM threads portably by default; undef otherwise])
+                     ;;
+                no)  ;;
+                *)   
+                     AC_MSG_ERROR(bad value ${enableval} for --enable-portable-native-sync) 
+                     ;;
+              esac],
+              [])
+
+AX_CREATE_STDINT_H([include/config-int.h])
+
+dnl -----------------------------------------------------------------------
+dnl                    Support for using a prebuilt class library
+dnl -----------------------------------------------------------------------
+AC_ARG_WITH([glibj_zip],
+            AS_HELP_STRING([--with-glibj-zip=ABS.PATH],
+                           [use prebuilt glibj.zip class library]))
+
+case "$with_glibj_zip" in
+"")
+        use_glibj_zip=false
+        ;;
+"no" )
+        use_glibj_zip=false
+        ;;
+"yes")
+        AC_MSG_ERROR([Please suply an absolute path to a prebuilt glibj.zip])
+        ;;
+*)
+        use_glibj_zip=true
+        PATH_TO_GLIBJ_ZIP=$with_glibj_zip
+	;;
+esac;
+
+AM_CONDITIONAL(USE_PREBUILT_GLIBJ_ZIP, test x$use_glibj_zip = xtrue)
+AC_SUBST(PATH_TO_GLIBJ_ZIP)
+
+dnl -----------------------------------------------------------
+dnl Build with Escher based X peers.
+dnl -----------------------------------------------------------
+AC_ARG_WITH([escher],
+	 AS_HELP_STRING([--with-escher=ABS.PATH],
+	                [specify path to escher dir or JAR for X peers]))
+case "$with_escher" in
+"")
+        use_escher=false
+        ;;
+"no")
+        use_escher=false
+        ;;
+"yes")
+        AC_MSG_ERROR([Please suply an absolute path to Escher library])
+        ;;
+*)
+        use_escher=true
+        PATH_TO_ESCHER=$with_escher
+        ;;
+esac;
+
+AM_CONDITIONAL(USE_ESCHER, test x$use_escher = xtrue)
+AC_SUBST(PATH_TO_ESCHER)
+
+dnl -----------------------------------------------------------
+dnl Check if local socket support should be included.
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([local-sockets],
+              [AS_HELP_STRING(--enable-local-sockets,enables local (AF_LOCAL) socket API [default: no])],
+              [case "${enableval}" in
+                yes)
+                  ENABLE_LOCAL_SOCKETS=yes
+                  ;;
+                *)
+                  ENABLE_LOCAL_SOCKETS=no
+                  ;;
+               esac],
+              [])
+if test "x$ENABLE_LOCAL_SOCKETS" = "xyes"
+then
+  AC_CHECK_HEADER([sys/un.h])
+  AC_CHECK_FUNCS([read write bind listen accept shutdown], [],
+                 AC_MSG_ERROR([networking support not available]))
+  AC_DEFINE(ENABLE_LOCAL_SOCKETS, [1], [Define to enable support for local sockets.])
+fi
+AM_CONDITIONAL(ENABLE_LOCAL_SOCKETS, test "x$ENABLE_LOCAL_SOCKETS" = "xyes")
+
+dnl -----------------------------------------------------------
+dnl Add the default preference peer
+dnl -----------------------------------------------------------
+AC_SUBST(DEFAULT_PREFS_PEER)
+
+dnl -----------------------------------------------------------
+dnl output files
+dnl -----------------------------------------------------------
+AC_CONFIG_FILES([Makefile
+doc/Makefile
+doc/api/Makefile
+external/Makefile
+external/sax/Makefile
+external/w3c_dom/Makefile
+external/relaxngDatatype/Makefile
+gnu/classpath/Configuration.java
+gnu/java/security/Configuration.java
+include/Makefile
+native/Makefile
+native/fdlibm/Makefile
+native/jawt/Makefile
+native/jni/Makefile
+native/jni/classpath/Makefile
+native/jni/java-io/Makefile
+native/jni/java-lang/Makefile
+native/jni/java-net/Makefile
+native/jni/java-nio/Makefile
+native/jni/java-util/Makefile
+native/jni/gtk-peer/Makefile
+native/jni/gconf-peer/Makefile
+native/jni/qt-peer/Makefile
+native/jni/xmlj/Makefile
+native/jni/midi-alsa/Makefile
+native/jni/midi-dssi/Makefile
+native/plugin/Makefile
+native/target/Makefile
+native/target/Linux/Makefile
+native/target/generic/Makefile
+resource/Makefile
+resource/META-INF/services/java.util.prefs.PreferencesFactory
+scripts/Makefile
+scripts/classpath.spec
+lib/Makefile
+lib/gen-classlist.sh
+lib/copy-vmresources.sh
+tools/Makefile
+examples/Makefile
+examples/Makefile.jawt
+examples/Makefile.java2d])
+
+if test "x${COMPILE_WRAPPERS}" = xno
+then
+AC_CONFIG_FILES([tools/gappletviewer
+tools/gjarsigner
+tools/gkeytool
+tools/gjar
+tools/gnative2ascii
+tools/gserialver])
+AC_CONFIG_COMMANDS([gappletviewer],[chmod 755 tools/gappletviewer])
+AC_CONFIG_COMMANDS([gjarsigner],[chmod 755 tools/gjarsigner])
+AC_CONFIG_COMMANDS([gkeytool],[chmod 755 tools/gkeytool])
+AC_CONFIG_COMMANDS([gjar],[chmod 755 tools/gjar])
+AC_CONFIG_COMMANDS([gnative2ascii],[chmod 755 tools/gnative2ascii])
+AC_CONFIG_COMMANDS([gserialver],[chmod 755 tools/gserialver])
+fi
+
+
+if test "x${COMPILE_WRAPPERS}" = xno
+then
+AC_CONFIG_FILES([tools/appletviewer
+tools/jarsigner
+tools/keytool])
+AC_CONFIG_COMMANDS([appletviewer],[chmod 755 tools/appletviewer])
+AC_CONFIG_COMMANDS([jarsigner],[chmod 755 tools/jarsigner])
+AC_CONFIG_COMMANDS([keytool],[chmod 755 tools/keytool])
+fi
+
+AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
+AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh])
+AC_OUTPUT
+
+# Create standard.omit based on decisions we just made.
+cat ${srcdir}/lib/standard.omit.in > lib/standard.omit
+if test x$use_escher != xtrue; then
+   echo gnu/java/awt/peer/x/.*java$ >> lib/standard.omit
+fi
+

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

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/depcomp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/depcomp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,423 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+if test -z "$depfile"; then
+   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
+   dir=`echo "$object" | sed 's,/.*$,/,'`
+   if test "$dir" = "$object"; then
+      dir=
+   fi
+   # FIXME: should be _deps on DOS.
+   depfile="$dir.deps/$base"
+fi
+
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  This file always lives in the current directory.
+  # Also, the AIX compiler puts `$object:' at the start of each line;
+  # $object doesn't have directory information.
+  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  outname="$stripped.o"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      tmpdepfile1="$dir.libs/$base.lo.d"
+      tmpdepfile2="$dir.libs/$base.d"
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1="$dir$base.o.d"
+      tmpdepfile2="$dir$base.d"
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2"
+      exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   else
+      tmpdepfile="$tmpdepfile2"
+   fi
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a space and a tab in the [].
+      sed -e 's,^.*\.[a-z]*:[ 	]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.  We will use -o /dev/null later,
+  # however we can't do the remplacement now because
+  # `-o $object' might simply not be used
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ 	]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    -*)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/depcomp

------------------------------------------------------------------------------
    svn:executable = *

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

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/doc/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/doc/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,14 @@
+SUBDIRS = api
+
+EXTRA_DIST = README.jaxp
+
+## GCJ LOCAL: we don't want to install Classpath's info files.
+## info_TEXINFOS = hacking.texinfo vmintegration.texinfo
+
+%.dvi : %.texinfo
+	texi2dvi $<
+
+%.ps : %.dvi
+	dvips -o $@ $<
+
+docs: hacking.ps vmintegration.ps tools.ps

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

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/doc/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/doc/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,614 @@
+# 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 = doc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in texinfo.tex
+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 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@
+SUBDIRS = api
+EXTRA_DIST = README.jaxp
+all: all-recursive
+
+.SUFFIXES:
+$(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  doc/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  doc/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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: ctags-recursive $(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
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+	clean clean-generic clean-libtool clean-recursive ctags \
+	ctags-recursive distclean distclean-generic distclean-libtool \
+	distclean-recursive 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-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic maintainer-clean-recursive \
+	mostlyclean mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-info-am
+
+
+%.dvi : %.texinfo
+	texi2dvi $<
+
+%.ps : %.dvi
+	dvips -o $@ $<
+
+docs: hacking.ps vmintegration.ps tools.ps
+# 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/doc/README.jaxp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/doc/README.jaxp?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/doc/README.jaxp (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/doc/README.jaxp Thu Nov  8 16:56:19 2007
@@ -0,0 +1,204 @@
+This file describes the jaxp (xml processing) implementation of GNU Classpath.
+GNU Classpath includes interfaces and implementations for basic XML processing
+in in the java programming language, some general purpose SAX2 utilities, and
+transformation.
+
+These classes used to be maintained as part of an external project GNU JAXP
+but are now integrated with the rest of the core class library provided by
+GNU Classpath.
+
+PACKAGES
+    
+. javax.xml.* ... JAXP 1.3 interfaces
+
+. gnu.xml.aelfred2.* ... SAX2 parser + validator
+. gnu.xml.dom.* ... DOM Level 3 Core, Traversal, XPath implementation
+. gnu.xml.dom.ls.* ... DOM Level 3 Load & Save implementation
+. gnu.xml.xpath.* ... JAXP XPath implementation
+. gnu.xml.transform.* ... JAXP XSL transformer implementation
+. gnu.xml.pipeline.* ... SAX2 event pipeline support
+. gnu.xml.stream.* ... StAX pull parser and SAX-over-StAX driver
+. gnu.xml.util.* ... various XML utility classes
+. gnu.xml.libxmlj.dom.* ... libxmlj DOM Level 3 Core and XPath
+. gnu.xml.libxmlj.sax.* ... libxmlj SAX parser
+. gnu.xml.libxmlj.transform.* ... libxmlj XSL transformer
+. gnu.xml.libxmlj.util.* ... libxmlj utility classes
+
+In the external directory you can find the following packages.
+They are not maintained as part of GNU Classpath, but are used by the
+classes in the above packages.
+
+. org.xml.sax.* ... SAX2 interfaces
+. org.w3c.dom.* ... DOM Level 3 interfaces
+. org.relaxng.datatype.* ... RELAX NG pluggable datatypes API
+
+CONFORMANCE
+
+    The primary test resources are at http://xmlconf.sourceforge.net
+    and include:
+
+    SAX2/XML conformance tests
+	That the "xml.testing.Driver" addresses the core XML 1.0
+	specification requirements, which closely correspond to the
+	functionality SAX1 provides.  The driver uses SAX2 APIs to
+	test that functionality It is used with a bugfixed version of
+	the NIST/OASIS XML conformance test cases.
+	
+	The AElfred2 parser is highly conformant, though it still takes
+	a few implementation shortcuts.  See its package documentation
+	for information about known XML conformance issues in AElfred2.
+
+	The primary issue is using Unicode character tables, rather than
+	those in the XML specification, for determining what names are
+	valid.  Most applications won't notice the difference, and this
+	solution is smaller and faster than the alternative.
+
+	For validation, a secondary issue is that issues relating to
+	entity modularity are not validated; they can't all be cleanly
+	layered.  For example, validity constraints related to standalone
+	declarations and PE nesting are not checked.
+
+        The current implementation has also been tested against Elliotte
+        Rusty Harold's SAXTest test suite (http://www.cafeconleche.org/SAXTest)
+        and achieves approximately 93% conformance to the SAX specification
+        according to these tests, higher than any other current Java parser.
+
+    SAX2
+	SAX2 API conformance currently has a minimal JUNIT (0.2) test suite,
+	which can be accessed at the xmlconf site listed above.  It does
+	not cover namespaces or LexicalHandler and Declhandler extensions
+	anywhere as exhaustively as the SAX1 level functionality is
+	tested by the "xml.testing.Driver".  However:
+
+	    - Applying the DOM unit tests to this implementation gives
+	      the LexicalHandler (comments, and boundaries of DTDs,
+	      CDATA sections, and general entities) a workout, and
+	      does the same for DeclHandler entity declarations.
+	    
+	    - The pipeline package's layered validator demands that
+	      element and attribute declarations are reported correctly.
+	
+	By those metrics, SAX2 conformance for AElfred2 is also strong. 
+    
+    DOM Level 3 Core Tests
+        The DOM implementation has been tested against the W3C DOM Level 3
+        Core conformance test suite (http://www.w3.org/DOM/Test/). Current
+        conformance according to these tests is 72.3%. Many of the test
+        failures are due to the fact that GNU JAXP does not currently
+        provide any W3C XML Schema support.
+
+    XSL transformation
+        The transformer and XPath implementation have been tested against
+        the OASIS XSLT and XPath TC test suite. Conformance against the
+        Xalan tests is currently 77%.
+
+
+libxmlj
+========================================================================
+
+libxmlj is an effort to create a 100% JAXP-compatible Java wrapper for
+libxml2 and libxslt. JAXP is the Java API for XML processing, libxml2
+is the XML C library for Gnome, and libxslt is the XSLT C library for
+Gnome.
+
+libxmlj currently supports most of the DOM Level 3 Core, Traversal, and
+XPath APIs, SAX2, and XSLT transformations. There is no W3C XML Schema
+support yet.
+
+libxmlj can parse and transform XML documents extremely quickly in
+comparison to Java-based JAXP implementations. DOM manipulations, however,
+involve JNI overhead, so the speed of DOM tree construction and traversal
+can be slower than the Java implementation.
+
+libxmlj is highly experimental, doesn't always conform to the DOM
+specification correctly, and may leak memory. Production use is not advised.
+
+The implementation can be found in gnu/xml/libxmlj and native/jni/xmlj.
+See the INSTALL file for the required versions of libxml2 and libxslt.
+configure --enable-xmlj will build it.
+
+Usage
+------------------------------------------------------------------------
+
+To enable the various GNU JAXP factories, set the following system properties
+(command-line version shown, but they can equally be set programmatically):
+
+  AElfred2:
+   -Djavax.xml.parsers.SAXParserFactory=gnu.xml.aelfred2.JAXPFactory
+
+  GNU DOM (using DOM Level 3 Load & Save):
+   -Djavax.xml.parsers.DocumentBuilderFactory=gnu.xml.dom.DomDocumentBuilderFactory
+
+  GNU DOM (using AElfred-only pipeline classes):
+   -Djavax.xml.parsers.DocumentBuilderFactory=gnu.xml.dom.JAXPFactory
+
+  GNU XSL transformer:
+   -Djavax.xml.transform.TransformerFactory=gnu.xml.transform.TransformerFactoryImpl
+
+  GNU StAX:
+   -Djavax.xml.stream.XMLEventFactory=gnu.xml.stream.XMLEventFactoryImpl
+   -Djavax.xml.stream.XMLInputFactory=gnu.xml.stream.XMLInputFactoryImpl
+   -Djavax.xml.stream.XMLOutputFactory=gnu.xml.stream.XMLOutputFactoryImpl
+
+  GNU SAX-over-StAX:
+   -Djavax.xml.parsers.SAXParserFactory=gnu.xml.stream.SAXParserFactory
+
+  libxmlj SAX:
+   -Djavax.xml.parsers.SAXParserFactory=gnu.xml.libxmlj.sax.GnomeSAXParserFactory
+
+  libxmlj DOM:
+   -Djavax.xml.parsers.DocumentBuilderFactory=gnu.xml.libxmlj.dom.GnomeDocumentBuilderFactory
+
+  libxmlj XSL transformer:
+   -Djavax.xml.transform.TransformerFactory=gnu.xml.libxmlj.transform.GnomeTransformerFactory
+
+When using libxmlj, the libxmlj shared library must be available.
+In general it is picked up by the runtime using GNU Classpath. If not you
+might want to try adding the directory where libxmlj.so is installed
+(by default ${prefix}/lib/classpath/) with ldconfig or specifing in the
+LD_LIBRARY_PATH environment variable. Additionally, you may need to specify
+the location of your shared libraries to the runtime environment using the
+java.library.path system property.
+
+Missing (libxmlj) Features
+------------------------------------------------------------------------ 
+
+See BUGS in native/jni/xmlj for known bugs in the libxmlj native bindings.
+
+This implementation should be thread-safe, but currently all
+transformation requests are queued via Java synchronization, which
+means that it effectively performs single-threaded. Long story short,
+both libxml2 and libxslt are not fully reentrant.  
+
+Update: it may be possible to make libxmlj thread-safe nonetheless
+using thread context variables.
+
+Update: thread context variables have been introduced. This is very
+untested though, libxmll therefore still has the single thread
+bottleneck.
+
+
+Validation
+===================================================
+
+Pluggable datatypes
+---------------------------------------------------
+Validators should use the RELAX NG pluggable datatypes API to retrieve
+datatype (XML Schema simple type) implementations in a schema-neutral
+fashion. The following code demonstrates looking up a W3C XML Schema
+nonNegativeInteger datatype:
+
+  DatatypeLibrary xsd = DatatypeLibraryLoader
+    .createDatatypeLibrary(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+  Datatype nonNegativeInteger = xsd.createDatatype("nonNegativeInteger");
+
+It is also possible to create new types by derivation. For instance,
+to create a datatype that will match a US ZIP code:
+
+  DatatypeBuilder b = xsd.createDatatypeBuilder("string");
+  b.addParameter("pattern", "(^[0-9]{5}$)|(^[0-9]{5}-[0-9]{4}$)");
+  Datatype zipCode = b.createDatatype();
+
+A datatype library implementation for XML Schema is provided; other
+library implementations may be added.
+

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

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/doc/api/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/doc/api/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,53 @@
+if CREATE_API_DOCS
+noinst_DATA = html
+endif
+
+sourcepath = $(top_builddir):$(top_srcdir):$(top_srcdir)/vm/reference:$(top_srcdir)/external/w3c_dom:$(top_srcdir)/external/sax
+
+classpathbox = "<span class='logo'><a href='http://www.gnu.org/software/classpath' target='_top'>GNU Classpath</a> ($(VERSION))"
+
+if CREATE_API_DOCS
+install-data-local:
+	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/api
+	@list='$(htmllist)'; for p in $$list; do \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  if test -f "$$p"; then \
+	    echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/api/$$f"; \
+	    $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/api/$$f; \
+	  elif test -d "$$p"; then \
+	    $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/api/$$f; \
+          fi; \
+        done
+
+uninstall-local:
+	@list='$(htmllist)'; for p in $$list; do \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  if test -f "$$p"; then \
+	    echo " rm -f $(DESTDIR)$(pkgdatadir)/api/$$f"; \
+	    rm -f $(DESTDIR)$(pkgdatadir)/api/$$f; \
+          fi; \
+        done
+endif
+
+html: create_html
+
+clean-local:
+	-rm -rf html create_html gjdoc_rawcomment.cache
+
+create_html:
+	-$(MKDIR) html > /dev/null 2>&1
+	$(GJDOC) \
+	-use \
+	-sourcepath "$(sourcepath)" \
+	-encoding UTF-8 \
+	-breakiterator \
+	-licensetext \
+	-linksource \
+	-splitindex \
+	-validhtml \
+	-d html \
+	-doctitle "GNU Classpath $(VERSION)" \
+	-windowtitle "GNU Classpath $(VERSION) Documentation" \
+	-header $(classpathbox) -footer $(classpathbox) \
+	-subpackages java:javax:org
+	touch create_html

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

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/doc/api/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/doc/api/Makefile.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,497 @@
+# 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 = doc/api
+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 =
+SOURCES =
+DIST_SOURCES =
+DATA = $(noinst_DATA)
+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@
+ at CREATE_API_DOCS_TRUE@noinst_DATA = html
+sourcepath = $(top_builddir):$(top_srcdir):$(top_srcdir)/vm/reference:$(top_srcdir)/external/w3c_dom:$(top_srcdir)/external/sax
+classpathbox = "<span class='logo'><a href='http://www.gnu.org/software/classpath' target='_top'>GNU Classpath</a> ($(VERSION))"
+all: all-am
+
+.SUFFIXES:
+$(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  doc/api/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  doc/api/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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 $(DATA)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+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."
+ at CREATE_API_DOCS_FALSE@uninstall-local:
+ at CREATE_API_DOCS_FALSE@install-data-local:
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-local
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	clean-local distclean distclean-generic distclean-libtool \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-data-local \
+	install-exec install-exec-am install-info install-info-am \
+	install-man install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am uninstall uninstall-am uninstall-info-am \
+	uninstall-local
+
+
+ at CREATE_API_DOCS_TRUE@install-data-local:
+ at CREATE_API_DOCS_TRUE@	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/api
+ at CREATE_API_DOCS_TRUE@	@list='$(htmllist)'; for p in $$list; do \
+ at CREATE_API_DOCS_TRUE@	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+ at CREATE_API_DOCS_TRUE@	  if test -f "$$p"; then \
+ at CREATE_API_DOCS_TRUE@	    echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/api/$$f"; \
+ at CREATE_API_DOCS_TRUE@	    $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/api/$$f; \
+ at CREATE_API_DOCS_TRUE@	  elif test -d "$$p"; then \
+ at CREATE_API_DOCS_TRUE@	    $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/api/$$f; \
+ at CREATE_API_DOCS_TRUE@          fi; \
+ at CREATE_API_DOCS_TRUE@        done
+
+ at CREATE_API_DOCS_TRUE@uninstall-local:
+ at CREATE_API_DOCS_TRUE@	@list='$(htmllist)'; for p in $$list; do \
+ at CREATE_API_DOCS_TRUE@	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+ at CREATE_API_DOCS_TRUE@	  if test -f "$$p"; then \
+ at CREATE_API_DOCS_TRUE@	    echo " rm -f $(DESTDIR)$(pkgdatadir)/api/$$f"; \
+ at CREATE_API_DOCS_TRUE@	    rm -f $(DESTDIR)$(pkgdatadir)/api/$$f; \
+ at CREATE_API_DOCS_TRUE@          fi; \
+ at CREATE_API_DOCS_TRUE@        done
+
+html: create_html
+
+clean-local:
+	-rm -rf html create_html gjdoc_rawcomment.cache
+
+create_html:
+	-$(MKDIR) html > /dev/null 2>&1
+	$(GJDOC) \
+	-use \
+	-sourcepath "$(sourcepath)" \
+	-encoding UTF-8 \
+	-breakiterator \
+	-licensetext \
+	-linksource \
+	-splitindex \
+	-validhtml \
+	-d html \
+	-doctitle "GNU Classpath $(VERSION)" \
+	-windowtitle "GNU Classpath $(VERSION) Documentation" \
+	-header $(classpathbox) -footer $(classpathbox) \
+	-subpackages java:javax:org
+	touch create_html
+# 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/doc/hacking.texinfo
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/doc/hacking.texinfo?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/doc/hacking.texinfo (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/doc/hacking.texinfo Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1733 @@
+\input texinfo @c -*-texinfo-*-
+
+ at c %**start of header
+ at setfilename hacking.info
+ at settitle GNU Classpath Hacker's Guide
+ at c %**end of header
+
+ at setchapternewpage off
+
+ at ifinfo
+This file contains important information you will need to know if you
+are going to hack on the GNU Classpath project code.
+
+Copyright (C) 1998,1999,2000,2001,2002,2003,2004, 2005 Free Software Foundation, Inc.
+
+ at ifnotplaintext
+ at dircategory GNU Libraries
+ at direntry
+* Classpath Hacking: (hacking).   GNU Classpath Hacker's Guide
+ at end direntry
+ at end ifnotplaintext
+ at end ifinfo
+
+ at titlepage
+ at title GNU Classpath Hacker's Guide
+ at author Aaron M. Renn
+ at author Paul N. Fisher
+ at author John Keiser
+ at author C. Brian Jones
+ at author Mark J. Wielaard
+
+ at page
+ at vskip 0pt plus 1filll
+Copyright @copyright{} 1998,1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+ at sp 2
+Permission is granted to make and distribute verbatim copies of
+this document provided the copyright notice and this permission notice
+are preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this
+document under the conditions for verbatim copying, provided that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this manual
+into another language, under the above conditions for modified versions,
+except that this permission notice may be stated in a translation
+approved by the Free Software Foundation.
+
+ at end titlepage
+
+ at ifinfo
+ at node Top, Introduction, (dir), (dir)
+ at top GNU Classpath Hacker's Guide
+
+This document contains important information you'll want to know if
+you want to hack on GNU Classpath, Essential Libraries for Java, to
+help create free core class libraries for use with virtual machines
+and compilers for the java programming language.
+ at end ifinfo
+
+ at menu
+* Introduction::                An introduction to the GNU Classpath project
+* Requirements::                Very important rules that must be followed
+* Volunteering::                So you want to help out
+* Project Goals::               Goals of the GNU Classpath project
+* Needed Tools and Libraries::  A list of programs and libraries you will need
+* Programming Standards::       Standards to use when writing code
+* Hacking Code::                Working on code, Working with others
+* Programming Goals::           What to consider when writing code
+* API Compatibility::           How to handle serialization and deprecated methods
+* Specification Sources::       Where to find class library specs
+* Naming Conventions::          How files and directories are named
+* Character Conversions::       Working on Character conversions
+* Localization::                How to handle localization/internationalization
+
+ at detailmenu
+ --- The Detailed Node Listing ---
+
+Programming Standards
+
+* Source Code Style Guide::     
+
+Working on the code, Working with others
+
+* Branches::                    
+* Writing ChangeLogs::          
+
+Working with branches
+
+* Writing ChangeLogs::          
+
+Programming Goals
+
+* Portability::                 Writing Portable Software                
+* Utility Classes::             Reusing Software
+* Robustness::                  Writing Robust Software               
+* Java Efficiency::             Writing Efficient Java            
+* Native Efficiency::           Writing Efficient JNI          
+* Security::                    Writing Secure Software
+
+API Compatibility
+
+* Serialization::               Serialization
+* Deprecated Methods::          Deprecated methods
+
+Localization
+
+* String Collation::            Sorting strings in different locales
+* Break Iteration::             Breaking up text into words, sentences, and lines
+* Date Formatting and Parsing::  Locale specific date handling
+* Decimal/Currency Formatting and Parsing::  Local specific number handling
+
+ at end detailmenu
+ at end menu
+
+ at node Introduction, Requirements, Top, Top
+ at comment node-name, next, previous, up
+ at chapter Introduction
+
+The GNU Classpath Project is a dedicated to providing a 100% free,
+clean room implementation of the standard core class libraries for
+compilers and runtime environments for the java programming language.
+It offers free software developers an alternative core library
+implementation upon which larger java-like programming environments
+can be build.  The GNU Classpath Project was started in the Spring of
+1998 as an official Free Software Foundation project.  Most of the
+volunteers working on GNU Classpath do so in their spare time, but a
+couple of projects based on GNU Classpath have paid programmers to
+improve the core libraries.  We appreciate everyone's efforts in the
+past to improve and help the project and look forward to future
+contributions by old and new members alike.
+
+ at node Requirements, Volunteering, Introduction, Top
+ at comment node-name, next, previous, up
+ at chapter Requirements
+
+Although GNU Classpath is following an open development model where input
+from developers is welcome, there are certain base requirements that
+need to be met by anyone who wants to contribute code to this project.
+They are mostly dictated by legal requirements and are not arbitrary
+restrictions chosen by the GNU Classpath team.
+
+You will need to adhere to the following things if you want to donate
+code to the GNU Classpath project:
+
+ at itemize @bullet
+ at item
+ at strong{Never under any circumstances refer to proprietary code while
+working on GNU Classpath.}  It is best if you have never looked at
+alternative proprietary core library code at all.  To reduce
+temptation, it would be best if you deleted the @file{src.zip} file
+from your proprietary JDK distribution (note that recent versions of
+GNU Classpath and the compilers and environments build on it are
+mature enough to not need any proprietary implementation at all when
+working on GNU Classpath, except in exceptional cases where you need
+to test compatibility issues pointed out by users).  If you have
+signed Sun's non-disclosure statement, then you unfortunately cannot
+work on Classpath code at all.  If you have any reason to believe that
+your code might be ``tainted'', please say something on the mailing
+list before writing anything.  If it turns out that your code was not
+developed in a clean room environment, we could be very embarrassed
+someday in court.  Please don't let that happen.
+
+ at item
+ at strong{Never decompile proprietary class library implementations.}  While
+the wording of the license in Sun's Java 2 releases has changed, it is
+not acceptable, under any circumstances, for a person working on
+GNU Classpath to decompile Sun's class libraries.  Allowing the use of
+decompilation in the GNU Classpath project would open up a giant can of
+legal worms, which we wish to avoid.
+
+ at item
+Classpath is licensed under the terms of the
+ at uref{http://www.fsf.org/copyleft/gpl.html,GNU General Public
+License}, with a special exception included to allow linking with
+non-GPL licensed works as long as no other license would restrict such
+linking.  To preserve freedom for all users and to maintain uniform
+licensing of Classpath, we will not accept code into the main
+distribution that is not licensed under these terms.  The exact
+wording of the license of the current version of GNU Classpath can be
+found online from the
+ at uref{http://www.gnu.org/software/classpath/license.html, GNU
+Classpath license page} and is of course distributed with current
+snapshot release from @uref{ftp://ftp.gnu.org/gnu/classpath/} or by
+obtaining a copy of the current CVS tree.
+
+ at item
+GNU Classpath is GNU software and this project is being officially sponsored
+by the @uref{http://www.fsf.org/,Free Software Foundation}.  Because of
+this, the FSF will hold copyright to all code developed as part of
+GNU Classpath.  This will allow them to pursue copyright violators in court,
+something an individual developer may neither have the time nor
+resources to do.  Everyone contributing code to GNU Classpath will need to
+sign a copyright assignment statement.  Additionally, if you are
+employed as a programmer, your employer may need to sign a copyright
+waiver disclaiming all interest in the software.  This may sound harsh,
+but unfortunately, it is the only way to ensure that the code you write
+is legally yours to distribute.
+ at end itemize
+
+ at node Volunteering, Project Goals, Requirements, Top
+ at comment node-name, next, previous, up
+ at chapter Volunteering to Help
+
+The GNU Classpath project needs volunteers to help us out.  People are
+needed to write unimplemented core packages, to test GNU Classpath on
+free software programs written in the java programming language, to
+test it on various platforms, and to port it to platforms that are
+currently unsupported.
+
+While pretty much all contributions are welcome (but see 
+ at pxref{Requirements}) it is always preferable that volunteers do the
+whole job when volunteering for a task.  So when you volunteer to write
+a Java package, please be willing to do the following:
+
+ at itemize @bullet
+ at item
+Implement a complete drop-in replacement for the particular package.
+That means implementing any ``internal'' classes.  For example, in the
+java.net package, there are non-public classes for implementing sockets.
+Without those classes, the public socket interface is useless.  But do
+not feel obligated to completely implement all of the functionality at
+once.  For example, in the java.net package, there are different types
+of protocol handlers for different types of URL's.  Not all of these
+need to be written at once.
+
+ at item
+Please write complete and thorough API documentation comments for
+every public and protected method and variable.  These should be
+superior to Sun's and cover everything about the item being
+documented.
+
+ at item
+Please write a regression test package that can be used to run tests
+of your package's functionality.  GNU Classpath uses the
+ at uref{http://sources.redhat.com/mauve/,Mauve project} for testing the
+functionality of the core class libraries.  The Classpath Project is
+fast approaching the point in time where all modifications to the
+source code repository will require appropriate test cases in Mauve to
+ensure correctness and prevent regressions.  
+ at end itemize
+
+Writing good documentation, tests and fixing bugs should be every
+developer's top priority in order to reach the elusive release of
+version 1.0.
+
+ at node Project Goals, Needed Tools and Libraries, Volunteering, Top
+ at comment node-name, next, previous, up
+ at chapter Project Goals
+
+The goal of the Classpath project is to produce a
+ at uref{http://www.fsf.org/philosophy/free-sw.html,free} implementation of
+the standard class library for Java.  However, there are other more
+specific goals as to which platforms should be supported.
+
+Classpath is targeted to support the following operating systems:
+
+ at enumerate
+ at item
+Free operating systems.  This includes GNU/Linux, GNU/Hurd, and the free
+BSDs.
+
+ at item
+Other Unix-like operating systems.
+
+ at item
+Platforms which currently have no Java support at all.
+
+ at item 
+Other platforms such as MS-Windows.
+ at end enumerate
+
+While free operating systems are the top priority, the other priorities
+can shift depending on whether or not there is a volunteer to port
+Classpath to those platforms and to test releases.
+
+Eventually we hope the Classpath will support all JVM's that provide
+JNI or CNI support.  However, the top priority is free JVM's.  A small
+list of Compiler/VM environments that are currently actively
+incorporating GNU Classpath is below.  A more complete overview of
+projects based on GNU classpath can be found online at
+ at uref{http://www.gnu.org/software/classpath/stories.html,the GNU
+Classpath stories page}.
+
+ at enumerate
+ at item
+ at uref{http://gcc.gnu.org/java/,GCJ}
+ at item 
+ at uref{http://jamvm.sourceforge.net/,jamvm}
+ at item 
+ at uref{http://kissme.sourceforge.net/,Kissme}
+ at item
+ at uref{http://www.ibm.com/developerworks/oss/jikesrvm/,Jikes RVM}
+ at item
+ at uref{http://www.sablevm.org/,SableVM}
+ at item
+ at uref{http://www.kaffe.org/,Kaffe}
+ at end enumerate
+
+As with OS platform support, this priority list could change if a
+volunteer comes forward to port, maintain, and test releases for a
+particular JVM.  Since gcj is part of the GNU Compiler Collective it
+is one of the most important targets.  But since it doesn't currently
+work out of the box with GNU Classpath it is currently not the easiest
+target.  When hacking on GNU Classpath the easiest is to use
+compilers and runtime environments that that work out of the box with
+it, such as the jikes compiler and the runtime environments jamvm and
+kissme.  But you can also work directly with targets like gcj and
+kaffe that have their own copy of GNU Classpath currently.  In that
+case changes have to be merged back into GNU Classpath proper though,
+which is sometimes more work.  SableVM is starting to migrate from an
+integrated GNU Classpath version to being usable with GNU Classpath
+out of the box.
+
+
+The initial target version for Classpath is the 1.1 spec.  Higher
+versions can be implemented (and have been implemented, including lots
+of 1.4 functionality) if desired, but please do not create classes
+that depend on features in those packages unless GNU Classpath already
+contains those features.  GNU Classpath has been free of any
+proprietary dependencies for a long time now and we like to keep it
+that way.  But finishing, polishing up, documenting, testing and
+debugging current functionality is of higher priority then adding new
+functionality.
+
+ at node Needed Tools and Libraries, Programming Standards, Project Goals, Top
+ at comment node-name, next, previous, up
+ at chapter Needed Tools and Libraries
+
+If you want to hack on Classpath, you should at least download and
+install the following tools.  And try to familiarize yourself with
+them.  Although in most cases having these tools installed will be all
+you really need to know about them.  Also note that when working on
+(snapshot) releases only GCC 3.3+ (plus a free VM from the list above
+and the libraries listed below) is needed.  The other tools are only
+needed when working directly on the CVS version.
+
+ at itemize @bullet
+ at item
+GCC 3.3+
+ at item
+CVS 1.11+
+ at item
+automake 1.7+
+ at item
+autoconf 2.59+
+ at item
+libtool 1.4.2+
+ at item
+GNU m4 1.4
+ at item
+texinfo 4.2+
+ at end itemize
+
+All of these tools are available from
+ at uref{ftp://gnudist.gnu.org/pub/gnu/,gnudist.gnu.org} via anonymous
+ftp, except CVS which is available from
+ at uref{http://www.cvshome.org/,www.cvshome.org}.  They are fully
+documented with texinfo manuals.  Texinfo can be browsed with the
+Emacs editor, or with the text editor of your choice, or transformed
+into nicely printable Postscript.
+
+Here is a brief description of the purpose of those tools.
+
+ at table @b
+
+ at item GCC
+The GNU Compiler Collection. This contains a C compiler (gcc) for
+compiling the native C code and a compiler for the java programming
+language (gcj).  You will need at least gcj version 3.3 or higher.  If
+that version is not available for your platform you can try the
+ at uref{http://www.jikes.org/, jikes compiler}.  We try to keep all code
+compilable with both gcj and jikes at all times.
+
+ at item CVS  
+A version control system that maintains a centralized Internet
+repository of all code in the Classpath system.
+
+ at item automake  
+This tool automatically creates Makefile.in files from Makefile.am
+files.  The Makefile.in is turned into a Makefile by autoconf.  Why
+use this?  Because it automatically generates every makefile target
+you would ever want (clean, install, dist, etc) in full compliance
+with the GNU coding standards.  It also simplifies Makefile creation
+in a number of ways that cannot be described here.  Read the docs for
+more info.
+
+ at item autoconf  
+Automatically configures a package for the platform on which it is
+being built and generates the Makefile for that platform.
+
+ at item libtool  
+Handles all of the zillions of hairy platform specific options needed
+to build shared libraries.
+
+ at item m4
+The free GNU replacement for the standard Unix macro processor.
+Proprietary m4 programs are broken and so GNU m4 is required for
+autoconf to work though knowing a lot about GNU m4 is not required to
+work with autoconf.
+
+ at item perl
+Larry Wall's scripting language.  It is used internally by automake.
+
+ at item texinfo
+Manuals and documentation (like this guide) are written in texinfo.
+Texinfo is the official documentation format of the GNU project.
+Texinfo uses a single source file to produce output in a number of formats,
+both online and printed (dvi, info, html, xml, etc.). This means that
+instead of writing different documents for online information and another
+for a printed manual, you need write only one document. And when the work
+is revised, you need revise only that one document.
+
+ at end table
+
+
+For compiling the native AWT libraries you need to have the following
+libraries installed:
+
+ at table @b
+ at item GTK+ 2.2.x
+ at uref{http://www.gtk.org/,GTK+} is a multi-platform toolkit for
+creating graphical user interfaces.  It is used as the basis of the
+GNU desktop project GNOME.
+
+ at item gdk-pixbuf
+ at uref{http://www.gnome.org/start/,gdk-pixbuf} is a GNOME library for
+representing images.
+ at end table
+
+
+GNU Classpath comes with a couple of libraries included in the source
+that are not part of GNU Classpath proper, but that have been included
+to provide certain needed functionality.  All these external libraries
+should be clearly marked as such.  In general we try to use as much as
+possible the clean upstream versions of these sources.  That way
+merging in new versions will be easiest.  You should always try to get
+bug fixes to these files accepted upstream first.  Currently we
+include the following 'external' libraries.  Most of these sources are
+included in the @file{external} directory.  That directory also
+contains a @file{README} file explaining how to import newer versions.
+
+ at table @b
+
+ at item GNU jaxp
+Can be found in @file{external/jaxp}.  Provides javax.xml, org.w3c and
+org.xml packages.  Upstream is
+ at uref{http://www.gnu.org/software/classpathx/,GNU ClasspathX}.
+
+ at item fdlibm
+Can be found in @file{native/fdlibm}.  Provides native implementations
+of some of the Float and Double operations.  Upstream is
+ at uref{http://gcc.gnu.org/java/,libgcj}, they sync again with the
+'real' upstream @uref{http://www.netlib.org/fdlibm/readme}.  See also
+java.lang.StrictMath.
+
+ at end table
+
+
+ at node Programming Standards, Hacking Code, Needed Tools and Libraries, Top
+ at comment node-name, next, previous, up
+ at chapter Programming Standards
+
+For C source code, follow the
+ at uref{http://www.gnu.org/prep/standards/,GNU Coding Standards}.
+The standards also specify various things like the install directory
+structure.  These should be followed if possible.
+
+For Java source code, please follow the
+ at uref{http://www.gnu.org/prep/standards/,GNU Coding
+Standards}, as much as possible.  There are a number of exceptions to
+the GNU Coding Standards that we make for GNU Classpath as documented
+in this guide.  We will hopefully be providing developers with a code
+formatting tool that closely matches those rules soon.
+
+For API documentation comments, please follow
+ at uref{http://java.sun.com/products/jdk/javadoc/writingdoccomments.html,How
+to Write Doc Comments for Javadoc}.  We would like to have a set of
+guidelines more tailored to GNU Classpath as part of this document.
+
+ at menu
+* Source Code Style Guide::     
+ at end menu
+
+ at node Source Code Style Guide,  , Programming Standards, Programming Standards
+ at comment node-name, next, previous, up
+ at section Java source coding style
+
+Here is a list of some specific rules used when hacking on GNU
+Classpath java source code. We try to follow the standard
+ at uref{http://www.gnu.org/prep/standards/,GNU Coding Standards}
+for that. There are lots of tools that can automatically generate it
+(although most tools assume C source, not java source code) and it
+seems as good a standard as any. There are a couple of exceptions and
+specific rules when hacking on GNU Classpath java source code however.
+The following lists how code is formatted (and some other code
+conventions):
+
+
+ at itemize @bullet
+
+ at item
+Java source files in GNU Classpath are encoded using UTF-8.  However,
+ordinarily it is considered best practice to use the ASCII subset of
+UTF-8 and write non-ASCII characters using \u escapes.
+
+ at item
+If possible, generate specific imports (expand) over java.io.* type
+imports. Order by gnu, java, javax, org. There must be one blank line
+between each group. The imports themselves are ordered alphabetically by
+package name. Classes and interfaces occur before sub-packages. The
+classes/interfaces are then also sorted alphabetical. Note that uppercase
+characters occur before lowercase characters.
+
+ at example
+import gnu.java.awt.EmbeddedWindow;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.swing.JFrame;
+ at end example
+
+ at item
+Blank line after package statement, last import statement, classes,
+interfaces, methods.
+
+ at item
+Opening/closing brace for class and method is at the same level of
+indent as the declaration.  All other braces are indented and content
+between braces indented again.
+
+ at item
+Since method definitions don't start in column zero anyway (since they
+are always inside a class definition), the rational for easy grepping
+for ``^method_def'' is mostly gone already. Since it is customary for
+almost everybody who writes java source code to put modifiers, return
+value and method name on the same line, we do too.
+
+ at c fixme Another rational for always indenting the method definition is that itmakes it a bit easier to distinguish methods in inner and anonymousclasses from code in their enclosing context. NEED EXAMPLE.
+
+ at item
+Implements and extends on separate lines, throws too.  Indent extends,
+implements, throws.  Apply deep indentation for method arguments.
+
+ at c fixme Needs example.
+
+ at item
+Don't add a space between a method or constructor call/definition and
+the open-bracket. This is because often the return value is an object on
+which you want to apply another method or from which you want to access
+a field.
+        
+Don't write:
+
+ at example
+  getToolkit ().createWindow (this);
+ at end example
+
+But write:
+ at example
+  getToolkit().createWindow(this);
+ at end example
+
+ at item
+The GNU Coding Standard it gives examples for almost every construct
+(if, switch, do, while, etc.).  One missing is the try-catch construct
+which should be formatted as:
+
+ at example
+  try
+    @{
+      //
+    @}
+  catch (...)
+    @{
+      //
+    @}
+ at end example
+
+ at item
+Wrap lines at 80 characters after assignments and before operators.
+Wrap always before extends, implements, throws, and labels.
+
+ at item
+Don't put multiple class definitions in the same file, except for
+inner classes. File names (plus .java) and class names should be the
+same.
+
+ at item
+Don't catch a @code{NullPointerException} as an alternative to simply
+checking for @code{null}.  It is clearer and usually more efficient
+to simply write an explicit check.
+
+For instance, don't write:
+
+ at example
+try
+  @{
+    return foo.doit();
+  @}
+catch (NullPointerException _)
+  @{
+    return 7;
+  @}
+ at end example
+
+If your intent above is to check whether @samp{foo} is @code{null},
+instead write:
+
+ at example
+if (foo == null)
+  return 7;
+else
+  return foo.doit();
+ at end example
+
+ at item
+Don't use redundant modifiers or other redundant constructs.  Here is
+some sample code that shows various redundant items in comments:
+
+ at example
+/*import java.lang.Integer;*/
+/*abstract*/ interface I @{
+   /*public abstract*/ void m();
+   /*public static final*/ int i = 1;
+   /*public static*/ class Inner @{@}
+@}
+final class C /*extends Object*/ @{
+   /*final*/ void m() @{@}
+@}
+ at end example
+
+Note that Jikes will generate warnings for redundant modifiers if you
+use @code{+Predundant-modifiers} on the command line.
+
+ at item
+Modifiers should be listed in the standard order recommended by the
+JLS.  Jikes will warn for this when given @code{+Pmodifier-order}.
+
+ at item
+Because the output of different compilers differs, we have
+standardized on explicitly specifying @code{serialVersionUID} in
+ at code{Serializable} classes in Classpath.  This field should be
+declared as @code{private static final}.  Note that a class may be
+ at code{Serializable} without being explicitly marked as such, due to
+inheritance.  For instance, all subclasses of @code{Throwable} need to
+have @code{serialVersionUID} declared.
+ at c fixme index
+ at c fixme link to the discussion
+
+ at item
+Don't declare unchecked exceptions in the @code{throws} clause of a
+method.  However, if throwing an unchecked exception is part of the
+method's API, you should mention it in the Javadoc.  There is one
+important exception to this rule, which is that a stub method should
+be marked as throwing @code{gnu.classpath.NotImplementedException}.
+This will let our API comparison tools note that the method is not
+fully implemented.
+
+ at item
+When overriding @code{Object.equals}, remember that @code{instanceof}
+filters out @code{null}, so an explicit check is not needed.
+
+ at item
+When catching an exception and rethrowing a new exception you should
+``chain'' the Throwables.  Don't just add the String representation of
+the caught exception.
+
+ at example
+  try
+    @{
+      // Some code that can throw
+    @}
+  catch (IOException ioe)
+    @{
+      throw (SQLException) new SQLException("Database corrupt").setCause(ioe);
+    @}
+ at end example
+
+ at item
+Avoid the use of reserved words for identifiers.  This is obvious with those
+such as @code{if} and @code{while} which have always been part of the Java
+programming language, but you should be careful about accidentally using
+words which have been added in later versions.  Notable examples are
+ at code{assert} (added in 1.4) and @code{enum} (added in 1.5).  Jikes will warn
+of the use of the word @code{enum}, but, as it doesn't yet support the 1.5
+version of the language, it will still allow this usage through.  A
+compiler which supports 1.5 (e.g. the Eclipse compiler, ecj) will simply
+fail to compile the offending source code.
+
+ at c fixme Describe Anonymous classes (example).
+ at c fixme Descibe Naming conventions when different from GNU Coding Standards.
+ at c fixme Describee API doc javadoc tags used.
+
+ at end itemize
+
+Some things are the same as in the normal GNU Coding Standards:
+
+ at itemize @bullet
+
+ at item
+Unnecessary braces can be removed, one line after an if, for, while as
+examples.
+
+ at item
+Space around operators (assignment, logical, relational, bitwise,
+mathematical, shift).
+
+ at item
+Blank line before single-line comments, multi-line comments, javadoc
+comments.
+
+ at item
+If more than 2 blank lines, trim to 2.
+
+ at item
+Don't keep commented out code.  Just remove it or add a real comment
+describing what it used to do and why it is changed to the current
+implementation.
+ at end itemize
+
+
+ at node Hacking Code, Programming Goals, Programming Standards, Top
+ at comment node-name, next, previous, up
+ at chapter Working on the code, Working with others
+
+There are a lot of people helping out with GNU Classpath.  Here are a
+couple of practical guidelines to make working together on the code
+smoother.
+
+The main thing is to always discuss what you are up to on the
+mailinglist.  Making sure that everybody knows who is working on what
+is the most important thing to make sure we cooperate most
+effectively.
+
+We maintain a
+ at uref{http://www.gnu.org/software/classpath/tasks.html,Task List}
+which contains items that you might want to work on.
+
+Before starting to work on something please make sure you read this
+complete guide.  And discuss it on list to make sure your work does
+not duplicate or interferes with work someone else is already doing.
+Always make sure that you submit things that are your own work.  And
+that you have paperwork on file (as stated in the requirements
+section) with the FSF authorizing the use of your additions.
+
+Technically the GNU Classpath project is hosted on
+ at uref{http://savannah.gnu.org/,Savannah} a central point for
+development, distribution and maintenance of GNU Software.  Here you
+will find the
+ at uref{https://savannah.gnu.org/projects/classpath/,project page}, bug
+reports, pending patches, links to mailing lists, news items and CVS.
+
+You can find instructions on getting a CVS checkout for classpath at
+ at uref{https://savannah.gnu.org/cvs/?group=classpath}.
+
+You don't have to get CVS commit write access to contribute, but it is
+sometimes more convenient to be able to add your changes directly to
+the project CVS. Please contact the GNU Classpath savannah admins to
+arrange CVS access if you would like to have it.
+
+Make sure to be subscribed to the commit-classpath mailinglist while
+you are actively hacking on Classpath.  You have to send patches (cvs
+diff -uN) to this list before committing.
+
+We really want to have a pretty open check-in policy.  But this means
+that you should be extra careful if you check something in.  If at all
+in doubt or if you think that something might need extra explaining
+since it is not completely obvious please make a little announcement
+about the change on the mailinglist.  And if you do commit something
+without discussing it first and another GNU Classpath hackers asks for
+extra explanation or suggests to revert a certain commit then please
+reply to the request by explaining why something should be so or if
+you agree to revert it.  (Just reverting immediately is OK without
+discussion, but then please don't mix it with other changes and please
+say so on list.)
+
+Patches that are already approved for libgcj or also OK for Classpath.
+(But you still have to send a patch/diff to the list.)  All other
+patches require you to think whether or not they are really OK and
+non-controversial, or if you would like some feedback first on them
+before committing.  We might get real commit rules in the future, for
+now use your own judgment, but be a bit conservative.
+
+Always contact the GNU Classpath maintainer before adding anything
+non-trivial that you didn't write yourself and that does not come from
+libgcj or from another known GNU Classpath or libgcj hacker.  If you
+have been assigned to commit changes on behalf of another project or
+a company always make sure they come from people who have signed the
+papers for the FSF and/or fall under the arrangement your company made
+with the FSF for contributions.  Mention in the ChangeLog who actually
+wrote the patch.
+
+Commits for completely unrelated changes they should be committed
+separately (especially when doing a formatting change and a logical
+change, do them in two separate commits). But do try to do a commit of
+as much things/files that are done at the same time which can
+logically be seen as part of the same change/cleanup etc.
+
+When the change fixes an important bug or adds nice new functionality
+please write a short entry for inclusion in the @file{NEWS} file.  If it
+changes the VM interface you must mention that in both the @file{NEWS} file
+and the VM Integration Guide.
+
+All the ``rules'' are really meant to make sure that GNU Classpath
+will be maintainable in the long run and to give all the projects that
+are now using GNU Classpath an accurate view of the changes we make to
+the code and to see what changed when.  If you think the requirements
+are ``unworkable'' please try it first for a couple of weeks.  If you
+still feel the same after having some more experience with the project
+please feel free to bring up suggestions for improvements on the list.
+But don't just ignore the rules!  Other hackers depend on them being
+followed to be the most productive they can be (given the above
+constraints).
+
+ at menu
+* Branches::                    
+* Writing ChangeLogs::          
+ at end menu
+
+ at node Branches, Writing ChangeLogs, Hacking Code, Hacking Code
+ at comment node-name, next, previous, up
+ at section Working with branches
+
+Sometimes it is necessary to create branch of the source for doing new
+work that is disruptive to the other hackers, or that needs new
+language or libraries not yet (easily) available.
+
+After discussing the need for a branch on the main mailinglist with
+the other hackers explaining the need of a branch and suggestion of
+the particular branch rules (what will be done on the branch, who will
+work on it, will there be different commit guidelines then for the
+mainline trunk and when is the branch estimated to be finished and
+merged back into the trunk) every GNU Classpath hacker with commit
+access should feel free to create a branch. There are however a couple
+of rules that every branch should follow:
+
+ at itemize @bullet
+
+ at item All branches ought to be documented in the developer wiki at
+ at uref{http://developer.classpath.org/mediation/ClasspathBranches}, so
+we can know which are live, who owns them, and when they die.
+
+ at item Some rules can be changed on a branch.  In particular the branch
+maintainer can change the review requirements, and the requirement of
+keeping things building, testing, etc, can also be lifted.  (These
+should be documented along with the branch name and owner if they
+differ from the trunk.)
+
+ at item Requirements for patch email to classpath-patches and for paperwork
+ at strong{cannot} be lifted. See @ref{Requirements}.
+
+ at item A branch should not be seen as ``private'' or
+``may be completely broken''. It should be as much as possible
+something that you work on with a team (and if there is no team - yet
+- then there is nothing as bad as having a completely broken build to
+get others to help out). There can of course be occasional breakage, but
+it should be planned and explained. And you can certainly have a rule
+like ``please ask me before committing to this branch''.
+
+ at item Merges from the trunk to a branch are at the discretion of the
+branch maintainer.
+
+ at item A merge from a branch to the trunk is treated like any other patch.
+In particular, it has to go through review, it must satisfy all the
+trunk requirements (build, regression test, documentation).
+
+ at item There may be additional timing requirements on merging a branch to
+the trunk depending on the release schedule, etc.  For instance we may
+not want to do a branch merge just before a release.
+
+ at end itemize
+
+If any of these rules are unclear please discuss on the list first.
+
+ at menu
+* Writing ChangeLogs::          
+ at end menu
+
+ at node Writing ChangeLogs,  , Branches, Hacking Code
+ at comment node-name, next, previous, up
+ at section Documenting what changed when with ChangeLog entries
+
+To keep track of who did what when we keep an explicit ChangeLog entry
+together with the code.  This mirrors the CVS commit messages and in
+general the ChangeLog entry is the same as the CVS commit message.
+This provides an easy way for people getting a (snapshot) release or
+without access to the CVS server to see what happened when.  We do not
+generate the ChangeLog file automatically from the CVS server since
+that is not reliable.
+
+A good ChangeLog entry guideline can be found in the Guile Manual at
+ at uref{http://www.gnu.org/software/guile/changelogs/guile-changelogs_3.html}.
+
+Here are some example to explain what should or shouldn't be in a
+ChangeLog entry (and the corresponding commit message):
+
+ at itemize @bullet
+
+ at item
+The first line of a ChangeLog entry should be:
+
+ at example
+[date] <two spaces> [full name] <two spaces> [email-contact]
+ at end example
+
+The second line should be blank. All other lines should be indented
+with one tab.
+
+ at item
+Just state what was changed.  Why something is done as it is done in
+the current code should be either stated in the code itself or be
+added to one of the documentation files (like this Hacking Guide).
+
+So don't write:
+
+ at example
+        * java/awt/font/OpenType.java: Remove 'public static final'
+        from OpenType tags, reverting the change of 2003-08-11.  See
+        Classpath discussion list of 2003-08-11.
+ at end example
+
+Just state:
+
+ at example
+        * java/awt/font/OpenType.java: Remove 'public static final' from
+        all member fields.
+ at end example
+
+In this case the reason for the change was added to this guide.
+
+ at item
+Just as with the normal code style guide, don't make lines longer then
+80 characters.
+
+ at item
+Just as with comments in the code. The ChangeLog entry should be a
+full sentence, starting with a captital and ending with a period.
+
+ at item
+Be precise in what changed, not the effect of the change (which should
+be clear from the code/patch).  So don't write:
+
+ at example
+ * java/io/ObjectOutputStream.java : Allow putFields be called more 
+ than once.
+ at end example
+
+But explain what changed and in which methods it was changed:
+
+ at example
+ * java/io/ObjectOutputStream.java (putFields): Don't call
+ markFieldsWritten(). Only create new PutField when
+ currentPutField is null.
+ (writeFields): Call markFieldsWritten().
+ at end example
+
+ at end itemize
+
+The above are all just guidelines.  We all appreciate the fact that writing
+ChangeLog entries, using a coding style that is not ``your own'' and the
+CVS, patch and diff tools do take some time to getting used to.  So don't
+feel like you have to do it perfect right away or that contributions
+aren't welcome if they aren't ``perfect''.  We all learn by doing and
+interacting with each other.
+
+
+ at node Programming Goals, API Compatibility, Hacking Code, Top
+ at comment node-name, next, previous, up
+ at chapter Programming Goals
+
+When you write code for Classpath, write with three things in mind, and
+in the following order: portability, robustness, and efficiency.
+
+If efficiency breaks portability or robustness, then don't do it the
+efficient way.  If robustness breaks portability, then bye-bye robust
+code.  Of course, as a programmer you would probably like to find sneaky
+ways to get around the issue so that your code can be all three ... the
+following chapters will give some hints on how to do this.
+
+ at menu
+* Portability::                 Writing Portable Software                
+* Utility Classes::             Reusing Software
+* Robustness::                  Writing Robust Software               
+* Java Efficiency::             Writing Efficient Java            
+* Native Efficiency::           Writing Efficient JNI          
+* Security::                    Writing Secure Software
+ at end menu
+
+ at node Portability, Utility Classes, Programming Goals, Programming Goals
+ at comment node-name, next, previous, up
+ at section Portability
+
+The portability goal for Classpath is the following:
+
+ at enumerate
+ at item
+native functions for each platform that work across all VMs on that
+platform
+ at item
+a single classfile set that work across all VMs on all platforms that
+support the native functions.
+ at end enumerate
+
+For almost all of Classpath, this is a very feasible goal, using a
+combination of JNI and native interfaces.  This is what you should shoot
+for.  For those few places that require knowledge of the Virtual Machine
+beyond that provided by the Java standards, the VM Interface was designed.
+Read the Virtual Machine Integration Guide for more information.
+
+Right now the only supported platform is Linux.  This will change as that
+version stabilizes and we begin the effort to port to many other
+platforms.  Jikes RVM runs Classpath on AIX, and generally the Jikes
+RVM team fixes Classpath to work on that platform. 
+
+ at node Utility Classes, Robustness, Portability, Programming Goals
+ at comment  node-name,  next,  previous,  up
+ at section Utility Classes
+
+At the moment, we are not very good at reuse of the JNI code.  There
+have been some attempts, called @dfn{libclasspath}, to
+create generally useful utility classes.  The utility classes are in
+the directory @file{native/jni/classpath} and they are mostly declared
+in @file{native/jni/classpath/jcl.h}.  These utility classes are
+currently only discussed in @ref{Robustness} and in @ref{Native
+Efficiency}.
+
+There are more utility classes available that could be factored out if
+a volunteer wants something nice to hack on.  The error reporting and
+exception throwing functions and macros in
+ at file{native/jni/gtk-peer/gthread-jni.c} might be good
+candidates for reuse.  There are also some generally useful utility
+functions in @file{gnu_java_awt_peer_gtk_GtkMainThread.c} that could
+be split out and put into libclasspath.
+
+ at node Robustness, Java Efficiency, Utility Classes, Programming Goals
+ at comment node-name, next, previous, up
+ at section Robustness
+
+Native code is very easy to make non-robust.  (That's one reason Java is
+so much better!)  Here are a few hints to make your native code more
+robust.
+
+Always check return values for standard functions.  It's sometimes easy
+to forget to check that malloc() return for an error.  Don't make that
+mistake.  (In fact, use JCL_malloc() in the jcl library instead--it will
+check the return value and throw an exception if necessary.)
+
+Always check the return values of JNI functions, or call
+ at code{ExceptionOccurred} to check whether an error occurred.  You must
+do this after @emph{every} JNI call.  JNI does not work well when an
+exception has been raised, and can have unpredictable behavior.
+
+Throw exceptions using @code{JCL_ThrowException}.  This guarantees that if
+something is seriously wrong, the exception text will at least get out
+somewhere (even if it is stderr).
+
+Check for null values of @code{jclass}es before you send them to JNI functions.
+JNI does not behave nicely when you pass a null class to it: it
+terminates Java with a "JNI Panic."
+
+In general, try to use functions in @file{native/jni/classpath/jcl.h}.  They
+check exceptions and return values and throw appropriate exceptions.
+
+ at node Java Efficiency, Native Efficiency, Robustness, Programming Goals
+ at comment node-name, next, previous, up
+ at section Java Efficiency
+
+For methods which explicitly throw a @code{NullPointerException} when an
+argument is passed which is null, per a Sun specification, do not write
+code like:
+
+ at example
+int 
+strlen (String foo) throws NullPointerException
+@{
+  if (foo == null)
+    throw new NullPointerException ("foo is null");
+  return foo.length ();
+@}
+ at end example
+
+Instead, the code should be written as:
+
+ at example
+int
+strlen (String foo) throws NullPointerException
+@{
+  return foo.length ();
+@}
+ at end example
+
+Explicitly comparing foo to null is unnecessary, as the virtual machine
+will throw a NullPointerException when length() is invoked.  Classpath
+is designed to be as fast as possible -- every optimization, no matter
+how small, is important.
+
+ at node Native Efficiency, Security, Java Efficiency, Programming Goals
+ at comment node-name, next, previous, up
+ at section Native Efficiency
+
+You might think that using native methods all over the place would give
+our implementation of Java speed, speed, blinding speed.  You'd be
+thinking wrong.  Would you believe me if I told you that an empty
+ at emph{interpreted} Java method is typically about three and a half times
+ at emph{faster} than the equivalent native method?
+
+Bottom line: JNI is overhead incarnate.  In Sun's implementation, even
+the JNI functions you use once you get into Java are slow.
+
+A final problem is efficiency of native code when it comes to things
+like method calls, fields, finding classes, etc.  Generally you should
+cache things like that in static C variables if you're going to use them
+over and over again.  GetMethodID(), GetFieldID(), and FindClass() are
+ at emph{slow}.  Classpath provides utility libraries for caching methodIDs
+and fieldIDs in @file{native/jni/classpath/jnilink.h}.  Other native data can
+be cached between method calls using functions found in
+ at file{native/jni/classpath/native_state.h}.
+
+Here are a few tips on writing native code efficiently:
+
+Make as few native method calls as possible.  Note that this is not the
+same thing as doing less in native method calls; it just means that, if
+given the choice between calling two native methods and writing a single
+native method that does the job of both, it will usually be better to
+write the single native method.  You can even call the other two native
+methods directly from your native code and not incur the overhead of a
+method call from Java to C.
+
+Cache @code{jmethodID}s and @code{jfieldID}s wherever you can.  String
+lookups are 
+expensive.  The best way to do this is to use the 
+ at file{native/jni/classpath/jnilink.h}
+library.  It will ensure that @code{jmethodID}s are always valid, even if the
+class is unloaded at some point.  In 1.1, jnilink simply caches a
+ at code{NewGlobalRef()} to the method's underlying class; however, when 1.2 comes
+along, it will use a weak reference to allow the class to be unloaded
+and then re-resolve the @code{jmethodID} the next time it is used.
+
+Cache classes that you need to access often.  jnilink will help with
+this as well.  The issue here is the same as the methodID and fieldID
+issue--how to make certain the class reference remains valid.
+
+If you need to associate native C data with your class, use Paul
+Fisher's native_state library (NSA).  It will allow you to get and set
+state fairly efficiently.  Japhar now supports this library, making
+native state get and set calls as fast as accessing a C variable
+directly.
+
+If you are using native libraries defined outside of Classpath, then
+these should be wrapped by a Classpath function instead and defined
+within a library of their own.  This makes porting Classpath's native
+libraries to new platforms easier in the long run.  It would be nice
+to be able to use Mozilla's NSPR or Apache's APR, as these libraries
+are already ported to numerous systems and provide all the necessary
+system functions as well.
+
+ at node Security,  , Native Efficiency, Programming Goals
+ at comment  node-name,  next,  previous,  up
+ at section Security
+
+Security is such a huge topic it probably deserves its own chapter.
+Most of the current code needs to be audited for security to ensure
+all of the proper security checks are in place within the Java
+platform, but also to verify that native code is reasonably secure and
+avoids common pitfalls, buffer overflows, etc.  A good source for
+information on secure programming is the excellent HOWTO by David
+Wheeler,
+ at uref{http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/index.html,Secure
+Programming for Linux and Unix HOWTO}.
+
+ at node API Compatibility, Specification Sources, Programming Goals, Top
+ at comment  node-name,  next,  previous,  up
+ at chapter API Compatibility
+
+ at menu
+* Serialization::               Serialization
+* Deprecated Methods::          Deprecated methods
+ at end menu
+
+ at node Serialization, Deprecated Methods, API Compatibility, API Compatibility
+ at comment  node-name,  next,  previous,  up
+ at section Serialization
+
+Sun has produced documentation concerning much of the information
+needed to make Classpath serializable compatible with Sun
+implementations.  Part of doing this is to make sure that every class
+that is Serializable actually defines a field named serialVersionUID
+with a value that matches the output of serialver on Sun's
+implementation.  The reason for doing this is below.
+
+If a class has a field (of any accessibility) named serialVersionUID
+of type long, that is what serialver uses. Otherwise it computes a
+value using some sort of hash function on the names of all method
+signatures in the .class file.  The fact that different compilers
+create different synthetic method signatures, such as access$0() if an
+inner class needs access to a private member of an enclosing class,
+make it impossible for two distinct compilers to reliably generate the
+same serial #, because their .class files differ. However, once you
+have a .class file, its serial # is unique, and the computation will
+give the same result no matter what platform you execute on.
+
+Serialization compatibility can be tested using tools provided with
+ at uref{http://www.kaffe.org/~stuart/japi/,Japitools}.  These
+tools can test binary serialization compatibility and also provide
+information about unknown serialized formats by writing these in XML
+instead.  Japitools is also the primary means of checking API
+compatibility for GNU Classpath with Sun's Java Platform.
+
+ at node Deprecated Methods,  , Serialization, API Compatibility
+ at comment  node-name,  next,  previous,  up
+ at section Deprecated Methods
+
+Sun has a practice of creating ``alias'' methods, where a public or
+protected method is deprecated in favor of a new one that has the same
+function but a different name.  Sun's reasons for doing this vary; as
+an example, the original name may contain a spelling error or it may
+not follow Java naming conventions.
+
+Unfortunately, this practice complicates class library code that calls
+these aliased methods.  Library code must still call the deprecated
+method so that old client code that overrides it continues to work.
+But library code must also call the new version, because new code is
+expected to override the new method.
+
+The correct way to handle this (and the way Sun does it) may seem
+counterintuitive because it means that new code is less efficient than
+old code: the new method must call the deprecated method, and throughout
+the library code calls to the old method must be replaced with calls to
+the new one.
+
+Take the example of a newly-written container laying out a component and
+wanting to know its preferred size.  The Component class has a
+deprecated preferredSize method and a new method, getPreferredSize. 
+Assume that the container is laying out an old component that overrides
+preferredSize and a new component that overrides getPreferredSize.  If
+the container calls getPreferredSize and the default implementation of
+getPreferredSize calls preferredSize, then the old component will have
+its preferredSize method called and new code will have its
+getPreferredSize method called.
+
+Even using this calling scheme, an old component may still be laid out
+improperly if it implements a method, getPreferredSize, that has the
+same signature as the new Component.getPreferredSize.  But that is a
+general problem -- adding new public or protected methods to a
+widely-used class that calls those methods internally is risky, because
+existing client code may have already declared methods with the same
+signature.
+
+The solution may still seem counterintuitive -- why not have the
+deprecated method call the new method, then have the library always call
+the old method?  One problem with that, using the preferred size example
+again, is that new containers, which will use the non-deprecated
+getPreferredSize, will not get the preferred size of old components.
+
+ at node Specification Sources, Naming Conventions, API Compatibility, Top
+ at comment node-name, next, previous, up
+ at chapter Specification Sources
+
+There are a number of specification sources to use when working on
+Classpath.  In general, the only place you'll find your classes
+specified is in the JavaDoc documentation or possibly in the
+corresponding white paper.  In the case of java.lang, java.io and
+java.util, you should look at the Java Language Specification.
+
+Here, however, is a list of specs, in order of canonicality:
+
+ at enumerate
+ at item
+ at uref{http://java.sun.com/docs/books/jls/clarify.html,Clarifications and Amendments to the JLS - 1.1}
+ at item
+ at uref{http://java.sun.com/docs/books/jls/html/1.1Update.html,JLS Updates
+- 1.1}
+ at item
+ at uref{http://java.sun.com/docs/books/jls/html/index.html,The 1.0 JLS}
+ at item
+ at uref{http://java.sun.com/docs/books/vmspec/index.html,JVM spec - 1.1}
+ at item
+ at uref{http://java.sun.com/products/jdk/1.1/docs/guide/jni/spec/jniTOC.doc.html,JNI spec - 1.1}
+ at item
+ at uref{http://java.sun.com/products/jdk/1.1/docs/api/packages.html,Sun's javadoc - 1.1}
+(since Sun's is the reference implementation, the javadoc is
+documentation for the Java platform itself.)
+ at item
+ at uref{http://java.sun.com/products/jdk/1.2/docs/guide/jvmdi/jvmdi.html,JVMDI spec - 1.2},
+ at uref{http://java.sun.com/products/jdk/1.2/docs/guide/jni/jni-12.html,JNI spec - 1.2}
+(sometimes gives clues about unspecified things in 1.1; if
+it was not specified accurately in 1.1, then use the spec
+for 1.2; also, we are using JVMDI in this project.)
+ at item
+ at uref{http://java.sun.com/products/jdk/1.2/docs/api/frame.html,Sun's javadoc - 1.2}
+(sometimes gives clues about unspecified things in 1.1; if
+it was not specified accurately in 1.1, then use the spec
+for 1.2)
+ at item
+ at uref{http://developer.java.sun.com/developer/bugParade/index.html,The
+Bug Parade}: I have obtained a ton of useful information about how
+things do work and how they *should* work from the Bug Parade just by
+searching for related bugs.  The submitters are very careful about their
+use of the spec.  And if something is unspecified, usually you can find
+a request for specification or a response indicating how Sun thinks it
+should be specified here.
+ at end enumerate
+
+You'll notice that in this document, white papers and specification
+papers are more canonical than the JavaDoc documentation.  This is true
+in general.
+
+
+ at node Naming Conventions, Character Conversions, Specification Sources, Top
+ at comment node-name, next, previous, up
+ at chapter Directory and File Naming Conventions
+
+The Classpath directory structure is laid out in the following manner:
+
+ at example
+classpath
+ |
+ |---->java
+ |       |
+ |       |-->awt
+ |       |-->io
+ |       |-->lang
+ |       |-->util
+ |       |     |
+ |       |     |--->zip
+ |       |     |--->jar
+ |       |-->net
+ |       |-->etc
+ |
+ |---->gnu
+ |       |
+ |       |-->java
+ |             |
+ |             |-->awt
+ |             |-->lang
+ |             |-->util
+ |             |     |
+ |             |     |-->zip
+ |             |-->etc
+ |
+ |---->native
+         |
+         |-->jni
+         |    |-->classpath
+         |    |-->gtk-peer
+         |    |-->java-io
+         |    |-->java-lang
+         |    |-->java-net
+         |    |-->java-util
+         |    |-->etc
+         |-->cni
+  
+ at end example
+
+Here is a brief description of the toplevel directories and their contents.
+
+ at table @b
+
+ at item java
+Contains the source code to the Java packages that make up the core
+class library.  Because this is the public interface to Java, it is
+important that the public classes, interfaces, methods, and variables
+are exactly the same as specified in Sun's documentation.  The directory
+structure is laid out just like the java package names.  For example,
+the class java.util.zip would be in the directory java-util.
+
+ at item gnu/java
+Internal classes (roughly analogous to Sun's sun.* classes) should go
+under the @file{gnu/java} directory.  Classes related to a particular public
+Java package should go in a directory named like that package.  For
+example, classes related to java.util.zip should go under a directory
+ at file{gnu/java/util/zip}.  Sub-packages under the main package name are
+allowed.  For classes spanning multiple public Java packages, pick an
+appropriate name and see what everybody else thinks.
+
+ at item native
+This directory holds native code needed by the public Java packages.
+Each package has its own subdirectory, which is the ``flattened'' name
+of the package.  For example, native method implementations for
+java.util.zip should go in @file{native/classpath/java-util}.  Classpath
+actually includes an all Java version of the zip classes, so no native
+code is required.
+
+ at end table
+
+Each person working on a package get's his or her own ``directory
+space'' underneath each of the toplevel directories.  In addition to the
+general guidelines above, the following standards should be followed:
+
+ at itemize @bullet
+
+ at item
+Classes that need to load native code should load a library with the
+same name as the flattened package name, with all hyphens removed.  For
+example, the native library name specified in LoadLibrary for
+java-util would be ``javautil''.
+
+ at item
+Each package has its own shared library for native code (if any).
+
+ at item
+The main native method implementation for a given method in class should
+go in a file with the same name as the class with a ``.c'' extension.
+For example, the JNI implementation of the native methods in
+java.net.InetAddress would go in @file{native/jni/java-net/InetAddress.c}.
+``Internal'' native functions called from the main native method can
+reside in files of any name.
+ at end itemize
+
+ at node Character Conversions, Localization, Naming Conventions, Top
+ at comment node-name, next, previous, up
+ at chapter Character Conversions
+
+Java uses the Unicode character encoding system internally.  This is a
+sixteen bit (two byte) collection of characters encompassing most of the
+world's written languages.  However, Java programs must often deal with
+outside interfaces that are byte (eight bit) oriented.  For example, a
+Unix file, a stream of data from a network socket, etc.  Beginning with
+Java 1.1, the @code{Reader} and @code{Writer} classes provide functionality
+for dealing with character oriented streams.  The classes 
+ at code{InputStreamReader} and @code{OutputStreamWriter} bridge the gap
+between byte streams and character streams by converting bytes to 
+Unicode characters and vice versa.
+
+In Classpath, @code{InputStreamReader} and @code{OutputStreamWriter}
+rely on an internal class called @code{gnu.java.io.EncodingManager} to load
+translaters that perform the actual conversion.  There are two types of
+converters, encoders and decoders.  Encoders are subclasses of
+ at code{gnu.java.io.encoder.Encoder}.  This type of converter takes a Java
+(Unicode) character stream or buffer and converts it to bytes using
+a specified encoding scheme.  Decoders are a subclass of 
+ at code{gnu.java.io.decoder.Decoder}.  This type of converter takes a 
+byte stream or buffer and converts it to Unicode characters.  The
+ at code{Encoder} and @code{Decoder} classes are subclasses of
+ at code{Writer} and @code{Reader} respectively, and so can be used in
+contexts that require character streams, but the Classpath implementation
+currently does not make use of them in this fashion.
+
+The @code{EncodingManager} class searches for requested encoders and
+decoders by name.  Since encoders and decoders are separate in Classpath,
+it is possible to have a decoder without an encoder for a particular 
+encoding scheme, or vice versa.  @code{EncodingManager} searches the
+package path specified by the @code{file.encoding.pkg} property.  The
+name of the encoder or decoder is appended to the search path to
+produce the required class name.  Note that @code{EncodingManager} knows
+about the default system encoding scheme, which it retrieves from the
+system property @code{file.encoding}, and it will return the proper
+translator for the default encoding if no scheme is specified.  Also, the 
+Classpath standard translator library, which is the @code{gnu.java.io} package, 
+is automatically appended to the end of the path.
+
+For efficiency, @code{EncodingManager} maintains a cache of translators
+that it has loaded.  This eliminates the need to search for a commonly
+used translator each time it is requested.
+
+Finally, @code{EncodingManager} supports aliasing of encoding scheme names.
+For example, the ISO Latin-1 encoding scheme can be referred to as
+''8859_1'' or ''ISO-8859-1''.  @code{EncodingManager} searches for 
+aliases by looking for the existence of a system property called
+ at code{gnu.java.io.encoding_scheme_alias.<encoding name>}.  If such a
+property exists.  The value of that property is assumed to be the
+canonical name of the encoding scheme, and a translator with that name is 
+looked up instead of one with the original name.
+
+Here is an example of how @code{EncodingManager} works.  A class requests
+a decoder for the ''UTF-8'' encoding scheme by calling
+ at code{EncodingManager.getDecoder("UTF-8")}.  First, an alias is searched
+for by looking for the system property 
+ at code{gnu.java.io.encoding_scheme_alias.UTF-8}.  In our example, this
+property exists and has the value ''UTF8''.  That is the actual
+decoder that will be searched for.  Next, @code{EncodingManager} looks
+in its cache for this translator.  Assuming it does not find it, it
+searches the translator path, which is this example consists only of
+the default @code{gnu.java.io}.  The ''decoder'' package name is 
+appended since we are looking for a decoder.  (''encoder'' would be 
+used if we were looking for an encoder).  Then name name of the translator
+is appended.  So @code{EncodingManager} attempts to load a translator
+class called @code{gnu.java.io.decoder.UTF8}.  If that class is found,
+an instance of it is returned.  If it is not found, a
+ at code{UnsupportedEncodingException}.
+
+To write a new translator, it is only necessary to subclass 
+ at code{Encoder} and/or @code{Decoder}.  Only a handful of abstract
+methods need to be implemented.  In general, no methods need to be
+overridden.  The needed methods calculate the number of bytes/chars
+that the translation will generate, convert buffers to/from bytes,
+and read/write a requested number of characters to/from a stream.
+
+Many common encoding schemes use only eight bits to encode characters.
+Writing a translator for these encodings is very easy.  There are 
+abstract translator classes @code{gnu.java.io.decode.DecoderEightBitLookup}
+and @code{gnu.java.io.encode.EncoderEightBitLookup}.  These classes
+implement all of the necessary methods.  All that is necessary to
+create a lookup table array that maps bytes to Unicode characters and
+set the class variable @code{lookup_table} equal to it in a static
+initializer.  Also, a single constructor that takes an appropriate
+stream as an argument must be supplied.  These translators are
+exceptionally easy to create and there are several of them supplied
+in the Classpath distribution.
+
+Writing multi-byte or variable-byte encodings is more difficult, but
+often not especially challenging.  The Classpath distribution ships with
+translators for the UTF8 encoding scheme which uses from one to three
+bytes to encode Unicode characters.  This can serve as an example of
+how to write such a translator.
+
+Many more translators are needed.  All major character encodings should
+eventually be supported.
+
+ at node Localization,  , Character Conversions, Top
+ at comment node-name, next, previous, up
+ at chapter Localization
+
+There are many parts of the Java standard runtime library that must
+be customized to the particular locale the program is being run in.
+These include the parsing and display of dates, times, and numbers;
+sorting words alphabetically; breaking sentences into words, etc.
+In general, Classpath uses general classes for performing these tasks,
+and customizes their behavior with configuration data specific to a
+given locale.
+
+ at menu
+* String Collation::            Sorting strings in different locales
+* Break Iteration::             Breaking up text into words, sentences, and lines
+* Date Formatting and Parsing::  Locale specific date handling
+* Decimal/Currency Formatting and Parsing::  Local specific number handling
+ at end menu
+
+In Classpath, all locale specific data is stored in a 
+ at code{ListResourceBundle} class in the package @code{gnu/java/locale}.
+The basename of the bundle is @code{LocaleInformation}.  See the
+documentation for the @code{java.util.ResourceBundle} class for details
+on how the specific locale classes should be named.
+
+ at code{ListResourceBundle}'s are used instead of 
+ at code{PropertyResourceBundle}'s because data more complex than simple
+strings need to be provided to configure certain Classpath components.
+Because @code{ListResourceBundle} allows an arbitrary Java object to
+be associated with a given configuration option, it provides the
+needed flexibility to accomodate Classpath's needs.
+
+Each Java library component that can be localized requires that certain
+configuration options be specified in the resource bundle for it.  It is
+important that each and every option be supplied for a specific 
+component or a critical runtime error will most likely result.
+
+As a standard, each option should be assigned a name that is a string.
+If the value is stored in a class or instance variable, then the option
+should name should have the name name as the variable.  Also, the value
+associated with each option should be a Java object with the same name
+as the option name (unless a simple scalar value is used).  Here is an
+example:
+
+A class loads a value for the @code{format_string} variable from the
+resource bundle in the specified locale.  Here is the code in the
+library class:
+
+ at example
+  ListResourceBundle lrb = 
+    ListResourceBundle.getBundle ("gnu/java/locale/LocaleInformation", locale);
+  String format_string = lrb.getString ("format_string");
+ at end example
+
+In the actual resource bundle class, here is how the configuration option
+gets defined:
+
+ at example
+/**
+  * This is the format string used for displaying values
+  */
+private static final String format_string = "%s %d %i";
+
+private static final Object[][] contents =
+@{
+  @{ "format_string", format_string @}
+@};
+ at end example
+
+Note that each variable should be @code{private}, @code{final}, and
+ at code{static}.  Each variable should also have a description of what it
+does as a documentation comment.  The @code{getContents()} method returns
+the @code{contents} array.
+
+There are many functional areas of the standard class library that are
+configured using this mechanism.  A given locale does not need to support
+each functional area.  But if a functional area is supported, then all
+of the specified entries for that area must be supplied.  In order to
+determine which functional areas are supported, there is a special key
+that is queried by the affected class or classes.  If this key exists, 
+and has a value that is a @code{Boolean} object wrappering the
+ at code{true} value, then full support is assumed.  Otherwise it is
+assumed that no support exists for this functional area.  Every class
+using resources for configuration must use this scheme and define a special
+scheme that indicates the functional area is supported.  Simply checking
+for the resource bundle's existence is not sufficient to ensure that a
+given functional area is supported.
+
+The following sections define the functional areas that use resources
+for locale specific configuration in GNU Classpath.  Please refer to the 
+documentation for the classes mentioned for details on how these values 
+are used.  You may also wish to look at the source file for 
+ at file{gnu/java/locale/LocaleInformation_en} as an example.
+
+ at node String Collation, Break Iteration, Localization, Localization
+ at comment node-name, next, previous, up
+ at section String Collation
+
+Collation involves the sorting of strings.  The Java class library provides
+a public class called @code{java.text.RuleBasedCollator} that performs
+sorting based on a set of sorting rules.
+
+ at itemize @bullet
+ at item RuleBasedCollator - A @code{Boolean} wrappering @code{true} to indicate
+that this functional area is supported.
+ at item collation_rules - The rules the specify how string collation is to
+be performed.
+ at end itemize
+
+Note that some languages might be too complex for @code{RuleBasedCollator}
+to handle.  In this case an entirely new class might need to be written in
+lieu of defining this rule string.
+
+ at node Break Iteration, Date Formatting and Parsing, String Collation, Localization
+ at comment node-name, next, previous, up
+ at section Break Iteration
+
+The class @code{java.text.BreakIterator} breaks text into words, sentences,
+and lines.  It is configured with the following resource bundle entries:
+
+ at itemize @bullet
+ at item BreakIterator - A @code{Boolean} wrappering @code{true} to indicate
+that this functional area is supported.
+ at item word_breaks - A @code{String} array of word break character sequences.
+ at item sentence_breaks - A @code{String} array of sentence break character
+sequences.
+ at item line_breaks - A @code{String} array of line break character sequences.
+ at end itemize
+
+ at node Date Formatting and Parsing, Decimal/Currency Formatting and Parsing, Break Iteration, Localization
+ at comment node-name, next, previous, up
+ at section Date Formatting and Parsing
+
+Date formatting and parsing is handled by the 
+ at code{java.text.SimpleDateFormat} class in most locales.  This class is
+configured by attaching an instance of the @code{java.text.DateFormatSymbols}
+class.  That class simply reads properties from our locale specific
+resource bundle.  The following items are required (refer to the 
+documentation of the @code{java.text.DateFormatSymbols} class for details
+io what the actual values should be):
+
+ at itemize @bullet
+ at item DateFormatSymbols - A @code{Boolean} wrappering @code{true} to indicate
+that this functional area is supported.
+ at item months - A @code{String} array of month names.
+ at item shortMonths - A @code{String} array of abbreviated month names.
+ at item weekdays - A @code{String} array of weekday names.
+ at item shortWeekdays - A @code{String} array of abbreviated weekday names.
+ at item ampms - A @code{String} array containing AM/PM names.
+ at item eras - A @code{String} array containing era (ie, BC/AD) names.
+ at item zoneStrings - An array of information about valid timezones for this 
+locale.
+ at item localPatternChars - A @code{String} defining date/time pattern symbols.
+ at item shortDateFormat - The format string for dates used by 
+ at code{DateFormat.SHORT}
+ at item mediumDateFormat - The format string for dates used by 
+ at code{DateFormat.MEDIUM}
+ at item longDateFormat - The format string for dates used by 
+ at code{DateFormat.LONG}
+ at item fullDateFormat - The format string for dates used by 
+ at code{DateFormat.FULL}
+ at item shortTimeFormat - The format string for times used by 
+ at code{DateFormat.SHORT}
+ at item mediumTimeFormat - The format string for times used by 
+ at code{DateFormat.MEDIUM}
+ at item longTimeFormat - The format string for times used by 
+ at code{DateFormat.LONG}
+ at item fullTimeFormat - The format string for times used by 
+ at code{DateFormat.FULL}
+ at end itemize
+
+Note that it may not be possible to use this mechanism for all locales.
+In those cases a special purpose class may need to be written to handle 
+date/time processing.
+
+ at node Decimal/Currency Formatting and Parsing,  , Date Formatting and Parsing, Localization
+ at comment node-name, next, previous, up
+ at section Decimal/Currency Formatting and Parsing
+
+ at code{NumberFormat} is an abstract class for formatting and parsing numbers.
+The class @code{DecimalFormat} provides a concrete subclass that handles
+this is in a locale independent manner.  As with @code{SimpleDateFormat},
+this class gets information on how to format numbers from a class that
+wrappers a collection of locale specific formatting values.  In this case,
+the class is @code{DecimalFormatSymbols}.  That class reads its default
+values for a locale from the resource bundle.  The required entries are:
+
+ at itemize @bullet
+ at item DecimalFormatSymbols - A @code{Boolean} wrappering @code{true} to 
+indicate that this functional area is supported.
+ at item currencySymbol - The string representing the local currency.
+ at item intlCurrencySymbol - The string representing the local currency in an
+international context.
+ at item decimalSeparator - The character to use as the decimal point as a
+ at code{String}.
+ at item digit - The character used to represent digits in a format string,
+as a @code{String}.
+ at item exponential - The char used to represent the exponent separator of a 
+number written in scientific notation, as a @code{String}.
+ at item groupingSeparator - The character used to separate groups of numbers
+in a large number, such as the ``,'' separator for thousands in the US, as
+a @code{String}.
+ at item infinity - The string representing infinity.
+ at item NaN - The string representing the Java not a number value.
+ at item minusSign - The character representing the negative sign, as a 
+ at code{String}.
+ at item monetarySeparator - The decimal point used in currency values, as a
+ at code{String}.
+ at item patternSeparator - The character used to separate positive and 
+negative format patterns, as a @code{String}.
+ at item percent - The percent sign, as a @code{String}.
+ at item perMill - The per mille sign, as a @code{String}.
+ at item zeroDigit - The character representing the digit zero, as a @code{String}.
+ at end itemize
+
+Note that several of these values are an individual character.  These should
+be wrappered in a @code{String} at character position 0, not in a
+ at code{Character} object.
+
+ at bye
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/doc/texinfo.tex
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/doc/texinfo.tex?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/doc/texinfo.tex (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/doc/texinfo.tex Thu Nov  8 16:56:19 2007
@@ -0,0 +1,6341 @@
+% texinfo.tex -- TeX macros to handle Texinfo files.
+%
+% Load plain if necessary, i.e., if running under initex.
+\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
+%
+\def\texinfoversion{2002-06-04.06}
+%
+% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+%               2000, 01, 02 Free Software Foundation, Inc.
+%
+% This texinfo.tex file 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.
+%
+% This texinfo.tex file is distributed in the hope that it will be
+% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+% General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this texinfo.tex file; see the file COPYING.  If not, write
+% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+% Boston, MA 02110-1301, USA.
+%
+% In other words, you are welcome to use, share and improve this program.
+% You are forbidden to forbid anyone else to use, share and improve
+% what you give them.   Help stamp out software-hoarding!
+%
+% Please try the latest version of texinfo.tex before submitting bug
+% reports; you can get the latest version from:
+%   ftp://ftp.gnu.org/gnu/texinfo.tex
+%     (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
+%   ftp://texinfo.org/texinfo/texinfo.tex
+%   ftp://tug.org/tex/texinfo.tex
+%     (and all CTAN mirrors, see http://www.ctan.org),
+%   and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
+% 
+% The texinfo.tex in any given Texinfo distribution could well be out
+% of date, so if that's what you're using, please check.
+% 
+% Texinfo has a small home page at http://texinfo.org/ and also
+% http://www.gnu.org/software/texinfo.
+%
+% Send bug reports to bug-texinfo at gnu.org.  Please include including a
+% complete document in each bug report with which we can reproduce the
+% problem.  Patches are, of course, greatly appreciated.
+%
+% To process a Texinfo manual with TeX, it's most reliable to use the
+% texi2dvi shell script that comes with the distribution.  For a simple
+% manual foo.texi, however, you can get away with this:
+%   tex foo.texi
+%   texindex foo.??
+%   tex foo.texi
+%   tex foo.texi
+%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
+% The extra TeX runs get the cross-reference information correct.
+% Sometimes one run after texindex suffices, and sometimes you need more
+% than two; texi2dvi does it as many times as necessary.
+%
+% It is possible to adapt texinfo.tex for other languages.  You can get
+% the existing language-specific files from the full Texinfo distribution.
+
+\message{Loading texinfo [version \texinfoversion]:}
+
+% If in a .fmt file, print the version number
+% and turn on active characters that we couldn't do earlier because
+% they might have appeared in the input file name.
+\everyjob{\message{[Texinfo version \texinfoversion]}%
+  \catcode`+=\active \catcode`\_=\active}
+
+% Save some parts of plain tex whose names we will redefine.
+\let\ptexb=\b
+\let\ptexbullet=\bullet
+\let\ptexc=\c
+\let\ptexcomma=\,
+\let\ptexdot=\.
+\let\ptexdots=\dots
+\let\ptexend=\end
+\let\ptexequiv=\equiv
+\let\ptexexclam=\!
+\let\ptexi=\i
+\let\ptexlbrace=\{
+\let\ptexrbrace=\}
+\let\ptexstar=\*
+\let\ptext=\t
+
+% We never want plain's outer \+ definition in Texinfo.
+% For @tex, we can use \tabalign.
+\let\+ = \relax
+
+\message{Basics,}
+\chardef\other=12
+
+% If this character appears in an error message or help string, it
+% starts a new line in the output.
+\newlinechar = `^^J
+
+% Set up fixed words for English if not already set.
+\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
+\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
+\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
+\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
+\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
+\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
+\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
+\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
+\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
+\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
+\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
+\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
+\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
+\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
+\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
+\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
+\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
+\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
+\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
+%
+\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
+\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
+\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
+\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
+\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
+\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
+\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
+\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
+\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
+\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
+\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
+\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
+%
+\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
+\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
+\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
+\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
+\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
+\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
+\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
+
+% Ignore a token.
+%
+\def\gobble#1{}
+
+\hyphenation{ap-pen-dix}
+\hyphenation{mini-buf-fer mini-buf-fers}
+\hyphenation{eshell}
+\hyphenation{white-space}
+
+% Margin to add to right of even pages, to left of odd pages.
+\newdimen \bindingoffset
+\newdimen \normaloffset
+\newdimen\pagewidth \newdimen\pageheight
+
+% Sometimes it is convenient to have everything in the transcript file
+% and nothing on the terminal.  We don't just call \tracingall here,
+% since that produces some useless output on the terminal.
+%
+\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
+\ifx\eTeXversion\undefined
+\def\loggingall{\tracingcommands2 \tracingstats2
+   \tracingpages1 \tracingoutput1 \tracinglostchars1
+   \tracingmacros2 \tracingparagraphs1 \tracingrestores1
+   \showboxbreadth\maxdimen\showboxdepth\maxdimen
+}%
+\else
+\def\loggingall{\tracingcommands3 \tracingstats2
+   \tracingpages1 \tracingoutput1 \tracinglostchars1
+   \tracingmacros2 \tracingparagraphs1 \tracingrestores1
+   \tracingscantokens1 \tracingassigns1 \tracingifs1
+   \tracinggroups1 \tracingnesting2
+   \showboxbreadth\maxdimen\showboxdepth\maxdimen
+}%
+\fi
+
+% add check for \lastpenalty to plain's definitions.  If the last thing
+% we did was a \nobreak, we don't want to insert more space.
+% 
+\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
+  \removelastskip\penalty-50\smallskip\fi\fi}
+\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
+  \removelastskip\penalty-100\medskip\fi\fi}
+\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
+  \removelastskip\penalty-200\bigskip\fi\fi}
+
+% For @cropmarks command.
+% Do @cropmarks to get crop marks.
+%
+\newif\ifcropmarks
+\let\cropmarks = \cropmarkstrue
+%
+% Dimensions to add cropmarks at corners.
+% Added by P. A. MacKay, 12 Nov. 1986
+%
+\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
+\newdimen\cornerlong  \cornerlong=1pc
+\newdimen\cornerthick \cornerthick=.3pt
+\newdimen\topandbottommargin \topandbottommargin=.75in
+
+% Main output routine.
+\chardef\PAGE = 255
+\output = {\onepageout{\pagecontents\PAGE}}
+
+\newbox\headlinebox
+\newbox\footlinebox
+
+% \onepageout takes a vbox as an argument.  Note that \pagecontents
+% does insertions, but you have to call it yourself.
+\def\onepageout#1{%
+  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
+  %
+  \ifodd\pageno  \advance\hoffset by \bindingoffset
+  \else \advance\hoffset by -\bindingoffset\fi
+  %
+  % Do this outside of the \shipout so @code etc. will be expanded in
+  % the headline as they should be, not taken literally (outputting ''code).
+  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
+  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
+  %
+  {%
+    % Have to do this stuff outside the \shipout because we want it to
+    % take effect in \write's, yet the group defined by the \vbox ends
+    % before the \shipout runs.
+    %
+    \escapechar = `\\     % use backslash in output files.
+    \indexdummies         % don't expand commands in the output.
+    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
+                   % the page break happens to be in the middle of an example.
+    \shipout\vbox{%
+      % Do this early so pdf references go to the beginning of the page.
+      \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
+      %
+      \ifcropmarks \vbox to \outervsize\bgroup
+        \hsize = \outerhsize
+        \vskip-\topandbottommargin
+        \vtop to0pt{%
+          \line{\ewtop\hfil\ewtop}%
+          \nointerlineskip
+          \line{%
+            \vbox{\moveleft\cornerthick\nstop}%
+            \hfill
+            \vbox{\moveright\cornerthick\nstop}%
+          }%
+          \vss}%
+        \vskip\topandbottommargin
+        \line\bgroup
+          \hfil % center the page within the outer (page) hsize.
+          \ifodd\pageno\hskip\bindingoffset\fi
+          \vbox\bgroup
+      \fi
+      %
+      \unvbox\headlinebox
+      \pagebody{#1}%
+      \ifdim\ht\footlinebox > 0pt
+        % Only leave this space if the footline is nonempty.
+        % (We lessened \vsize for it in \oddfootingxxx.)
+        % The \baselineskip=24pt in plain's \makefootline has no effect.
+        \vskip 2\baselineskip
+        \unvbox\footlinebox
+      \fi
+      %
+      \ifcropmarks
+          \egroup % end of \vbox\bgroup
+        \hfil\egroup % end of (centering) \line\bgroup
+        \vskip\topandbottommargin plus1fill minus1fill
+        \boxmaxdepth = \cornerthick
+        \vbox to0pt{\vss
+          \line{%
+            \vbox{\moveleft\cornerthick\nsbot}%
+            \hfill
+            \vbox{\moveright\cornerthick\nsbot}%
+          }%
+          \nointerlineskip
+          \line{\ewbot\hfil\ewbot}%
+        }%
+      \egroup % \vbox from first cropmarks clause
+      \fi
+    }% end of \shipout\vbox
+  }% end of group with \turnoffactive
+  \advancepageno
+  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
+}
+
+\newinsert\margin \dimen\margin=\maxdimen
+
+\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
+{\catcode`\@ =11
+\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
+% marginal hacks, juha at viisa.uucp (Juha Takala)
+\ifvoid\margin\else % marginal info is present
+  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
+\dimen@=\dp#1 \unvbox#1
+\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
+\ifr at ggedbottom \kern-\dimen@ \vfil \fi}
+}
+
+% Here are the rules for the cropmarks.  Note that they are
+% offset so that the space between them is truly \outerhsize or \outervsize
+% (P. A. MacKay, 12 November, 1986)
+%
+\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
+\def\nstop{\vbox
+  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
+\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
+\def\nsbot{\vbox
+  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
+
+% Parse an argument, then pass it to #1.  The argument is the rest of
+% the input line (except we remove a trailing comment).  #1 should be a
+% macro which expects an ordinary undelimited TeX argument.
+%
+\def\parsearg#1{%
+  \let\next = #1%
+  \begingroup
+    \obeylines
+    \futurelet\temp\parseargx
+}
+
+% If the next token is an obeyed space (from an @example environment or
+% the like), remove it and recurse.  Otherwise, we're done.
+\def\parseargx{%
+  % \obeyedspace is defined far below, after the definition of \sepspaces.
+  \ifx\obeyedspace\temp
+    \expandafter\parseargdiscardspace
+  \else
+    \expandafter\parseargline
+  \fi
+}
+
+% Remove a single space (as the delimiter token to the macro call).
+{\obeyspaces %
+ \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
+
+{\obeylines %
+  \gdef\parseargline#1^^M{%
+    \endgroup % End of the group started in \parsearg.
+    %
+    % First remove any @c comment, then any @comment.
+    % Result of each macro is put in \toks0.
+    \argremovec #1\c\relax %
+    \expandafter\argremovecomment \the\toks0 \comment\relax %
+    %
+    % Call the caller's macro, saved as \next in \parsearg.
+    \expandafter\next\expandafter{\the\toks0}%
+  }%
+}
+
+% Since all \c{,omment} does is throw away the argument, we can let TeX
+% do that for us.  The \relax here is matched by the \relax in the call
+% in \parseargline; it could be more or less anything, its purpose is
+% just to delimit the argument to the \c.
+\def\argremovec#1\c#2\relax{\toks0 = {#1}}
+\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
+
+% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
+%    @end itemize  @c foo
+% will have two active spaces as part of the argument with the
+% `itemize'.  Here we remove all active spaces from #1, and assign the
+% result to \toks0.
+%
+% This loses if there are any *other* active characters besides spaces
+% in the argument -- _ ^ +, for example -- since they get expanded.
+% Fortunately, Texinfo does not define any such commands.  (If it ever
+% does, the catcode of the characters in questionwill have to be changed
+% here.)  But this means we cannot call \removeactivespaces as part of
+% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
+% that \parsearg gets might well have any character at all in it.
+%
+\def\removeactivespaces#1{%
+  \begingroup
+    \ignoreactivespaces
+    \edef\temp{#1}%
+    \global\toks0 = \expandafter{\temp}%
+  \endgroup
+}
+
+% Change the active space to expand to nothing.
+%
+\begingroup
+  \obeyspaces
+  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
+\endgroup
+
+
+\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
+
+%% These are used to keep @begin/@end levels from running away
+%% Call \inENV within environments (after a \begingroup)
+\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
+\def\ENVcheck{%
+\ifENV\errmessage{Still within an environment; press RETURN to continue}
+\endgroup\fi} % This is not perfect, but it should reduce lossage
+
+% @begin foo  is the same as @foo, for now.
+\newhelp\EMsimple{Press RETURN to continue.}
+
+\outer\def\begin{\parsearg\beginxxx}
+
+\def\beginxxx #1{%
+\expandafter\ifx\csname #1\endcsname\relax
+{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
+\csname #1\endcsname\fi}
+
+% @end foo executes the definition of \Efoo.
+%
+\def\end{\parsearg\endxxx}
+\def\endxxx #1{%
+  \removeactivespaces{#1}%
+  \edef\endthing{\the\toks0}%
+  %
+  \expandafter\ifx\csname E\endthing\endcsname\relax
+    \expandafter\ifx\csname \endthing\endcsname\relax
+      % There's no \foo, i.e., no ``environment'' foo.
+      \errhelp = \EMsimple
+      \errmessage{Undefined command `@end \endthing'}%
+    \else
+      \unmatchedenderror\endthing
+    \fi
+  \else
+    % Everything's ok; the right environment has been started.
+    \csname E\endthing\endcsname
+  \fi
+}
+
+% There is an environment #1, but it hasn't been started.  Give an error.
+%
+\def\unmatchedenderror#1{%
+  \errhelp = \EMsimple
+  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
+}
+
+% Define the control sequence \E#1 to give an unmatched @end error.
+%
+\def\defineunmatchedend#1{%
+  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
+}
+
+
+% Single-spacing is done by various environments (specifically, in
+% \nonfillstart and \quotations).
+\newskip\singlespaceskip \singlespaceskip = 12.5pt
+\def\singlespace{%
+  % Why was this kern here?  It messes up equalizing space above and below
+  % environments.  --karl, 6may93
+  %{\advance \baselineskip by -\singlespaceskip
+  %\kern \baselineskip}%
+  \setleading\singlespaceskip
+}
+
+%% Simple single-character @ commands
+
+% @@ prints an @
+% Kludge this until the fonts are right (grr).
+\def\@{{\tt\char64}}
+
+% This is turned off because it was never documented
+% and you can use @w{...} around a quote to suppress ligatures.
+%% Define @` and @' to be the same as ` and '
+%% but suppressing ligatures.
+%\def\`{{`}}
+%\def\'{{'}}
+
+% Used to generate quoted braces.
+\def\mylbrace {{\tt\char123}}
+\def\myrbrace {{\tt\char125}}
+\let\{=\mylbrace
+\let\}=\myrbrace
+\begingroup
+  % Definitions to produce actual \{ & \} command in an index.
+  \catcode`\{ = 12 \catcode`\} = 12
+  \catcode`\[ = 1 \catcode`\] = 2
+  \catcode`\@ = 0 \catcode`\\ = 12
+  @gdef at lbracecmd[\{]%
+  @gdef at rbracecmd[\}]%
+ at endgroup
+
+% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
+% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
+\let\, = \c
+\let\dotaccent = \.
+\def\ringaccent#1{{\accent23 #1}}
+\let\tieaccent = \t
+\let\ubaraccent = \b
+\let\udotaccent = \d
+
+% Other special characters: @questiondown @exclamdown
+% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
+\def\questiondown{?`}
+\def\exclamdown{!`}
+
+% Dotless i and dotless j, used for accents.
+\def\imacro{i}
+\def\jmacro{j}
+\def\dotless#1{%
+  \def\temp{#1}%
+  \ifx\temp\imacro \ptexi
+  \else\ifx\temp\jmacro \j
+  \else \errmessage{@dotless can be used only with i or j}%
+  \fi\fi
+}
+
+% Be sure we're in horizontal mode when doing a tie, since we make space
+% equivalent to this in @example-like environments. Otherwise, a space
+% at the beginning of a line will start with \penalty -- and
+% since \penalty is valid in vertical mode, we'd end up putting the
+% penalty on the vertical list instead of in the new paragraph.
+{\catcode`@ = 11
+ % Avoid using \@M directly, because that causes trouble
+ % if the definition is written into an index file.
+ \global\let\tiepenalty = \@M
+ \gdef\tie{\leavevmode\penalty\tiepenalty\ }
+}
+
+% @: forces normal size whitespace following.
+\def\:{\spacefactor=1000 }
+
+% @* forces a line break.
+\def\*{\hfil\break\hbox{}\ignorespaces}
+
+% @. is an end-of-sentence period.
+\def\.{.\spacefactor=3000 }
+
+% @! is an end-of-sentence bang.
+\def\!{!\spacefactor=3000 }
+
+% @? is an end-of-sentence query.
+\def\?{?\spacefactor=3000 }
+
+% @w prevents a word break.  Without the \leavevmode, @w at the
+% beginning of a paragraph, when TeX is still in vertical mode, would
+% produce a whole line of output instead of starting the paragraph.
+\def\w#1{\leavevmode\hbox{#1}}
+
+% @group ... @end group forces ... to be all on one page, by enclosing
+% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
+% to keep its height that of a normal line.  According to the rules for
+% \topskip (p.114 of the TeXbook), the glue inserted is
+% max (\topskip - \ht (first item), 0).  If that height is large,
+% therefore, no glue is inserted, and the space between the headline and
+% the text is small, which looks bad.
+%
+\def\group{\begingroup
+  \ifnum\catcode13=\active \else
+    \errhelp = \groupinvalidhelp
+    \errmessage{@group invalid in context where filling is enabled}%
+  \fi
+  %
+  % The \vtop we start below produces a box with normal height and large
+  % depth; thus, TeX puts \baselineskip glue before it, and (when the
+  % next line of text is done) \lineskip glue after it.  (See p.82 of
+  % the TeXbook.)  Thus, space below is not quite equal to space
+  % above.  But it's pretty close.
+  \def\Egroup{%
+    \egroup           % End the \vtop.
+    \endgroup         % End the \group.
+  }%
+  %
+  \vtop\bgroup
+    % We have to put a strut on the last line in case the @group is in
+    % the midst of an example, rather than completely enclosing it.
+    % Otherwise, the interline space between the last line of the group
+    % and the first line afterwards is too small.  But we can't put the
+    % strut in \Egroup, since there it would be on a line by itself.
+    % Hence this just inserts a strut at the beginning of each line.
+    \everypar = {\strut}%
+    %
+    % Since we have a strut on every line, we don't need any of TeX's
+    % normal interline spacing.
+    \offinterlineskip
+    %
+    % OK, but now we have to do something about blank
+    % lines in the input in @example-like environments, which normally
+    % just turn into \lisppar, which will insert no space now that we've
+    % turned off the interline space.  Simplest is to make them be an
+    % empty paragraph.
+    \ifx\par\lisppar
+      \edef\par{\leavevmode \par}%
+      %
+      % Reset ^^M's definition to new definition of \par.
+      \obeylines
+    \fi
+    %
+    % Do @comment since we are called inside an environment such as
+    % @example, where each end-of-line in the input causes an
+    % end-of-line in the output.  We don't want the end-of-line after
+    % the `@group' to put extra space in the output.  Since @group
+    % should appear on a line by itself (according to the Texinfo
+    % manual), we don't worry about eating any user text.
+    \comment
+}
+%
+% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
+% message, so this ends up printing `@group can only ...'.
+%
+\newhelp\groupinvalidhelp{%
+group can only be used in environments such as @example,^^J%
+where each line of input produces a line of output.}
+
+% @need space-in-mils
+% forces a page break if there is not space-in-mils remaining.
+
+\newdimen\mil  \mil=0.001in
+
+\def\need{\parsearg\needx}
+
+% Old definition--didn't work.
+%\def\needx #1{\par %
+%% This method tries to make TeX break the page naturally
+%% if the depth of the box does not fit.
+%{\baselineskip=0pt%
+%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
+%\prevdepth=-1000pt
+%}}
+
+\def\needx#1{%
+  % Ensure vertical mode, so we don't make a big box in the middle of a
+  % paragraph.
+  \par
+  %
+  % If the @need value is less than one line space, it's useless.
+  \dimen0 = #1\mil
+  \dimen2 = \ht\strutbox
+  \advance\dimen2 by \dp\strutbox
+  \ifdim\dimen0 > \dimen2
+    %
+    % Do a \strut just to make the height of this box be normal, so the
+    % normal leading is inserted relative to the preceding line.
+    % And a page break here is fine.
+    \vtop to #1\mil{\strut\vfil}%
+    %
+    % TeX does not even consider page breaks if a penalty added to the
+    % main vertical list is 10000 or more.  But in order to see if the
+    % empty box we just added fits on the page, we must make it consider
+    % page breaks.  On the other hand, we don't want to actually break the
+    % page after the empty box.  So we use a penalty of 9999.
+    %
+    % There is an extremely small chance that TeX will actually break the
+    % page at this \penalty, if there are no other feasible breakpoints in
+    % sight.  (If the user is using lots of big @group commands, which
+    % almost-but-not-quite fill up a page, TeX will have a hard time doing
+    % good page breaking, for example.)  However, I could not construct an
+    % example where a page broke at this \penalty; if it happens in a real
+    % document, then we can reconsider our strategy.
+    \penalty9999
+    %
+    % Back up by the size of the box, whether we did a page break or not.
+    \kern -#1\mil
+    %
+    % Do not allow a page break right after this kern.
+    \nobreak
+  \fi
+}
+
+% @br   forces paragraph break
+
+\let\br = \par
+
+% @dots{} output an ellipsis using the current font.
+% We do .5em per period so that it has the same spacing in a typewriter
+% font as three actual period characters.
+%
+\def\dots{%
+  \leavevmode
+  \hbox to 1.5em{%
+    \hskip 0pt plus 0.25fil minus 0.25fil
+    .\hss.\hss.%
+    \hskip 0pt plus 0.5fil minus 0.5fil
+  }%
+}
+
+% @enddots{} is an end-of-sentence ellipsis.
+%
+\def\enddots{%
+  \leavevmode
+  \hbox to 2em{%
+    \hskip 0pt plus 0.25fil minus 0.25fil
+    .\hss.\hss.\hss.%
+    \hskip 0pt plus 0.5fil minus 0.5fil
+  }%
+  \spacefactor=3000
+}
+
+
+% @page    forces the start of a new page
+%
+\def\page{\par\vfill\supereject}
+
+% @exdent text....
+% outputs text on separate line in roman font, starting at standard page margin
+
+% This records the amount of indent in the innermost environment.
+% That's how much \exdent should take out.
+\newskip\exdentamount
+
+% This defn is used inside fill environments such as @defun.
+\def\exdent{\parsearg\exdentyyy}
+\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
+
+% This defn is used inside nofill environments such as @example.
+\def\nofillexdent{\parsearg\nofillexdentyyy}
+\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
+\leftline{\hskip\leftskip{\rm#1}}}}
+
+% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
+% paragraph.  For more general purposes, use the \margin insertion
+% class.  WHICH is `l' or `r'.
+%
+\newskip\inmarginspacing \inmarginspacing=1cm
+\def\strutdepth{\dp\strutbox}
+%
+\def\doinmargin#1#2{\strut\vadjust{%
+  \nobreak
+  \kern-\strutdepth
+  \vtop to \strutdepth{%
+    \baselineskip=\strutdepth
+    \vss
+    % if you have multiple lines of stuff to put here, you'll need to
+    % make the vbox yourself of the appropriate size.
+    \ifx#1l%
+      \llap{\ignorespaces #2\hskip\inmarginspacing}%
+    \else
+      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
+    \fi
+    \null
+  }%
+}}
+\def\inleftmargin{\doinmargin l}
+\def\inrightmargin{\doinmargin r}
+%
+% @inmargin{TEXT [, RIGHT-TEXT]}
+% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
+% else use TEXT for both).
+% 
+\def\inmargin#1{\parseinmargin #1,,\finish}
+\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
+  \setbox0 = \hbox{\ignorespaces #2}% 
+  \ifdim\wd0 > 0pt
+    \def\lefttext{#1}%  have both texts
+    \def\righttext{#2}%
+  \else
+    \def\lefttext{#1}%  have only one text
+    \def\righttext{#1}%
+  \fi
+  %
+  \ifodd\pageno
+    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
+  \else
+    \def\temp{\inleftmargin\lefttext}%
+  \fi
+  \temp
+}
+
+% @include file    insert text of that file as input.
+% Allow normal characters that  we make active in the argument (a file name).
+\def\include{\begingroup
+  \catcode`\\=12
+  \catcode`~=12
+  \catcode`^=12
+  \catcode`_=12
+  \catcode`|=12
+  \catcode`<=12
+  \catcode`>=12
+  \catcode`+=12
+  \parsearg\includezzz}
+% Restore active chars for included file.
+\def\includezzz#1{\endgroup\begingroup
+  % Read the included file in a group so nested @include's work.
+  \def\thisfile{#1}%
+  \input\thisfile
+\endgroup}
+
+\def\thisfile{}
+
+% @center line   outputs that line, centered
+
+\def\center{\parsearg\centerzzz}
+\def\centerzzz #1{{\advance\hsize by -\leftskip
+\advance\hsize by -\rightskip
+\centerline{#1}}}
+
+% @sp n   outputs n lines of vertical space
+
+\def\sp{\parsearg\spxxx}
+\def\spxxx #1{\vskip #1\baselineskip}
+
+% @comment ...line which is ignored...
+% @c is the same as @comment
+% @ignore ... @end ignore  is another way to write a comment
+
+\def\comment{\begingroup \catcode`\^^M=\other%
+\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
+\commentxxx}
+{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
+
+\let\c=\comment
+
+% @paragraphindent NCHARS
+% We'll use ems for NCHARS, close enough.
+% We cannot implement @paragraphindent asis, though.
+% 
+\def\asisword{asis} % no translation, these are keywords
+\def\noneword{none}
+%
+\def\paragraphindent{\parsearg\doparagraphindent}
+\def\doparagraphindent#1{%
+  \def\temp{#1}%
+  \ifx\temp\asisword
+  \else
+    \ifx\temp\noneword
+      \defaultparindent = 0pt
+    \else
+      \defaultparindent = #1em
+    \fi
+  \fi
+  \parindent = \defaultparindent
+}
+
+% @exampleindent NCHARS
+% We'll use ems for NCHARS like @paragraphindent.
+% It seems @exampleindent asis isn't necessary, but
+% I preserve it to make it similar to @paragraphindent.
+\def\exampleindent{\parsearg\doexampleindent}
+\def\doexampleindent#1{%
+  \def\temp{#1}%
+  \ifx\temp\asisword
+  \else
+    \ifx\temp\noneword
+      \lispnarrowing = 0pt
+    \else
+      \lispnarrowing = #1em
+    \fi
+  \fi
+}
+
+% @asis just yields its argument.  Used with @table, for example.
+%
+\def\asis#1{#1}
+
+% @math outputs its argument in math mode.
+% We don't use $'s directly in the definition of \math because we need
+% to set catcodes according to plain TeX first, to allow for subscripts,
+% superscripts, special math chars, etc.
+% 
+% @math does not do math typesetting in section titles, index
+% entries, and other such contexts where the catcodes are set before
+% @math gets a chance to work.  This could perhaps be fixed, but for now
+% at least we can have real math in the main text, where it's needed most.
+%
+\let\implicitmath = $%$ font-lock fix
+%
+% One complication: _ usually means subscripts, but it could also mean
+% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
+% _ within @math be active (mathcode "8000), and distinguish by seeing
+% if the current family is \slfam, which is what @var uses.
+% 
+{\catcode95 = \active  % 95 = _
+\gdef\mathunderscore{%
+  \catcode95=\active
+  \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
+}}
+%
+% Another complication: we want \\ (and @\) to output a \ character.
+% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
+% this is not advertised and we don't care.  Texinfo does not
+% otherwise define @\.
+% 
+% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
+\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
+%
+\def\math{%
+  \tex
+  \mathcode`\_="8000 \mathunderscore
+  \let\\ = \mathbackslash
+  \implicitmath\finishmath}
+\def\finishmath#1{#1\implicitmath\Etex}
+
+% @bullet and @minus need the same treatment as @math, just above.
+\def\bullet{\implicitmath\ptexbullet\implicitmath}
+\def\minus{\implicitmath-\implicitmath}
+
+% @refill is a no-op.
+\let\refill=\relax
+
+% If working on a large document in chapters, it is convenient to
+% be able to disable indexing, cross-referencing, and contents, for test runs.
+% This is done with @novalidate (before @setfilename).
+%
+\newif\iflinks \linkstrue % by default we want the aux files.
+\let\novalidate = \linksfalse
+
+% @setfilename is done at the beginning of every texinfo file.
+% So open here the files we need to have open while reading the input.
+% This makes it possible to make a .fmt file for texinfo.
+\def\setfilename{%
+   \iflinks
+     \readauxfile
+   \fi % \openindices needs to do some work in any case.
+   \openindices
+   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
+   \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
+   %
+   % If texinfo.cnf is present on the system, read it.
+   % Useful for site-wide @afourpaper, etc.
+   % Just to be on the safe side, close the input stream before the \input.
+   \openin 1 texinfo.cnf
+   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
+   \closein1
+   \temp
+   %
+   \comment % Ignore the actual filename.
+}
+
+% Called from \setfilename.
+%
+\def\openindices{%
+  \newindex{cp}%
+  \newcodeindex{fn}%
+  \newcodeindex{vr}%
+  \newcodeindex{tp}%
+  \newcodeindex{ky}%
+  \newcodeindex{pg}%
+}
+
+% @bye.
+\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
+
+
+\message{pdf,}
+% adobe `portable' document format
+\newcount\tempnum
+\newcount\lnkcount
+\newtoks\filename
+\newcount\filenamelength
+\newcount\pgn
+\newtoks\toksA
+\newtoks\toksB
+\newtoks\toksC
+\newtoks\toksD
+\newbox\boxA
+\newcount\countA
+\newif\ifpdf
+\newif\ifpdfmakepagedest
+
+\ifx\pdfoutput\undefined
+  \pdffalse
+  \let\pdfmkdest = \gobble
+  \let\pdfurl = \gobble
+  \let\endlink = \relax
+  \let\linkcolor = \relax
+  \let\pdfmakeoutlines = \relax
+\else
+  \pdftrue
+  \pdfoutput = 1
+  \input pdfcolor
+  \def\dopdfimage#1#2#3{%
+    \def\imagewidth{#2}%
+    \def\imageheight{#3}%
+    % without \immediate, pdftex seg faults when the same image is
+    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
+    \ifnum\pdftexversion < 14
+      \immediate\pdfimage
+    \else
+      \immediate\pdfximage
+    \fi
+      \ifx\empty\imagewidth\else width \imagewidth \fi
+      \ifx\empty\imageheight\else height \imageheight \fi
+      \ifnum\pdftexversion<13
+	 #1.pdf%
+       \else
+         {#1.pdf}%
+       \fi
+    \ifnum\pdftexversion < 14 \else
+      \pdfrefximage \pdflastximage
+    \fi}
+  \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
+  \def\pdfmkpgn#1{#1}
+  \let\linkcolor = \Blue  % was Cyan, but that seems light?
+  \def\endlink{\Black\pdfendlink}
+  % Adding outlines to PDF; macros for calculating structure of outlines
+  % come from Petr Olsak
+  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
+    \else \csname#1\endcsname \fi}
+  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
+    \advance\tempnum by1
+    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
+  \def\pdfmakeoutlines{{%
+    \openin 1 \jobname.toc
+    \ifeof 1\else\begingroup
+      \closein 1 
+      \indexnofonts
+      \def\tt{}
+      \let\_ = \normalunderscore
+      % Thanh's hack / proper braces in bookmarks  
+      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
+      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
+      %
+      \def\chapentry ##1##2##3{}
+      \let\appendixentry = \chapentry
+      \def\unnumbchapentry ##1##2{}
+      \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
+      \def\unnumbsecentry ##1##2##3{\advancenumber{chap##2}}
+      \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
+      \def\unnumbsubsecentry ##1##2##3##4{\advancenumber{sec##2.##3}}
+      \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
+      \def\unnumbsubsubsecentry ##1##2##3##4##5{\advancenumber{subsec##2.##3.##4}}
+      \input \jobname.toc
+      \def\chapentry ##1##2##3{%
+        \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
+      \let\appendixentry = \chapentry
+      \def\unnumbchapentry ##1##2{%
+        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
+      \def\secentry ##1##2##3##4{%
+        \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
+      \def\unnumbsecentry ##1##2##3{%
+        \pdfoutline goto name{\pdfmkpgn{##3}}{##1}}
+      \def\subsecentry ##1##2##3##4##5{%
+        \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
+      \def\unnumbsubsecentry ##1##2##3##4{%
+        \pdfoutline goto name{\pdfmkpgn{##4}}{##1}}
+      \def\subsubsecentry ##1##2##3##4##5##6{%
+        \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
+      \def\unnumbsubsubsecentry ##1##2##3##4##5{%
+        \pdfoutline goto name{\pdfmkpgn{##5}}{##1}}
+      \input \jobname.toc
+    \endgroup\fi
+  }}
+  \def\makelinks #1,{%
+    \def\params{#1}\def\E{END}%
+    \ifx\params\E
+      \let\nextmakelinks=\relax
+    \else
+      \let\nextmakelinks=\makelinks
+      \ifnum\lnkcount>0,\fi
+      \picknum{#1}%
+      \startlink attr{/Border [0 0 0]} 
+        goto name{\pdfmkpgn{\the\pgn}}%
+      \linkcolor #1%
+      \advance\lnkcount by 1%
+      \endlink
+    \fi
+    \nextmakelinks
+  }
+  \def\picknum#1{\expandafter\pn#1}
+  \def\pn#1{%
+    \def\p{#1}%
+    \ifx\p\lbrace
+      \let\nextpn=\ppn
+    \else
+      \let\nextpn=\ppnn
+      \def\first{#1}
+    \fi
+    \nextpn
+  }
+  \def\ppn#1{\pgn=#1\gobble}
+  \def\ppnn{\pgn=\first}
+  \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
+  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
+    \ifx\PP\D\let\nextsp\relax
+    \else\let\nextsp\skipspaces
+      \ifx\p\space\else\addtokens{\filename}{\PP}%
+        \advance\filenamelength by 1
+      \fi
+    \fi
+    \nextsp}
+  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
+  \ifnum\pdftexversion < 14
+    \let \startlink \pdfannotlink
+  \else
+    \let \startlink \pdfstartlink
+  \fi
+  \def\pdfurl#1{%
+    \begingroup
+      \normalturnoffactive\def\@{@}%
+      \let\value=\expandablevalue
+      \leavevmode\Red
+      \startlink attr{/Border [0 0 0]}%
+        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
+        % #1
+    \endgroup}
+  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
+  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
+  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
+  \def\maketoks{%
+    \expandafter\poptoks\the\toksA|ENDTOKS|
+    \ifx\first0\adn0
+    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
+    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
+    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 
+    \else
+      \ifnum0=\countA\else\makelink\fi
+      \ifx\first.\let\next=\done\else
+        \let\next=\maketoks
+        \addtokens{\toksB}{\the\toksD}
+        \ifx\first,\addtokens{\toksB}{\space}\fi
+      \fi
+    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+    \next}
+  \def\makelink{\addtokens{\toksB}%
+    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
+  \def\pdflink#1{%
+    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
+    \linkcolor #1\endlink}
+  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
+\fi % \ifx\pdfoutput
+
+
+\message{fonts,}
+% Font-change commands.
+
+% Texinfo sort of supports the sans serif font style, which plain TeX does not.
+% So we set up a \sf analogous to plain's \rm, etc.
+\newfam\sffam
+\def\sf{\fam=\sffam \tensf}
+\let\li = \sf % Sometimes we call it \li, not \sf.
+
+% We don't need math for this one.
+\def\ttsl{\tenttsl}
+
+% Default leading.
+\newdimen\textleading  \textleading = 13.2pt
+
+% Set the baselineskip to #1, and the lineskip and strut size
+% correspondingly.  There is no deep meaning behind these magic numbers
+% used as factors; they just match (closely enough) what Knuth defined.
+%
+\def\lineskipfactor{.08333}
+\def\strutheightpercent{.70833}
+\def\strutdepthpercent {.29167}
+%
+\def\setleading#1{%
+  \normalbaselineskip = #1\relax
+  \normallineskip = \lineskipfactor\normalbaselineskip
+  \normalbaselines
+  \setbox\strutbox =\hbox{%
+    \vrule width0pt height\strutheightpercent\baselineskip
+                    depth \strutdepthpercent \baselineskip
+  }%
+}
+
+% Set the font macro #1 to the font named #2, adding on the
+% specified font prefix (normally `cm').
+% #3 is the font's design size, #4 is a scale factor
+\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
+
+% Use cm as the default font prefix.
+% To specify the font prefix, you must define \fontprefix
+% before you read in texinfo.tex.
+\ifx\fontprefix\undefined
+\def\fontprefix{cm}
+\fi
+% Support font families that don't use the same naming scheme as CM.
+\def\rmshape{r}
+\def\rmbshape{bx}               %where the normal face is bold
+\def\bfshape{b}
+\def\bxshape{bx}
+\def\ttshape{tt}
+\def\ttbshape{tt}
+\def\ttslshape{sltt}
+\def\itshape{ti}
+\def\itbshape{bxti}
+\def\slshape{sl}
+\def\slbshape{bxsl}
+\def\sfshape{ss}
+\def\sfbshape{ss}
+\def\scshape{csc}
+\def\scbshape{csc}
+
+\newcount\mainmagstep
+\ifx\bigger\relax
+  % not really supported.
+  \let\mainmagstep=\magstep1
+  \setfont\textrm\rmshape{12}{1000}
+  \setfont\texttt\ttshape{12}{1000}
+\else
+  \mainmagstep=\magstephalf
+  \setfont\textrm\rmshape{10}{\mainmagstep}
+  \setfont\texttt\ttshape{10}{\mainmagstep}
+\fi
+% Instead of cmb10, you many want to use cmbx10.
+% cmbx10 is a prettier font on its own, but cmb10
+% looks better when embedded in a line with cmr10.
+\setfont\textbf\bfshape{10}{\mainmagstep}
+\setfont\textit\itshape{10}{\mainmagstep}
+\setfont\textsl\slshape{10}{\mainmagstep}
+\setfont\textsf\sfshape{10}{\mainmagstep}
+\setfont\textsc\scshape{10}{\mainmagstep}
+\setfont\textttsl\ttslshape{10}{\mainmagstep}
+\font\texti=cmmi10 scaled \mainmagstep
+\font\textsy=cmsy10 scaled \mainmagstep
+
+% A few fonts for @defun, etc.
+\setfont\defbf\bxshape{10}{\magstep1} %was 1314
+\setfont\deftt\ttshape{10}{\magstep1}
+\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
+
+% Fonts for indices, footnotes, small examples (9pt).
+\setfont\smallrm\rmshape{9}{1000}
+\setfont\smalltt\ttshape{9}{1000}
+\setfont\smallbf\bfshape{10}{900}
+\setfont\smallit\itshape{9}{1000}
+\setfont\smallsl\slshape{9}{1000}
+\setfont\smallsf\sfshape{9}{1000}
+\setfont\smallsc\scshape{10}{900}
+\setfont\smallttsl\ttslshape{10}{900}
+\font\smalli=cmmi9
+\font\smallsy=cmsy9
+
+% Fonts for small examples (8pt).
+\setfont\smallerrm\rmshape{8}{1000}
+\setfont\smallertt\ttshape{8}{1000}
+\setfont\smallerbf\bfshape{10}{800}
+\setfont\smallerit\itshape{8}{1000}
+\setfont\smallersl\slshape{8}{1000}
+\setfont\smallersf\sfshape{8}{1000}
+\setfont\smallersc\scshape{10}{800}
+\setfont\smallerttsl\ttslshape{10}{800}
+\font\smalleri=cmmi8
+\font\smallersy=cmsy8
+
+% Fonts for title page:
+\setfont\titlerm\rmbshape{12}{\magstep3}
+\setfont\titleit\itbshape{10}{\magstep4}
+\setfont\titlesl\slbshape{10}{\magstep4}
+\setfont\titlett\ttbshape{12}{\magstep3}
+\setfont\titlettsl\ttslshape{10}{\magstep4}
+\setfont\titlesf\sfbshape{17}{\magstep1}
+\let\titlebf=\titlerm
+\setfont\titlesc\scbshape{10}{\magstep4}
+\font\titlei=cmmi12 scaled \magstep3
+\font\titlesy=cmsy10 scaled \magstep4
+\def\authorrm{\secrm}
+
+% Chapter (and unnumbered) fonts (17.28pt).
+\setfont\chaprm\rmbshape{12}{\magstep2}
+\setfont\chapit\itbshape{10}{\magstep3}
+\setfont\chapsl\slbshape{10}{\magstep3}
+\setfont\chaptt\ttbshape{12}{\magstep2}
+\setfont\chapttsl\ttslshape{10}{\magstep3}
+\setfont\chapsf\sfbshape{17}{1000}
+\let\chapbf=\chaprm
+\setfont\chapsc\scbshape{10}{\magstep3}
+\font\chapi=cmmi12 scaled \magstep2
+\font\chapsy=cmsy10 scaled \magstep3
+
+% Section fonts (14.4pt).
+\setfont\secrm\rmbshape{12}{\magstep1}
+\setfont\secit\itbshape{10}{\magstep2}
+\setfont\secsl\slbshape{10}{\magstep2}
+\setfont\sectt\ttbshape{12}{\magstep1}
+\setfont\secttsl\ttslshape{10}{\magstep2}
+\setfont\secsf\sfbshape{12}{\magstep1}
+\let\secbf\secrm
+\setfont\secsc\scbshape{10}{\magstep2}
+\font\seci=cmmi12 scaled \magstep1
+\font\secsy=cmsy10 scaled \magstep2
+
+% Subsection fonts (13.15pt).
+\setfont\ssecrm\rmbshape{12}{\magstephalf}
+\setfont\ssecit\itbshape{10}{1315}
+\setfont\ssecsl\slbshape{10}{1315}
+\setfont\ssectt\ttbshape{12}{\magstephalf}
+\setfont\ssecttsl\ttslshape{10}{1315}
+\setfont\ssecsf\sfbshape{12}{\magstephalf}
+\let\ssecbf\ssecrm
+\setfont\ssecsc\scbshape{10}{\magstep1}
+\font\sseci=cmmi12 scaled \magstephalf
+\font\ssecsy=cmsy10 scaled 1315
+% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
+% but that is not a standard magnification.
+
+% In order for the font changes to affect most math symbols and letters,
+% we have to define the \textfont of the standard families.  Since
+% texinfo doesn't allow for producing subscripts and superscripts except
+% in the main text, we don't bother to reset \scriptfont and
+% \scriptscriptfont (which would also require loading a lot more fonts).
+%
+\def\resetmathfonts{%
+  \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
+  \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
+  \textfont\ttfam=\tentt \textfont\sffam=\tensf
+}
+
+% The font-changing commands redefine the meanings of \tenSTYLE, instead
+% of just \STYLE.  We do this so that font changes will continue to work
+% in math mode, where it is the current \fam that is relevant in most
+% cases, not the current font.  Plain TeX does \def\bf{\fam=\bffam
+% \tenbf}, for example.  By redefining \tenbf, we obviate the need to
+% redefine \bf itself.
+\def\textfonts{%
+  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
+  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
+  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
+  \resetmathfonts \setleading{\textleading}}
+\def\titlefonts{%
+  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
+  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
+  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
+  \let\tenttsl=\titlettsl
+  \resetmathfonts \setleading{25pt}}
+\def\titlefont#1{{\titlefonts\rm #1}}
+\def\chapfonts{%
+  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
+  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
+  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
+  \resetmathfonts \setleading{19pt}}
+\def\secfonts{%
+  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
+  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
+  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
+  \resetmathfonts \setleading{16pt}}
+\def\subsecfonts{%
+  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
+  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
+  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
+  \resetmathfonts \setleading{15pt}}
+\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
+\def\smallfonts{%
+  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
+  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
+  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
+  \let\tenttsl=\smallttsl
+  \resetmathfonts \setleading{10.5pt}}
+\def\smallerfonts{%
+  \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
+  \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
+  \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
+  \let\tenttsl=\smallerttsl
+  \resetmathfonts \setleading{9.5pt}}
+\let\smallexamplefonts = \smallerfonts
+
+% Set up the default fonts, so we can use them for creating boxes.
+%
+\textfonts
+
+% Define these so they can be easily changed for other fonts.
+\def\angleleft{$\langle$}
+\def\angleright{$\rangle$}
+
+% Count depth in font-changes, for error checks
+\newcount\fontdepth \fontdepth=0
+
+% Fonts for short table of contents.
+\setfont\shortcontrm\rmshape{12}{1000}
+\setfont\shortcontbf\bxshape{12}{1000}
+\setfont\shortcontsl\slshape{12}{1000}
+
+%% Add scribe-like font environments, plus @l for inline lisp (usually sans
+%% serif) and @ii for TeX italic
+
+% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
+% unless the following character is such as not to need one.
+\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
+\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
+\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
+
+\let\i=\smartitalic
+\let\var=\smartslanted
+\let\dfn=\smartslanted
+\let\emph=\smartitalic
+\let\cite=\smartslanted
+
+\def\b#1{{\bf #1}}
+\let\strong=\b
+
+% We can't just use \exhyphenpenalty, because that only has effect at
+% the end of a paragraph.  Restore normal hyphenation at the end of the
+% group within which \nohyphenation is presumably called.
+%
+\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
+\def\restorehyphenation{\hyphenchar\font = `- }
+
+\def\t#1{%
+  {\tt \rawbackslash \frenchspacing #1}%
+  \null
+}
+\let\ttfont=\t
+\def\samp#1{`\tclose{#1}'\null}
+\setfont\keyrm\rmshape{8}{1000}
+\font\keysy=cmsy9
+\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
+  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
+    \vbox{\hrule\kern-0.4pt
+     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
+    \kern-0.4pt\hrule}%
+  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
+% The old definition, with no lozenge:
+%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
+\def\ctrl #1{{\tt \rawbackslash \hat}#1}
+
+% @file, @option are the same as @samp.
+\let\file=\samp
+\let\option=\samp
+
+% @code is a modification of @t,
+% which makes spaces the same size as normal in the surrounding text.
+\def\tclose#1{%
+  {%
+    % Change normal interword space to be same as for the current font.
+    \spaceskip = \fontdimen2\font
+    %
+    % Switch to typewriter.
+    \tt
+    %
+    % But `\ ' produces the large typewriter interword space.
+    \def\ {{\spaceskip = 0pt{} }}%
+    %
+    % Turn off hyphenation.
+    \nohyphenation
+    %
+    \rawbackslash
+    \frenchspacing
+    #1%
+  }%
+  \null
+}
+
+% We *must* turn on hyphenation at `-' and `_' in \code.
+% Otherwise, it is too hard to avoid overfull hboxes
+% in the Emacs manual, the Library manual, etc.
+
+% Unfortunately, TeX uses one parameter (\hyphenchar) to control
+% both hyphenation at - and hyphenation within words.
+% We must therefore turn them both off (\tclose does that)
+% and arrange explicitly to hyphenate at a dash.
+%  -- rms.
+{
+  \catcode`\-=\active
+  \catcode`\_=\active
+  %
+  \global\def\code{\begingroup
+    \catcode`\-=\active \let-\codedash
+    \catcode`\_=\active \let_\codeunder
+    \codex
+  }
+  %
+  % If we end up with any active - characters when handling the index,
+  % just treat them as a normal -.
+  \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
+}
+
+\def\realdash{-}
+\def\codedash{-\discretionary{}{}{}}
+\def\codeunder{%
+  % this is all so @math{@code{var_name}+1} can work.  In math mode, _
+  % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
+  % will therefore expand the active definition of _, which is us
+  % (inside @code that is), therefore an endless loop.
+  \ifusingtt{\ifmmode
+               \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
+             \else\normalunderscore \fi
+             \discretionary{}{}{}}%
+            {\_}%
+}
+\def\codex #1{\tclose{#1}\endgroup}
+
+% @kbd is like @code, except that if the argument is just one @key command,
+% then @kbd has no effect.
+
+% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
+%   `example' (@kbd uses ttsl only inside of @example and friends),
+%   or `code' (@kbd uses normal tty font always).
+\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
+\def\kbdinputstylexxx#1{%
+  \def\arg{#1}%
+  \ifx\arg\worddistinct
+    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
+  \else\ifx\arg\wordexample
+    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
+  \else\ifx\arg\wordcode
+    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
+  \fi\fi\fi
+}
+\def\worddistinct{distinct}
+\def\wordexample{example}
+\def\wordcode{code}
+
+% Default is kbdinputdistinct.  (Too much of a hassle to call the macro,
+% the catcodes are wrong for parsearg to work.)
+\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
+
+\def\xkey{\key}
+\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
+\ifx\one\xkey\ifx\threex\three \key{#2}%
+\else{\tclose{\kbdfont\look}}\fi
+\else{\tclose{\kbdfont\look}}\fi}
+
+% For @url, @env, @command quotes seem unnecessary, so use \code.
+\let\url=\code
+\let\env=\code
+\let\command=\code
+
+% @uref (abbreviation for `urlref') takes an optional (comma-separated)
+% second argument specifying the text to display and an optional third
+% arg as text to display instead of (rather than in addition to) the url
+% itself.  First (mandatory) arg is the url.  Perhaps eventually put in
+% a hypertex \special here.
+%
+\def\uref#1{\douref #1,,,\finish}
+\def\douref#1,#2,#3,#4\finish{\begingroup
+  \unsepspaces
+  \pdfurl{#1}%
+  \setbox0 = \hbox{\ignorespaces #3}%
+  \ifdim\wd0 > 0pt
+    \unhbox0 % third arg given, show only that
+  \else
+    \setbox0 = \hbox{\ignorespaces #2}%
+    \ifdim\wd0 > 0pt
+      \ifpdf
+        \unhbox0             % PDF: 2nd arg given, show only it
+      \else
+        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
+      \fi
+    \else
+      \code{#1}% only url given, so show it
+    \fi
+  \fi
+  \endlink
+\endgroup}
+
+% rms does not like angle brackets --karl, 17may97.
+% So now @email is just like @uref, unless we are pdf.
+% 
+%\def\email#1{\angleleft{\tt #1}\angleright}
+\ifpdf
+  \def\email#1{\doemail#1,,\finish}
+  \def\doemail#1,#2,#3\finish{\begingroup
+    \unsepspaces
+    \pdfurl{mailto:#1}%
+    \setbox0 = \hbox{\ignorespaces #2}%
+    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
+    \endlink
+  \endgroup}
+\else
+  \let\email=\uref
+\fi
+
+% Check if we are currently using a typewriter font.  Since all the
+% Computer Modern typewriter fonts have zero interword stretch (and
+% shrink), and it is reasonable to expect all typewriter fonts to have
+% this property, we can check that font parameter.
+%
+\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
+
+% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
+% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
+%
+\def\dmn#1{\thinspace #1}
+
+\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
+
+% @l was never documented to mean ``switch to the Lisp font'',
+% and it is not used as such in any manual I can find.  We need it for
+% Polish suppressed-l.  --karl, 22sep96.
+%\def\l#1{{\li #1}\null}
+
+% Explicit font changes: @r, @sc, undocumented @ii.
+\def\r#1{{\rm #1}}              % roman font
+\def\sc#1{{\smallcaps#1}}       % smallcaps font
+\def\ii#1{{\it #1}}             % italic font
+
+% @acronym downcases the argument and prints in smallcaps.
+\def\acronym#1{{\smallcaps \lowercase{#1}}}
+
+% @pounds{} is a sterling sign.
+\def\pounds{{\it\$}}
+
+
+\message{page headings,}
+
+\newskip\titlepagetopglue \titlepagetopglue = 1.5in
+\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
+
+% First the title page.  Must do @settitle before @titlepage.
+\newif\ifseenauthor
+\newif\iffinishedtitlepage
+
+% Do an implicit @contents or @shortcontents after @end titlepage if the
+% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
+%
+\newif\ifsetcontentsaftertitlepage
+ \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
+\newif\ifsetshortcontentsaftertitlepage
+ \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
+
+\def\shorttitlepage{\parsearg\shorttitlepagezzz}
+\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
+        \endgroup\page\hbox{}\page}
+
+\def\titlepage{\begingroup \parindent=0pt \textfonts
+   \let\subtitlerm=\tenrm
+   \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
+   %
+   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
+   %
+   % Leave some space at the very top of the page.
+   \vglue\titlepagetopglue
+   %
+   % Now you can print the title using @title.
+   \def\title{\parsearg\titlezzz}%
+   \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
+                    % print a rule at the page bottom also.
+                    \finishedtitlepagefalse
+                    \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
+   % No rule at page bottom unless we print one at the top with @title.
+   \finishedtitlepagetrue
+   %
+   % Now you can put text using @subtitle.
+   \def\subtitle{\parsearg\subtitlezzz}%
+   \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
+   %
+   % @author should come last, but may come many times.
+   \def\author{\parsearg\authorzzz}%
+   \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
+      {\authorfont \leftline{##1}}}%
+   %
+   % Most title ``pages'' are actually two pages long, with space
+   % at the top of the second.  We don't want the ragged left on the second.
+   \let\oldpage = \page
+   \def\page{%
+      \iffinishedtitlepage\else
+         \finishtitlepage
+      \fi
+      \oldpage
+      \let\page = \oldpage
+      \hbox{}}%
+%   \def\page{\oldpage \hbox{}}
+}
+
+\def\Etitlepage{%
+   \iffinishedtitlepage\else
+      \finishtitlepage
+   \fi
+   % It is important to do the page break before ending the group,
+   % because the headline and footline are only empty inside the group.
+   % If we use the new definition of \page, we always get a blank page
+   % after the title page, which we certainly don't want.
+   \oldpage
+   \endgroup
+   %
+   % Need this before the \...aftertitlepage checks so that if they are
+   % in effect the toc pages will come out with page numbers.
+   \HEADINGSon
+   %
+   % If they want short, they certainly want long too.
+   \ifsetshortcontentsaftertitlepage
+     \shortcontents
+     \contents
+     \global\let\shortcontents = \relax
+     \global\let\contents = \relax
+   \fi
+   %
+   \ifsetcontentsaftertitlepage
+     \contents
+     \global\let\contents = \relax
+     \global\let\shortcontents = \relax
+   \fi
+}
+
+\def\finishtitlepage{%
+   \vskip4pt \hrule height 2pt width \hsize
+   \vskip\titlepagebottomglue
+   \finishedtitlepagetrue
+}
+
+%%% Set up page headings and footings.
+
+\let\thispage=\folio
+
+\newtoks\evenheadline    % headline on even pages
+\newtoks\oddheadline     % headline on odd pages
+\newtoks\evenfootline    % footline on even pages
+\newtoks\oddfootline     % footline on odd pages
+
+% Now make Tex use those variables
+\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
+                            \else \the\evenheadline \fi}}
+\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
+                            \else \the\evenfootline \fi}\HEADINGShook}
+\let\HEADINGShook=\relax
+
+% Commands to set those variables.
+% For example, this is what  @headings on  does
+% @evenheading @thistitle|@thispage|@thischapter
+% @oddheading @thischapter|@thispage|@thistitle
+% @evenfooting @thisfile||
+% @oddfooting ||@thisfile
+
+\def\evenheading{\parsearg\evenheadingxxx}
+\def\oddheading{\parsearg\oddheadingxxx}
+\def\everyheading{\parsearg\everyheadingxxx}
+
+\def\evenfooting{\parsearg\evenfootingxxx}
+\def\oddfooting{\parsearg\oddfootingxxx}
+\def\everyfooting{\parsearg\everyfootingxxx}
+
+{\catcode`\@=0 %
+
+\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
+\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
+\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
+
+\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
+\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
+\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
+  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
+  %
+  % Leave some space for the footline.  Hopefully ok to assume
+  % @evenfooting will not be used by itself.
+  \global\advance\pageheight by -\baselineskip
+  \global\advance\vsize by -\baselineskip
+}
+
+\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
+%
+}% unbind the catcode of @.
+
+% @headings double      turns headings on for double-sided printing.
+% @headings single      turns headings on for single-sided printing.
+% @headings off         turns them off.
+% @headings on          same as @headings double, retained for compatibility.
+% @headings after       turns on double-sided headings after this page.
+% @headings doubleafter turns on double-sided headings after this page.
+% @headings singleafter turns on single-sided headings after this page.
+% By default, they are off at the start of a document,
+% and turned `on' after @end titlepage.
+
+\def\headings #1 {\csname HEADINGS#1\endcsname}
+
+\def\HEADINGSoff{
+\global\evenheadline={\hfil} \global\evenfootline={\hfil}
+\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
+\HEADINGSoff
+% When we turn headings on, set the page number to 1.
+% For double-sided printing, put current file name in lower left corner,
+% chapter name on inside top of right hand pages, document
+% title on inside top of left hand pages, and page numbers on outside top
+% edge of all pages.
+\def\HEADINGSdouble{
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chapoddpage
+}
+\let\contentsalignmacro = \chappager
+
+% For single-sided printing, chapter title goes across top left of page,
+% page number on top right.
+\def\HEADINGSsingle{
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chappager
+}
+\def\HEADINGSon{\HEADINGSdouble}
+
+\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
+\let\HEADINGSdoubleafter=\HEADINGSafter
+\def\HEADINGSdoublex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chapoddpage
+}
+
+\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
+\def\HEADINGSsinglex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chappager
+}
+
+% Subroutines used in generating headings
+% This produces Day Month Year style of output.
+% Only define if not already defined, in case a txi-??.tex file has set
+% up a different format (e.g., txi-cs.tex does this).
+\ifx\today\undefined
+\def\today{%
+  \number\day\space
+  \ifcase\month
+  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
+  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
+  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
+  \fi
+  \space\number\year}
+\fi
+
+% @settitle line...  specifies the title of the document, for headings.
+% It generates no output of its own.
+\def\thistitle{\putwordNoTitle}
+\def\settitle{\parsearg\settitlezzz}
+\def\settitlezzz #1{\gdef\thistitle{#1}}
+
+
+\message{tables,}
+% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
+
+% default indentation of table text
+\newdimen\tableindent \tableindent=.8in
+% default indentation of @itemize and @enumerate text
+\newdimen\itemindent  \itemindent=.3in
+% margin between end of table item and start of table text.
+\newdimen\itemmargin  \itemmargin=.1in
+
+% used internally for \itemindent minus \itemmargin
+\newdimen\itemmax
+
+% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
+% these defs.
+% They also define \itemindex
+% to index the item name in whatever manner is desired (perhaps none).
+
+\newif\ifitemxneedsnegativevskip
+
+\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
+
+\def\internalBitem{\smallbreak \parsearg\itemzzz}
+\def\internalBitemx{\itemxpar \parsearg\itemzzz}
+
+\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
+\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
+
+\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
+\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
+
+\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
+                 \itemzzz {#1}}
+
+\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
+                 \itemzzz {#1}}
+
+\def\itemzzz #1{\begingroup %
+  \advance\hsize by -\rightskip
+  \advance\hsize by -\tableindent
+  \setbox0=\hbox{\itemfont{#1}}%
+  \itemindex{#1}%
+  \nobreak % This prevents a break before @itemx.
+  %
+  % If the item text does not fit in the space we have, put it on a line
+  % by itself, and do not allow a page break either before or after that
+  % line.  We do not start a paragraph here because then if the next
+  % command is, e.g., @kindex, the whatsit would get put into the
+  % horizontal list on a line by itself, resulting in extra blank space.
+  \ifdim \wd0>\itemmax
+    %
+    % Make this a paragraph so we get the \parskip glue and wrapping,
+    % but leave it ragged-right.
+    \begingroup
+      \advance\leftskip by-\tableindent
+      \advance\hsize by\tableindent
+      \advance\rightskip by0pt plus1fil
+      \leavevmode\unhbox0\par
+    \endgroup
+    %
+    % We're going to be starting a paragraph, but we don't want the
+    % \parskip glue -- logically it's part of the @item we just started.
+    \nobreak \vskip-\parskip
+    %
+    % Stop a page break at the \parskip glue coming up.  Unfortunately
+    % we can't prevent a possible page break at the following
+    % \baselineskip glue.
+    \nobreak
+    \endgroup
+    \itemxneedsnegativevskipfalse
+  \else
+    % The item text fits into the space.  Start a paragraph, so that the
+    % following text (if any) will end up on the same line.
+    \noindent
+    % Do this with kerns and \unhbox so that if there is a footnote in
+    % the item text, it can migrate to the main vertical list and
+    % eventually be printed.
+    \nobreak\kern-\tableindent
+    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
+    \unhbox0
+    \nobreak\kern\dimen0
+    \endgroup
+    \itemxneedsnegativevskiptrue
+  \fi
+}
+
+\def\item{\errmessage{@item while not in a table}}
+\def\itemx{\errmessage{@itemx while not in a table}}
+\def\kitem{\errmessage{@kitem while not in a table}}
+\def\kitemx{\errmessage{@kitemx while not in a table}}
+\def\xitem{\errmessage{@xitem while not in a table}}
+\def\xitemx{\errmessage{@xitemx while not in a table}}
+
+% Contains a kludge to get @end[description] to work.
+\def\description{\tablez{\dontindex}{1}{}{}{}{}}
+
+% @table, @ftable, @vtable.
+\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
+{\obeylines\obeyspaces%
+\gdef\tablex #1^^M{%
+\tabley\dontindex#1        \endtabley}}
+
+\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
+{\obeylines\obeyspaces%
+\gdef\ftablex #1^^M{%
+\tabley\fnitemindex#1        \endtabley
+\def\Eftable{\endgraf\afterenvbreak\endgroup}%
+\let\Etable=\relax}}
+
+\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
+{\obeylines\obeyspaces%
+\gdef\vtablex #1^^M{%
+\tabley\vritemindex#1        \endtabley
+\def\Evtable{\endgraf\afterenvbreak\endgroup}%
+\let\Etable=\relax}}
+
+\def\dontindex #1{}
+\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
+\def\vritemindex #1{\doind {vr}{\code{#1}}}%
+
+{\obeyspaces %
+\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
+\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
+
+\def\tablez #1#2#3#4#5#6{%
+\aboveenvbreak %
+\begingroup %
+\def\Edescription{\Etable}% Necessary kludge.
+\let\itemindex=#1%
+\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
+\ifnum 0#4>0 \tableindent=#4\mil \fi %
+\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
+\def\itemfont{#2}%
+\itemmax=\tableindent %
+\advance \itemmax by -\itemmargin %
+\advance \leftskip by \tableindent %
+\exdentamount=\tableindent
+\parindent = 0pt
+\parskip = \smallskipamount
+\ifdim \parskip=0pt \parskip=2pt \fi%
+\def\Etable{\endgraf\afterenvbreak\endgroup}%
+\let\item = \internalBitem %
+\let\itemx = \internalBitemx %
+\let\kitem = \internalBkitem %
+\let\kitemx = \internalBkitemx %
+\let\xitem = \internalBxitem %
+\let\xitemx = \internalBxitemx %
+}
+
+% This is the counter used by @enumerate, which is really @itemize
+
+\newcount \itemno
+
+\def\itemize{\parsearg\itemizezzz}
+
+\def\itemizezzz #1{%
+  \begingroup % ended by the @end itemize
+  \itemizey {#1}{\Eitemize}
+}
+
+\def\itemizey #1#2{%
+\aboveenvbreak %
+\itemmax=\itemindent %
+\advance \itemmax by -\itemmargin %
+\advance \leftskip by \itemindent %
+\exdentamount=\itemindent
+\parindent = 0pt %
+\parskip = \smallskipamount %
+\ifdim \parskip=0pt \parskip=2pt \fi%
+\def#2{\endgraf\afterenvbreak\endgroup}%
+\def\itemcontents{#1}%
+\let\item=\itemizeitem}
+
+% Set sfcode to normal for the chars that usually have another value.
+% These are `.?!:;,'
+\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
+  \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
+
+% \splitoff TOKENS\endmark defines \first to be the first token in
+% TOKENS, and \rest to be the remainder.
+%
+\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
+
+% Allow an optional argument of an uppercase letter, lowercase letter,
+% or number, to specify the first label in the enumerated list.  No
+% argument is the same as `1'.
+%
+\def\enumerate{\parsearg\enumeratezzz}
+\def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
+\def\enumeratey #1 #2\endenumeratey{%
+  \begingroup % ended by the @end enumerate
+  %
+  % If we were given no argument, pretend we were given `1'.
+  \def\thearg{#1}%
+  \ifx\thearg\empty \def\thearg{1}\fi
+  %
+  % Detect if the argument is a single token.  If so, it might be a
+  % letter.  Otherwise, the only valid thing it can be is a number.
+  % (We will always have one token, because of the test we just made.
+  % This is a good thing, since \splitoff doesn't work given nothing at
+  % all -- the first parameter is undelimited.)
+  \expandafter\splitoff\thearg\endmark
+  \ifx\rest\empty
+    % Only one token in the argument.  It could still be anything.
+    % A ``lowercase letter'' is one whose \lccode is nonzero.
+    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
+    %   not equal to itself.
+    % Otherwise, we assume it's a number.
+    %
+    % We need the \relax at the end of the \ifnum lines to stop TeX from
+    % continuing to look for a <number>.
+    %
+    \ifnum\lccode\expandafter`\thearg=0\relax
+      \numericenumerate % a number (we hope)
+    \else
+      % It's a letter.
+      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
+        \lowercaseenumerate % lowercase letter
+      \else
+        \uppercaseenumerate % uppercase letter
+      \fi
+    \fi
+  \else
+    % Multiple tokens in the argument.  We hope it's a number.
+    \numericenumerate
+  \fi
+}
+
+% An @enumerate whose labels are integers.  The starting integer is
+% given in \thearg.
+%
+\def\numericenumerate{%
+  \itemno = \thearg
+  \startenumeration{\the\itemno}%
+}
+
+% The starting (lowercase) letter is in \thearg.
+\def\lowercaseenumerate{%
+  \itemno = \expandafter`\thearg
+  \startenumeration{%
+    % Be sure we're not beyond the end of the alphabet.
+    \ifnum\itemno=0
+      \errmessage{No more lowercase letters in @enumerate; get a bigger
+                  alphabet}%
+    \fi
+    \char\lccode\itemno
+  }%
+}
+
+% The starting (uppercase) letter is in \thearg.
+\def\uppercaseenumerate{%
+  \itemno = \expandafter`\thearg
+  \startenumeration{%
+    % Be sure we're not beyond the end of the alphabet.
+    \ifnum\itemno=0
+      \errmessage{No more uppercase letters in @enumerate; get a bigger
+                  alphabet}
+    \fi
+    \char\uccode\itemno
+  }%
+}
+
+% Call itemizey, adding a period to the first argument and supplying the
+% common last two arguments.  Also subtract one from the initial value in
+% \itemno, since @item increments \itemno.
+%
+\def\startenumeration#1{%
+  \advance\itemno by -1
+  \itemizey{#1.}\Eenumerate\flushcr
+}
+
+% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
+% to @enumerate.
+%
+\def\alphaenumerate{\enumerate{a}}
+\def\capsenumerate{\enumerate{A}}
+\def\Ealphaenumerate{\Eenumerate}
+\def\Ecapsenumerate{\Eenumerate}
+
+% Definition of @item while inside @itemize.
+
+\def\itemizeitem{%
+\advance\itemno by 1
+{\let\par=\endgraf \smallbreak}%
+\ifhmode \errmessage{In hmode at itemizeitem}\fi
+{\parskip=0in \hskip 0pt
+\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
+\vadjust{\penalty 1200}}%
+\flushcr}
+
+% @multitable macros
+% Amy Hendrickson, 8/18/94, 3/6/96
+%
+% @multitable ... @end multitable will make as many columns as desired.
+% Contents of each column will wrap at width given in preamble.  Width
+% can be specified either with sample text given in a template line,
+% or in percent of \hsize, the current width of text on page.
+
+% Table can continue over pages but will only break between lines.
+
+% To make preamble:
+%
+% Either define widths of columns in terms of percent of \hsize:
+%   @multitable @columnfractions .25 .3 .45
+%   @item ...
+%
+%   Numbers following @columnfractions are the percent of the total
+%   current hsize to be used for each column. You may use as many
+%   columns as desired.
+
+
+% Or use a template:
+%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
+%   @item ...
+%   using the widest term desired in each column.
+%
+% For those who want to use more than one line's worth of words in
+% the preamble, break the line within one argument and it
+% will parse correctly, i.e.,
+%
+%     @multitable {Column 1 template} {Column 2 template} {Column 3
+%      template}
+% Not:
+%     @multitable {Column 1 template} {Column 2 template}
+%      {Column 3 template}
+
+% Each new table line starts with @item, each subsequent new column
+% starts with @tab. Empty columns may be produced by supplying @tab's
+% with nothing between them for as many times as empty columns are needed,
+% ie, @tab at tab@tab will produce two empty columns.
+
+% @item, @tab, @multitable or @end multitable do not need to be on their
+% own lines, but it will not hurt if they are.
+
+% Sample multitable:
+
+%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
+%   @item first col stuff @tab second col stuff @tab third col
+%   @item
+%   first col stuff
+%   @tab
+%   second col stuff
+%   @tab
+%   third col
+%   @item first col stuff @tab second col stuff
+%   @tab Many paragraphs of text may be used in any column.
+%
+%         They will wrap at the width determined by the template.
+%   @item at tab@tab This will be in third column.
+%   @end multitable
+
+% Default dimensions may be reset by user.
+% @multitableparskip is vertical space between paragraphs in table.
+% @multitableparindent is paragraph indent in table.
+% @multitablecolmargin is horizontal space to be left between columns.
+% @multitablelinespace is space to leave between table items, baseline
+%                                                            to baseline.
+%   0pt means it depends on current normal line spacing.
+%
+\newskip\multitableparskip
+\newskip\multitableparindent
+\newdimen\multitablecolspace
+\newskip\multitablelinespace
+\multitableparskip=0pt
+\multitableparindent=6pt
+\multitablecolspace=12pt
+\multitablelinespace=0pt
+
+% Macros used to set up halign preamble:
+%
+\let\endsetuptable\relax
+\def\xendsetuptable{\endsetuptable}
+\let\columnfractions\relax
+\def\xcolumnfractions{\columnfractions}
+\newif\ifsetpercent
+
+% #1 is the part of the @columnfraction before the decimal point, which
+% is presumably either 0 or the empty string (but we don't check, we
+% just throw it away).  #2 is the decimal part, which we use as the
+% percent of \hsize for this column.
+\def\pickupwholefraction#1.#2 {%
+  \global\advance\colcount by 1
+  \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
+  \setuptable
+}
+
+\newcount\colcount
+\def\setuptable#1{%
+  \def\firstarg{#1}%
+  \ifx\firstarg\xendsetuptable
+    \let\go = \relax
+  \else
+    \ifx\firstarg\xcolumnfractions
+      \global\setpercenttrue
+    \else
+      \ifsetpercent
+         \let\go\pickupwholefraction
+      \else
+         \global\advance\colcount by 1
+         \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
+                            % typically that is always in the input, anyway.
+         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
+      \fi
+    \fi
+    \ifx\go\pickupwholefraction
+      % Put the argument back for the \pickupwholefraction call, so
+      % we'll always have a period there to be parsed.
+      \def\go{\pickupwholefraction#1}%
+    \else
+      \let\go = \setuptable
+    \fi%
+  \fi
+  \go
+}
+
+% This used to have \hskip1sp.  But then the space in a template line is
+% not enough.  That is bad.  So let's go back to just & until we
+% encounter the problem it was intended to solve again.
+% --karl, nathan at acm.org, 20apr99.
+\def\tab{&}
+
+% @multitable ... @end multitable definitions:
+%
+\def\multitable{\parsearg\dotable}
+\def\dotable#1{\bgroup
+  \vskip\parskip
+  \let\item\crcr
+  \tolerance=9500
+  \hbadness=9500
+  \setmultitablespacing
+  \parskip=\multitableparskip
+  \parindent=\multitableparindent
+  \overfullrule=0pt
+  \global\colcount=0
+  \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
+  %
+  % To parse everything between @multitable and @item:
+  \setuptable#1 \endsetuptable
+  %
+  % \everycr will reset column counter, \colcount, at the end of
+  % each line. Every column entry will cause \colcount to advance by one.
+  % The table preamble
+  % looks at the current \colcount to find the correct column width.
+  \everycr{\noalign{%
+  %
+  % \filbreak%% keeps underfull box messages off when table breaks over pages.
+  % Maybe so, but it also creates really weird page breaks when the table
+  % breaks over pages. Wouldn't \vfil be better?  Wait until the problem
+  % manifests itself, so it can be fixed for real --karl.
+    \global\colcount=0\relax}}%
+  %
+  % This preamble sets up a generic column definition, which will
+  % be used as many times as user calls for columns.
+  % \vtop will set a single line and will also let text wrap and
+  % continue for many paragraphs if desired.
+  \halign\bgroup&\global\advance\colcount by 1\relax
+    \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
+  %
+  % In order to keep entries from bumping into each other
+  % we will add a \leftskip of \multitablecolspace to all columns after
+  % the first one.
+  %
+  % If a template has been used, we will add \multitablecolspace
+  % to the width of each template entry.
+  %
+  % If the user has set preamble in terms of percent of \hsize we will
+  % use that dimension as the width of the column, and the \leftskip
+  % will keep entries from bumping into each other.  Table will start at
+  % left margin and final column will justify at right margin.
+  %
+  % Make sure we don't inherit \rightskip from the outer environment.
+  \rightskip=0pt
+  \ifnum\colcount=1
+    % The first column will be indented with the surrounding text.
+    \advance\hsize by\leftskip
+  \else
+    \ifsetpercent \else
+      % If user has not set preamble in terms of percent of \hsize
+      % we will advance \hsize by \multitablecolspace.
+      \advance\hsize by \multitablecolspace
+    \fi
+   % In either case we will make \leftskip=\multitablecolspace:
+  \leftskip=\multitablecolspace
+  \fi
+  % Ignoring space at the beginning and end avoids an occasional spurious
+  % blank line, when TeX decides to break the line at the space before the
+  % box from the multistrut, so the strut ends up on a line by itself.
+  % For example:
+  % @multitable @columnfractions .11 .89
+  % @item @code{#}
+  % @tab Legal holiday which is valid in major parts of the whole country.
+  % Is automatically provided with highlighting sequences respectively marking
+  % characters.
+  \noindent\ignorespaces##\unskip\multistrut}\cr
+}
+
+\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
+% If so, do nothing. If not, give it an appropriate dimension based on
+% current baselineskip.
+\ifdim\multitablelinespace=0pt
+\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
+\global\advance\multitablelinespace by-\ht0
+%% strut to put in table in case some entry doesn't have descenders,
+%% to keep lines equally spaced
+\let\multistrut = \strut
+\else
+%% FIXME: what is \box0 supposed to be?
+\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
+width0pt\relax} \fi
+%% Test to see if parskip is larger than space between lines of
+%% table. If not, do nothing.
+%%        If so, set to same dimension as multitablelinespace.
+\ifdim\multitableparskip>\multitablelinespace
+\global\multitableparskip=\multitablelinespace
+\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
+                                      %% than skip between lines in the table.
+\fi%
+\ifdim\multitableparskip=0pt
+\global\multitableparskip=\multitablelinespace
+\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
+                                      %% than skip between lines in the table.
+\fi}
+
+
+\message{conditionals,}
+% Prevent errors for section commands.
+% Used in @ignore and in failing conditionals.
+\def\ignoresections{%
+  \let\chapter=\relax
+  \let\unnumbered=\relax
+  \let\top=\relax
+  \let\unnumberedsec=\relax
+  \let\unnumberedsection=\relax
+  \let\unnumberedsubsec=\relax
+  \let\unnumberedsubsection=\relax
+  \let\unnumberedsubsubsec=\relax
+  \let\unnumberedsubsubsection=\relax
+  \let\section=\relax
+  \let\subsec=\relax
+  \let\subsubsec=\relax
+  \let\subsection=\relax
+  \let\subsubsection=\relax
+  \let\appendix=\relax
+  \let\appendixsec=\relax
+  \let\appendixsection=\relax
+  \let\appendixsubsec=\relax
+  \let\appendixsubsection=\relax
+  \let\appendixsubsubsec=\relax
+  \let\appendixsubsubsection=\relax
+  \let\contents=\relax
+  \let\smallbook=\relax
+  \let\titlepage=\relax
+}
+
+% Used in nested conditionals, where we have to parse the Texinfo source
+% and so want to turn off most commands, in case they are used
+% incorrectly.
+%
+\def\ignoremorecommands{%
+  \let\defcodeindex = \relax
+  \let\defcv = \relax
+  \let\deffn = \relax
+  \let\deffnx = \relax
+  \let\defindex = \relax
+  \let\defivar = \relax
+  \let\defmac = \relax
+  \let\defmethod = \relax
+  \let\defop = \relax
+  \let\defopt = \relax
+  \let\defspec = \relax
+  \let\deftp = \relax
+  \let\deftypefn = \relax
+  \let\deftypefun = \relax
+  \let\deftypeivar = \relax
+  \let\deftypeop = \relax
+  \let\deftypevar = \relax
+  \let\deftypevr = \relax
+  \let\defun = \relax
+  \let\defvar = \relax
+  \let\defvr = \relax
+  \let\ref = \relax
+  \let\xref = \relax
+  \let\printindex = \relax
+  \let\pxref = \relax
+  \let\settitle = \relax
+  \let\setchapternewpage = \relax
+  \let\setchapterstyle = \relax
+  \let\everyheading = \relax
+  \let\evenheading = \relax
+  \let\oddheading = \relax
+  \let\everyfooting = \relax
+  \let\evenfooting = \relax
+  \let\oddfooting = \relax
+  \let\headings = \relax
+  \let\include = \relax
+  \let\lowersections = \relax
+  \let\down = \relax
+  \let\raisesections = \relax
+  \let\up = \relax
+  \let\set = \relax
+  \let\clear = \relax
+  \let\item = \relax
+}
+
+% Ignore @ignore, @ifhtml, @ifinfo, @ifplaintext, @ifnottex, @html, @menu,
+% @direntry, and @documentdescription.
+%
+\def\ignore{\doignore{ignore}}
+\def\ifhtml{\doignore{ifhtml}}
+\def\ifinfo{\doignore{ifinfo}}
+\def\ifplaintext{\doignore{ifplaintext}}
+\def\ifnottex{\doignore{ifnottex}}
+\def\html{\doignore{html}}
+\def\menu{\doignore{menu}}
+\def\direntry{\doignore{direntry}}
+\def\documentdescription{\doignore{documentdescription}}
+\def\documentdescriptionword{documentdescription}
+
+% @dircategory CATEGORY  -- specify a category of the dir file
+% which this file should belong to.  Ignore this in TeX.
+\let\dircategory = \comment
+
+% Ignore text until a line `@end #1'.
+%
+\def\doignore#1{\begingroup
+  % Don't complain about control sequences we have declared \outer.
+  \ignoresections
+  %
+  % Define a command to swallow text until we reach `@end #1'.
+  % This @ is a catcode 12 token (that is the normal catcode of @ in
+  % this texinfo.tex file).  We change the catcode of @ below to match.
+  \long\def\doignoretext##1 at end #1{\enddoignore}%
+  %
+  % Make sure that spaces turn into tokens that match what \doignoretext wants.
+  \catcode32 = 10
+  %
+  % Ignore braces, too, so mismatched braces don't cause trouble.
+  \catcode`\{ = 9
+  \catcode`\} = 9
+  %
+  % We must not have @c interpreted as a control sequence.
+  \catcode`\@ = 12
+  %
+  \def\ignoreword{#1}%
+  \ifx\ignoreword\documentdescriptionword
+    % The c kludge breaks documentdescription, since
+    % `documentdescription' contains a `c'.  Means not everything will
+    % be ignored inside @documentdescription, but oh well...
+  \else
+    % Make the letter c a comment character so that the rest of the line
+    % will be ignored. This way, the document can have (for example)
+    %   @c @end ifinfo
+    % and the @end ifinfo will be properly ignored.
+    % (We've just changed @ to catcode 12.)
+    \catcode`\c = 14
+  \fi
+  %
+  % And now expand the command defined above.
+  \doignoretext
+}
+
+% What we do to finish off ignored text.
+%
+\def\enddoignore{\endgroup\ignorespaces}%
+
+\newif\ifwarnedobs\warnedobsfalse
+\def\obstexwarn{%
+  \ifwarnedobs\relax\else
+  % We need to warn folks that they may have trouble with TeX 3.0.
+  % This uses \immediate\write16 rather than \message to get newlines.
+    \immediate\write16{}
+    \immediate\write16{WARNING: for users of Unix TeX 3.0!}
+    \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
+    \immediate\write16{If you are running another version of TeX, relax.}
+    \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
+    \immediate\write16{  Then upgrade your TeX installation if you can.}
+    \immediate\write16{  (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
+    \immediate\write16{If you are stuck with version 3.0, run the}
+    \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
+    \immediate\write16{  to use a workaround.}
+    \immediate\write16{}
+    \global\warnedobstrue
+    \fi
+}
+
+% **In TeX 3.0, setting text in \nullfont hangs tex.  For a
+% workaround (which requires the file ``dummy.tfm'' to be installed),
+% uncomment the following line:
+%%%%%\font\nullfont=dummy\let\obstexwarn=\relax
+
+% Ignore text, except that we keep track of conditional commands for
+% purposes of nesting, up to an `@end #1' command.
+%
+\def\nestedignore#1{%
+  \obstexwarn
+  % We must actually expand the ignored text to look for the @end
+  % command, so that nested ignore constructs work.  Thus, we put the
+  % text into a \vbox and then do nothing with the result.  To minimize
+  % the change of memory overflow, we follow the approach outlined on
+  % page 401 of the TeXbook: make the current font be a dummy font.
+  %
+  \setbox0 = \vbox\bgroup
+    % Don't complain about control sequences we have declared \outer.
+    \ignoresections
+    %
+    % Define `@end #1' to end the box, which will in turn undefine the
+    % @end command again.
+    \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
+    %
+    % We are going to be parsing Texinfo commands.  Most cause no
+    % trouble when they are used incorrectly, but some commands do
+    % complicated argument parsing or otherwise get confused, so we
+    % undefine them.
+    %
+    % We can't do anything about stray @-signs, unfortunately;
+    % they'll produce `undefined control sequence' errors.
+    \ignoremorecommands
+    %
+    % Set the current font to be \nullfont, a TeX primitive, and define
+    % all the font commands to also use \nullfont.  We don't use
+    % dummy.tfm, as suggested in the TeXbook, because not all sites
+    % might have that installed.  Therefore, math mode will still
+    % produce output, but that should be an extremely small amount of
+    % stuff compared to the main input.
+    %
+    \nullfont
+    \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
+    \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
+    \let\tensf=\nullfont
+    % Similarly for index fonts.
+    \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
+    \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
+    \let\smallsf=\nullfont
+    % Similarly for smallexample fonts.
+    \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont
+    \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont
+    \let\smallersf=\nullfont
+    %
+    % Don't complain when characters are missing from the fonts.
+    \tracinglostchars = 0
+    %
+    % Don't bother to do space factor calculations.
+    \frenchspacing
+    %
+    % Don't report underfull hboxes.
+    \hbadness = 10000
+    %
+    % Do minimal line-breaking.
+    \pretolerance = 10000
+    %
+    % Do not execute instructions in @tex
+    \def\tex{\doignore{tex}}%
+    % Do not execute macro definitions.
+    % `c' is a comment character, so the word `macro' will get cut off.
+    \def\macro{\doignore{ma}}%
+}
+
+% @set VAR sets the variable VAR to an empty value.
+% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
+%
+% Since we want to separate VAR from REST-OF-LINE (which might be
+% empty), we can't just use \parsearg; we have to insert a space of our
+% own to delimit the rest of the line, and then take it out again if we
+% didn't need it.  Make sure the catcode of space is correct to avoid
+% losing inside @example, for instance.
+%
+\def\set{\begingroup\catcode` =10
+  \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
+  \parsearg\setxxx}
+\def\setxxx#1{\setyyy#1 \endsetyyy}
+\def\setyyy#1 #2\endsetyyy{%
+  \def\temp{#2}%
+  \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
+  \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
+  \fi
+  \endgroup
+}
+% Can't use \xdef to pre-expand #2 and save some time, since \temp or
+% \next or other control sequences that we've defined might get us into
+% an infinite loop. Consider `@set foo @cite{bar}'.
+\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
+
+% @clear VAR clears (i.e., unsets) the variable VAR.
+%
+\def\clear{\parsearg\clearxxx}
+\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
+
+% @value{foo} gets the text saved in variable foo.
+{
+  \catcode`\_ = \active
+  %
+  % We might end up with active _ or - characters in the argument if
+  % we're called from @code, as @code{@value{foo-bar_}}.  So \let any
+  % such active characters to their normal equivalents.
+  \gdef\value{\begingroup
+    \catcode`\-=12 \catcode`\_=12
+    \indexbreaks \let_\normalunderscore
+    \valuexxx}
+}
+\def\valuexxx#1{\expandablevalue{#1}\endgroup}
+
+% We have this subroutine so that we can handle at least some @value's
+% properly in indexes (we \let\value to this in \indexdummies).  Ones
+% whose names contain - or _ still won't work, but we can't do anything
+% about that.  The command has to be fully expandable, since the result
+% winds up in the index file.  This means that if the variable's value
+% contains other Texinfo commands, it's almost certain it will fail
+% (although perhaps we could fix that with sufficient work to do a
+% one-level expansion on the result, instead of complete).
+%
+\def\expandablevalue#1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    {[No value for ``#1'']}%
+  \else
+    \csname SET#1\endcsname
+  \fi
+}
+
+% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
+% with @set.
+%
+\def\ifset{\parsearg\ifsetxxx}
+\def\ifsetxxx #1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    \expandafter\ifsetfail
+  \else
+    \expandafter\ifsetsucceed
+  \fi
+}
+\def\ifsetsucceed{\conditionalsucceed{ifset}}
+\def\ifsetfail{\nestedignore{ifset}}
+\defineunmatchedend{ifset}
+
+% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
+% defined with @set, or has been undefined with @clear.
+%
+\def\ifclear{\parsearg\ifclearxxx}
+\def\ifclearxxx #1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    \expandafter\ifclearsucceed
+  \else
+    \expandafter\ifclearfail
+  \fi
+}
+\def\ifclearsucceed{\conditionalsucceed{ifclear}}
+\def\ifclearfail{\nestedignore{ifclear}}
+\defineunmatchedend{ifclear}
+
+% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
+% read the text following, through the first @end iftex (etc.).  Make
+% `@end iftex' (etc.) valid only after an @iftex.
+%
+\def\iftex{\conditionalsucceed{iftex}}
+\def\ifnothtml{\conditionalsucceed{ifnothtml}}
+\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
+\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
+\defineunmatchedend{iftex}
+\defineunmatchedend{ifnothtml}
+\defineunmatchedend{ifnotinfo}
+\defineunmatchedend{ifnotplaintext}
+
+% We can't just want to start a group at @iftex (etc.) and end it at
+% @end iftex, since then @set commands inside the conditional have no
+% effect (they'd get reverted at the end of the group).  So we must
+% define \Eiftex to redefine itself to be its previous value.  (We can't
+% just define it to fail again with an ``unmatched end'' error, since
+% the @ifset might be nested.)
+%
+\def\conditionalsucceed#1{%
+  \edef\temp{%
+    % Remember the current value of \E#1.
+    \let\nece{prevE#1} = \nece{E#1}%
+    %
+    % At the `@end #1', redefine \E#1 to be its previous value.
+    \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
+  }%
+  \temp
+}
+
+% We need to expand lots of \csname's, but we don't want to expand the
+% control sequences after we've constructed them.
+%
+\def\nece#1{\expandafter\noexpand\csname#1\endcsname}
+
+% @defininfoenclose.
+\let\definfoenclose=\comment
+
+
+\message{indexing,}
+% Index generation facilities
+
+% Define \newwrite to be identical to plain tex's \newwrite
+% except not \outer, so it can be used within \newindex.
+{\catcode`\@=11
+\gdef\newwrite{\alloc at 7\write\chardef\sixt@@n}}
+
+% \newindex {foo} defines an index named foo.
+% It automatically defines \fooindex such that
+% \fooindex ...rest of line... puts an entry in the index foo.
+% It also defines \fooindfile to be the number of the output channel for
+% the file that accumulates this index.  The file's extension is foo.
+% The name of an index should be no more than 2 characters long
+% for the sake of vms.
+%
+\def\newindex#1{%
+  \iflinks
+    \expandafter\newwrite \csname#1indfile\endcsname
+    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
+  \fi
+  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
+    \noexpand\doindex{#1}}
+}
+
+% @defindex foo  ==  \newindex{foo}
+%
+\def\defindex{\parsearg\newindex}
+
+% Define @defcodeindex, like @defindex except put all entries in @code.
+%
+\def\defcodeindex{\parsearg\newcodeindex}
+%
+\def\newcodeindex#1{%
+  \iflinks
+    \expandafter\newwrite \csname#1indfile\endcsname
+    \openout \csname#1indfile\endcsname \jobname.#1
+  \fi
+  \expandafter\xdef\csname#1index\endcsname{%
+    \noexpand\docodeindex{#1}}%
+}
+
+
+% @synindex foo bar    makes index foo feed into index bar.
+% Do this instead of @defindex foo if you don't want it as a separate index.
+% 
+% @syncodeindex foo bar   similar, but put all entries made for index foo
+% inside @code.
+% 
+\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
+\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
+
+% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
+% #3 the target index (bar).
+\def\dosynindex#1#2#3{%
+  % Only do \closeout if we haven't already done it, else we'll end up
+  % closing the target index.
+  \expandafter \ifx\csname donesynindex#2\endcsname \undefined
+    % The \closeout helps reduce unnecessary open files; the limit on the
+    % Acorn RISC OS is a mere 16 files.
+    \expandafter\closeout\csname#2indfile\endcsname
+    \expandafter\let\csname\donesynindex#2\endcsname = 1
+  \fi
+  % redefine \fooindfile:
+  \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
+  \expandafter\let\csname#2indfile\endcsname=\temp
+  % redefine \fooindex:
+  \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
+}
+
+% Define \doindex, the driver for all \fooindex macros.
+% Argument #1 is generated by the calling \fooindex macro,
+%  and it is "foo", the name of the index.
+
+% \doindex just uses \parsearg; it calls \doind for the actual work.
+% This is because \doind is more useful to call from other macros.
+
+% There is also \dosubind {index}{topic}{subtopic}
+% which makes an entry in a two-level index such as the operation index.
+
+\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
+\def\singleindexer #1{\doind{\indexname}{#1}}
+
+% like the previous two, but they put @code around the argument.
+\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
+\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
+
+% Take care of texinfo commands likely to appear in an index entry.
+% (Must be a way to avoid doing expansion at all, and thus not have to
+% laboriously list every single command here.)
+% 
+\def\indexdummies{%
+\def\ { }%
+\def\@{@}% change to @@ when we switch to @ as escape char in aux files.
+% Need these in case \tex is in effect and \{ is a \delimiter again.
+% But can't use \lbracecmd and \rbracecmd because texindex assumes
+% braces and backslashes are used only as delimiters.  
+\let\{ = \mylbrace
+\let\} = \myrbrace
+\def\_{{\realbackslash _}}%
+\normalturnoffactive
+%
+% Take care of the plain tex accent commands.
+\def\,##1{\realbackslash ,{##1}}%
+\def\"{\realbackslash "}%
+\def\`{\realbackslash `}%
+\def\'{\realbackslash '}%
+\def\^{\realbackslash ^}%
+\def\~{\realbackslash ~}%
+\def\={\realbackslash =}%
+\def\b{\realbackslash b}%
+\def\c{\realbackslash c}%
+\def\d{\realbackslash d}%
+\def\u{\realbackslash u}%
+\def\v{\realbackslash v}%
+\def\H{\realbackslash H}%
+\def\dotless##1{\realbackslash dotless {##1}}%
+% Take care of the plain tex special European modified letters.
+\def\AA{\realbackslash AA}%
+\def\AE{\realbackslash AE}%
+\def\L{\realbackslash L}%
+\def\OE{\realbackslash OE}%
+\def\O{\realbackslash O}%
+\def\aa{\realbackslash aa}%
+\def\ae{\realbackslash ae}%
+\def\l{\realbackslash l}%
+\def\oe{\realbackslash oe}%
+\def\o{\realbackslash o}%
+\def\ss{\realbackslash ss}%
+%
+% Although these internals commands shouldn't show up, sometimes they do.
+\def\bf{\realbackslash bf }%
+\def\gtr{\realbackslash gtr}%
+\def\hat{\realbackslash hat}%
+\def\less{\realbackslash less}%
+%\def\rm{\realbackslash rm }%
+\def\sf{\realbackslash sf}%
+\def\sl{\realbackslash sl }%
+\def\tclose##1{\realbackslash tclose {##1}}%
+\def\tt{\realbackslash tt}%
+%
+\def\b##1{\realbackslash b {##1}}%
+\def\i##1{\realbackslash i {##1}}%
+\def\sc##1{\realbackslash sc {##1}}%
+\def\t##1{\realbackslash t {##1}}%
+\def\r##1{\realbackslash r {##1}}%
+%
+\def\TeX{\realbackslash TeX}%
+\def\acronym##1{\realbackslash acronym {##1}}%
+\def\cite##1{\realbackslash cite {##1}}%
+\def\code##1{\realbackslash code {##1}}%
+\def\command##1{\realbackslash command {##1}}%
+\def\dfn##1{\realbackslash dfn {##1}}%
+\def\dots{\realbackslash dots }%
+\def\emph##1{\realbackslash emph {##1}}%
+\def\env##1{\realbackslash env {##1}}%
+\def\file##1{\realbackslash file {##1}}%
+\def\kbd##1{\realbackslash kbd {##1}}%
+\def\key##1{\realbackslash key {##1}}%
+\def\math##1{\realbackslash math {##1}}%
+\def\option##1{\realbackslash option {##1}}%
+\def\samp##1{\realbackslash samp {##1}}%
+\def\strong##1{\realbackslash strong {##1}}%
+\def\uref##1{\realbackslash uref {##1}}%
+\def\url##1{\realbackslash url {##1}}%
+\def\var##1{\realbackslash var {##1}}%
+\def\w{\realbackslash w }%
+%
+% These math commands don't seem likely to be used in index entries.
+\def\copyright{\realbackslash copyright}%
+\def\equiv{\realbackslash equiv}%
+\def\error{\realbackslash error}%
+\def\expansion{\realbackslash expansion}%
+\def\point{\realbackslash point}%
+\def\print{\realbackslash print}%
+\def\result{\realbackslash result}%
+%
+% Handle some cases of @value -- where the variable name does not
+% contain - or _, and the value does not contain any
+% (non-fully-expandable) commands.
+\let\value = \expandablevalue
+%
+\unsepspaces
+% Turn off macro expansion
+\turnoffmacros
+}
+
+% If an index command is used in an @example environment, any spaces
+% therein should become regular spaces in the raw index file, not the
+% expansion of \tie (\leavevmode \penalty \@M \ ).
+{\obeyspaces
+ \gdef\unsepspaces{\obeyspaces\let =\space}}
+
+% \indexnofonts no-ops all font-change commands.
+% This is used when outputting the strings to sort the index by.
+\def\indexdummyfont#1{#1}
+\def\indexdummytex{TeX}
+\def\indexdummydots{...}
+
+\def\indexnofonts{%
+\def\@{@}%
+% how to handle braces?
+\def\_{\normalunderscore}%
+%
+\let\,=\indexdummyfont
+\let\"=\indexdummyfont
+\let\`=\indexdummyfont
+\let\'=\indexdummyfont
+\let\^=\indexdummyfont
+\let\~=\indexdummyfont
+\let\==\indexdummyfont
+\let\b=\indexdummyfont
+\let\c=\indexdummyfont
+\let\d=\indexdummyfont
+\let\u=\indexdummyfont
+\let\v=\indexdummyfont
+\let\H=\indexdummyfont
+\let\dotless=\indexdummyfont
+% Take care of the plain tex special European modified letters.
+\def\AA{AA}%
+\def\AE{AE}%
+\def\L{L}%
+\def\OE{OE}%
+\def\O{O}%
+\def\aa{aa}%
+\def\ae{ae}%
+\def\l{l}%
+\def\oe{oe}%
+\def\o{o}%
+\def\ss{ss}%
+%
+% Don't no-op \tt, since it isn't a user-level command
+% and is used in the definitions of the active chars like <, >, |, etc.
+% Likewise with the other plain tex font commands.
+%\let\tt=\indexdummyfont
+%
+\let\b=\indexdummyfont
+\let\i=\indexdummyfont
+\let\r=\indexdummyfont
+\let\sc=\indexdummyfont
+\let\t=\indexdummyfont
+%
+\let\TeX=\indexdummytex
+\let\acronym=\indexdummyfont
+\let\cite=\indexdummyfont
+\let\code=\indexdummyfont
+\let\command=\indexdummyfont
+\let\dfn=\indexdummyfont
+\let\dots=\indexdummydots
+\let\emph=\indexdummyfont
+\let\env=\indexdummyfont
+\let\file=\indexdummyfont
+\let\kbd=\indexdummyfont
+\let\key=\indexdummyfont
+\let\math=\indexdummyfont
+\let\option=\indexdummyfont
+\let\samp=\indexdummyfont
+\let\strong=\indexdummyfont
+\let\uref=\indexdummyfont
+\let\url=\indexdummyfont
+\let\var=\indexdummyfont
+\let\w=\indexdummyfont
+}
+
+% To define \realbackslash, we must make \ not be an escape.
+% We must first make another character (@) an escape
+% so we do not become unable to do a definition.
+
+{\catcode`\@=0 \catcode`\\=\other
+ @gdef at realbackslash{\}}
+
+\let\indexbackslash=0  %overridden during \printindex.
+\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
+
+% For \ifx comparisons.
+\def\emptymacro{\empty}
+
+% Most index entries go through here, but \dosubind is the general case.
+%
+\def\doind#1#2{\dosubind{#1}{#2}\empty}
+
+% Workhorse for all \fooindexes.
+% #1 is name of index, #2 is stuff to put there, #3 is subentry --
+% \empty if called from \doind, as we usually are.  The main exception
+% is with defuns, which call us directly.
+%
+\def\dosubind#1#2#3{%
+  % Put the index entry in the margin if desired.
+  \ifx\SETmarginindex\relax\else
+    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
+  \fi
+  {%
+    \count255=\lastpenalty
+    {%
+      \indexdummies % Must do this here, since \bf, etc expand at this stage
+      \escapechar=`\\
+      {%
+        \let\folio = 0% We will expand all macros now EXCEPT \folio.
+        \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
+        % so it will be output as is; and it will print as backslash.
+        %
+        \def\thirdarg{#3}%
+        %
+        % If third arg is present, precede it with space in sort key.
+        \ifx\thirdarg\emptymacro
+          \let\subentry = \empty
+        \else
+          \def\subentry{ #3}%
+        \fi
+        %
+        % First process the index entry with all font commands turned
+        % off to get the string to sort by.
+        {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
+        %
+        % Now the real index entry with the fonts.
+        \toks0 = {#2}%
+        %
+        % If the third (subentry) arg is present, add it to the index
+        % line to write.
+        \ifx\thirdarg\emptymacro \else
+          \toks0 = \expandafter{\the\toks0{#3}}%
+        \fi
+        %
+        % Set up the complete index entry, with both the sort key and
+        % the original text, including any font commands.  We write
+        % three arguments to \entry to the .?? file (four in the
+        % subentry case), texindex reduces to two when writing the .??s
+        % sorted result.
+        \edef\temp{%
+          \write\csname#1indfile\endcsname{%
+            \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
+        }%
+        %
+        % If a skip is the last thing on the list now, preserve it
+        % by backing up by \lastskip, doing the \write, then inserting
+        % the skip again.  Otherwise, the whatsit generated by the
+        % \write will make \lastskip zero.  The result is that sequences
+        % like this:
+        % @end defun
+        % @tindex whatever
+        % @defun ...
+        % will have extra space inserted, because the \medbreak in the
+        % start of the @defun won't see the skip inserted by the @end of
+        % the previous defun.
+        %
+        % But don't do any of this if we're not in vertical mode.  We
+        % don't want to do a \vskip and prematurely end a paragraph.
+        %
+        % Avoid page breaks due to these extra skips, too.
+        %
+        \iflinks
+          \ifvmode
+            \skip0 = \lastskip
+            \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
+          \fi
+          %
+          \temp % do the write
+          %
+          %
+          \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
+        \fi
+      }%
+    }%
+    \penalty\count255
+  }%
+}
+
+% The index entry written in the file actually looks like
+%  \entry {sortstring}{page}{topic}
+% or
+%  \entry {sortstring}{page}{topic}{subtopic}
+% The texindex program reads in these files and writes files
+% containing these kinds of lines:
+%  \initial {c}
+%     before the first topic whose initial is c
+%  \entry {topic}{pagelist}
+%     for a topic that is used without subtopics
+%  \primary {topic}
+%     for the beginning of a topic that is used with subtopics
+%  \secondary {subtopic}{pagelist}
+%     for each subtopic.
+
+% Define the user-accessible indexing commands
+% @findex, @vindex, @kindex, @cindex.
+
+\def\findex {\fnindex}
+\def\kindex {\kyindex}
+\def\cindex {\cpindex}
+\def\vindex {\vrindex}
+\def\tindex {\tpindex}
+\def\pindex {\pgindex}
+
+\def\cindexsub {\begingroup\obeylines\cindexsub}
+{\obeylines %
+\gdef\cindexsub "#1" #2^^M{\endgroup %
+\dosubind{cp}{#2}{#1}}}
+
+% Define the macros used in formatting output of the sorted index material.
+
+% @printindex causes a particular index (the ??s file) to get printed.
+% It does not print any chapter heading (usually an @unnumbered).
+%
+\def\printindex{\parsearg\doprintindex}
+\def\doprintindex#1{\begingroup
+  \dobreak \chapheadingskip{10000}%
+  %
+  \smallfonts \rm
+  \tolerance = 9500
+  \indexbreaks
+  %
+  % See if the index file exists and is nonempty.
+  % Change catcode of @ here so that if the index file contains
+  % \initial {@}
+  % as its first line, TeX doesn't complain about mismatched braces
+  % (because it thinks @} is a control sequence).
+  \catcode`\@ = 11
+  \openin 1 \jobname.#1s
+  \ifeof 1
+    % \enddoublecolumns gets confused if there is no text in the index,
+    % and it loses the chapter title and the aux file entries for the
+    % index.  The easiest way to prevent this problem is to make sure
+    % there is some text.
+    \putwordIndexNonexistent
+  \else
+    %
+    % If the index file exists but is empty, then \openin leaves \ifeof
+    % false.  We have to make TeX try to read something from the file, so
+    % it can discover if there is anything in it.
+    \read 1 to \temp
+    \ifeof 1
+      \putwordIndexIsEmpty
+    \else
+      % Index files are almost Texinfo source, but we use \ as the escape
+      % character.  It would be better to use @, but that's too big a change
+      % to make right now.
+      \def\indexbackslash{\rawbackslashxx}%
+      \catcode`\\ = 0
+      \escapechar = `\\
+      \begindoublecolumns
+      \input \jobname.#1s
+      \enddoublecolumns
+    \fi
+  \fi
+  \closein 1
+\endgroup}
+
+% These macros are used by the sorted index file itself.
+% Change them to control the appearance of the index.
+
+\def\initial#1{{%
+  % Some minor font changes for the special characters.
+  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
+  %
+  % Remove any glue we may have, we'll be inserting our own.
+  \removelastskip
+  %
+  % We like breaks before the index initials, so insert a bonus.
+  \penalty -300
+  %
+  % Typeset the initial.  Making this add up to a whole number of
+  % baselineskips increases the chance of the dots lining up from column
+  % to column.  It still won't often be perfect, because of the stretch
+  % we need before each entry, but it's better.
+  %
+  % No shrink because it confuses \balancecolumns.
+  \vskip 1.67\baselineskip plus .5\baselineskip
+  \leftline{\secbf #1}%
+  \vskip .33\baselineskip plus .1\baselineskip
+  %
+  % Do our best not to break after the initial.
+  \nobreak
+}}
+
+% This typesets a paragraph consisting of #1, dot leaders, and then #2
+% flush to the right margin.  It is used for index and table of contents
+% entries.  The paragraph is indented by \leftskip.
+%
+\def\entry#1#2{\begingroup
+  %
+  % Start a new paragraph if necessary, so our assignments below can't
+  % affect previous text.
+  \par
+  %
+  % Do not fill out the last line with white space.
+  \parfillskip = 0in
+  %
+  % No extra space above this paragraph.
+  \parskip = 0in
+  %
+  % Do not prefer a separate line ending with a hyphen to fewer lines.
+  \finalhyphendemerits = 0
+  %
+  % \hangindent is only relevant when the entry text and page number
+  % don't both fit on one line.  In that case, bob suggests starting the
+  % dots pretty far over on the line.  Unfortunately, a large
+  % indentation looks wrong when the entry text itself is broken across
+  % lines.  So we use a small indentation and put up with long leaders.
+  %
+  % \hangafter is reset to 1 (which is the value we want) at the start
+  % of each paragraph, so we need not do anything with that.
+  \hangindent = 2em
+  %
+  % When the entry text needs to be broken, just fill out the first line
+  % with blank space.
+  \rightskip = 0pt plus1fil
+  %
+  % A bit of stretch before each entry for the benefit of balancing columns.
+  \vskip 0pt plus1pt
+  %
+  % Start a ``paragraph'' for the index entry so the line breaking
+  % parameters we've set above will have an effect.
+  \noindent
+  %
+  % Insert the text of the index entry.  TeX will do line-breaking on it.
+  #1%
+  % The following is kludged to not output a line of dots in the index if
+  % there are no page numbers.  The next person who breaks this will be
+  % cursed by a Unix daemon.
+  \def\tempa{{\rm }}%
+  \def\tempb{#2}%
+  \edef\tempc{\tempa}%
+  \edef\tempd{\tempb}%
+  \ifx\tempc\tempd\ \else%
+    %
+    % If we must, put the page number on a line of its own, and fill out
+    % this line with blank space.  (The \hfil is overwhelmed with the
+    % fill leaders glue in \indexdotfill if the page number does fit.)
+    \hfil\penalty50
+    \null\nobreak\indexdotfill % Have leaders before the page number.
+    %
+    % The `\ ' here is removed by the implicit \unskip that TeX does as
+    % part of (the primitive) \par.  Without it, a spurious underfull
+    % \hbox ensues.
+    \ifpdf
+      \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
+    \else
+      \ #2% The page number ends the paragraph.
+    \fi
+  \fi%
+  \par
+\endgroup}
+
+% Like \dotfill except takes at least 1 em.
+\def\indexdotfill{\cleaders
+  \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
+
+\def\primary #1{\line{#1\hfil}}
+
+\newskip\secondaryindent \secondaryindent=0.5cm
+\def\secondary#1#2{{%
+  \parfillskip=0in
+  \parskip=0in
+  \hangindent=1in
+  \hangafter=1
+  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
+  \ifpdf
+    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
+  \else
+    #2
+  \fi
+  \par
+}}
+
+% Define two-column mode, which we use to typeset indexes.
+% Adapted from the TeXbook, page 416, which is to say,
+% the manmac.tex format used to print the TeXbook itself.
+\catcode`\@=11
+
+\newbox\partialpage
+\newdimen\doublecolumnhsize
+
+\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
+  % Grab any single-column material above us.
+  \output = {%
+    %
+    % Here is a possibility not foreseen in manmac: if we accumulate a
+    % whole lot of material, we might end up calling this \output
+    % routine twice in a row (see the doublecol-lose test, which is
+    % essentially a couple of indexes with @setchapternewpage off).  In
+    % that case we just ship out what is in \partialpage with the normal
+    % output routine.  Generally, \partialpage will be empty when this
+    % runs and this will be a no-op.  See the indexspread.tex test case.
+    \ifvoid\partialpage \else
+      \onepageout{\pagecontents\partialpage}%
+    \fi
+    %
+    \global\setbox\partialpage = \vbox{%
+      % Unvbox the main output page.
+      \unvbox\PAGE
+      \kern-\topskip \kern\baselineskip
+    }%
+  }%
+  \eject % run that output routine to set \partialpage
+  %
+  % Use the double-column output routine for subsequent pages.
+  \output = {\doublecolumnout}%
+  %
+  % Change the page size parameters.  We could do this once outside this
+  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
+  % format, but then we repeat the same computation.  Repeating a couple
+  % of assignments once per index is clearly meaningless for the
+  % execution time, so we may as well do it in one place.
+  %
+  % First we halve the line length, less a little for the gutter between
+  % the columns.  We compute the gutter based on the line length, so it
+  % changes automatically with the paper format.  The magic constant
+  % below is chosen so that the gutter has the same value (well, +-<1pt)
+  % as it did when we hard-coded it.
+  %
+  % We put the result in a separate register, \doublecolumhsize, so we
+  % can restore it in \pagesofar, after \hsize itself has (potentially)
+  % been clobbered.
+  %
+  \doublecolumnhsize = \hsize
+    \advance\doublecolumnhsize by -.04154\hsize
+    \divide\doublecolumnhsize by 2
+  \hsize = \doublecolumnhsize
+  %
+  % Double the \vsize as well.  (We don't need a separate register here,
+  % since nobody clobbers \vsize.)
+  \vsize = 2\vsize
+}
+
+% The double-column output routine for all double-column pages except
+% the last.
+%
+\def\doublecolumnout{%
+  \splittopskip=\topskip \splitmaxdepth=\maxdepth
+  % Get the available space for the double columns -- the normal
+  % (undoubled) page height minus any material left over from the
+  % previous page.
+  \dimen@ = \vsize
+  \divide\dimen@ by 2
+  \advance\dimen@ by -\ht\partialpage
+  %
+  % box0 will be the left-hand column, box2 the right.
+  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
+  \onepageout\pagesofar
+  \unvbox255
+  \penalty\outputpenalty
+}
+%
+% Re-output the contents of the output page -- any previous material,
+% followed by the two boxes we just split, in box0 and box2.
+\def\pagesofar{%
+  \unvbox\partialpage
+  %
+  \hsize = \doublecolumnhsize
+  \wd0=\hsize \wd2=\hsize
+  \hbox to\pagewidth{\box0\hfil\box2}%
+}
+% 
+% All done with double columns.
+\def\enddoublecolumns{%
+  \output = {%
+    % Split the last of the double-column material.  Leave it on the
+    % current page, no automatic page break.
+    \balancecolumns
+    %
+    % If we end up splitting too much material for the current page,
+    % though, there will be another page break right after this \output
+    % invocation ends.  Having called \balancecolumns once, we do not
+    % want to call it again.  Therefore, reset \output to its normal
+    % definition right away.  (We hope \balancecolumns will never be
+    % called on to balance too much material, but if it is, this makes
+    % the output somewhat more palatable.)
+    \global\output = {\onepageout{\pagecontents\PAGE}}%
+  }%
+  \eject
+  \endgroup % started in \begindoublecolumns
+  %
+  % \pagegoal was set to the doubled \vsize above, since we restarted
+  % the current page.  We're now back to normal single-column
+  % typesetting, so reset \pagegoal to the normal \vsize (after the
+  % \endgroup where \vsize got restored).
+  \pagegoal = \vsize
+}
+%
+% Called at the end of the double column material.
+\def\balancecolumns{%
+  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
+  \dimen@ = \ht0
+  \advance\dimen@ by \topskip
+  \advance\dimen@ by-\baselineskip
+  \divide\dimen@ by 2 % target to split to
+  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen at .}%
+  \splittopskip = \topskip
+  % Loop until we get a decent breakpoint.
+  {%
+    \vbadness = 10000
+    \loop
+      \global\setbox3 = \copy0
+      \global\setbox1 = \vsplit3 to \dimen@
+    \ifdim\ht3>\dimen@
+      \global\advance\dimen@ by 1pt
+    \repeat
+  }%
+  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
+  \setbox0=\vbox to\dimen@{\unvbox1}%
+  \setbox2=\vbox to\dimen@{\unvbox3}%
+  %
+  \pagesofar
+}
+\catcode`\@ = \other
+
+
+\message{sectioning,}
+% Chapters, sections, etc.
+
+\newcount\chapno
+\newcount\secno        \secno=0
+\newcount\subsecno     \subsecno=0
+\newcount\subsubsecno  \subsubsecno=0
+
+% This counter is funny since it counts through charcodes of letters A, B, ...
+\newcount\appendixno  \appendixno = `\@
+% \def\appendixletter{\char\the\appendixno}
+% We do the following for the sake of pdftex, which needs the actual
+% letter in the expansion, not just typeset.
+\def\appendixletter{%
+  \ifnum\appendixno=`A A%
+  \else\ifnum\appendixno=`B B%
+  \else\ifnum\appendixno=`C C%
+  \else\ifnum\appendixno=`D D%
+  \else\ifnum\appendixno=`E E%
+  \else\ifnum\appendixno=`F F%
+  \else\ifnum\appendixno=`G G%
+  \else\ifnum\appendixno=`H H%
+  \else\ifnum\appendixno=`I I%
+  \else\ifnum\appendixno=`J J%
+  \else\ifnum\appendixno=`K K%
+  \else\ifnum\appendixno=`L L%
+  \else\ifnum\appendixno=`M M%
+  \else\ifnum\appendixno=`N N%
+  \else\ifnum\appendixno=`O O%
+  \else\ifnum\appendixno=`P P%
+  \else\ifnum\appendixno=`Q Q%
+  \else\ifnum\appendixno=`R R%
+  \else\ifnum\appendixno=`S S%
+  \else\ifnum\appendixno=`T T%
+  \else\ifnum\appendixno=`U U%
+  \else\ifnum\appendixno=`V V%
+  \else\ifnum\appendixno=`W W%
+  \else\ifnum\appendixno=`X X%
+  \else\ifnum\appendixno=`Y Y%
+  \else\ifnum\appendixno=`Z Z%
+  % The \the is necessary, despite appearances, because \appendixletter is
+  % expanded while writing the .toc file.  \char\appendixno is not
+  % expandable, thus it is written literally, thus all appendixes come out
+  % with the same letter (or @) in the toc without it.
+  \else\char\the\appendixno
+  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+
+% Each @chapter defines this as the name of the chapter.
+% page headings and footings can use it.  @section does likewise.
+\def\thischapter{}
+\def\thissection{}
+
+\newcount\absseclevel % used to calculate proper heading level
+\newcount\secbase\secbase=0 % @raise/lowersections modify this count
+
+% @raisesections: treat @section as chapter, @subsection as section, etc.
+\def\raisesections{\global\advance\secbase by -1}
+\let\up=\raisesections % original BFox name
+
+% @lowersections: treat @chapter as section, @section as subsection, etc.
+\def\lowersections{\global\advance\secbase by 1}
+\let\down=\lowersections % original BFox name
+
+% Choose a numbered-heading macro
+% #1 is heading level if unmodified by @raisesections or @lowersections
+% #2 is text for heading
+\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
+\ifcase\absseclevel
+  \chapterzzz{#2}
+\or
+  \seczzz{#2}
+\or
+  \numberedsubseczzz{#2}
+\or
+  \numberedsubsubseczzz{#2}
+\else
+  \ifnum \absseclevel<0
+    \chapterzzz{#2}
+  \else
+    \numberedsubsubseczzz{#2}
+  \fi
+\fi
+}
+
+% like \numhead, but chooses appendix heading levels
+\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
+\ifcase\absseclevel
+  \appendixzzz{#2}
+\or
+  \appendixsectionzzz{#2}
+\or
+  \appendixsubseczzz{#2}
+\or
+  \appendixsubsubseczzz{#2}
+\else
+  \ifnum \absseclevel<0
+    \appendixzzz{#2}
+  \else
+    \appendixsubsubseczzz{#2}
+  \fi
+\fi
+}
+
+% like \numhead, but chooses numberless heading levels
+\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
+\ifcase\absseclevel
+  \unnumberedzzz{#2}
+\or
+  \unnumberedseczzz{#2}
+\or
+  \unnumberedsubseczzz{#2}
+\or
+  \unnumberedsubsubseczzz{#2}
+\else
+  \ifnum \absseclevel<0
+    \unnumberedzzz{#2}
+  \else
+    \unnumberedsubsubseczzz{#2}
+  \fi
+\fi
+}
+
+% @chapter, @appendix, @unnumbered.
+\def\thischaptername{No Chapter Title}
+\outer\def\chapter{\parsearg\chapteryyy}
+\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
+\def\chapterzzz #1{%
+\secno=0 \subsecno=0 \subsubsecno=0
+\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
+\chapmacro {#1}{\the\chapno}%
+\gdef\thissection{#1}%
+\gdef\thischaptername{#1}%
+% We don't substitute the actual chapter name into \thischapter
+% because we don't want its macros evaluated now.
+\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
+                                  {\the\chapno}}}%
+\temp
+\donoderef
+\global\let\section = \numberedsec
+\global\let\subsection = \numberedsubsec
+\global\let\subsubsection = \numberedsubsubsec
+}
+
+\outer\def\appendix{\parsearg\appendixyyy}
+\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
+\def\appendixzzz #1{%
+\secno=0 \subsecno=0 \subsubsecno=0
+\global\advance \appendixno by 1
+\message{\putwordAppendix\space \appendixletter}%
+\chapmacro {#1}{\putwordAppendix{} \appendixletter}%
+\gdef\thissection{#1}%
+\gdef\thischaptername{#1}%
+\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash appendixentry{\the\toks0}%
+                       {\appendixletter}}}%
+\temp
+\appendixnoderef
+\global\let\section = \appendixsec
+\global\let\subsection = \appendixsubsec
+\global\let\subsubsection = \appendixsubsubsec
+}
+
+% @centerchap is like @unnumbered, but the heading is centered.
+\outer\def\centerchap{\parsearg\centerchapyyy}
+\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
+
+% @top is like @unnumbered.
+\outer\def\top{\parsearg\unnumberedyyy}
+
+\outer\def\unnumbered{\parsearg\unnumberedyyy}
+\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
+\def\unnumberedzzz #1{%
+\secno=0 \subsecno=0 \subsubsecno=0
+%
+% This used to be simply \message{#1}, but TeX fully expands the
+% argument to \message.  Therefore, if #1 contained @-commands, TeX
+% expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
+% expanded @cite (which turns out to cause errors because \cite is meant
+% to be executed, not expanded).
+%
+% Anyway, we don't want the fully-expanded definition of @cite to appear
+% as a result of the \message, we just want `@cite' itself.  We use
+% \the<toks register> to achieve this: TeX expands \the<toks> only once,
+% simply yielding the contents of <toks register>.  (We also do this for
+% the toc entries.)
+\toks0 = {#1}\message{(\the\toks0)}%
+%
+\unnumbchapmacro {#1}%
+\gdef\thischapter{#1}\gdef\thissection{#1}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
+\temp
+\unnumbnoderef
+\global\let\section = \unnumberedsec
+\global\let\subsection = \unnumberedsubsec
+\global\let\subsubsection = \unnumberedsubsubsec
+}
+
+% Sections.
+\outer\def\numberedsec{\parsearg\secyyy}
+\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
+\def\seczzz #1{%
+\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
+\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
+                                  {\the\chapno}{\the\secno}}}%
+\temp
+\donoderef
+\nobreak
+}
+
+\outer\def\appendixsection{\parsearg\appendixsecyyy}
+\outer\def\appendixsec{\parsearg\appendixsecyyy}
+\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
+\def\appendixsectionzzz #1{%
+\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
+\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
+                                  {\appendixletter}{\the\secno}}}%
+\temp
+\appendixnoderef
+\nobreak
+}
+
+\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
+\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
+\def\unnumberedseczzz #1{%
+\plainsecheading {#1}\gdef\thissection{#1}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry%
+  {\the\toks0}{\the\chapno}}}%
+\temp
+\unnumbnoderef
+\nobreak
+}
+
+% Subsections.
+\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
+\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
+\def\numberedsubseczzz #1{%
+\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
+\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
+                                    {\the\chapno}{\the\secno}{\the\subsecno}}}%
+\temp
+\donoderef
+\nobreak
+}
+
+\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
+\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
+\def\appendixsubseczzz #1{%
+\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
+\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
+                                {\appendixletter}{\the\secno}{\the\subsecno}}}%
+\temp
+\appendixnoderef
+\nobreak
+}
+
+\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
+\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
+\def\unnumberedsubseczzz #1{%
+\plainsubsecheading {#1}\gdef\thissection{#1}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
+  {\the\toks0}{\the\chapno}{\the\secno}}}%
+\temp
+\unnumbnoderef
+\nobreak
+}
+
+% Subsubsections.
+\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
+\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
+\def\numberedsubsubseczzz #1{%
+\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
+\subsubsecheading {#1}
+  {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
+  {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
+\temp
+\donoderef
+\nobreak
+}
+
+\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
+\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
+\def\appendixsubsubseczzz #1{%
+\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
+\subsubsecheading {#1}
+  {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
+  {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
+\temp
+\appendixnoderef
+\nobreak
+}
+
+\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
+\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
+\def\unnumberedsubsubseczzz #1{%
+\plainsubsubsecheading {#1}\gdef\thissection{#1}%
+\toks0 = {#1}%
+\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
+  {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}}}%
+\temp
+\unnumbnoderef
+\nobreak
+}
+
+% These are variants which are not "outer", so they can appear in @ifinfo.
+% Actually, they should now be obsolete; ordinary section commands should work.
+\def\infotop{\parsearg\unnumberedzzz}
+\def\infounnumbered{\parsearg\unnumberedzzz}
+\def\infounnumberedsec{\parsearg\unnumberedseczzz}
+\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
+\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
+
+\def\infoappendix{\parsearg\appendixzzz}
+\def\infoappendixsec{\parsearg\appendixseczzz}
+\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
+\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
+
+\def\infochapter{\parsearg\chapterzzz}
+\def\infosection{\parsearg\sectionzzz}
+\def\infosubsection{\parsearg\subsectionzzz}
+\def\infosubsubsection{\parsearg\subsubsectionzzz}
+
+% These macros control what the section commands do, according
+% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
+% Define them by default for a numbered chapter.
+\global\let\section = \numberedsec
+\global\let\subsection = \numberedsubsec
+\global\let\subsubsection = \numberedsubsubsec
+
+% Define @majorheading, @heading and @subheading
+
+% NOTE on use of \vbox for chapter headings, section headings, and such:
+%       1) We use \vbox rather than the earlier \line to permit
+%          overlong headings to fold.
+%       2) \hyphenpenalty is set to 10000 because hyphenation in a
+%          heading is obnoxious; this forbids it.
+%       3) Likewise, headings look best if no \parindent is used, and
+%          if justification is not attempted.  Hence \raggedright.
+
+
+\def\majorheading{\parsearg\majorheadingzzz}
+\def\majorheadingzzz #1{%
+{\advance\chapheadingskip by 10pt \chapbreak }%
+{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                  \parindent=0pt\raggedright
+                  \rm #1\hfill}}\bigskip \par\penalty 200}
+
+\def\chapheading{\parsearg\chapheadingzzz}
+\def\chapheadingzzz #1{\chapbreak %
+{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                  \parindent=0pt\raggedright
+                  \rm #1\hfill}}\bigskip \par\penalty 200}
+
+% @heading, @subheading, @subsubheading.
+\def\heading{\parsearg\plainsecheading}
+\def\subheading{\parsearg\plainsubsecheading}
+\def\subsubheading{\parsearg\plainsubsubsecheading}
+
+% These macros generate a chapter, section, etc. heading only
+% (including whitespace, linebreaking, etc. around it),
+% given all the information in convenient, parsed form.
+
+%%% Args are the skip and penalty (usually negative)
+\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
+
+\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
+
+%%% Define plain chapter starts, and page on/off switching for it
+% Parameter controlling skip before chapter headings (if needed)
+
+\newskip\chapheadingskip
+
+\def\chapbreak{\dobreak \chapheadingskip {-4000}}
+\def\chappager{\par\vfill\supereject}
+\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
+
+\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
+
+\def\CHAPPAGoff{%
+\global\let\contentsalignmacro = \chappager
+\global\let\pchapsepmacro=\chapbreak
+\global\let\pagealignmacro=\chappager}
+
+\def\CHAPPAGon{%
+\global\let\contentsalignmacro = \chappager
+\global\let\pchapsepmacro=\chappager
+\global\let\pagealignmacro=\chappager
+\global\def\HEADINGSon{\HEADINGSsingle}}
+
+\def\CHAPPAGodd{
+\global\let\contentsalignmacro = \chapoddpage
+\global\let\pchapsepmacro=\chapoddpage
+\global\let\pagealignmacro=\chapoddpage
+\global\def\HEADINGSon{\HEADINGSdouble}}
+
+\CHAPPAGon
+
+\def\CHAPFplain{
+\global\let\chapmacro=\chfplain
+\global\let\unnumbchapmacro=\unnchfplain
+\global\let\centerchapmacro=\centerchfplain}
+
+% Plain chapter opening.
+% #1 is the text, #2 the chapter number or empty if unnumbered.
+\def\chfplain#1#2{%
+  \pchapsepmacro
+  {%
+    \chapfonts \rm
+    \def\chapnum{#2}%
+    \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
+    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
+          \hangindent = \wd0 \centerparametersmaybe
+          \unhbox0 #1\par}%
+  }%
+  \nobreak\bigskip % no page break after a chapter title
+  \nobreak
+}
+
+% Plain opening for unnumbered.
+\def\unnchfplain#1{\chfplain{#1}{}}
+
+% @centerchap -- centered and unnumbered.
+\let\centerparametersmaybe = \relax
+\def\centerchfplain#1{{%
+  \def\centerparametersmaybe{%
+    \advance\rightskip by 3\rightskip
+    \leftskip = \rightskip
+    \parfillskip = 0pt
+  }%
+  \chfplain{#1}{}%
+}}
+
+\CHAPFplain % The default
+
+\def\unnchfopen #1{%
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                       \parindent=0pt\raggedright
+                       \rm #1\hfill}}\bigskip \par\nobreak
+}
+
+\def\chfopen #1#2{\chapoddpage {\chapfonts
+\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
+\par\penalty 5000 %
+}
+
+\def\centerchfopen #1{%
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+                       \parindent=0pt
+                       \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
+}
+
+\def\CHAPFopen{
+\global\let\chapmacro=\chfopen
+\global\let\unnumbchapmacro=\unnchfopen
+\global\let\centerchapmacro=\centerchfopen}
+
+
+% Section titles.
+\newskip\secheadingskip
+\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
+\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
+\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
+
+% Subsection titles.
+\newskip \subsecheadingskip
+\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
+\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
+\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
+
+% Subsubsection titles.
+\let\subsubsecheadingskip = \subsecheadingskip
+\let\subsubsecheadingbreak = \subsecheadingbreak
+\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
+\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
+
+
+% Print any size section title.
+%
+% #1 is the section type (sec/subsec/subsubsec), #2 is the section
+% number (maybe empty), #3 the text.
+\def\sectionheading#1#2#3{%
+  {%
+    \expandafter\advance\csname #1headingskip\endcsname by \parskip
+    \csname #1headingbreak\endcsname
+  }%
+  {%
+    % Switch to the right set of fonts.
+    \csname #1fonts\endcsname \rm
+    %
+    % Only insert the separating space if we have a section number.
+    \def\secnum{#2}%
+    \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
+    %
+    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
+          \hangindent = \wd0 % zero if no section number
+          \unhbox0 #3}%
+  }%
+  \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
+}
+
+
+\message{toc,}
+% Table of contents.
+\newwrite\tocfile
+
+% Write an entry to the toc file, opening it if necessary.
+% Called from @chapter, etc.  We supply {\folio} at the end of the
+% argument, which will end up as the last argument to the \...entry macro.
+%
+% We open the .toc file here instead of at @setfilename or any other
+% fixed time so that @contents can be put in the document anywhere.
+%
+\newif\iftocfileopened
+\def\writetocentry#1{%
+  \iftocfileopened\else
+    \immediate\openout\tocfile = \jobname.toc
+    \global\tocfileopenedtrue
+  \fi
+  \iflinks \write\tocfile{#1{\folio}}\fi
+  %
+  % Tell \shipout to create a page destination if we're doing pdf, which
+  % will be the target of the links in the table of contents.  We can't
+  % just do it on every page because the title pages are numbered 1 and
+  % 2 (the page numbers aren't printed), and so are the first two pages
+  % of the document.  Thus, we'd have two destinations named `1', and
+  % two named `2'.
+  \ifpdf \pdfmakepagedesttrue \fi
+}
+
+\newskip\contentsrightmargin \contentsrightmargin=1in
+\newcount\savepageno
+\newcount\lastnegativepageno \lastnegativepageno = -1
+
+% Finish up the main text and prepare to read what we've written
+% to \tocfile.
+%
+\def\startcontents#1{%
+   % If @setchapternewpage on, and @headings double, the contents should
+   % start on an odd page, unlike chapters.  Thus, we maintain
+   % \contentsalignmacro in parallel with \pagealignmacro.
+   % From: Torbjorn Granlund <tege at matematik.su.se>
+   \contentsalignmacro
+   \immediate\closeout\tocfile
+   %
+   % Don't need to put `Contents' or `Short Contents' in the headline.
+   % It is abundantly clear what they are.
+   \unnumbchapmacro{#1}\def\thischapter{}%
+   \savepageno = \pageno
+   \begingroup                  % Set up to handle contents files properly.
+      \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
+      % We can't do this, because then an actual ^ in a section
+      % title fails, e.g., @chapter ^ -- exponentiation.  --karl, 9jul97.
+      %\catcode`\^=7 % to see ^^e4 as \"a etc. juha at piuha.ydi.vtt.fi
+      \raggedbottom             % Worry more about breakpoints than the bottom.
+      \advance\hsize by -\contentsrightmargin % Don't use the full line length.
+      %
+      % Roman numerals for page numbers.
+      \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
+}
+
+
+% Normal (long) toc.
+\def\contents{%
+   \startcontents{\putwordTOC}%
+     \openin 1 \jobname.toc
+     \ifeof 1 \else
+       \closein 1
+       \input \jobname.toc
+     \fi
+     \vfill \eject
+     \contentsalignmacro % in case @setchapternewpage odd is in effect
+     \pdfmakeoutlines
+   \endgroup
+   \lastnegativepageno = \pageno
+   \pageno = \savepageno
+}
+
+% And just the chapters.
+\def\summarycontents{%
+   \startcontents{\putwordShortTOC}%
+      %
+      \let\chapentry = \shortchapentry
+      \let\appendixentry = \shortappendixentry
+      \let\unnumbchapentry = \shortunnumberedentry
+      % We want a true roman here for the page numbers.
+      \secfonts
+      \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
+      \rm
+      \hyphenpenalty = 10000
+      \advance\baselineskip by 1pt % Open it up a little.
+      \def\secentry ##1##2##3##4{}
+      \def\unnumbsecentry ##1##2##3{}
+      \def\subsecentry ##1##2##3##4##5{}
+      \def\unnumbsubsecentry ##1##2##3##4{}
+      \def\subsubsecentry ##1##2##3##4##5##6{}
+      \def\unnumbsubsubsecentry ##1##2##3##4##5{}
+      \openin 1 \jobname.toc
+      \ifeof 1 \else
+        \closein 1
+        \input \jobname.toc
+      \fi
+     \vfill \eject
+     \contentsalignmacro % in case @setchapternewpage odd is in effect
+   \endgroup
+   \lastnegativepageno = \pageno
+   \pageno = \savepageno
+}
+\let\shortcontents = \summarycontents
+
+\ifpdf
+  \pdfcatalog{/PageMode /UseOutlines}%
+\fi
+
+% These macros generate individual entries in the table of contents.
+% The first argument is the chapter or section name.
+% The last argument is the page number.
+% The arguments in between are the chapter number, section number, ...
+
+% Chapters, in the main contents.
+\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
+%
+% Chapters, in the short toc.
+% See comments in \dochapentry re vbox and related settings.
+\def\shortchapentry#1#2#3{%
+  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
+}
+
+% Appendices, in the main contents.
+\def\appendixentry#1#2#3{\dochapentry{\putwordAppendix{} #2\labelspace#1}{#3}}
+%
+% Appendices, in the short toc.
+\let\shortappendixentry = \shortchapentry
+
+% Typeset the label for a chapter or appendix for the short contents.
+% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
+% We could simplify the code here by writing out an \appendixentry
+% command in the toc file for appendices, instead of using \chapentry
+% for both, but it doesn't seem worth it.
+%
+\newdimen\shortappendixwidth
+%
+\def\shortchaplabel#1{%
+  % This space should be enough, since a single number is .5em, and the
+  % widest letter (M) is 1em, at least in the Computer Modern fonts.
+  % But use \hss just in case.
+  % (This space doesn't include the extra space that gets added after
+  % the label; that gets put in by \shortchapentry above.)
+  \dimen0 = 1em
+  \hbox to \dimen0{#1\hss}%
+}
+
+% Unnumbered chapters.
+\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
+\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}}
+
+% Sections.
+\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
+\def\unnumbsecentry#1#2#3{\dosecentry{#1}{#3}}
+
+% Subsections.
+\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
+\def\unnumbsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
+
+% And subsubsections.
+\def\subsubsecentry#1#2#3#4#5#6{%
+  \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
+\def\unnumbsubsubsecentry#1#2#3#4#5{\dosubsubsecentry{#1}{#5}}
+
+% This parameter controls the indentation of the various levels.
+\newdimen\tocindent \tocindent = 3pc
+
+% Now for the actual typesetting. In all these, #1 is the text and #2 is the
+% page number.
+%
+% If the toc has to be broken over pages, we want it to be at chapters
+% if at all possible; hence the \penalty.
+\def\dochapentry#1#2{%
+   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
+   \begingroup
+     \chapentryfonts
+     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+   \endgroup
+   \nobreak\vskip .25\baselineskip plus.1\baselineskip
+}
+
+\def\dosecentry#1#2{\begingroup
+  \secentryfonts \leftskip=\tocindent
+  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+\endgroup}
+
+\def\dosubsecentry#1#2{\begingroup
+  \subsecentryfonts \leftskip=2\tocindent
+  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+\endgroup}
+
+\def\dosubsubsecentry#1#2{\begingroup
+  \subsubsecentryfonts \leftskip=3\tocindent
+  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+\endgroup}
+
+% Final typesetting of a toc entry; we use the same \entry macro as for
+% the index entries, but we want to suppress hyphenation here.  (We
+% can't do that in the \entry macro, since index entries might consist
+% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
+\def\tocentry#1#2{\begingroup
+  \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
+  % Do not use \turnoffactive in these arguments.  Since the toc is
+  % typeset in cmr, characters such as _ would come out wrong; we
+  % have to do the usual translation tricks.
+  \entry{#1}{#2}%
+\endgroup}
+
+% Space between chapter (or whatever) number and the title.
+\def\labelspace{\hskip1em \relax}
+
+\def\dopageno#1{{\rm #1}}
+\def\doshortpageno#1{{\rm #1}}
+
+\def\chapentryfonts{\secfonts \rm}
+\def\secentryfonts{\textfonts}
+\let\subsecentryfonts = \textfonts
+\let\subsubsecentryfonts = \textfonts
+
+
+\message{environments,}
+% @foo ... @end foo.
+
+% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
+% 
+% Since these characters are used in examples, it should be an even number of
+% \tt widths. Each \tt character is 1en, so two makes it 1em.
+%
+\def\point{$\star$}
+\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
+\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
+\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
+\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
+
+% The @error{} command.
+% Adapted from the TeXbook's \boxit.
+% 
+\newbox\errorbox
+%
+{\tentt \global\dimen0 = 3em}% Width of the box.
+\dimen2 = .55pt % Thickness of rules
+% The text. (`r' is open on the right, `e' somewhat less so on the left.)
+\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
+%
+\global\setbox\errorbox=\hbox to \dimen0{\hfil
+   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
+   \advance\hsize by -2\dimen2 % Rules.
+   \vbox{
+      \hrule height\dimen2
+      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
+         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
+         \kern3pt\vrule width\dimen2}% Space to right.
+      \hrule height\dimen2}
+    \hfil}
+%
+\def\error{\leavevmode\lower.7ex\copy\errorbox}
+
+% @tex ... @end tex    escapes into raw Tex temporarily.
+% One exception: @ is still an escape character, so that @end tex works.
+% But \@ or @@ will get a plain tex @ character.
+
+\def\tex{\begingroup
+  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
+  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
+  \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
+  \catcode `\%=14
+  \catcode 43=12 % plus
+  \catcode`\"=12
+  \catcode`\==12
+  \catcode`\|=12
+  \catcode`\<=12
+  \catcode`\>=12
+  \escapechar=`\\
+  %
+  \let\b=\ptexb
+  \let\bullet=\ptexbullet
+  \let\c=\ptexc
+  \let\,=\ptexcomma
+  \let\.=\ptexdot
+  \let\dots=\ptexdots
+  \let\equiv=\ptexequiv
+  \let\!=\ptexexclam
+  \let\i=\ptexi
+  \let\{=\ptexlbrace
+  \let\+=\tabalign
+  \let\}=\ptexrbrace
+  \let\*=\ptexstar
+  \let\t=\ptext
+  %
+  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
+  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
+  \def\@{@}%
+\let\Etex=\endgroup}
+
+% Define @lisp ... @end lisp.
+% @lisp does a \begingroup so it can rebind things,
+% including the definition of @end lisp (which normally is erroneous).
+
+% Amount to narrow the margins by for @lisp.
+\newskip\lispnarrowing \lispnarrowing=0.4in
+
+% This is the definition that ^^M gets inside @lisp, @example, and other
+% such environments.  \null is better than a space, since it doesn't
+% have any width.
+\def\lisppar{\null\endgraf}
+
+% Make each space character in the input produce a normal interword
+% space in the output.  Don't allow a line break at this space, as this
+% is used only in environments like @example, where each line of input
+% should produce a line of output anyway.
+%
+{\obeyspaces %
+\gdef\sepspaces{\obeyspaces\let =\tie}}
+
+% Define \obeyedspace to be our active space, whatever it is.  This is
+% for use in \parsearg.
+{\sepspaces%
+\global\let\obeyedspace= }
+
+% This space is always present above and below environments.
+\newskip\envskipamount \envskipamount = 0pt
+
+% Make spacing and below environment symmetrical.  We use \parskip here
+% to help in doing that, since in @example-like environments \parskip
+% is reset to zero; thus the \afterenvbreak inserts no space -- but the
+% start of the next paragraph will insert \parskip
+%
+\def\aboveenvbreak{{%
+  \ifnum\lastpenalty < 10000
+    \advance\envskipamount by \parskip
+    \endgraf
+    \ifdim\lastskip<\envskipamount
+      \removelastskip
+      \penalty-50
+      \vskip\envskipamount
+    \fi
+  \fi
+}}
+
+\let\afterenvbreak = \aboveenvbreak
+
+% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
+\let\nonarrowing=\relax
+
+% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
+% environment contents.
+\font\circle=lcircle10
+\newdimen\circthick
+\newdimen\cartouter\newdimen\cartinner
+\newskip\normbskip\newskip\normpskip\newskip\normlskip
+\circthick=\fontdimen8\circle
+%
+\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
+\def\ctr{{\hskip 6pt\circle\char'010}}
+\def\cbl{{\circle\char'012\hskip -6pt}}
+\def\cbr{{\hskip 6pt\circle\char'011}}
+\def\carttop{\hbox to \cartouter{\hskip\lskip
+        \ctl\leaders\hrule height\circthick\hfil\ctr
+        \hskip\rskip}}
+\def\cartbot{\hbox to \cartouter{\hskip\lskip
+        \cbl\leaders\hrule height\circthick\hfil\cbr
+        \hskip\rskip}}
+%
+\newskip\lskip\newskip\rskip
+
+\long\def\cartouche{%
+\begingroup
+        \lskip=\leftskip \rskip=\rightskip
+        \leftskip=0pt\rightskip=0pt %we want these *outside*.
+        \cartinner=\hsize \advance\cartinner by-\lskip
+                          \advance\cartinner by-\rskip
+        \cartouter=\hsize
+        \advance\cartouter by 18.4pt % allow for 3pt kerns on either
+%                                    side, and for 6pt waste from
+%                                    each corner char, and rule thickness
+        \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
+        % Flag to tell @lisp, etc., not to narrow margin.
+        \let\nonarrowing=\comment
+        \vbox\bgroup
+                \baselineskip=0pt\parskip=0pt\lineskip=0pt
+                \carttop
+                \hbox\bgroup
+                        \hskip\lskip
+                        \vrule\kern3pt
+                        \vbox\bgroup
+                                \hsize=\cartinner
+                                \kern3pt
+                                \begingroup
+                                        \baselineskip=\normbskip
+                                        \lineskip=\normlskip
+                                        \parskip=\normpskip
+                                        \vskip -\parskip
+\def\Ecartouche{%
+                                \endgroup
+                                \kern3pt
+                        \egroup
+                        \kern3pt\vrule
+                        \hskip\rskip
+                \egroup
+                \cartbot
+        \egroup
+\endgroup
+}}
+
+
+% This macro is called at the beginning of all the @example variants,
+% inside a group.
+\def\nonfillstart{%
+  \aboveenvbreak
+  \inENV % This group ends at the end of the body
+  \hfuzz = 12pt % Don't be fussy
+  \sepspaces % Make spaces be word-separators rather than space tokens.
+  \singlespace
+  \let\par = \lisppar % don't ignore blank lines
+  \obeylines % each line of input is a line of output
+  \parskip = 0pt
+  \parindent = 0pt
+  \emergencystretch = 0pt % don't try to avoid overfull boxes
+  % @cartouche defines \nonarrowing to inhibit narrowing
+  % at next level down.
+  \ifx\nonarrowing\relax
+    \advance \leftskip by \lispnarrowing
+    \exdentamount=\lispnarrowing
+    \let\exdent=\nofillexdent
+    \let\nonarrowing=\relax
+  \fi
+}
+
+% Define the \E... control sequence only if we are inside the particular
+% environment, so the error checking in \end will work.
+%
+% To end an @example-like environment, we first end the paragraph (via
+% \afterenvbreak's vertical glue), and then the group.  That way we keep
+% the zero \parskip that the environments set -- \parskip glue will be
+% inserted at the beginning of the next paragraph in the document, after
+% the environment.
+%
+\def\nonfillfinish{\afterenvbreak\endgroup}
+
+% @lisp: indented, narrowed, typewriter font.
+\def\lisp{\begingroup
+  \nonfillstart
+  \let\Elisp = \nonfillfinish
+  \tt
+  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
+  \gobble       % eat return
+}
+
+% @example: Same as @lisp.
+\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
+
+% @small... is usually equivalent to the non-small (@smallbook
+% redefines).  We must call \example (or whatever) last in the
+% definition, since it reads the return following the @example (or
+% whatever) command.
+%
+% This actually allows (for example) @end display inside an
+% @smalldisplay.  Too bad, but makeinfo will catch the error anyway.
+%
+\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
+\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
+\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
+\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
+
+% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
+% Originally contributed by Pavel at xerox.
+\def\smalllispx{\begingroup
+  \def\Esmalllisp{\nonfillfinish\endgroup}%
+  \def\Esmallexample{\nonfillfinish\endgroup}%
+  \smallexamplefonts
+  \lisp
+}
+
+% @display: same as @lisp except keep current font.
+%
+\def\display{\begingroup
+  \nonfillstart
+  \let\Edisplay = \nonfillfinish
+  \gobble
+}
+%
+% @smalldisplay (when @smallbook): @display plus smaller fonts.
+%
+\def\smalldisplayx{\begingroup
+  \def\Esmalldisplay{\nonfillfinish\endgroup}%
+  \smallexamplefonts \rm
+  \display
+}
+
+% @format: same as @display except don't narrow margins.
+%
+\def\format{\begingroup
+  \let\nonarrowing = t
+  \nonfillstart
+  \let\Eformat = \nonfillfinish
+  \gobble
+}
+%
+% @smallformat (when @smallbook): @format plus smaller fonts.
+%
+\def\smallformatx{\begingroup
+  \def\Esmallformat{\nonfillfinish\endgroup}%
+  \smallexamplefonts \rm
+  \format
+}
+
+% @flushleft (same as @format).
+%
+\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
+
+% @flushright.
+%
+\def\flushright{\begingroup
+  \let\nonarrowing = t
+  \nonfillstart
+  \let\Eflushright = \nonfillfinish
+  \advance\leftskip by 0pt plus 1fill
+  \gobble
+}
+
+
+% @quotation does normal linebreaking (hence we can't use \nonfillstart)
+% and narrows the margins.
+%
+\def\quotation{%
+  \begingroup\inENV %This group ends at the end of the @quotation body
+  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
+  \singlespace
+  \parindent=0pt
+  % We have retained a nonzero parskip for the environment, since we're
+  % doing normal filling. So to avoid extra space below the environment...
+  \def\Equotation{\parskip = 0pt \nonfillfinish}%
+  %
+  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
+  \ifx\nonarrowing\relax
+    \advance\leftskip by \lispnarrowing
+    \advance\rightskip by \lispnarrowing
+    \exdentamount = \lispnarrowing
+    \let\nonarrowing = \relax
+  \fi
+}
+
+
+% LaTeX-like @verbatim... at end verbatim and @verb{<char>...<char>}
+% If we want to allow any <char> as delimiter, 
+% we need the curly braces so that makeinfo sees the @verb command, eg:
+% `@verbx...x' would look like the '@verbx' command.  --janneke at gnu.org
+%
+% [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
+%
+% [Knuth] p. 344; only we need to do '@' too
+\def\dospecials{%
+  \do\ \do\\\do\@\do\{\do\}\do\$\do\&%
+  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
+%
+% [Knuth] p. 380
+\def\uncatcodespecials{%
+  \def\do##1{\catcode`##1=12}\dospecials}
+%
+% [Knuth] pp. 380,381,391
+% Disable Spanish ligatures ?` and !` of \tt font
+\begingroup
+  \catcode`\`=\active\gdef`{\relax\lq}
+\endgroup
+%
+% Setup for the @verb command.
+%
+% Eight spaces for a tab
+\begingroup
+  \catcode`\^^I=\active
+  \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
+\endgroup
+%
+\def\setupverb{%
+  \tt  % easiest (and conventionally used) font for verbatim
+  \def\par{\leavevmode\endgraf}%
+  \catcode`\`=\active
+  \tabeightspaces
+  % Respect line breaks,
+  % print special symbols as themselves, and
+  % make each space count
+  % must do in this order:
+  \obeylines \uncatcodespecials \sepspaces
+}
+
+% Setup for the @verbatim environment
+%
+% Real tab expansion
+\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
+%
+\def\starttabbox{\setbox0=\hbox\bgroup}
+\begingroup
+  \catcode`\^^I=\active
+  \gdef\tabexpand{%
+    \catcode`\^^I=\active
+    \def^^I{\leavevmode\egroup
+      \dimen0=\wd0 % the width so far, or since the previous tab
+      \divide\dimen0 by\tabw
+      \multiply\dimen0 by\tabw % compute previous multiple of \tabw
+      \advance\dimen0 by\tabw  % advance to next multiple of \tabw
+      \wd0=\dimen0 \box0 \starttabbox
+    }%
+  }
+\endgroup
+\def\setupverbatim{%
+  % Easiest (and conventionally used) font for verbatim
+  \tt
+  \def\par{\leavevmode\egroup\box0\endgraf}%
+  \catcode`\`=\active
+  \tabexpand
+  % Respect line breaks,
+  % print special symbols as themselves, and
+  % make each space count
+  % must do in this order:
+  \obeylines \uncatcodespecials \sepspaces
+  \everypar{\starttabbox}%
+}
+
+% Do the @verb magic: verbatim text is quoted by unique 
+% delimiter characters.  Before first delimiter expect a 
+% right brace, after last delimiter expect closing brace:
+%
+%    \def\doverb'{'<char>#1<char>'}'{#1}
+%
+% [Knuth] p. 382; only eat outer {}
+\begingroup
+  \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
+  \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
+\endgroup
+%
+\def\verb{\begingroup\setupverb\doverb}
+%
+%
+% Do the @verbatim magic: define the macro \doverbatim so that
+% the (first) argument ends when '@end verbatim' is reached, ie:
+%
+%     \def\doverbatim#1 at end verbatim{#1}
+%
+% For Texinfo it's a lot easier than for LaTeX, 
+% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
+% we need not redefine '\', '{' and '}'
+%
+% Inspired by LaTeX's verbatim command set [latex.ltx]
+%% Include LaTeX hack for completeness -- never know
+%% \begingroup
+%% \catcode`|=0 \catcode`[=1
+%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
+%% \catcode`\\=12|gdef|doverbatim#1 at end verbatim[
+%% #1|endgroup|def|Everbatim[]|end[verbatim]]
+%% |endgroup
+\begingroup
+  \catcode`\ =\active
+  \gdef\doverbatim#1 at end verbatim{#1\end{verbatim}}
+\endgroup
+%
+\def\verbatim{%
+  \def\Everbatim{\nonfillfinish\endgroup}%
+  \begingroup
+    \nonfillstart
+    \advance\leftskip by -\defbodyindent
+    \begingroup\setupverbatim\doverbatim
+}
+
+% @verbatiminclude FILE - insert text of file in verbatim environment.
+%
+% Allow normal characters that we make active in the argument (a file name).
+\def\verbatiminclude{%
+  \begingroup
+    \catcode`\\=12
+    \catcode`~=12
+    \catcode`^=12
+    \catcode`_=12
+    \catcode`|=12
+    \catcode`<=12
+    \catcode`>=12
+    \catcode`+=12
+    \parsearg\doverbatiminclude
+}
+\def\setupverbatiminclude{%
+  \begingroup
+    \nonfillstart
+    \advance\leftskip by -\defbodyindent
+    \begingroup\setupverbatim
+}
+%
+\def\doverbatiminclude#1{%
+     % Restore active chars for included file.
+  \endgroup
+  \begingroup
+  \def\thisfile{#1}%
+  \expandafter\expandafter\setupverbatiminclude\input\thisfile
+  \endgroup\nonfillfinish\endgroup
+}
+
+% @copying ... @end copying.
+% Save the text away for @insertcopying later.
+% 
+\newbox\copyingbox
+%
+\def\copying{\begingroup
+  \parindent = 0pt  % looks wrong on title page
+  \def\Ecopying{\egroup\endgroup}%
+  \global\setbox\copyingbox = \vbox\bgroup
+}
+
+% @insertcopying.
+% 
+\def\insertcopying{\unvcopy\copyingbox}
+
+
+\message{defuns,}
+% @defun etc.
+
+% Allow user to change definition object font (\df) internally
+\def\setdeffont #1 {\csname DEF#1\endcsname}
+
+\newskip\defbodyindent \defbodyindent=.4in
+\newskip\defargsindent \defargsindent=50pt
+\newskip\deftypemargin \deftypemargin=12pt
+\newskip\deflastargmargin \deflastargmargin=18pt
+
+\newcount\parencount
+% define \functionparens, which makes ( and ) and & do special things.
+% \functionparens affects the group it is contained in.
+\def\activeparens{%
+\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
+\catcode`\[=\active \catcode`\]=\active}
+
+% Make control sequences which act like normal parenthesis chars.
+\let\lparen = ( \let\rparen = )
+
+{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
+
+% Be sure that we always have a definition for `(', etc.  For example,
+% if the fn name has parens in it, \boldbrax will not be in effect yet,
+% so TeX would otherwise complain about undefined control sequence.
+\global\let(=\lparen \global\let)=\rparen
+\global\let[=\lbrack \global\let]=\rbrack
+
+\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
+\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
+% This is used to turn on special parens
+% but make & act ordinary (given that it's active).
+\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
+
+% Definitions of (, ) and & used in args for functions.
+% This is the definition of ( outside of all parentheses.
+\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
+  \global\advance\parencount by 1
+}
+%
+% This is the definition of ( when already inside a level of parens.
+\gdef\opnested{\char`\(\global\advance\parencount by 1 }
+%
+\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
+  % also in that case restore the outer-level definition of (.
+  \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
+  \global\advance \parencount by -1 }
+% If we encounter &foo, then turn on ()-hacking afterwards
+\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
+%
+\gdef\normalparens{\boldbrax\let&=\ampnr}
+} % End of definition inside \activeparens
+%% These parens (in \boldbrax) actually are a little bolder than the
+%% contained text.  This is especially needed for [ and ]
+\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
+\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
+\let\ampnr = \&
+\def\lbrb{{\bf\char`\[}}
+\def\rbrb{{\bf\char`\]}}
+
+% Active &'s sneak into the index arguments, so make sure it's defined.
+{
+  \catcode`& = 13
+  \global\let& = \ampnr
+}
+
+% First, defname, which formats the header line itself.
+% #1 should be the function name.
+% #2 should be the type of definition, such as "Function".
+
+\def\defname #1#2{%
+% Get the values of \leftskip and \rightskip as they were
+% outside the @def...
+\dimen2=\leftskip
+\advance\dimen2 by -\defbodyindent
+\noindent
+\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
+\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
+\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
+\parshape 2 0in \dimen0 \defargsindent \dimen1
+% Now output arg 2 ("Function" or some such)
+% ending at \deftypemargin from the right margin,
+% but stuck inside a box of width 0 so it does not interfere with linebreaking
+{% Adjust \hsize to exclude the ambient margins,
+% so that \rightline will obey them.
+\advance \hsize by -\dimen2
+\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}%
+% Make all lines underfull and no complaints:
+\tolerance=10000 \hbadness=10000
+\advance\leftskip by -\defbodyindent
+\exdentamount=\defbodyindent
+{\df #1}\enskip        % Generate function name
+}
+
+% Common pieces to start any @def...
+% #1 is the \E... control sequence to end the definition (which we define).
+% #2 is the \...x control sequence (which our caller defines).
+% #3 is the control sequence to process the header, such as \defunheader.
+% 
+\def\parsebodycommon#1#2#3{%
+  \begingroup\inENV
+  % If there are two @def commands in a row, we'll have a \nobreak,
+  % which is there to keep the function description together with its
+  % header.  But if there's nothing but headers, we want to allow a
+  % break after all.
+  \ifnum\lastpenalty = 10000 \penalty0 \fi
+  \medbreak
+  %
+  % Define the \E... end token that this defining construct specifies
+  % so that it will exit this group.
+  \def#1{\endgraf\endgroup\medbreak}%
+  %
+  \parindent=0in
+  \advance\leftskip by \defbodyindent
+  \exdentamount=\defbodyindent
+}
+
+% Process body of @defun, @deffn, @defmac, etc.
+%
+\def\defparsebody#1#2#3{%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
+  \catcode61=\active % 61 is `='
+  \begingroup\obeylines\activeparens
+  \spacesplit#3%
+}
+
+% #1, #2, #3 are the common arguments (see \defparsebody).
+% #4, delimited by the space, is the class name.
+%
+\def\defmethparsebody#1#2#3#4 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
+  \begingroup\obeylines\activeparens
+  \spacesplit{#3{#4}}%
+}
+
+% Used for @deftypemethod and @deftypeivar.
+% #1, #2, #3 are the common arguments (see \defparsebody).
+% #4, delimited by a space, is the class name.
+% #5 is the method's return type.
+%
+\def\deftypemethparsebody#1#2#3#4 #5 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
+  \begingroup\obeylines\activeparens
+  \spacesplit{#3{#4}{#5}}%
+}
+
+% Used for @deftypeop.  The change from \deftypemethparsebody is an
+% extra argument at the beginning which is the `category', instead of it
+% being the hardwired string `Method' or `Instance Variable'.  We have
+% to account for this both in the \...x definition and in parsing the
+% input at hand.  Thus also need a control sequence (passed as #5) for
+% the \E... definition to assign the category name to.
+% 
+\def\deftypeopparsebody#1#2#3#4#5 #6 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 ##2 ##3 {%
+    \def#4{##1}%
+    \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}%
+  \begingroup\obeylines\activeparens
+  \spacesplit{#3{#5}{#6}}%
+}
+
+% For @defop.
+\def\defopparsebody #1#2#3#4#5 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 ##2 {\def#4{##1}%
+    \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
+  \begingroup\obeylines\activeparens
+  \spacesplit{#3{#5}}%
+}
+
+% These parsing functions are similar to the preceding ones
+% except that they do not make parens into active characters.
+% These are used for "variables" since they have no arguments.
+%
+\def\defvarparsebody #1#2#3{%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2{\begingroup\obeylines\spacesplit#3}%
+  \catcode61=\active %
+  \begingroup\obeylines
+  \spacesplit#3%
+}
+
+% @defopvar.
+\def\defopvarparsebody #1#2#3#4#5 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 ##2 {\def#4{##1}%
+    \begingroup\obeylines\spacesplit{#3{##2}}}%
+  \begingroup\obeylines
+  \spacesplit{#3{#5}}%
+}
+
+\def\defvrparsebody#1#2#3#4 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
+  \begingroup\obeylines
+  \spacesplit{#3{#4}}%
+}
+
+% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
+% type is just `struct', because we lose the braces in `{struct
+% termios}' when \spacesplit reads its undelimited argument.  Sigh.
+% \let\deftpparsebody=\defvrparsebody
+%
+% So, to get around this, we put \empty in with the type name.  That
+% way, TeX won't find exactly `{...}' as an undelimited argument, and
+% won't strip off the braces.
+%
+\def\deftpparsebody #1#2#3#4 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
+  \begingroup\obeylines
+  \spacesplit{\parsetpheaderline{#3{#4}}}\empty
+}
+
+% Fine, but then we have to eventually remove the \empty *and* the
+% braces (if any).  That's what this does.
+%
+\def\removeemptybraces\empty#1\relax{#1}
+
+% After \spacesplit has done its work, this is called -- #1 is the final
+% thing to call, #2 the type name (which starts with \empty), and #3
+% (which might be empty) the arguments.
+%
+\def\parsetpheaderline#1#2#3{%
+  #1{\removeemptybraces#2\relax}{#3}%
+}%
+
+% Split up #2 at the first space token.
+% call #1 with two arguments:
+%  the first is all of #2 before the space token,
+%  the second is all of #2 after that space token.
+% If #2 contains no space token, all of it is passed as the first arg
+% and the second is passed as empty.
+%
+{\obeylines
+\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
+\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
+\ifx\relax #3%
+#1{#2}{}\else #1{#2}{#3#4}\fi}}
+
+% Define @defun.
+
+% First, define the processing that is wanted for arguments of \defun
+% Use this to expand the args and terminate the paragraph they make up
+
+\def\defunargs#1{\functionparens \sl
+% Expand, preventing hyphenation at `-' chars.
+% Note that groups don't affect changes in \hyphenchar.
+% Set the font temporarily and use \font in case \setfont made \tensl a macro.
+{\tensl\hyphenchar\font=0}%
+#1%
+{\tensl\hyphenchar\font=45}%
+\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
+\interlinepenalty=10000
+\advance\rightskip by 0pt plus 1fil
+\endgraf\nobreak\vskip -\parskip\nobreak
+}
+
+\def\deftypefunargs #1{%
+% Expand, preventing hyphenation at `-' chars.
+% Note that groups don't affect changes in \hyphenchar.
+% Use \boldbraxnoamp, not \functionparens, so that & is not special.
+\boldbraxnoamp
+\tclose{#1}% avoid \code because of side effects on active chars
+\interlinepenalty=10000
+\advance\rightskip by 0pt plus 1fil
+\endgraf\nobreak\vskip -\parskip\nobreak
+}
+
+% Do complete processing of one @defun or @defunx line already parsed.
+
+% @deffn Command forward-char nchars
+
+\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
+
+\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
+\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defun == @deffn Function
+
+\def\defun{\defparsebody\Edefun\defunx\defunheader}
+
+\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{\putwordDeffunc}%
+\defunargs {#2}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @deftypefun int foobar (int @var{foo}, float @var{bar})
+
+\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
+
+% #1 is the data type.  #2 is the name and args.
+\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
+% #1 is the data type, #2 the name, #3 the args.
+\def\deftypefunheaderx #1#2 #3\relax{%
+\doind {fn}{\code{#2}}% Make entry in function index
+\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
+\deftypefunargs {#3}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
+
+\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
+
+% \defheaderxcond#1\relax$.$
+% puts #1 in @code, followed by a space, but does nothing if #1 is null.
+\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
+
+% #1 is the classification.  #2 is the data type.  #3 is the name and args.
+\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
+% #1 is the classification, #2 the data type, #3 the name, #4 the args.
+\def\deftypefnheaderx #1#2#3 #4\relax{%
+\doind {fn}{\code{#3}}% Make entry in function index
+\begingroup
+\normalparens % notably, turn off `&' magic, which prevents
+%               at least some C++ text from working
+\defname {\defheaderxcond#2\relax$.$#3}{#1}%
+\deftypefunargs {#4}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defmac == @deffn Macro
+
+\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
+
+\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{\putwordDefmac}%
+\defunargs {#2}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defspec == @deffn Special Form
+
+\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
+
+\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{\putwordDefspec}%
+\defunargs {#2}\endgroup %
+\catcode 61=\other % Turn off change made in \defparsebody
+}
+
+% @defop CATEGORY CLASS OPERATION ARG...
+%
+\def\defop #1 {\def\defoptype{#1}%
+\defopparsebody\Edefop\defopx\defopheader\defoptype}
+%
+\def\defopheader#1#2#3{%
+\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
+\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}%
+\defunargs {#3}\endgroup %
+}
+
+% @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
+%
+\def\deftypeop #1 {\def\deftypeopcategory{#1}%
+  \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
+                       \deftypeopcategory}
+%
+% #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
+\def\deftypeopheader#1#2#3#4{%
+  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
+  \begingroup
+    \defname{\defheaderxcond#2\relax$.$#3}
+            {\deftypeopcategory\ \putwordon\ \code{#1}}%
+    \deftypefunargs{#4}%
+  \endgroup
+}
+
+% @deftypemethod CLASS TYPE METHOD ARG...
+%
+\def\deftypemethod{%
+  \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
+%
+% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
+\def\deftypemethodheader#1#2#3#4{%
+  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
+  \begingroup
+    \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
+    \deftypefunargs{#4}%
+  \endgroup
+}
+
+% @deftypeivar CLASS TYPE VARNAME
+%
+\def\deftypeivar{%
+  \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
+%
+% #1 is the class name, #2 the data type, #3 the variable name.
+\def\deftypeivarheader#1#2#3{%
+  \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
+  \begingroup
+    \defname{\defheaderxcond#2\relax$.$#3}
+            {\putwordInstanceVariableof\ \code{#1}}%
+    \defvarargs{#3}%
+  \endgroup
+}
+
+% @defmethod == @defop Method
+%
+\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
+%
+% #1 is the class name, #2 the method name, #3 the args.
+\def\defmethodheader#1#2#3{%
+  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
+  \begingroup
+    \defname{#2}{\putwordMethodon\ \code{#1}}%
+    \defunargs{#3}%
+  \endgroup
+}
+
+% @defcv {Class Option} foo-class foo-flag
+
+\def\defcv #1 {\def\defcvtype{#1}%
+\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
+
+\def\defcvarheader #1#2#3{%
+\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index
+\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}%
+\defvarargs {#3}\endgroup %
+}
+
+% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
+%
+\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
+%
+\def\defivarheader#1#2#3{%
+  \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index
+  \begingroup
+    \defname{#2}{\putwordInstanceVariableof\ #1}%
+    \defvarargs{#3}%
+  \endgroup
+}
+
+% @defvar
+% First, define the processing that is wanted for arguments of @defvar.
+% This is actually simple: just print them in roman.
+% This must expand the args and terminate the paragraph they make up
+\def\defvarargs #1{\normalparens #1%
+\interlinepenalty=10000
+\endgraf\nobreak\vskip -\parskip\nobreak}
+
+% @defvr Counter foo-count
+
+\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
+
+\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
+\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
+
+% @defvar == @defvr Variable
+
+\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
+
+\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
+\begingroup\defname {#1}{\putwordDefvar}%
+\defvarargs {#2}\endgroup %
+}
+
+% @defopt == @defvr {User Option}
+
+\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
+
+\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
+\begingroup\defname {#1}{\putwordDefopt}%
+\defvarargs {#2}\endgroup %
+}
+
+% @deftypevar int foobar
+
+\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
+
+% #1 is the data type.  #2 is the name, perhaps followed by text that
+% is actually part of the data type, which should not be put into the index.
+\def\deftypevarheader #1#2{%
+\dovarind#2 \relax% Make entry in variables index
+\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
+\interlinepenalty=10000
+\endgraf\nobreak\vskip -\parskip\nobreak
+\endgroup}
+\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
+
+% @deftypevr {Global Flag} int enable
+
+\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
+
+\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
+\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
+\interlinepenalty=10000
+\endgraf\nobreak\vskip -\parskip\nobreak
+\endgroup}
+
+% Now define @deftp
+% Args are printed in bold, a slight difference from @defvar.
+
+\def\deftpargs #1{\bf \defvarargs{#1}}
+
+% @deftp Class window height width ...
+
+\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
+
+\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
+\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
+
+% These definitions are used if you use @defunx (etc.)
+% anywhere other than immediately after a @defun or @defunx.
+% 
+\def\defcvx#1 {\errmessage{@defcvx in invalid context}}
+\def\deffnx#1 {\errmessage{@deffnx in invalid context}}
+\def\defivarx#1 {\errmessage{@defivarx in invalid context}}
+\def\defmacx#1 {\errmessage{@defmacx in invalid context}}
+\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
+\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
+\def\defopx#1 {\errmessage{@defopx in invalid context}}
+\def\defspecx#1 {\errmessage{@defspecx in invalid context}}
+\def\deftpx#1 {\errmessage{@deftpx in invalid context}}
+\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
+\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
+\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
+\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
+\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
+\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
+\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
+\def\defunx#1 {\errmessage{@defunx in invalid context}}
+\def\defvarx#1 {\errmessage{@defvarx in invalid context}}
+\def\defvrx#1 {\errmessage{@defvrx in invalid context}}
+
+
+\message{macros,}
+% @macro.
+
+% To do this right we need a feature of e-TeX, \scantokens,
+% which we arrange to emulate with a temporary file in ordinary TeX.
+\ifx\eTeXversion\undefined
+ \newwrite\macscribble
+ \def\scanmacro#1{%
+   \begingroup \newlinechar`\^^M
+   % Undo catcode changes of \startcontents and \doprintindex
+   \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
+   % Append \endinput to make sure that TeX does not see the ending newline.
+   \toks0={#1\endinput}%
+   \immediate\openout\macscribble=\jobname.tmp
+   \immediate\write\macscribble{\the\toks0}%
+   \immediate\closeout\macscribble
+   \let\xeatspaces\eatspaces
+   \input \jobname.tmp
+   \endgroup
+}
+\else
+\def\scanmacro#1{%
+\begingroup \newlinechar`\^^M
+% Undo catcode changes of \startcontents and \doprintindex
+\catcode`\@=0 \catcode`\\=12 \escapechar=`\@
+\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
+\fi
+
+\newcount\paramno   % Count of parameters
+\newtoks\macname    % Macro name
+\newif\ifrecursive  % Is it recursive?
+\def\macrolist{}    % List of all defined macros in the form
+                    % \do\macro1\do\macro2...
+
+% Utility routines.
+% Thisdoes \let #1 = #2, except with \csnames.
+\def\cslet#1#2{%
+\expandafter\expandafter
+\expandafter\let
+\expandafter\expandafter
+\csname#1\endcsname
+\csname#2\endcsname}
+
+% Trim leading and trailing spaces off a string.
+% Concepts from aro-bend problem 15 (see CTAN).
+{\catcode`\@=11
+\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
+\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
+\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
+\def\unbrace#1{#1}
+\unbrace{\gdef\trim@@@ #1 } #2@{#1}
+}
+
+% Trim a single trailing ^^M off a string.
+{\catcode`\^^M=12\catcode`\Q=3%
+\gdef\eatcr #1{\eatcra #1Q^^MQ}%
+\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
+\gdef\eatcrb#1Q#2Q{#1}%
+}
+
+% Macro bodies are absorbed as an argument in a context where
+% all characters are catcode 10, 11 or 12, except \ which is active
+% (as in normal texinfo). It is necessary to change the definition of \.
+
+% It's necessary to have hard CRs when the macro is executed. This is
+% done by  making ^^M (\endlinechar) catcode 12 when reading the macro
+% body, and then making it the \newlinechar in \scanmacro.
+
+\def\macrobodyctxt{%
+  \catcode`\~=12
+  \catcode`\^=12
+  \catcode`\_=12
+  \catcode`\|=12
+  \catcode`\<=12
+  \catcode`\>=12
+  \catcode`\+=12
+  \catcode`\{=12
+  \catcode`\}=12
+  \catcode`\@=12
+  \catcode`\^^M=12
+  \usembodybackslash}
+
+\def\macroargctxt{%
+  \catcode`\~=12
+  \catcode`\^=12
+  \catcode`\_=12
+  \catcode`\|=12
+  \catcode`\<=12
+  \catcode`\>=12
+  \catcode`\+=12
+  \catcode`\@=12
+  \catcode`\\=12}
+
+% \mbodybackslash is the definition of \ in @macro bodies.
+% It maps \foo\ => \csname macarg.foo\endcsname => #N
+% where N is the macro parameter number.
+% We define \csname macarg.\endcsname to be \realbackslash, so
+% \\ in macro replacement text gets you a backslash.
+
+{\catcode`@=0 @catcode`@\=@active
+ @gdef at usembodybackslash{@let\=@mbodybackslash}
+ @gdef at mbodybackslash#1\{@csname macarg.#1 at endcsname}
+}
+\expandafter\def\csname macarg.\endcsname{\realbackslash}
+
+\def\macro{\recursivefalse\parsearg\macroxxx}
+\def\rmacro{\recursivetrue\parsearg\macroxxx}
+
+\def\macroxxx#1{%
+  \getargs{#1}%           now \macname is the macname and \argl the arglist
+  \ifx\argl\empty       % no arguments
+     \paramno=0%
+  \else
+     \expandafter\parsemargdef \argl;%
+  \fi
+  \if1\csname ismacro.\the\macname\endcsname
+     \message{Warning: redefining \the\macname}%
+  \else
+     \expandafter\ifx\csname \the\macname\endcsname \relax
+     \else \errmessage{Macro name \the\macname\space already defined}\fi
+     \global\cslet{macsave.\the\macname}{\the\macname}%
+     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
+     % Add the macroname to \macrolist
+     \toks0 = \expandafter{\macrolist\do}%
+     \xdef\macrolist{\the\toks0
+       \expandafter\noexpand\csname\the\macname\endcsname}%
+  \fi
+  \begingroup \macrobodyctxt
+  \ifrecursive \expandafter\parsermacbody
+  \else \expandafter\parsemacbody
+  \fi}
+
+\def\unmacro{\parsearg\unmacroxxx}
+\def\unmacroxxx#1{%
+  \if1\csname ismacro.#1\endcsname
+    \global\cslet{#1}{macsave.#1}%
+    \global\expandafter\let \csname ismacro.#1\endcsname=0%
+    % Remove the macro name from \macrolist
+    \begingroup
+      \edef\tempa{\expandafter\noexpand\csname#1\endcsname}%
+      \def\do##1{%
+        \def\tempb{##1}%
+        \ifx\tempa\tempb
+          % remove this
+        \else
+          \toks0 = \expandafter{\newmacrolist\do}%
+          \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}%
+        \fi}%
+      \def\newmacrolist{}%
+      % Execute macro list to define \newmacrolist
+      \macrolist
+      \global\let\macrolist\newmacrolist
+    \endgroup
+  \else
+    \errmessage{Macro #1 not defined}%
+  \fi
+}
+
+% This makes use of the obscure feature that if the last token of a
+% <parameter list> is #, then the preceding argument is delimited by
+% an opening brace, and that opening brace is not consumed.
+\def\getargs#1{\getargsxxx#1{}}
+\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
+\def\getmacname #1 #2\relax{\macname={#1}}
+\def\getmacargs#1{\def\argl{#1}}
+
+% Parse the optional {params} list.  Set up \paramno and \paramlist
+% so \defmacro knows what to do.  Define \macarg.blah for each blah
+% in the params list, to be ##N where N is the position in that list.
+% That gets used by \mbodybackslash (above).
+
+% We need to get `macro parameter char #' into several definitions.
+% The technique used is stolen from LaTeX:  let \hash be something
+% unexpandable, insert that wherever you need a #, and then redefine
+% it to # just before using the token list produced.
+%
+% The same technique is used to protect \eatspaces till just before
+% the macro is used.
+
+\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
+        \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
+\def\parsemargdefxxx#1,{%
+  \if#1;\let\next=\relax
+  \else \let\next=\parsemargdefxxx
+    \advance\paramno by 1%
+    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
+        {\xeatspaces{\hash\the\paramno}}%
+    \edef\paramlist{\paramlist\hash\the\paramno,}%
+  \fi\next}
+
+% These two commands read recursive and nonrecursive macro bodies.
+% (They're different since rec and nonrec macros end differently.)
+
+\long\def\parsemacbody#1 at end macro%
+{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
+\long\def\parsermacbody#1 at end rmacro%
+{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
+
+% This defines the macro itself. There are six cases: recursive and
+% nonrecursive macros of zero, one, and many arguments.
+% Much magic with \expandafter here.
+% \xdef is used so that macro definitions will survive the file
+% they're defined in; @include reads the file inside a group.
+\def\defmacro{%
+  \let\hash=##% convert placeholders to macro parameter chars
+  \ifrecursive
+    \ifcase\paramno
+    % 0
+      \expandafter\xdef\csname\the\macname\endcsname{%
+        \noexpand\scanmacro{\temp}}%
+    \or % 1
+      \expandafter\xdef\csname\the\macname\endcsname{%
+         \bgroup\noexpand\macroargctxt
+         \noexpand\braceorline
+         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
+      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
+         \egroup\noexpand\scanmacro{\temp}}%
+    \else % many
+      \expandafter\xdef\csname\the\macname\endcsname{%
+         \bgroup\noexpand\macroargctxt
+         \noexpand\csname\the\macname xx\endcsname}%
+      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
+          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+      \expandafter\expandafter
+      \expandafter\xdef
+      \expandafter\expandafter
+        \csname\the\macname xxx\endcsname
+          \paramlist{\egroup\noexpand\scanmacro{\temp}}%
+    \fi
+  \else
+    \ifcase\paramno
+    % 0
+      \expandafter\xdef\csname\the\macname\endcsname{%
+        \noexpand\norecurse{\the\macname}%
+        \noexpand\scanmacro{\temp}\egroup}%
+    \or % 1
+      \expandafter\xdef\csname\the\macname\endcsname{%
+         \bgroup\noexpand\macroargctxt
+         \noexpand\braceorline
+         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
+      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
+        \egroup
+        \noexpand\norecurse{\the\macname}%
+        \noexpand\scanmacro{\temp}\egroup}%
+    \else % many
+      \expandafter\xdef\csname\the\macname\endcsname{%
+         \bgroup\noexpand\macroargctxt
+         \expandafter\noexpand\csname\the\macname xx\endcsname}%
+      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
+          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+      \expandafter\expandafter
+      \expandafter\xdef
+      \expandafter\expandafter
+      \csname\the\macname xxx\endcsname
+      \paramlist{%
+          \egroup
+          \noexpand\norecurse{\the\macname}%
+          \noexpand\scanmacro{\temp}\egroup}%
+    \fi
+  \fi}
+
+\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
+
+% \braceorline decides whether the next nonwhitespace character is a
+% {.  If so it reads up to the closing }, if not, it reads the whole
+% line.  Whatever was read is then fed to the next control sequence
+% as an argument (by \parsebrace or \parsearg)
+\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
+\def\braceorlinexxx{%
+  \ifx\nchar\bgroup\else
+    \expandafter\parsearg
+  \fi \next}
+
+% We mant to disable all macros during \shipout so that they are not
+% expanded by \write.
+\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
+  \edef\next{\macrolist}\expandafter\endgroup\next}
+
+
+% @alias.
+% We need some trickery to remove the optional spaces around the equal
+% sign.  Just make them active and then expand them all to nothing.
+\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
+\def\aliasxxx #1{\aliasyyy#1\relax}
+\def\aliasyyy #1=#2\relax{\ignoreactivespaces
+\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
+           \expandafter\noexpand\csname#2\endcsname}%
+\expandafter\endgroup\next}
+
+
+\message{cross references,}
+% @xref etc.
+
+\newwrite\auxfile
+
+\newif\ifhavexrefs    % True if xref values are known.
+\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
+
+% @inforef is relatively simple.
+\def\inforef #1{\inforefzzz #1,,,,**}
+\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
+  node \samp{\ignorespaces#1{}}}
+
+% @node's job is to define \lastnode.
+\def\node{\ENVcheck\parsearg\nodezzz}
+\def\nodezzz#1{\nodexxx [#1,]}
+\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
+\let\nwnode=\node
+\let\lastnode=\relax
+
+% The sectioning commands (@chapter, etc.) call these.
+\def\donoderef{%
+  \ifx\lastnode\relax\else
+    \expandafter\expandafter\expandafter\setref{\lastnode}%
+      {Ysectionnumberandtype}%
+    \global\let\lastnode=\relax
+  \fi
+}
+\def\unnumbnoderef{%
+  \ifx\lastnode\relax\else
+    \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
+    \global\let\lastnode=\relax
+  \fi
+}
+\def\appendixnoderef{%
+  \ifx\lastnode\relax\else
+    \expandafter\expandafter\expandafter\setref{\lastnode}%
+      {Yappendixletterandtype}%
+    \global\let\lastnode=\relax
+  \fi
+}
+
+
+% @anchor{NAME} -- define xref target at arbitrary point.
+%
+\newcount\savesfregister
+\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
+\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
+\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
+
+% \setref{NAME}{SNT} defines a cross-reference point NAME, namely
+% NAME-title, NAME-pg, and NAME-SNT.  Called from \foonoderef.  We have
+% to set \indexdummies so commands such as @code in a section title
+% aren't expanded.  It would be nicer not to expand the titles in the
+% first place, but there's so many layers that that is hard to do.
+%
+\def\setref#1#2{{%
+  \indexdummies
+  \pdfmkdest{#1}%
+  \dosetq{#1-title}{Ytitle}%
+  \dosetq{#1-pg}{Ypagenumber}%
+  \dosetq{#1-snt}{#2}%
+}}
+
+% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
+% the node name, #2 the name of the Info cross-reference, #3 the printed
+% node name, #4 the name of the Info file, #5 the name of the printed
+% manual.  All but the node name can be omitted.
+%
+\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
+\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
+\def\ref#1{\xrefX[#1,,,,,,,]}
+\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
+  \unsepspaces
+  \def\printedmanual{\ignorespaces #5}%
+  \def\printednodename{\ignorespaces #3}%
+  \setbox1=\hbox{\printedmanual}%
+  \setbox0=\hbox{\printednodename}%
+  \ifdim \wd0 = 0pt
+    % No printed node name was explicitly given.
+    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
+      % Use the node name inside the square brackets.
+      \def\printednodename{\ignorespaces #1}%
+    \else
+      % Use the actual chapter/section title appear inside
+      % the square brackets.  Use the real section title if we have it.
+      \ifdim \wd1 > 0pt
+        % It is in another manual, so we don't have it.
+        \def\printednodename{\ignorespaces #1}%
+      \else
+        \ifhavexrefs
+          % We know the real title if we have the xref values.
+          \def\printednodename{\refx{#1-title}{}}%
+        \else
+          % Otherwise just copy the Info node name.
+          \def\printednodename{\ignorespaces #1}%
+        \fi%
+      \fi
+    \fi
+  \fi
+  %
+  % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
+  % insert empty discretionaries after hyphens, which means that it will
+  % not find a line break at a hyphen in a node names.  Since some manuals
+  % are best written with fairly long node names, containing hyphens, this
+  % is a loss.  Therefore, we give the text of the node name again, so it
+  % is as if TeX is seeing it for the first time.
+  \ifpdf
+    \leavevmode
+    \getfilename{#4}%
+    {\normalturnoffactive
+     \ifnum\filenamelength>0
+       \startlink attr{/Border [0 0 0]}%
+         goto file{\the\filename.pdf} name{#1}%
+     \else
+       \startlink attr{/Border [0 0 0]}%
+         goto name{#1}%
+     \fi
+    }%
+    \linkcolor
+  \fi
+  %
+  \ifdim \wd1 > 0pt
+    \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
+  \else
+    % _ (for example) has to be the character _ for the purposes of the
+    % control sequence corresponding to the node, but it has to expand
+    % into the usual \leavevmode...\vrule stuff for purposes of
+    % printing. So we \turnoffactive for the \refx-snt, back on for the
+    % printing, back off for the \refx-pg.
+    {\normalturnoffactive
+     % Only output a following space if the -snt ref is nonempty; for
+     % @unnumbered and @anchor, it won't be.
+     \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
+     \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
+    }%
+    % [mynode],
+    [\printednodename],\space
+    % page 3
+    \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
+  \fi
+  \endlink
+\endgroup}
+
+% \dosetq is the interface for calls from other macros
+
+% Use \normalturnoffactive so that punctuation chars such as underscore
+% and backslash work in node names.  (\turnoffactive doesn't do \.)
+\def\dosetq#1#2{%
+  {\let\folio=0%
+   \normalturnoffactive
+   \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
+   \iflinks
+     \next
+   \fi
+  }%
+}
+
+% \internalsetq {foo}{page} expands into
+% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
+% When the aux file is read, ' is the escape character
+
+\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
+
+% Things to be expanded by \internalsetq
+
+\def\Ypagenumber{\folio}
+
+\def\Ytitle{\thissection}
+
+\def\Ynothing{}
+
+\def\Ysectionnumberandtype{%
+\ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
+\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
+\else \ifnum \subsubsecno=0 %
+\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
+\else %
+\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
+\fi \fi \fi }
+
+\def\Yappendixletterandtype{%
+\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
+\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
+\else \ifnum \subsubsecno=0 %
+\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
+\else %
+\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
+\fi \fi \fi }
+
+\gdef\xreftie{'tie}
+
+% Use TeX 3.0's \inputlineno to get the line number, for better error
+% messages, but if we're using an old version of TeX, don't do anything.
+%
+\ifx\inputlineno\thisisundefined
+  \let\linenumber = \empty % Non-3.0.
+\else
+  \def\linenumber{\the\inputlineno:\space}
+\fi
+
+% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
+% If its value is nonempty, SUFFIX is output afterward.
+
+\def\refx#1#2{%
+  \expandafter\ifx\csname X#1\endcsname\relax
+    % If not defined, say something at least.
+    \angleleft un\-de\-fined\angleright
+    \iflinks
+      \ifhavexrefs
+        \message{\linenumber Undefined cross reference `#1'.}%
+      \else
+        \ifwarnedxrefs\else
+          \global\warnedxrefstrue
+          \message{Cross reference values unknown; you must run TeX again.}%
+        \fi
+      \fi
+    \fi
+  \else
+    % It's defined, so just use it.
+    \csname X#1\endcsname
+  \fi
+  #2% Output the suffix in any case.
+}
+
+% This is the macro invoked by entries in the aux file.
+%
+\def\xrdef#1{\begingroup
+  % Reenable \ as an escape while reading the second argument.
+  \catcode`\\ = 0
+  \afterassignment\endgroup
+  \expandafter\gdef\csname X#1\endcsname
+}
+
+% Read the last existing aux file, if any.  No error if none exists.
+\def\readauxfile{\begingroup
+  \catcode`\^^@=\other
+  \catcode`\^^A=\other
+  \catcode`\^^B=\other
+  \catcode`\^^C=\other
+  \catcode`\^^D=\other
+  \catcode`\^^E=\other
+  \catcode`\^^F=\other
+  \catcode`\^^G=\other
+  \catcode`\^^H=\other
+  \catcode`\^^K=\other
+  \catcode`\^^L=\other
+  \catcode`\^^N=\other
+  \catcode`\^^P=\other
+  \catcode`\^^Q=\other
+  \catcode`\^^R=\other
+  \catcode`\^^S=\other
+  \catcode`\^^T=\other
+  \catcode`\^^U=\other
+  \catcode`\^^V=\other
+  \catcode`\^^W=\other
+  \catcode`\^^X=\other
+  \catcode`\^^Z=\other
+  \catcode`\^^[=\other
+  \catcode`\^^\=\other
+  \catcode`\^^]=\other
+  \catcode`\^^^=\other
+  \catcode`\^^_=\other
+  \catcode`\@=\other
+  \catcode`\^=\other
+  % It was suggested to define this as 7, which would allow ^^e4 etc.
+  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
+  % supported in the main text, it doesn't seem desirable.  Furthermore,
+  % that is not enough: for node names that actually contain a ^
+  % character, we would end up writing a line like this: 'xrdef {'hat
+  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
+  % argument, and \hat is not an expandable control sequence.  It could
+  % all be worked out, but why?  Either we support ^^ or we don't.
+  %
+  % The other change necessary for this was to define \auxhat:
+  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
+  % and then to call \auxhat in \setq.
+  %
+  \catcode`\~=\other
+  \catcode`\[=\other
+  \catcode`\]=\other
+  \catcode`\"=\other
+  \catcode`\_=\other
+  \catcode`\|=\other
+  \catcode`\<=\other
+  \catcode`\>=\other
+  \catcode`\$=\other
+  \catcode`\#=\other
+  \catcode`\&=\other
+  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
+  % Make the characters 128-255 be printing characters
+  {%
+    \count 1=128
+    \def\loop{%
+      \catcode\count 1=\other
+      \advance\count 1 by 1
+      \ifnum \count 1<256 \loop \fi
+    }%
+  }%
+  % The aux file uses ' as the escape (for now).
+  % Turn off \ as an escape so we do not lose on
+  % entries which were dumped with control sequences in their names.
+  % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
+  % Reference to such entries still does not work the way one would wish,
+  % but at least they do not bomb out when the aux file is read in.
+  \catcode`\{=1
+  \catcode`\}=2
+  \catcode`\%=\other
+  \catcode`\'=0
+  \catcode`\\=\other
+  %
+  \openin 1 \jobname.aux
+  \ifeof 1 \else
+    \closein 1
+    \input \jobname.aux
+    \global\havexrefstrue
+    \global\warnedobstrue
+  \fi
+  % Open the new aux file.  TeX will close it automatically at exit.
+  \openout\auxfile=\jobname.aux
+\endgroup}
+
+
+% Footnotes.
+
+\newcount \footnoteno
+
+% The trailing space in the following definition for supereject is
+% vital for proper filling; pages come out unaligned when you do a
+% pagealignmacro call if that space before the closing brace is
+% removed. (Generally, numeric constants should always be followed by a
+% space to prevent strange expansion errors.)
+\def\supereject{\par\penalty -20000\footnoteno =0 }
+
+% @footnotestyle is meaningful for info output only.
+\let\footnotestyle=\comment
+
+\let\ptexfootnote=\footnote
+
+{\catcode `\@=11
+%
+% Auto-number footnotes.  Otherwise like plain.
+\gdef\footnote{%
+  \global\advance\footnoteno by \@ne
+  \edef\thisfootno{$^{\the\footnoteno}$}%
+  %
+  % In case the footnote comes at the end of a sentence, preserve the
+  % extra spacing after we do the footnote number.
+  \let\@sf\empty
+  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
+  %
+  % Remove inadvertent blank space before typesetting the footnote number.
+  \unskip
+  \thisfootno\@sf
+  \footnotezzz
+}%
+
+% Don't bother with the trickery in plain.tex to not require the
+% footnote text as a parameter.  Our footnotes don't need to be so general.
+%
+% Oh yes, they do; otherwise, @ifset and anything else that uses
+% \parseargline fail inside footnotes because the tokens are fixed when
+% the footnote is read.  --karl, 16nov96.
+%
+\long\gdef\footnotezzz{\insert\footins\bgroup
+  % We want to typeset this text as a normal paragraph, even if the
+  % footnote reference occurs in (for example) a display environment.
+  % So reset some parameters.
+  \interlinepenalty\interfootnotelinepenalty
+  \splittopskip\ht\strutbox % top baseline for broken footnotes
+  \splitmaxdepth\dp\strutbox
+  \floatingpenalty\@MM
+  \leftskip\z at skip
+  \rightskip\z at skip
+  \spaceskip\z at skip
+  \xspaceskip\z at skip
+  \parindent\defaultparindent
+  %
+  \smallfonts \rm
+  %
+  % Because we use hanging indentation in footnotes, a @noindent appears
+  % to exdent this text, so make it be a no-op.  makeinfo does not use
+  % hanging indentation so @noindent can still be needed within footnote
+  % text after an @example or the like (not that this is good style).
+  \let\noindent = \relax
+  %
+  % Hang the footnote text off the number.  Use \everypar in case the
+  % footnote extends for more than one paragraph.
+  \everypar = {\hang}%
+  \textindent{\thisfootno}%
+  %
+  % Don't crash into the line above the footnote text.  Since this
+  % expands into a box, it must come within the paragraph, lest it
+  % provide a place where TeX can split the footnote.
+  \footstrut
+  \futurelet\next\fo at t
+}
+\def\fo at t{\ifcat\bgroup\noexpand\next \let\next\f@@t
+  \else\let\next\f at t\fi \next}
+\def\f@@t{\bgroup\aftergroup\@foot\let\next}
+\def\f at t#1{#1\@foot}
+\def\@foot{\strut\par\egroup}
+
+}%end \catcode `\@=11
+
+% @| inserts a changebar to the left of the current line.  It should
+% surround any changed text.  This approach does *not* work if the
+% change spans more than two lines of output.  To handle that, we would
+% have adopt a much more difficult approach (putting marks into the main
+% vertical list for the beginning and end of each change).
+%
+\def\|{%
+  % \vadjust can only be used in horizontal mode.
+  \leavevmode
+  %
+  % Append this vertical mode material after the current line in the output.
+  \vadjust{%
+    % We want to insert a rule with the height and depth of the current
+    % leading; that is exactly what \strutbox is supposed to record.
+    \vskip-\baselineskip
+    %
+    % \vadjust-items are inserted at the left edge of the type.  So
+    % the \llap here moves out into the left-hand margin.
+    \llap{%
+      %
+      % For a thicker or thinner bar, change the `1pt'.
+      \vrule height\baselineskip width1pt
+      %
+      % This is the space between the bar and the text.
+      \hskip 12pt
+    }%
+  }%
+}
+
+% For a final copy, take out the rectangles
+% that mark overfull boxes (in case you have decided
+% that the text looks ok even though it passes the margin).
+%
+\def\finalout{\overfullrule=0pt}
+
+% @image.  We use the macros from epsf.tex to support this.
+% If epsf.tex is not installed and @image is used, we complain.
+%
+% Check for and read epsf.tex up front.  If we read it only at @image
+% time, we might be inside a group, and then its definitions would get
+% undone and the next image would fail.
+\openin 1 = epsf.tex
+\ifeof 1 \else
+  \closein 1
+  % Do not bother showing banner with post-v2.7 epsf.tex (available in
+  % doc/epsf.tex until it shows up on ctan).
+  \def\epsfannounce{\toks0 = }%
+  \input epsf.tex
+\fi
+%
+% We will only complain once about lack of epsf.tex.
+\newif\ifwarnednoepsf
+\newhelp\noepsfhelp{epsf.tex must be installed for images to
+  work.  It is also included in the Texinfo distribution, or you can get
+  it from ftp://tug.org/tex/epsf.tex.}
+%
+\def\image#1{%
+  \ifx\epsfbox\undefined
+    \ifwarnednoepsf \else
+      \errhelp = \noepsfhelp
+      \errmessage{epsf.tex not found, images will be ignored}%
+      \global\warnednoepsftrue
+    \fi
+  \else
+    \imagexxx #1,,,,,\finish
+  \fi
+}
+%
+% Arguments to @image:
+% #1 is (mandatory) image filename; we tack on .eps extension.
+% #2 is (optional) width, #3 is (optional) height.
+% #4 is (ignored optional) html alt text.
+% #5 is (ignored optional) extension.
+% #6 is just the usual extra ignored arg for parsing this stuff.
+\newif\ifimagevmode
+\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
+  \catcode`\^^M = 5     % in case we're inside an example
+  \normalturnoffactive  % allow _ et al. in names
+  % If the image is by itself, center it.
+  \ifvmode
+    \imagevmodetrue
+    \nobreak\bigskip
+    % Usually we'll have text after the image which will insert
+    % \parskip glue, so insert it here too to equalize the space
+    % above and below. 
+    \nobreak\vskip\parskip
+    \nobreak
+    \line\bgroup\hss
+  \fi
+  %
+  % Output the image.
+  \ifpdf
+    \dopdfimage{#1}{#2}{#3}%
+  \else
+    % \epsfbox itself resets \epsf?size at each figure.
+    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
+    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
+    \epsfbox{#1.eps}%
+  \fi
+  %
+  \ifimagevmode \hss \egroup \bigbreak \fi  % space after the image
+\endgroup}
+
+
+\message{localization,}
+% and i18n.
+
+% @documentlanguage is usually given very early, just after
+% @setfilename.  If done too late, it may not override everything
+% properly.  Single argument is the language abbreviation.
+% It would be nice if we could set up a hyphenation file here.
+%
+\def\documentlanguage{\parsearg\dodocumentlanguage}
+\def\dodocumentlanguage#1{%
+  \tex % read txi-??.tex file in plain TeX.
+  % Read the file if it exists.
+  \openin 1 txi-#1.tex
+  \ifeof1
+    \errhelp = \nolanghelp
+    \errmessage{Cannot read language file txi-#1.tex}%
+    \let\temp = \relax
+  \else
+    \def\temp{\input txi-#1.tex }%
+  \fi
+  \temp
+  \endgroup
+}
+\newhelp\nolanghelp{The given language definition file cannot be found or
+is empty.  Maybe you need to install it?  In the current directory
+should work if nowhere else does.}
+
+
+% @documentencoding should change something in TeX eventually, most
+% likely, but for now just recognize it.
+\let\documentencoding = \comment
+
+
+% Page size parameters.
+%
+\newdimen\defaultparindent \defaultparindent = 15pt
+
+\chapheadingskip = 15pt plus 4pt minus 2pt
+\secheadingskip = 12pt plus 3pt minus 2pt
+\subsecheadingskip = 9pt plus 2pt minus 2pt
+
+% Prevent underfull vbox error messages.
+\vbadness = 10000
+
+% Don't be so finicky about underfull hboxes, either.
+\hbadness = 2000
+
+% Following George Bush, just get rid of widows and orphans.
+\widowpenalty=10000
+\clubpenalty=10000
+
+% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
+% using an old version of TeX, don't do anything.  We want the amount of
+% stretch added to depend on the line length, hence the dependence on
+% \hsize.  We call this whenever the paper size is set.
+%
+\def\setemergencystretch{%
+  \ifx\emergencystretch\thisisundefined
+    % Allow us to assign to \emergencystretch anyway.
+    \def\emergencystretch{\dimen0}%
+  \else
+    \emergencystretch = .15\hsize
+  \fi
+}
+
+% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
+% 4) hoffset; 5) binding offset; 6) topskip.  We also call
+% \setleading{\textleading}, so the caller should define \textleading.
+% The caller should also set \parskip.
+%
+\def\internalpagesizes#1#2#3#4#5#6{%
+  \voffset = #3\relax
+  \topskip = #6\relax
+  \splittopskip = \topskip
+  %
+  \vsize = #1\relax
+  \advance\vsize by \topskip
+  \outervsize = \vsize
+  \advance\outervsize by 2\topandbottommargin
+  \pageheight = \vsize
+  %
+  \hsize = #2\relax
+  \outerhsize = \hsize
+  \advance\outerhsize by 0.5in
+  \pagewidth = \hsize
+  %
+  \normaloffset = #4\relax
+  \bindingoffset = #5\relax
+  %
+  \setleading{\textleading}
+  %
+  \parindent = \defaultparindent
+  \setemergencystretch
+}
+
+% Use `small' versions.
+% 
+\def\smallenvironments{%
+  \let\smalldisplay = \smalldisplayx
+  \let\smallexample = \smalllispx
+  \let\smallformat = \smallformatx
+  \let\smalllisp = \smalllispx
+}
+
+% @letterpaper (the default).
+\def\letterpaper{{\globaldefs = 1
+  \parskip = 3pt plus 2pt minus 1pt
+  \textleading = 13.2pt
+  %
+  % If page is nothing but text, make it come out even.
+  \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
+}}
+
+% Use @smallbook to reset parameters for 7x9.5 (or so) format.
+\def\smallbook{{\globaldefs = 1
+  \parskip = 2pt plus 1pt
+  \textleading = 12pt
+  %
+  \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
+  %
+  \lispnarrowing = 0.3in
+  \tolerance = 700
+  \hfuzz = 1pt
+  \contentsrightmargin = 0pt
+  \deftypemargin = 0pt
+  \defbodyindent = .5cm
+  \smallenvironments
+}}
+
+% Use @afourpaper to print on European A4 paper.
+\def\afourpaper{{\globaldefs = 1
+  \parskip = 3pt plus 2pt minus 1pt
+  \textleading = 12pt
+  %
+  \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
+  %
+  \tolerance = 700
+  \hfuzz = 1pt
+}}
+
+% Use @afivepaper to print on European A5 paper.
+% From romildo at urano.iceb.ufop.br, 2 July 2000.
+% He also recommends making @example and @lisp be small.
+\def\afivepaper{{\globaldefs = 1
+  \parskip = 2pt plus 1pt minus 0.1pt
+  \textleading = 12.5pt
+  %
+  \internalpagesizes{166mm}{120mm}{\voffset}{-8mm}{\bindingoffset}{8pt}%
+  %
+  \lispnarrowing = 0.2in
+  \tolerance = 800
+  \hfuzz = 1.2pt
+  \contentsrightmargin = 0mm
+  \deftypemargin = 0pt
+  \defbodyindent = 2mm
+  \tableindent = 12mm
+  %
+  \smallenvironments
+}}
+
+% A specific text layout, 24x15cm overall, intended for A4 paper.  Top margin
+% 29mm, hence bottom margin 28mm, nominal side margin 3cm.
+\def\afourlatex{{\globaldefs = 1
+  \textleading = 13.6pt
+  %
+  \afourpaper
+  \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
+  %
+  % Must explicitly reset to 0 because we call \afourpaper, apparently,
+  % although this does not entirely make sense.
+  \globaldefs = 0
+}}
+
+% Use @afourwide to print on European A4 paper in wide format.
+\def\afourwide{%
+  \afourpaper
+  \internalpagesizes{6.5in}{9.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
+}
+
+% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
+% Perhaps we should allow setting the margins, \topskip, \parskip,
+% and/or leading, also. Or perhaps we should compute them somehow.
+%
+\def\pagesizes{\parsearg\pagesizesxxx}
+\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
+\def\pagesizesyyy#1,#2,#3\finish{{%
+  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
+  \globaldefs = 1
+  %
+  \parskip = 3pt plus 2pt minus 1pt
+  \setleading{\textleading}%
+  %
+  \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
+}}
+
+% Set default to letter.
+%
+\letterpaper
+
+
+\message{and turning on texinfo input format.}
+
+% Define macros to output various characters with catcode for normal text.
+\catcode`\"=\other
+\catcode`\~=\other
+\catcode`\^=\other
+\catcode`\_=\other
+\catcode`\|=\other
+\catcode`\<=\other
+\catcode`\>=\other
+\catcode`\+=\other
+\catcode`\$=\other
+\def\normaldoublequote{"}
+\def\normaltilde{~}
+\def\normalcaret{^}
+\def\normalunderscore{_}
+\def\normalverticalbar{|}
+\def\normalless{<}
+\def\normalgreater{>}
+\def\normalplus{+}
+\def\normaldollar{$}%$ font-lock fix
+
+% This macro is used to make a character print one way in ttfont
+% where it can probably just be output, and another way in other fonts,
+% where something hairier probably needs to be done.
+%
+% #1 is what to print if we are indeed using \tt; #2 is what to print
+% otherwise.  Since all the Computer Modern typewriter fonts have zero
+% interword stretch (and shrink), and it is reasonable to expect all
+% typewriter fonts to have this, we can check that font parameter.
+%
+\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
+
+% Same as above, but check for italic font.  Actually this also catches
+% non-italic slanted fonts since it is impossible to distinguish them from
+% italic fonts.  But since this is only used by $ and it uses \sl anyway
+% this is not a problem.
+\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
+
+% Turn off all special characters except @
+% (and those which the user can use as if they were ordinary).
+% Most of these we simply print from the \tt font, but for some, we can
+% use math or other variants that look better in normal text.
+
+\catcode`\"=\active
+\def\activedoublequote{{\tt\char34}}
+\let"=\activedoublequote
+\catcode`\~=\active
+\def~{{\tt\char126}}
+\chardef\hat=`\^
+\catcode`\^=\active
+\def^{{\tt \hat}}
+
+\catcode`\_=\active
+\def_{\ifusingtt\normalunderscore\_}
+% Subroutine for the previous macro.
+\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
+
+\catcode`\|=\active
+\def|{{\tt\char124}}
+\chardef \less=`\<
+\catcode`\<=\active
+\def<{{\tt \less}}
+\chardef \gtr=`\>
+\catcode`\>=\active
+\def>{{\tt \gtr}}
+\catcode`\+=\active
+\def+{{\tt \char 43}}
+\catcode`\$=\active
+\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
+%\catcode 27=\active
+%\def^^[{$\diamondsuit$}
+
+% Set up an active definition for =, but don't enable it most of the time.
+{\catcode`\==\active
+\global\def={{\tt \char 61}}}
+
+\catcode`+=\active
+\catcode`\_=\active
+
+% If a .fmt file is being used, characters that might appear in a file
+% name cannot be active until we have parsed the command line.
+% So turn them off again, and have \everyjob (or @setfilename) turn them on.
+% \otherifyactive is called near the end of this file.
+\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
+
+\catcode`\@=0
+
+% \rawbackslashxx output one backslash character in current font
+\global\chardef\rawbackslashxx=`\\
+%{\catcode`\\=\other
+%@gdef at rawbackslashxx{\}}
+
+% \rawbackslash redefines \ as input to do \rawbackslashxx.
+{\catcode`\\=\active
+ at gdef@rawbackslash{@let\=@rawbackslashxx }}
+
+% \normalbackslash outputs one backslash in fixed width font.
+\def\normalbackslash{{\tt\rawbackslashxx}}
+
+% \catcode 17=0   % Define control-q
+\catcode`\\=\active
+
+% Used sometimes to turn off (effectively) the active characters
+% even after parsing them.
+ at def@turnoffactive{@let"=@normaldoublequote
+ at let\=@realbackslash
+ at let~=@normaltilde
+ at let^=@normalcaret
+ at let_=@normalunderscore
+ at let|=@normalverticalbar
+ at let<=@normalless
+ at let>=@normalgreater
+ at let+=@normalplus
+ at let$=@normaldollar}%$ font-lock fix
+
+ at def@normalturnoffactive{@let"=@normaldoublequote
+ at let\=@normalbackslash
+ at let~=@normaltilde
+ at let^=@normalcaret
+ at let_=@normalunderscore
+ at let|=@normalverticalbar
+ at let<=@normalless
+ at let>=@normalgreater
+ at let+=@normalplus
+ at let$=@normaldollar}%$ font-lock fix
+
+% Make _ and + \other characters, temporarily.
+% This is canceled by @fixbackslash.
+ at otherifyactive
+
+% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
+% That is what \eatinput is for; after that, the `\' should revert to printing
+% a backslash.
+%
+ at gdef@eatinput input texinfo{@fixbackslash}
+ at global@let\ = @eatinput
+
+% On the other hand, perhaps the file did not have a `\input texinfo'. Then
+% the first `\{ in the file would cause an error. This macro tries to fix
+% that, assuming it is called before the first `\' could plausibly occur.
+% Also back turn on active characters that might appear in the input
+% file name, in case not using a pre-dumped format.
+%
+ at gdef@fixbackslash{%
+  @ifx\@eatinput @let\ = @normalbackslash @fi
+  @catcode`+=@active
+  @catcode`@_=@active
+}
+
+% Say @foo, not \foo, in error messages.
+ at escapechar = `@@
+
+% These look ok in all fonts, so just make them not special.  
+ at catcode`@& = @other
+ at catcode`@# = @other
+ at catcode`@% = @other
+
+ at c Set initial fonts.
+ at textfonts
+ at rm
+
+
+ at c Local variables:
+ at c eval: (add-hook 'write-file-hooks 'time-stamp)
+ at c page-delimiter: "^\\\\message"
+ at c time-stamp-start: "def\\\\texinfoversion{"
+ at c time-stamp-format: "%:y-%02m-%02d.%02H"
+ at c time-stamp-end: "}"
+ at c End:

Added: llvm-gcc-4.2/trunk/libjava/classpath/doc/tools.texinfo
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/doc/tools.texinfo?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/doc/tools.texinfo (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/doc/tools.texinfo Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1206 @@
+\input texinfo @c -*-texinfo-*-
+
+ at c %**start of header
+ at setfilename tools.info
+ at settitle GNU Classpath Tools Guide
+ at c %**end of header
+
+ at setchapternewpage on
+
+ at ifinfo
+This file documents the Tools included in a standard distribution of the GNU
+Classpath project deliverables.
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+
+ at ifnotplaintext
+ at dircategory GNU Libraries
+ at direntry
+* Classpath Tools: (tools).       GNU Classpath Tools Guide
+ at end direntry
+ at end ifnotplaintext
+ at end ifinfo
+
+ at titlepage
+ at title GNU Classpath Tools Guide
+ at author The GNU Classpath Team
+
+ at page
+ at vskip 0pt plus 1filll
+Copyright @copyright{} 2006 Free Software Foundation, Inc.
+ at sp 2
+Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this document under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation.
+
+ at end titlepage
+
+ at contents
+
+ at ifinfo
+ at node Top, Applet Tools, (dir), (dir)
+ at top GNU Classpath Tools Guide
+
+This document contains important information you need to know in order to use
+the tools included in the GNU Classpath project deliverables.
+
+The Tools aim at providing a free replacement, similar in their behavior, to
+their counter-parts found in the Reference Implementation (RI) of the Java
+Software Development Kit (SDK).
+
+ at end ifinfo
+
+ at menu
+* Applet Tools::               Work with applets
+* Security Tools::             Work securely with Java applications
+* I18N Issues::                How to add support for non-English languages
+
+ at detailmenu
+ --- The Detailed Node Listing ---
+
+Applet Tools
+
+* appletviewer Tool::          Load applets
+* gcjwebplugin::               Load applets in a web browser
+
+Security Tools
+
+* jarsigner Tool::             Sign and verify .JAR files
+* keytool Tool::               Manage private keys and public certificates
+
+jarsigner Tool
+
+* Common jarsigner Options::   Options used when signing or verifying a file
+* Signing Options::            Options only used when signing a .JAR file
+* Verification Options::       Options only used when verifying a .JAR file
+
+keytool Tool
+
+* Getting Help::               How to get help with keytool commands
+* Common keytool Options::     Options used in more than one command
+* Distinguished Names::        X.500 Distinguished Names used in certificates
+* Add/Update Commands::        Commands for adding data to a Key Store
+* Export Commands::            Commands for exporting data from a Key Store
+* Display Commands::           Commands for displaying data in a Key Store
+* Management Commands::        Commands for managing a Key Store
+
+Add/Update Commands
+
+* Command -genkey::            Generate private key and self-signed certificate
+* Command -import::            Import certificates and certificate replies
+* Command -selfcert::          Generate self-signed certificate
+* Command -cacert::            Import a CA Trusted Certificate
+* Command -identitydb::        Import JDK-1 style identities
+
+Export Commands
+
+* Command -certreq::           Generate Certificate Signing Requests (CSR)
+* Command -export::            Export a certificate in a Key Store
+
+Display Commands
+
+* Command -list::              Display information about one or all Aliases
+* Command -printcert::         Print a certificate or a certificate fingerprint
+
+Management Commands
+
+* Command -keyclone::          Clone a Key Entry in a Key Store
+* Command -storepasswd::       Change the password protecting a Key Store
+* Command -keypasswd::         Change the password protecting a Key Entry
+* Command -delete::            Remove an entry in a Key Store
+
+I18N Issues
+
+* Language Resources::         Where resources are located
+* Message Formats::            How messages are internationalized
+
+ at end detailmenu
+ at end menu
+
+ at comment ----------------------------------------------------------------------
+
+ at node Applet Tools, Security Tools, Top, Top
+ at comment node-name, next, previous, up
+ at chapter Applet Tools
+
+Two Applet Tools are available with GNU Classpath: @b{appletviewer}
+and @b{gcjwebplugin}.
+
+To avoid conflicts with other implementations, the appletviewer
+executable is called ``gappletviewer''.
+
+ at menu
+* appletviewer Tool::          Load applets
+* gcjwebplugin::               Load applets in a web browser
+ at end menu
+
+If while using these tools you think you found a bug, then please report it at @uref{http://www.gnu.org/software/classpath/bugs.html,classpath-bugs}.
+
+ at comment ----------------------------------------------------------------------
+
+ at node appletviewer Tool, gcjwebplugin, Applet Tools, Applet Tools
+ at comment node-name, next, previous, up
+ at section The @code{appletviewer} Tool
+
+ at table @b
+
+ at item SYNOPSIS
+ at code{appletviewer [OPTION]... URL...}@*
+ at code{appletviewer [OPTION]... -code CODE}@*
+ at code{appletviewer [OPTION]... -plugin INPUT,OUTPUT}
+
+ at item DESCRIPTION
+The @code{appletviewer} tool loads and runs an applet.
+
+Use the first form to test applets specified by tag.  The URL should
+resolve to an HTML document from which the @code{appletviewer} will
+extract applet tags.  The APPLET, EMBED and OBJECT tags are supported.
+If a given document contains multiple applet tags, all the applets
+will be loaded, with each applet appearing in its own window.
+Likewise, when multiple URLs are specified, each applet tag instance
+is given its own window.  If a given document contains no recognized
+tags the @code{appletviewer} does nothing.
+
+ at example
+ at code{appletviewer http://www.gnu.org/software/classpath/}
+ at end example
+
+Use the second form to test an applet in development.  This form
+allows applet tag attributes to be supplied on the command line.  Only
+one applet may be specified using the @code{-code} option.  The
+ at code{-code} option overrides the URL form -- any URLs specified will
+be ignored.
+
+ at example
+ at code{appletviewer -code Test.class -param datafile,data.txt}
+ at end example
+
+ at code{gcjwebplugin} uses the third form to communicate with the
+ at code{appletviewer} through named pipes.
+
+ at item URL OPTIONS
+ at table @b
+ at item -debug
+This option is not yet implemented but is provided for compatibility.
+
+ at item -encoding CHARSET
+Use this option to specify an alternate character encoding for the
+specified HTML page.
+
+ at end table
+
+ at item APPLET TAG OPTIONS
+ at table @b
+ at item -code CODE
+Use the @code{-code} option to specify the value of the applet tag
+CODE attribute.
+
+ at item -codebase CODEBASE
+Use the @code{-codebase} option to specify the value of the applet tag
+CODEBASE attribute.
+
+ at item -archive ARCHIVE
+Use the @code{-archive} option to specify the value of the applet tag
+ARCHIVE attribute.
+
+ at item -width WIDTH
+Use the @code{-width} option to specify the value of the applet tag
+WIDTH attribute.
+
+ at item -height HEIGHT
+Use the @code{-height} option to specify the value of the applet tag
+HEIGHT attribute.
+
+ at item -param NAME,VALUE
+Use the @code{-param} option to specify values for the NAME and VALUE
+attributes of an applet PARAM tag.
+
+ at end table
+
+ at item PLUGIN OPTION
+ at table @b
+ at item -plugin INPUT,OUTPUT
+ at code{gcjwebplugin} uses the @code{-plugin} option to specify the
+named pipe the @code{appletviewer} should use for receiving commands
+(INPUT) and the one it should use for sending commands to
+ at code{gcjwebplugin} (OUTPUT).
+
+ at end table
+
+ at item DEBUGGING OPTION
+ at table @b
+ at item -verbose
+Use the @code{-verbose} option to have the @code{appletviewer} print
+debugging messages.
+
+ at end table
+
+ at item STANDARD OPTIONS
+ at table @b
+ at item -help
+Use the @code{-help} option to have the @code{appletviewer} print a
+usage message, then exit.
+
+ at item -version
+Use the @code{-version} option to have the @code{appletviewer} print
+its version, then exit.
+
+ at item -JOPTION
+Use the @code{-J} option to pass OPTION to the virtual machine that
+will run the @code{appletviewer}.  Unlike other options, there must
+not be a space between the -J and OPTION.
+
+ at end table
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node gcjwebplugin, , appletviewer Tool, Applet Tools
+ at comment node-name, next, previous, up
+ at section The @code{gcjwebplugin} Tool
+
+ at code{gcjwebplugin} is a plugin that adds applet support to web
+browsers.  Currently @code{gcjwebplugin} only supports Mozilla-based
+browsers (e.g., Firefox, Galeon, Mozilla).
+
+ at comment ----------------------------------------------------------------------
+
+ at node Security Tools, I18N Issues, Applet Tools, Top
+ at comment node-name, next, previous, up
+ at chapter Security Tools
+
+Two Security Tools are available with GNU Classpath: @b{jarsigner} and @b{keytool}.
+
+To avoid conflicts with other implementations, the jarsigner
+executable is called ``gjarsigner'' and the keytool executable is
+called ``gkeytool''.
+
+ at menu
+* jarsigner Tool::             Sign and verify .JAR files
+* keytool Tool::               Manage private keys and public certificates
+ at end menu
+
+If while using these tools you think you found a bug, then please report it at @uref{http://www.gnu.org/software/classpath/bugs.html,classpath-bugs}.
+
+ at comment ----------------------------------------------------------------------
+
+ at node jarsigner Tool, keytool Tool, Security Tools, Security Tools
+ at comment node-name, next, previous, up
+ at section The @code{jarsigner} Tool
+
+The @b{jarsigner} tool is invoked from the command line, in one of two forms, as follows:
+
+ at example
+ at code{jarsigner [OPTION]... FILE ALIAS}
+ at code{jarsigner -verify [OPTION]... FILE}
+ at end example
+
+When the first form is used, the tool signs the designated JAR file. The second form, on the other hand, is used to verify a previously signed JAR file.
+
+ at code{FILE} is the .JAR file to process; i.e. to sign if the first syntax form is used, or to verify if the second syntax form is used instead.
+
+ at code{ALIAS} must be a known @i{Alias} of a @i{Key Entry} in the designated @i{Key Store}. The private key material associated with this @i{Alias} is then used for signing the designated .JAR file.
+
+ at menu
+* Common jarsigner Options::   Options used when signing or verifying a file
+* Signing Options::            Options only used when signing a .JAR file
+* Verification Options::       Options only used when verifying a .JAR file
+ at end menu
+
+ at comment ----------------------------------------------------------------------
+
+ at node Common jarsigner Options, Signing Options, jarsigner Tool, jarsigner Tool
+ at comment node-name, next, previous, up
+ at subsection Common options
+
+The following options may be used when the tool is used for either signing, or verifying, a .JAR file.
+
+ at table @b
+ at item -verbose
+Use this option to force the tool to generate more verbose messages, during its processing.
+
+ at item -internalsf
+When present, the tool will include --which otherwise it does not-- the @code{.SF} file in the @code{.DSA} generated file.
+
+ at item -sectionsonly
+When present, the tool will include in the @code{.SF} generated file --which otherwise it does not-- a header containing a hash of the whole manifest file.  When that header is included, the tool can quickly check, during verification, if the hash (in the header) matches or not the manifest file.
+
+ at item -provider PROVIDER_CLASS_NAME
+A fully qualified class name of a @i{Security Provider} to add to the current list of @i{Security Providers} already installed in the JVM in-use. If a provider class is specified with this option, and was successfully added to the runtime --i.e. it was not already installed-- then the tool will attempt to remove this @i{Security Provider} before exiting.
+
+ at item -help
+Prints a help text similar to this one.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Signing Options, Verification Options, Common jarsigner Options, jarsigner Tool
+ at comment node-name, next, previous, up
+ at subsection Signing options
+
+The following options may be specified when using the tool for signing purposes.
+
+ at table @b
+ at item -keystore URL
+Use this option to specify the location of the key store to use. The default value is a file URL referencing the file named @file{.keystore} located in the path returned by the call to @code{java.lang.System#getProperty(String)} using @code{user.home} as argument.
+
+If a URL was specified, but was found to be malformed --e.g. missing protocol element-- the tool will attempt to use the URL value as a file-name (with absolute or relative path-name) of a key store --as if the protocol was @code{file:}.
+
+ at item -storetype STORE_TYPE
+Use this option to specify the type of the key store to use. The default value, if this option is omitted, is that of the property @code{keystore.type} in the security properties file, which is obtained by invoking the static method call @code{getDefaultType()} in @code{java.security.KeyStore}.
+
+ at item -storepass PASSWORD
+Use this option to specify the password which will be used to unlock the key store. If this option is missing, the User will be prompted to provide a password.
+
+ at item -keypass PASSWORD
+Use this option to specify the password which the tool will use to unlock the @i{Key Entry} associated with the designated @i{Alias}.
+
+If this option is omitted, the tool will first attempt to unlock the @i{Key Entry} using the same password protecting the key store. If this fails, you will then be prompted to provide a password.
+
+ at item -sigfile NAME
+Use this option to designate a literal that will be used to construct file names for both the @code{.SF} and @code{.DSA} signature files. These files  will be generated, by the tool, and placed in the @file{META-INF} directory of the signed JAR.  Permissible characters for @code{NAME} must be in the range "a-zA-Z0-9_-".  All characters will be converted to upper-case ones.
+
+If this option is missing, the first eight characters of the @code{ALIAS} argument will be used. When this is the case, any character in @code{ALIAS} that is outside the permissible range of characters will be replaced by an underscore.
+
+ at item -signedjar FILE
+Use this option to specify the file name of the signed JAR. If this option is omitted, then the signed JAR will be named the same as @code{FILE}; i.e. the input JAR file will be replaced with the signed copy.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Verification Options, , Signing Options, jarsigner Tool
+ at comment node-name, next, previous, up
+ at subsection Verification options
+
+The following options may be specified when using the tool for verification purposes.
+
+ at table @b
+ at item -verify
+Use this option to indicate that the tool is to be used for verification purposes.
+
+ at item -certs
+This option is used in conjunction with the @code{-verbose} option. When present, along with the @code{-verbose} option, the tool will print more detailed information about the certificates of the signer(s) being processed.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node keytool Tool, , jarsigner Tool, Security Tools
+ at comment node-name, next, previous, up
+ at section The @code{keytool} Tool
+
+Cryptographic credentials, in a Java environment, are usually stored in a @i{Key Store}. The Java SDK specifies a @i{Key Store} as a persistent container of two types of objects: @i{Key Entries} and @i{Trusted Certificates}. The security tool @b{keytool} is a Java-based application for managing those types of objects.
+
+A @i{Key Entry} represents the private key part of a key-pair used in Public-Key Cryptography, and a signed X.509 certificate which authenticates the public key part for a known entity; i.e. the owner of the key-pair. The X.509 certificate itself contains the public key part of the key-pair.
+
+A @i{Trusted Certificate} is a signed X.509 certificate issued by a trusted entity. The @i{Trust} in this context is relative to the User of the @b{keytool}. In other words, the existence of a @i{Trusted Certificate} in the @i{Key Store} processed by a @b{keytool} command implies that the User trusts the @i{Issuer} of that @i{Trusted Certificate} to also sign, and hence authenticates, other @i{Subjects} the tool may process.
+
+ at i{Trusted Certificates} are important because they allow the tool to mechanically construct @i{Chains of Trust} starting from one of the @i{Trusted Certificates} in a @i{Key Store} and ending with a certificate whose @i{Issuer} is potentially unknown. A valid chain is an ordered list, starting with a @i{Trusted Certificate} (also called the @i{anchor}), ending with the target certificate, and satisfying the condition that the @i{Subject} of certificate @code{#i} is the @i{Issuer} of certificate @code{#i + 1}.
+
+The @b{keytool} is invoked from the command line as follows:
+
+ at example
+ at code{keytool [COMMAND]...}
+ at end example
+
+Multiple @code{COMMAND}s may be specified at once, each complete with its own options. @b{keytool} will parse all the arguments, before processing, and executing, each @code{COMMAND}. If an exception occurs while executing one @code{COMMAND} @b{keytool} will abort. Note however that because the implementation of the tool uses code to parse command line options that also supports GNU-style options, you have to separate each command group with a double-hyphen; e.g
+
+ at example
+ at code{keytool -list -- -printcert -alias mykey}
+ at end example
+
+Here is a summary of the commands supported by the tool:
+
+ at enumerate
+ at item Add/Update commands
+ at itemize @bullet
+ at item -genkey [OPTION]@dots{}
+Generate a new @i{Key Entry}, eventually creating a new key store.
+
+ at item -import [OPTION]@dots{}
+Add, to a key store, @i{Key Entries} (private keys and certificate chains authenticating the public keys) and @i{Trusted Certificates} (3rd party certificates which can be used as @i{Trust Anchors} when building chains-of-trust).
+
+ at item -selfcert [OPTION]@dots{}
+Generate a new self-signed @i{Trusted Certificate}.
+
+ at item -cacert [OPTION]@dots{}
+Import a CA @i{Trusted Certificate}.
+
+ at item -identitydb [OPTION]@dots{}
+ at b{NOT IMPLEMENTED YET}.@*
+Import a JDK 1.1 style Identity Database.
+ at end itemize
+
+ at item Export commands
+ at itemize @bullet
+ at item -certreq [OPTION]@dots{}
+Issue a @i{Certificate Signing Request} (CSR) which can be then sent to a @i{Certification Authority} (CA) to issue a certificate signed (by the CA) and authenticating the @i{Subject} of the request.
+
+ at item -export [OPTION]@dots{}
+Export a certificate from a key store.
+ at end itemize
+
+ at item Display commands
+ at itemize @bullet
+ at item -list [OPTION]@dots{}
+Print one or all certificates in a key store to @code{STDOUT}.
+
+ at item -printcert [OPTION]@dots{}
+Print a human-readable form of a certificate, in a designated file, to @code{STDOUT}.
+ at end itemize
+
+ at item Management commands
+ at itemize @bullet
+ at item -keyclone [OPTION]@dots{}
+Clone a @i{Key Entry} in a key store.
+
+ at item -storepasswd [OPTION]@dots{}
+Change the password protecting a key store.
+
+ at item -keypasswd [OPTION]@dots{}
+Change the password protecting a @i{Key Entry} in a key store.
+
+ at item -delete [OPTION]@dots{}
+Delete a @i{Key Entry} or a @i{Trusted Certificate} from a key store.
+ at end itemize
+
+ at end enumerate
+
+ at menu
+* Getting Help::               How to get help with keytool commands
+* Common keytool Options::     Options used in more than one command
+* Distinguished Names::        X.500 Distinguished Names used in certificates
+* Add/Update Commands::        Commands for adding data to a Key Store
+* Export Commands::            Commands for exporting data from a Key Store
+* Display Commands::           Commands for displaying data in a Key Store
+* Management Commands::        Commands for managing a Key Store
+ at end menu
+
+ at comment ----------------------------------------------------------------------
+
+ at node Getting Help, Common keytool Options, keytool Tool, keytool Tool
+ at comment node-name, next, previous, up
+ at subsection Getting help
+
+To get a general help text about the tool, use the @code{-help} option; e.g.
+
+ at example
+ at code{keytool -help}
+ at end example
+
+To get more specific help text about one of the tool's command use the @code{-help} option for that command; e.g.
+
+ at example
+ at code{keytool -genkey -help}
+ at end example
+
+In both instances, the tool will print a help text and then will exit the running JVM.
+
+It is worth noting here that the help messages printed by the tool are I18N-ready. This means that if/when the contents of the tool's @i{Message Bundle} properties file are available in languages other than English, you may see those messages in that language.
+
+ at comment ----------------------------------------------------------------------
+
+ at node Common keytool Options, Distinguished Names, Getting Help, keytool Tool
+ at comment node-name, next, previous, up
+ at subsection Common options
+
+The following @code{OPTION}s are used in more than one @code{COMMAND}. They are described here to reduce redundancy.
+
+ at table @b
+ at anchor{alias}
+ at item -alias ALIAS
+Every entry, be it a @i{Key Entry} or a @i{Trusted Certificate}, in a key store is uniquely identified by a user-defined @i{Alias} string. Use this option to specify the @i{Alias} to use when referring to an entry in the key store. Unless specified otherwise, a default value of @code{mykey} shall be used when this option is omitted from the command line.
+
+ at anchor{keyalg}
+ at item -keyalg ALGORITHM
+Use this option to specify the canonical name of the key-pair generation algorithm. The default value for this option is @code{DSS} (a synonym for the Digital Signature Algorithm also known as DSA).
+
+ at anchor{keysize}
+ at item -keysize SIZE
+Use this option to specify the number of bits of the shared modulus (for both the public and private keys) to use when generating new keys. A default value of @code{1024} will be used if this option is omitted from the command line.
+
+ at anchor{validity}
+ at item -validity DAY_COUNT
+Use this option to specify the number of days a newly generated certificate will be valid for. The default value is @code{90} (days) if this option is omitted from the command line.
+
+ at anchor{storetype}
+ at item -storetype STORE_TYPE
+Use this option to specify the type of the key store to use. The default value, if this option is omitted, is that of the property @code{keystore.type} in the security properties file, which is obtained by invoking the static method call @code{getDefaultType()} in @code{java.security.KeyStore}.
+
+ at anchor{storepass}
+ at item -storepass PASSWORD
+Use this option to specify the password protecting the key store. If this option is omitted from the command line, you will be prompted to provide a password.
+
+ at anchor{keystore}
+ at item -keystore URL
+Use this option to specify the location of the key store to use. The default value is a file URL referencing the file named @file{.keystore} located in the path returned by the call to @code{java.lang.System#getProperty(String)} using @code{user.home} as argument.
+
+If a URL was specified, but was found to be malformed --e.g. missing protocol element-- the tool will attempt to use the URL value as a file-name (with absolute or relative path-name) of a key store --as if the protocol was @code{file:}.
+
+ at anchor{provider}
+ at item -provider PROVIDER_CLASS_NAME
+A fully qualified class name of a @i{Security Provider} to add to the current list of @i{Security Providers} already installed in the JVM in-use. If a provider class is specified with this option, and was successfully added to the runtime --i.e. it was not already installed-- then the tool will attempt to removed this @i{Security Provider} before exiting.
+
+ at anchor{file}
+ at item -file FILE
+Use this option to designate a file to use with a command. When specified with this option, the value is expected to be the fully qualified path of a file accessible by the File System. Depending on the command, the file may be used as input or as output. When this option is omitted from the command line, @code{STDIN} will be used instead, as the source of input, and @code{STDOUT} will be used instead as the output destination.
+
+ at anchor{verbose}
+ at item -v
+Unless specified otherwise, use this option to enable more verbose output.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Distinguished Names, Add/Update Commands, Common keytool Options, keytool Tool
+ at comment node-name, next, previous, up
+ at subsection X.500 Distinguished Names
+
+ at anchor{dn}
+A @i{Distinguished Name} (or DN) MUST be supplied with some of the @code{COMMAND}s using a @code{-dname} option. The syntax of a valid value for this option MUST follow RFC-2253 specifications. Namely the following components (with their accepted meaning) will be recognized. Note that the component name is case-insensitive:
+
+ at ftable @var
+ at item CN
+The Common Name; e.g. @kbd{host.domain.com}
+ at item OU
+The Organizational Unit; e.g. @kbd{IT Department}
+ at item O
+The Organization Name; e.g. @kbd{The Sample Company}
+ at item L
+The Locality Name; e.g. @kbd{Sydney}
+ at item ST
+The State Name; e.g. @kbd{New South Wales}
+ at item C
+The 2-letter Country identifier; e.g. @kbd{AU}
+ at end ftable
+
+When specified with a @code{-dname} option, each pair of component/value will be separated from the other with a comma. Each component and value pair MUST be separated by an equal sign. For example, the following is a valid DN value:@*
+
+ at format
+CN=host.domain.com, O=The Sample Company, L=Sydney, ST=NSW, C=AU
+ at end format
+@*
+If the @i{Distinguished Name} is required, and no valid default value can be used, the tool will prompt you to enter the information through the console.
+
+ at comment ----------------------------------------------------------------------
+
+ at node Add/Update Commands, Export Commands, Distinguished Names, keytool Tool
+ at comment node-name, next, previous, up
+ at subsection Add/Update commands
+
+ at menu
+* Command -genkey::            Generate private key and self-signed certificate
+* Command -import::            Import certificates and certificate replies
+* Command -selfcert::          Generate self-signed certificate
+* Command -cacert::            Import a CA Trusted Certificate
+* Command -identitydb::        Import JDK-1 style identities
+ at end menu
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -genkey, Command -import, Add/Update Commands, Add/Update Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-genkey} command
+
+Use this command to generate a new key-pair (both private and public keys), and save these credentials in the key store as a @i{Key Entry}, associated with the designated (if was specified with the @code{-alias} option) or default (if the @code{-alias} option is omitted) @i{Alias}.
+
+The private key material will be protected with a user-defined password (see @code{-keypass} option). The public key on the other hand will be part of a self-signed X.509 certificate, which will form a 1-element chain and will be saved in the key store.
+
+ at table @b
+ at item -alias ALIAS
+For more details @pxref{alias,, ALIAS}.
+
+ at item -keyalg ALGORITHM
+For more details @pxref{keyalg,, ALGORITHM}.
+
+ at item -keysize KEY_SIZE
+For more details @pxref{keysize,, KEY_SIZE}.
+
+ at item -sigalg ALGORITHM
+The canonical name of the digital signature algorithm to use for signing certificates. If this option is omitted, a default value will be chosen based on the type of the key-pair; i.e. the algorithm that ends up being used by the -keyalg option. If the key-pair generation algorithm is @code{DSA}, the value for the signature algorithm will be @code{SHA1withDSA}. If on the other hand the key-pair generation algorithm is @code{RSA}, then the tool will use @code{MD5withRSA} as the signature algorithm.
+
+ at item -dname NAME
+This a mandatory value for the command. If no value is specified --i.e. the @code{-dname} option is omitted-- the tool will prompt you to enter a @i{Distinguished Name} to use as both the @i{Owner} and @i{Issuer} of the generated self-signed certificate.
+
+For more details @pxref{dn,, X.500 DISTINGUISHED NAME}.
+
+ at item -keypass PASSWORD
+Use this option to specify the password which the tool will use to protect the newly created @i{Key Entry}.
+
+If this option is omitted, you will be prompted to provide a password.
+
+ at item -validity DAY_COUNT
+For more details @pxref{validity,, DAY_COUNT}.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -import, Command -selfcert, Command -genkey, Add/Update Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-import} command
+
+Use this command to read an X.509 certificate, or a PKCS#7 @i{Certificate Reply} from a designated input source and incorporate the certificates into the key store.
+
+If the @i{Alias} does not already exist in the key store, the tool treats the certificate read from the input source as a new @i{Trusted Certificate}. It then attempts to discover a chain-of-trust, starting from that certificate and ending at another @i{Trusted Certificate}, already stored in the key store. If the @code{-trustcacerts} option is present, an additional key store, of type @code{JKS} named @file{cacerts}, and assumed to be present in @file{$@{JAVA_HOME@}/lib/security} will also be consulted if found -- at code{$@{JAVA_HOME@}} refers to the location of an installed @i{Java Runtime Environment} (JRE). If no chain-of-trust can be established, and unless the @code{-noprompt} option has been specified, the certificate is printed to @code{STDOUT} and the user is prompted for a confirmation.
+
+If @i{Alias} exists in the key store, the tool will treat the certificate(s) read from the input source as a @i{Certificate Reply}, which can be a chain of certificates, that eventually would replace the chain of certificates associated with the @i{Key Entry} of that @i{Alias}. The substitution of the certificates only occurs if a chain-of-trust can be established between the bottom certificate of the chain read from the input file and the @i{Trusted Certificates} already present in the key store. Again, if the @code{-trustcacerts} option is specified, additional @i{Trusted Certificates} in the same @file{cacerts} key store will be considered. If no chain-of-trust can be established, the operation will abort.
+
+ at table @b
+ at item -alias ALIAS
+For more details @pxref{alias,, ALIAS}.
+
+ at item -file FILE
+For more details @pxref{file,, FILE}.
+
+ at item -keypass PASSWORD
+Use this option to specify the password which the tool will use to protect the @i{Key Entry} associated with the designated @i{Alias}, when replacing this @i{Alias}' chain of certificates with that found in the certificate reply.
+
+If this option is omitted, and the chain-of-trust for the certificate reply has been established, the tool will first attempt to unlock the @i{Key Entry} using the same password protecting the key store. If this fails, you will then be prompted to provide a password.
+
+ at item -noprompt
+Use this option to prevent the tool from prompting the user.
+
+ at item -trustcacerts
+Use this option to indicate to the tool that a key store, of type @code{JKS}, named @file{cacerts}, and usually located in @file{lib/security} in an installed @i{Java Runtime Environment} should be considered when trying to establish chain-of-trusts.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -selfcert, Command -cacert, Command -import, Add/Update Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-selfcert} command
+
+Use this command to generate a self-signed X.509 version 1 certificate. The newly generated certificate will form a chain of one element which will replace the previous chain associated with the designated @i{Alias} (if @code{-alias} option was specified), or the default @i{Alias} (if @code{-alias} option was omitted).
+
+ at table @b
+ at item -alias ALIAS
+For more details @pxref{alias,, ALIAS}.
+
+ at item -sigalg ALGORITHM
+The canonical name of the digital signature algorithm to use for signing the certificate. If this option is omitted, a default value will be chosen based on the type of the private key associated with the designated @i{Alias}. If the private key is a @code{DSA} one, the value for the signature algorithm will be @code{SHA1withDSA}. If on the other hand the private key is an @code{RSA} one, then the tool will use @code{MD5withRSA} as the signature algorithm.
+
+ at item -dname NAME
+Use this option to specify the @i{Distinguished Name} of the newly generated self-signed certificate. If this option is omitted, the existing @i{Distinguished Name} of the base certificate in the chain associated with the designated @i{Alias} will be used instead.
+
+For more details @pxref{dn,, X.500 DISTINGUISHED NAME}.
+
+ at item -validity DAY_COUNT
+For more details @pxref{validity,, DAY_COUNT}.
+
+ at item -keypass PASSWORD
+Use this option to specify the password which the tool will use to unlock the @i{Key Entry} associated with the designated @i{Alias}.
+
+If this option is omitted, the tool will first attempt to unlock the @i{Key Entry} using the same password protecting the key store. If this fails, you will then be prompted to provide a password.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -cacert, Command -identitydb, Command -selfcert, Add/Update Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-cacert} command
+
+Use this command to import, a CA certificate and add it to the key store as a @i{Trusted Certificate}. The @i{Alias} for this new entry will be constructed from the FILE's base-name after replacing hyphens and dots with underscores.
+
+This command is useful when used in a script that recursively visits a directory of CA certificates to populate a @code{cacerts.gkr} @i{Key Store} of trusted certificates which can then be used commands that specify the @code{-trustcacerts} option.
+
+ at table @b
+ at item -file FILE
+For more details @pxref{file,, FILE}.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -identitydb, , Command -cacert, Add/Update Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-identitydb} command
+
+ at b{NOT IMPLEMENTED YET}.
+
+Use this command to import a JDK 1.1 style Identity Database.
+
+ at table @b
+ at item -file FILE
+For more details @pxref{file,, FILE}.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Export Commands, Display Commands, Add/Update Commands, keytool Tool
+ at comment node-name, next, previous, up
+ at subsection Export commands
+
+ at menu
+* Command -certreq::           Generate Certificate Signing Requests (CSR)
+* Command -export::            Export a certificate in a Key Store
+ at end menu
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -certreq, Command -export, Export Commands, Export Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-certreq} command
+
+Use this command to generate a PKCS#10 @i{Certificate Signing Request} (CSR) and write it to a designated output destination. The contents of the destination should look something like the following:
+
+ at example
+-----BEGIN NEW CERTIFICATE REQUEST-----
+MI...QAwXzEUMBIGA1UEAwwLcnNuQGdudS5vcmcxGzAZBgNVBAoMElUg
+Q2...A0GA1UEBwwGU3lkbmV5MQwwCgYDVQQIDANOU1cxCzAJBgNVBACC
+...
+FC...IVwNVOfQLRX+O5kAhQ/a4RTZme2L8PnpvgRwrf7Eg8D6w==
+-----END NEW CERTIFICATE REQUEST-----
+ at end example
+
+ at b{IMPORTANT}: Some documentation (e.g. RSA examples) claims that the @code{Attributes} field, in the CSR is @code{OPTIONAL} while RFC-2986 implies the opposite. This implementation considers this field, by default, as @code{OPTIONAL}, unless the option @code{-attributes} is specified on the command line.
+
+ at table @b
+ at item -alias ALIAS
+For more details @pxref{alias,, ALIAS}.
+
+ at item -sigalg ALGORITHM
+The canonical name of the digital signature algorithm to use for signing the certificate. If this option is omitted, a default value will be chosen based on the type of the private key associated with the designated @i{Alias}. If the private key is a @code{DSA} one, the value for the signature algorithm will be @code{SHA1withDSA}. If on the other hand the private key is an @code{RSA} one, then the tool will use @code{MD5withRSA} as the signature algorithm.
+
+ at item -file FILE
+For more details @pxref{file,, FILE}.
+
+ at item -keypass PASSWORD
+Use this option to specify the password which the tool will use to unlock the @i{Key Entry} associated with the designated @i{Alias}.
+
+If this option is omitted, the tool will first attempt to unlock the @i{Key Entry} using the same password protecting the key store. If this fails, you will then be prompted to provide a password.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at item -attributes
+Use this option to force the tool to encode a @code{NULL} DER value in the CSR as the value of the @code{Attributes} field.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -export, , Command -certreq, Export Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-export} command
+
+Use this command to export a certificate stored in a key store to a designated output destination, either in binary format (if the @code{-v} option is specified), or in RFC-1421 compliant encoding (if the @code{-rfc} option is specified instead).
+
+ at table @b
+ at item -alias ALIAS
+For more details @pxref{alias,, ALIAS}.
+
+ at item -file FILE
+For more details @pxref{file,, FILE}.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -rfc
+Use RFC-1421 specifications when encoding the output.
+
+ at item -v
+Output the certificate in binary DER encoding. This is the default output format of the command if neither @code{-rfc} nor @code{-v} options were detected on the command line. If both this option and the @code{-rfc} option are detected on the command line, the tool will opt for the RFC-1421 style encoding.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Display Commands, Management Commands, Export Commands, keytool Tool
+ at comment node-name, next, previous, up
+ at subsection Display commands
+
+ at menu
+* Command -list::              Display information about one or all Aliases
+* Command -printcert::         Print a certificate or a certificate fingerprint
+ at end menu
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -list, Command -printcert, Display Commands, Display Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-list} command
+
+Use this command to print one or all of a key store entries to @code{STDOUT}. Usually this command will only print a @i{fingerprint} of the certificate, unless either the @code{-rfc} or the @code{-v} option is specified.
+
+ at table @b
+ at item -alias ALIAS
+If this option is omitted, the tool will print ALL the entries found in the key store.
+
+For more details @pxref{alias,, ALIAS}.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -rfc
+Use RFC-1421 specifications when encoding the output.
+
+ at item -v
+Output the certificate in human-readable format. If both this option and the @code{-rfc} option are detected on the command line, the tool will opt for the human-readable form and will not abort the command.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -printcert, , Command -list, Display Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-printcert} command
+
+Use this command to read a certificate from a designated input source and print it to @code{STDOUT} in a human-readable form.
+
+ at table @b
+ at item -file FILE
+For more details @pxref{file,, FILE}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Management Commands, , Display Commands, keytool Tool
+ at comment node-name, next, previous, up
+ at subsection Management commands
+
+ at menu
+* Command -keyclone::          Clone a Key Entry in a Key Store
+* Command -storepasswd::       Change the password protecting a Key Store
+* Command -keypasswd::         Change the password protecting a Key Entry
+* Command -delete::            Remove an entry in a Key Store
+ at end menu
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -keyclone, Command -storepasswd, Management Commands, Management Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-keyclone} command
+
+Use this command to clone an existing @i{Key Entry} and store it under a new (different) @i{Alias} protecting, its private key material with possibly a new password.
+
+ at table @b
+ at item -alias ALIAS
+For more details @pxref{alias,, ALIAS}.
+
+ at item -dest ALIAS
+Use this option to specify the new @i{Alias} which will be used to identify the cloned copy of the @i{Key Entry}.
+
+ at item -keypass PASSWORD
+Use this option to specify the password which the tool will use to unlock the @i{Key Entry} associated with the designated @i{Alias}.
+
+If this option is omitted, the tool will first attempt to unlock the @i{Key Entry} using the same password protecting the key store. If this fails, you will then be prompted to provide a password.
+
+ at item -new PASSWORD
+Use this option to specify the password protecting the private key material of the newly cloned copy of the @i{Key Entry}.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -storepasswd, Command -keypasswd, Command -keyclone, Management Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-storepasswd} command
+
+Use this command to change the password protecting a key store.
+
+ at table @b
+ at item -new PASSWORD
+The new, and different, password which will be used to protect the designated key store.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -keypasswd, Command -delete, Command -storepasswd, Management Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-keypasswd} command
+
+Use this command to change the password protecting the private key material of a designated @i{Key Entry}.
+
+ at table @b
+ at item -alias ALIAS
+For more details @pxref{alias,, ALIAS}.
+
+Use this option to specify the password which the tool will use to unlock the @i{Key Entry} associated with the designated @i{Alias}.
+
+If this option is omitted, the tool will first attempt to unlock the @i{Key Entry} using the same password protecting the key store. If this fails, you will then be prompted to provide a password.
+
+ at item -new PASSWORD
+The new, and different, password which will be used to protect the private key material of the designated @i{Key Entry}.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node Command -delete, , Command -keypasswd, Management Commands
+ at comment node-name, next, previous, up
+ at subsubsection @code{-delete} command
+
+Use this command to delete a designated key store entry.
+
+ at table @b
+ at item -alias ALIAS
+For more details @pxref{alias,, ALIAS}.
+
+ at item -storetype STORE_TYPE
+For more details @pxref{storetype,, STORE_TYPE}.
+
+ at item -keystore URL
+For more details @pxref{keystore,, URL}.
+
+ at item -storepass PASSWORD
+For more details @pxref{storepass,, PASSWORD}.
+
+ at item -provider PROVIDER_CLASS_NAME
+For more details @pxref{provider,, PROVIDER_CLASS_NAME}.
+
+ at item -v
+For more details @pxref{verbose}.
+
+ at end table
+
+ at comment ----------------------------------------------------------------------
+
+ at node I18N Issues, , Security Tools, Top
+ at comment node-name, next, previous, up
+ at chapter I18N Issues
+
+Some tools -- at pxref{Security Tools}-- allow using other than the English language when prompting the User for input, and outputing messages. This chapter describes the elements used to offer this support and how they can be adapted for use with specific languages.
+
+ at menu
+* Language Resources::         Where resources are located
+* Message Formats::            How messages are internationalized
+ at end menu
+
+ at comment ----------------------------------------------------------------------
+
+ at node Language Resources, Message Formats, I18N Issues, I18N Issues
+ at comment node-name, next, previous, up
+ at section Language-specific resources
+
+The Tools use Java @code{ResourceBundle}s to store messages, and message templates they use at runtime to generate the message text itself, depending on the locale in use at the time.
+
+The @i{Resource Bundles} these tools use are essentially Java @i{Properties} files consisting of a set of @i{Name/Value} pairs. The @i{Name} is the @i{Propery Name} and the @i{Value} is a substitution string that is used when the code references the associated @i{Name}. For example the following is a line in a @i{Resource Bundle} used by the @code{keytool} Tool:
+
+ at example
+Command.23=A correct key password MUST be provided
+ at end example
+
+When the tool needs to signal a mandatory but missing key password, it would reference the property named @code{Command.23} and the message "@kbd{A correct key password MUST be provided}" will be used instead. This indirect referencing of "resources" permits replacing, as late as possible, the English strings with strings in other languages, provided of course @i{Resource Bundles} in those languages are provided.
+
+For the GNU Classpath Tools described in this Guide, the @i{Resource Bundles} are files named @file{messages[_ll[_CC[_VV]]].properties} where:
+
+ at ftable @var
+ at item ll
+Is the 2-letter code for the Language,
+ at item CC
+Is the 2-letter code for the Region, and
+ at item VV
+Is the 2-letter code for the Variant of the language.
+ at end ftable
+
+The complete list of language codes can be found at @uref{http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt, Code for the representation of names of languages}. A similar list for the region codes can be found at @uref{http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html, ISO 3166 Codes (Countries)}.
+
+The location of the @i{Resource Bundles} for the GNU Classpath Tools is specific to each tool. The next table shows where these files are found in a standard GNU Classpath distribution:
+
+ at ftable @code
+ at item jarsigner
+ at file{gnu/classpath/tools/jarsigner}
+ at item keytool
+ at file{gnu/classpath/tools/keytool}
+ at end ftable
+
+The collection of @i{Resource Bundles} in a location act as an inverted tree with a parent-child relationship. For example suppose in the @file{gnu/classpath/tools/keytool} there are 3 message bundles named:
+
+ at enumerate
+ at item @code{messages.properties}
+ at item @code{messages_fr.properties}
+ at item @code{messages_fr_FR.properties}
+ at end enumerate
+
+In the above example, bundle #1 will act as the parent of bundle #2, which in turn will act as the parent for bundle #3. This ordering is used by the Java runtime to choose which file to load based on the set Locale. For example if the Locale is @code{fr_CH}, @code{messages_fr.properties} will be used because (a) @code{messages_fr_CH.properties} does not exist, but (b) @code{messages_fr.properties} is the parent for the required bundle, and it exists. As another example, suppose the Locale was set to @code{en_AU}; then the tool will end up using @code{messages.properties} because (a) @code{messages_en_AU.properties} does not exist, (b) @code{messages_en.properties} which is the parent for the required bundle does not exist, but (c) @code{messages.properties} exists and is the root of the hierarchy.
+
+You can see from the examples above that @file{messages.properties} is the safety net that the Java runtime falls back to when failing to find a specific bunlde and its parent(s). This file is always provided with the Tool. In time, more localized versions will be included to cater for other languages.
+
+In the meantime, if you are willing to contribute localized versions of these resources, grab the @file{messages.properties} for a specific tool; translate it; save it with the appropriate language and region suffix and mail it to @code{classpath@@gnu.org}.
+
+ at comment ----------------------------------------------------------------------
+
+ at node Message Formats, , Language Resources, I18N Issues
+ at comment node-name, next, previous, up
+ at section Message formats
+
+If you open any of the @file{messages.properties} described in the previous section, you may see properties that look like so:
+
+ at example
+Command.67=Issuer: @{0@}
+Command.68=Serial number: @{0,number@}
+Command.69=Valid from: @{0,date,full@} - @{0,time,full@}
+Command.70=\ \ \ \ \ until: @{0,date,full@} - @{0,time,full@}
+ at end example
+
+These are @i{Message Formats} used by the tools to customize a text string that will then be used either as a prompt for User input or as output.
+
+If you are translating a @file{messages.properties} be careful not to alter text between curly braces.
+
+ at comment ----------------------------------------------------------------------
+
+ at bye

Added: llvm-gcc-4.2/trunk/libjava/classpath/doc/vmintegration.texinfo
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/doc/vmintegration.texinfo?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/doc/vmintegration.texinfo (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/doc/vmintegration.texinfo Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1928 @@
+\input texinfo @c -*-texinfo-*-
+
+ at c %**start of header
+ at setfilename vmintegration.info
+ at settitle GNU Classpath VM Integration Guide
+ at c %**end of header
+
+ at setchapternewpage off
+
+ at ifinfo
+This file contains important information you will need to know if you
+are going to write an interface between GNU Classpath and a Virtual
+Machine.
+
+Copyright (C) 1998-2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+ at ifnotplaintext
+ at dircategory GNU Libraries
+ at direntry
+* VM Integration: (vmintegration).   GNU Classpath VM Integration Guide
+ at end direntry
+ at end ifnotplaintext
+ at end ifinfo
+
+ at titlepage
+ at title GNU Classpath VM Integration Guide
+ at author John Keiser
+ at author C. Brian Jones
+ at author Mark Wielaard
+
+ at page
+ at vskip 0pt plus 1filll
+Copyright @copyright{} 1998-2002 Free Software Foundation, Inc.
+ at sp 2
+Permission is granted to make and distribute verbatim copies of
+this document provided the copyright notice and this permission notice
+are preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this
+document under the conditions for verbatim copying, provided that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this manual
+into another language, under the above conditions for modified versions,
+except that this permission notice may be stated in a translation
+approved by the Free Software Foundation.
+
+ at end titlepage
+
+ at ifinfo
+ at node Top, Introduction, (dir), (dir)
+ at top GNU Classpath Hacker's Guide
+
+This file contains important information you will need to know if you
+are going to write an interface between GNU Classpath and a Virtual
+Machine.
+
+This document is incomplete, as we are still in alpha with the interface.
+
+ at end ifinfo
+
+ at menu
+* Introduction::                An introduction to the Classpath project
+* Initialization::              Initializing the classes
+* Classpath Hooks::             Hooks from Classpath to the VM
+* VM Hooks::                    Hooks from the underlying VM to Classpath
+* JNI Implementation::		Hooking the VM to jni.h
+* JVMTI Implementation::        Hooking the VM to jvmti.h
+* Miscellaneous VM Requirements::  
+ at end menu
+
+ at node Introduction, Initialization, Top, Top
+ at comment node-name, next, previous, up
+ at chapter Introduction
+
+The Classpath Project's ambition to be a 100% clean room implementation
+of the standard Java class libraries cannot be fulfilled without some
+level of integration with the Virtual Machine, the underlying machinery
+that actually runs Java.
+
+There are several VMs out there, here is a small list.
+
+ at itemize @bullet
+ at item @uref{http://www.hungry.com/old-hungry/products/japhar/,Japhar}
+Japhar was the first VM to use GNU Classpath.  Today you can see that
+sort of relationship in the source tree which denotes several Japhar
+specific files as a reference implementation of those pieces.  This VM
+has been primarily tested against Linux and lacks garbage collections, a
+JIT, and suffers recently from slow development.
+
+ at item @uref{http://www.intel.com/research/mrl/orp/,Intel's Open Runtime Platform}
+Intel surprised us not long ago with the release of this rather advanced
+VM that uses GNU Classpath for a set of class libraries and works on
+Linux and Windows 2000.  As of June, 2004, it does not appear that ORP
+is under active development.
+
+ at item @uref{http://www.sablevm.org/,SableVM}
+SableVM is a robust, extremely portable, efficient, and
+specifications-compliant Java Virtual Machine that aims to be easy to
+maintain and to extend. It features a state-of-the-art, efficient
+interpreter engine. Its source code is very accessible and easy to
+understand, and has many robustness features that have been the object
+of careful design.
+
+ at item @uref{http://www.kaffe.org,Kaffe}
+Kaffe is an advanced VM and together with its own class libraries
+provides a Java 1.1 compatible environment.
+
+ at item @uref{http://www.mozilla.org/projects/ef,Electrical Fire}
+The Electrical File VM continues to be listed as a Mozilla project
+though development has been somewhat quiet.  A number of concepts from
+EF were expected at one point to be rolled into Japhar, but that
+development has not occurred as of yet.
+
+ at item @uref{http://latte.snu.ac.kr/,LaTTe}
+This VM project so far supports only Sun UltraSparc processors using the
+proprietary Solaris 2.5.1 or higher operating system.  LaTTe was derived
+from Kaffe but claims a number of improvements.
+
+ at item @uref{http://gcc.gnu.org/java/,GNU Compiler for Java (GCJ)}
+This is a portable, optimizing, ahead-of-time compiler for the Java
+Programming Language. It can compile Java source code directly to native
+machine code, Java source code to Java bytecode (class files), and Java
+bytecode to native machine code. Compiled applications are linked with the
+GCJ runtime, libgcj which is based on the GNU Classpath code, which provides
+the core class libraries, a garbage collector, and a bytecode interpreter.
+libgcj can dynamically load and interpret class files, resulting in mixed
+compiled/interpreted applications.
+GCJ is part of the GNU Compiler Collection (@uref{http://gcc.gnu.org/,GCC}).
+On March 6 2000 the libgcj and GNU Classpath projects were officially merged
+and there is active work on merging all the classes between the projects.
+Licensed under GPL+exception, just as GNU Classpath is.
+
+ at item @uref{http://kissme.sourceforge.net/,Kissme}
+This is a free Java Virtual Machine that is being developed on GNU/Linux
+and can run console Java applications.  Kissme also provides support for
+orthogonally persistent Java.
+ at c I don't know what ``orthogonally persistent Java'' is, and I bet
+ at c there are other people don't know either. -- Steve Augart, 4 June 2004
+
+ at item @uref{http://jamvm.sourceforge.net/,JamVM}
+A simple, small bytecode interpreter that works out-of-the-box with
+pure GNU Classpath; it is emerging as the preferred platform for
+quickly testing a new build of GNU Classpath.  Licensed under the GPL.
+
+ at item @uref{http://oss.software.ibm.com/jikesrvm,Jikes RVM}
+A free runtime environment for Java, written in Java.  Works
+out-of-the-box with pure GNU Classpath.  Features an optimizing JIT.
+Runs on the x86 and PowerPC architectures, on the AIX, Linux, and Mac
+OS/X operating systems.  Licensed under the CPL (Common Public
+License).  Extensively documented.  Actively developed as of June,
+2004.
+
+ at end itemize
+
+In the past integration efforts were focused mainly on Japhar with an eye
+towards getting Electrical Fire to work.  Most information contained in
+this document is gleaned from these efforts. Recently more work has been
+done on getting gcj, orp and kissme to work out of the box with GNU Classpath
+but there is much to do before that becomes a reality.
+
+
+ at node Initialization, Classpath Hooks, Introduction, Top
+ at comment node-name, next, previous, up
+ at chapter Initialization
+
+The order of initialization, as far as I can tell, doesn't matter just
+yet.  However, when we move to 1.2 support, it probably will matter, so
+we'll have a note in here at that time.
+
+The initialization order is currently documented in the
+ at file{Runtime.java} source file.
+
+ at node Classpath Hooks, VM Hooks, Initialization, Top
+ at comment node-name, next, previous, up
+ at chapter Classpath Hooks
+
+The primary method of interaction between Classpath and the VM is via
+the helper classes, which are named after the relevant core library
+class, but include an additional `VM' prefix.  The library classes from
+Classpath call out to these to get certain VM-specific dirty work done.
+A reference copy of each VM class exists.  The majority consist of a
+series of static methods, some of which are simply declared
+ at code{native}, and some which provide a default implementation.  VMs may
+either use these as is, or create their own local variations.  When
+using the default implementations, the VM is responsible for
+implementing any of the code marked as @code{native} which corresponds
+to functionality they wish their VM to provide.  When using their own
+versions of the classes, VM implementors may choose to change the mix of
+native and non-native methods from that below, so as to best suit their
+implementation.
+
+ at menu
+* java.lang::
+* gnu.classpath::
+* java.util::
+* java.io::
+* java.security::
+* java.net::
+* java.nio::
+* java.nio.channels::
+* gnu.java.nio::
+* java.lang.reflect::
+* gnu.java.lang::
+* gnu.java.lang.management::
+* java.lang.management::
+* Classpath Callbacks::
+ at end menu
+
+ at node java.lang, gnu.classpath, Classpath Hooks, Classpath Hooks
+ at comment  node-name,  next,  previous,  up
+
+ at section @code{java.lang}
+
+ at code{java.lang} is the core Java package, being imported automatically by all
+classes.  It includes basic classes as @code{Object} and @code{String}.
+A VM must implement at least some parts of this package in order to
+become operable.
+
+ at menu
+* java.lang.VMClass::
+* java.lang.VMObject::
+* java.lang.VMClassLoader::
+* java.lang.VMSystem::
+* java.lang.VMThrowable::
+* java.lang.VMCompiler::
+* java.lang.VMDouble::
+* java.lang.VMFloat::
+* java.lang.VMProcess::
+* java.lang.VMRuntime::
+* java.lang.VMString::
+* java.lang.VMThread::
+* java.lang.VMMath::
+ at end menu
+
+ at node java.lang.VMClass, java.lang.VMObject ,java.lang,java.lang
+ at subsection @code{java.lang.VMClass}
+
+The core class, @code{java.lang.Class}, and the corresponding VM class,
+ at code{java.lang.VMClass}, provide two main functions within GNU Classpath.
+
+ at enumerate
+ at item For basic VM operation, @code{java.lang.Class} provides the link between
+the Java-based representation of a class it embodies and the VM's own
+internal structure for a class.  @xref{VM Hooks}.
+
+ at item As far as the user is concerned, the main function of
+ at code{java.lang.Class} is as an entry point to the reflection
+facilities, and so it also provides this functionality, backed by the
+VM class.
+ at end enumerate
+
+This VM class lists the following methods, organized by the version of the
+Java specification in which they occur.  All are @code{native}, unless
+otherwise specified, and pertain to reflection.  As a result, the VM only
+needs to implement these methods in order to provide reflection support,
+and then only to the degree required.
+
+ at itemize @bullet
+ at item 1.0
+ at itemize @bullet
+ at item @code{isInterface(Class)} -- This is simply a property test, and matches
+the presence of an appropriate flag within the class file.
+ at item @code{getName(Class)} -- Returns the fully-qualified name of the class.
+ at item @code{getSuperclass(Class)} -- Returns a @code{Class} instance which
+represents the superclass.  Again, the class file contains an element directly
+relating to this.  @code{null} is returned for primitives, interfaces and
+ at code{Object}.
+ at item @code{getInterfaces(Class)} -- Same as the above, but the implemented
+or extended interfaces rather than the superclass.  An empty array should
+be returned, rather than @code{null}.
+ at item @code{getDeclaredClasses(Class,boolean)} -- Returns the internal classes
+this instance declares directly.  The flag determines whether or not the
+VM should filter out non-public classes.
+ at item @code{getDeclaredFields(Class,boolean)} -- The same for fields.
+ at item @code{getDeclaredMethods(Class,boolean)} -- And for methods.
+ at item @code{getDeclaredConstructors(Class,boolean)} -- And constructors.
+ at item @code{getClassLoader(Class)} -- Returns the @code{ClassLoader} instance
+which is responsible for the specified class.
+ at item @code{forName(String, boolean, ClassLoader)} -- The VM should create a
+ at code{Class} instance corresponding to the named class.  As noted in
+ at ref{VM Hooks}, the internal content of the instance is the
+responsibility of the VM.  The supplied class loader is recorded as that
+which loaded the class, and the boolean specifies whether or not to
+run the class initializer.
+ at item @code{isArray(Class)} -- Another property test, corresponding to a
+class file flag.
+ at item @code{initialize(Class)} -- The VM should initialize the class fully,
+if it has not already done so.
+ at item @code{loadArrayClass(String,ClassLoader)} -- This is called if
+ at code{forName} returns @code{null} and the string specifies an array class.
+The specified array class should be loaded with the supplied class loader.
+ at item @code{throwException(Throwable)} -- The VM should throw the supplied
+checked exception, without declaring it.
+ at end itemize
+ at item 1.1
+ at itemize @bullet
+ at item @code{isInstance(Class,Object)} -- This is a reflection-based equivalent
+of the @code{instanceof} operator.
+ at item @code{isAssignableFrom(Class,Class)} -- Mainly a shorthand for the above,
+removing the need to create an instance to test assignability.  
+ at item @code{isPrimitive(Class)} -- Returns true if this class is simply
+a representation of one of the primitive types: @code{boolean}, @code{byte},
+ at code{char}, @code{short}, @code{int}, @code{long}, @code{float},
+ at code{double} and @code{void}.
+ at item @code{getComponentType(Class)} -- Produces a @code{Class} instance which
+represents the type of the members of the array the class instance represents.
+Classes which don't represent an array type return @code{null}.
+ at item @code{getModifiers(Class,boolean)} -- Returns an integer which encodes
+the class' modifiers, such as @code{public}.  Again, this relates to
+information stored in the class file.
+ at item @code{getDeclaringClass(Class)} -- Returns the class that declared
+an inner or member class, or @code{null} if the instance refers to a top-level
+class.
+ at end itemize
+ at item 1.5
+ at itemize @bullet
+ at item @code{isSynthetic(Class)} -- Returns true if the flags for this class
+mark it as synthetic.
+ at item @code{isAnnotation(Class)} -- Returns true if the flags for this class
+mark it as an annotation.
+ at item @code{isEnum(Class)} -- Returns true if the flags for this class
+mark it as an enumeration.
+ at item @code{getSimpleName(Class)} -- Returns the simple name of the class.
+A default implementation is provided, but a more efficient version may instead
+be provided by the VM.
+ at item @code{getCanonicalName(Class)} -- Returns the canonical name of the
+class.  A default implementation is provided, but a more efficient
+version may instead be provided by the VM.
+ at item @code{getEnclosingClass(Class)} -- Returns the immediately enclosing
+class (null for a top-level class).
+ at item @code{getEnclosingConstructor(Class)} -- Returns the constructor
+which immediately encloses the supplied class.
+ at item @code{getEnclosingMethod(Class)} -- Returns the method
+which immediately encloses the supplied class.
+ at item @code{getClassSignature(Class)} -- Returns the generic signature of
+the class or null if there isn't one.
+ at item @code{isAnonymousClass(Class)} -- Returns true if the class is an
+anonymous class.
+ at item @code{isLocalClass(Class)} -- Returns true if the class is an
+local class.
+ at item @code{isMemberClass(Class)} -- Returns true if the class is an
+member class.
+ at end itemize
+ at end itemize
+
+ at node java.lang.VMObject, java.lang.VMClassLoader, java.lang.VMClass, java.lang
+ at subsection @code{java.lang.VMObject}
+
+ at code{VMObject} is the bridge between the low level @code{Object}
+facilities such as making a clone, getting the class of the object and
+the wait/notify semantics.  This is accomplished using the following
+ at code{native} methods.
+
+ at itemize @bullet
+ at item @code{getClass(Object)} -- Returns the @code{Class} instance for the
+object.  @code{Class} objects are produced by the VM, as described in
+ at ref{VM Hooks}.
+ at item @code{clone(Cloneable)} -- The VM should produce a low-level clone of the
+specified object, creating a field-by-field shallow copy of the original.
+The only difference between the two is that the new object should still be
+ at code{finalizable}, even if the original is not.
+ at item @code{notify(Object)} -- The VM should choose one of the threads waiting
+for a lock on the specified object arbitrarily, and wake it.  If the current
+thread does not currently hold the lock on the object, then an
+ at code{IllegalMonitorStateException} should be thrown.
+ at item @code{notifyAll(Object)} -- Same as the above, but all threads are
+awakened.
+ at item @code{wait(Object,long,int)} -- The VM should set the current thread
+into a waiting state, which persists until it receives a notify signal or the
+specified time (in milliseconds and nanoseconds) is exceeded.  The nanoseconds
+restriction may be ignored if such granularity is not available, and a
+ at code{IllegalMonitorStateException} should be thrown if the current thread
+doesn't own the object.
+ at end itemize
+
+ at node java.lang.VMClassLoader, java.lang.VMSystem, java.lang.VMObject, java.lang
+ at subsection @code{java.lang.VMClassLoader}
+ at code{VMClassLoader} provides methods for defining and resolving core and
+primitive classes, as well as handling resources, packages and assertions.
+The class is a mixture of @code{native} methods and Java-based
+implementations, with some of the latter being @emph{stubs}.
+
+ at itemize @bullet
+ at item Native Methods
+ at itemize @bullet
+ at item @code{defineClass(ClassLoader,String,byte[],int,int,ProtectionDomain)}
+-- The VM should create a @code{Class} instance from the supplied byte array.
+ at item @code{resolveClass(Class)} -- Resolve references to other classes in the
+supplied class.
+ at item @code{loadClass(name,boolean)} -- Load a class using the bootstrap
+loader.
+ at item @code{getPrimitiveClass(char)} -- The VM should provide a @code{Class}
+implementation for one of the primitive classes.  The supplied character
+matches the JNI code for the primitive class e.g. `B' for byte and
+`Z' for boolean.
+ at end itemize
+ at item Java Methods
+ at itemize @bullet
+ at item @code{getResource(String)} -- The default implementation calls
+ at code{getResources} and returns the first element in the returned enumeration,
+or @code{null} if there are no elements.
+ at item @code{getResources(String)} -- By default, this compiles a list of
+URLs via the boot class path.  Any matching files within a zip file are added,
+and directories on the boot class path are automatically converted to file
+URLs that refer to join the directory with the resource name (whether or not
+it actually exists).
+ at item @code{getPackage(String)} -- Always returns null, which may be suitable
+if the VM does not wish to return a @code{Package} implementation. Otherwise,
+it may be necessary to make this a @code{native} method.
+ at item @code{getPackages()} -- As with the last, a default stub implementation
+exists (returning an empty array) which may be replaced if support is
+required. 
+ at item @code{defaultAssertionStatus()} -- A stub which can be implemented
+by VMs providing assertion support.  At present, it always returns @code{true}.
+ at item @code{packageAssertionStatus()} -- Much the same status as the above.
+The method should return a map converting package names to boolean status
+values.  The stub implementation provides an empty map.
+ at item @code{classAssertionStatus()} -- Same as the last, but for classes.
+ at item @code{getSystemClassLoader()} -- The default calls @code{ClassLoader}
+to create a new auxillary class loader with a system and extension class
+loader.  The VM may wish to replace it if it wishes to supply its own custom
+system class loader.
+ at end itemize
+ at end itemize
+ at node java.lang.VMSystem, java.lang.VMThrowable, java.lang.VMClassLoader, java.lang
+ at subsection @code{java.lang.VMSystem}
+ at code{VMSystem} handles the default I/O streams, provides access to the
+system clock and environment variables and provides methods for
+ at code{System.arraycopy} and the @code{identityHashCode} of an
+ at code{Object}.  It consists of @code{native} methods, but the default
+implementation also provides some helper methods to simplify stream
+creation.  
+
+ at itemize @bullet
+ at item Native Methods
+ at itemize @bullet
+ at item @code{arraycopy(Object,int,Object,int,int)} -- The VM should copy
+a specified number of array objects from one array to another, with 
+appropriate checks for compatible typing, available elements and space.
+The VM should be able to perform this more efficiently using native code
+and direct memory manipulation than would have been achieved by using Java.
+ at item @code{identityHashCode(Object)} -- This is the hashcode for
+ at code{Object}, which relates to the actual location of the object in memory.
+ at item @code{setIn(InputStream)} -- Set the system input stream.
+ at item @code{setOut(PrintStream)} -- Set the system output stream.
+ at item @code{setErr(PrintStream)} -- Set the system error stream.
+ at item @code{currentTimeMillis()} -- Gets the system time in milliseconds.
+ at item @code{getenv(String)} -- Returns the value of the specified environment
+variable.
+ at item @code{getenv()} -- Returns a list of `name=value' pairs which correspond
+to the environment variables.
+ at end itemize
+ at item Java Methods
+ at itemize @bullet
+ at item @code{makeStandardInputStream()} -- Helps provide the functionality of
+ at code{System.in} by wrapping the appropriate file descriptor in a
+buffered file input stream.  VMs may choose to create the stream from
+the descriptor differently rather than using this method.
+ at item @code{makeStandardOutputStream()} -- Helps provide the functionality of
+ at code{System.out} by wrapping the appropriate file descriptor in a buffered
+file output stream.  VMs may choose to create the stream from the descriptor
+differently rather than using this method.
+ at item @code{makeStandardErrorStream()} -- Helps provide the functionality of
+ at code{System.err} by wrapping the appropriate file descriptor in a buffered
+file output stream.  VMs may choose to create the stream from the descriptor
+differently rather than using this method.
+ at end itemize
+ at end itemize
+
+Classpath also provides native implementations of
+
+ at itemize @bullet
+ at item @code{setIn(InputStream)} 
+ at item @code{setOut(PrintStream)} 
+ at item @code{setErr(PrintStream)} 
+ at item @code{currentTimeMillis()} 
+ at item @code{getenv(String)}
+ at end itemize
+
+making a VM implementation optional.
+
+ at node java.lang.VMThrowable, java.lang.VMCompiler, java.lang.VMSystem, java.lang
+ at subsection @code{java.lang.VMThrowable}
+ at code{VMThrowable} is used to hold the VM state of a throwable, created either
+when a @code{Throwable} is created or the @code{fillInStackTrace()} method is
+called (i.e. when the actual stack trace is needed, as a lot of exceptions are
+never actually used).  The actual class has two @code{native} methods,
+one (@code{fillInStackTrace()}) being a method of the class used to obtain
+instances, and the other an instance method, @code{getStackTrace()}.
+ at itemize @bullet
+ at item @code{fillInStackTrace(Throwable)} -- The VM should return the current
+execution state of the @code{Throwable} in the form of a @code{VMThrowable}
+instance.  The VM may also return @code{null} if it does not support this
+functionality.
+ at item @code{getStackTrace()} -- This is used to create a real
+ at code{StackTraceElement} array for the exception, using the state data
+stored during creation of the instance.
+ at end itemize
+
+ at node java.lang.VMCompiler, java.lang.VMDouble, java.lang.VMThrowable, java.lang
+ at subsection @code{java.lang.VMCompiler}
+
+ at code{VMCompiler} provides an interface for VMs which wish to provide
+JIT compilation support.  The default implementation is simply a series
+of stubs. The property, @code{java.compiler}, should point to a library
+containing the function @code{java_lang_Compiler_start()} if such support
+is to be provided.
+
+ at itemize @bullet
+ at item @code{compileClass(Class)} -- Invoke the compiler to compile the specific
+class, returning @code{true} if successful.
+ at item @code{compileClasses(String)} -- The compiler should compile the classes
+matching the specified string, again returning @code{true} on success.
+ at item @code{command(Object)} -- The object represents a command given to the
+compiler, and is specific to the compiler implementation.
+ at item @code{enable} -- Enable the operation of the compiler.
+ at item @code{disable} -- Disable compiler operation.
+ at end itemize
+
+ at node java.lang.VMDouble, java.lang.VMFloat, java.lang.VMCompiler, java.lang
+ at subsection @code{java.lang.VMDouble}
+
+ at code{VMDouble} provides native support for the conversion and parsing
+of doubles.
+
+ at itemize @bullet
+ at item @code{doubleToLongBits(double)} -- Converts the double to the IEEE 754
+bit layout, collapsing NaNs to @code{0x7ff8000000000000L}.
+ at item @code{doubleToRawLongBits(double)} -- Same as the above, but preserves
+NaNs.
+ at item @code{longBitsToDouble(long)} -- This is the inverse of the last method,
+preserving NaNs so that the output of one can be fed into the other without
+data loss.
+ at item @code{toString(double,boolean)} -- Converts the double to a string,
+giving a shorter value if the flag @code{isFloat} is @code{true}, indicating
+that the conversion was requested by @code{java.lang.Float} rather than
+ at code{java.lang.Double}.
+ at item @code{initIDs} -- Used by JNI-based solutions to initialize the cache
+of the static field IDs.  The default @code{VMDouble} implementation has a
+static initializer which loads the JNI library and calls this method.
+ at item @code{parseDouble} -- Turn the string into a usable double value.
+ at end itemize
+
+Classpath provides native implementations of all these, making VM
+implementation optional.
+
+ at node java.lang.VMFloat, java.lang.VMProcess, java.lang.VMDouble, java.lang
+ at subsection @code{java.lang.VMFloat}
+
+ at code{VMFloat} provides native support for the conversion of floats.
+
+ at itemize @bullet
+ at item @code{floatToIntBits(float)} -- Converts the float to the IEEE 754
+bit layout, collapsing NaNs to @code{0x7fc00000}.
+ at item @code{floatToRawIntBits(float)} -- Same as the above, but preserves
+NaNs.
+ at item @code{intBitsToFloat(int)} -- This is the inverse of the last method,
+preserving NaNs so that the output of one can be fed into the other without
+data loss.
+ at end itemize
+
+Classpath provides native implementations of all these, making VM
+implementation optional.
+
+ at node java.lang.VMProcess, java.lang.VMRuntime, java.lang.VMFloat, java.lang
+ at subsection @code{java.lang.VMProcess}
+
+ at code{VMProcess} handles the execution of external processes.  In the
+default implementation, threads are spawned and reaped by @code{ProcessThread}.
+A constructor creates a new @code{VMProcess}, which extends rather than
+complements @code{Process}, using an array of arguments, an array of
+environment variables and a working directory.  The instance maintains
+system input, output and error streams linked to the external process.
+Three @code{native} methods are used, and implementations are provided
+for all three by Classpath, making VM implementation optional.  These use
+the POSIX functions, @code{fork()}, @code{waitpid()} and @code{kill()}.
+
+ at itemize @bullet
+ at item @code{nativeSpawn(String[],String[],File,boolean)} -- The VM should
+create a new process which uses the specified command-line arguments,
+environment variables and working directory.  Unlike the other two
+methods, this method is linked to an instance, and must call
+ at code{setProcessInfo()} with the results before returning.  The
+boolean argument maps to the @code{redirectErrorStream} property of
+ at code{java.lang.ProcessBuilder}.  When true, the output and error streams
+are merged.
+ at item @code{nativeReap()} -- This is called to perform a reap of any
+zombie processes, and should not block, instead returning a boolean as to
+whether reaping actually took place.
+ at item @code{nativeKill(long)} -- The VM should terminate the specified PID.
+ at end itemize
+
+ at node java.lang.VMRuntime, java.lang.VMString, java.lang.VMProcess, java.lang
+ at subsection @code{java.lang.VMRuntime}
+
+The @code{VMRuntime} class provides a series of native methods
+which divulge information about the runtime or invoke certain
+operations.  This includes retrieving the amount of available memory,
+and scheduling the garbage collector.  There are two exceptions: the
+ at code{enableShutdownHooks} method, which allows the VM to put in its own
+shutdown hooks when @code{Runtime.addShutdownHook()} is first invoked,
+and @code{exec(String[],String[],File)} which spawns an external process.
+These are Java-based static methods instead.  The first is simply a stub by
+default, while the second simply links to the functionality of
+ at code{VMProcess} (and should be changed if a different @code{Process}
+implementation is used).
+
+ at itemize @bullet
+ at item @code{availableProcessors()} -- Returns the number of processors 
+available to the VM.
+ at item @code{freeMemory()} -- Returns the amount of memory the VM has available
+on the heap for allocating.
+ at item @code{totalMemory()} -- Returns the size of the heap.
+ at item @code{maxMemory()} -- Returns the maximum memory block the VM will
+attempt to allocate.  May be simply @code{Long.MAX_VALUE} (8 exabytes!)
+ at item @code{gc()} -- Allows users to explicitly invoke the garbage collector.
+This is a suggestion to the VM, rather than a command, and the garbage
+collector should run anyway @emph{without} it being invoked.
+ at item @code{runFinalization()} -- Like the above, but related to the
+finalilzation of objects rather than the garbage collector.
+ at item @code{runFinalizationForExit()} -- Called immediately prior to VM
+shutdown in order to finalize all objects (including `live' ones)
+ at item @code{traceInstructions(boolean)} -- This turns on and off the optional
+VM functionality of printing a trace of executed bytecode instructions.
+ at item @code{traceMethodCalls(boolean)} -- This turns on and off the optional
+VM functionality of printing a trace of methods called.
+ at item @code{runFinalizersOnExit(boolean)} -- A toggleable setting for
+running the finalization process at exit.
+ at item @code{exit(int)} -- The VM should shutdown with the specified exit code.
+ at item @code{nativeLoad(String,ClassLoader)} -- Attempts to load a file,
+returning an integer which is non-zero for success.  Nothing happens if the
+file has already been loaded.
+ at item @code{mapLibraryName(String)} -- The VM should map the system-independent
+library name supplied to the platform-dependent equivalent (e.g. a @code{.so}
+or @code{.dll} file)
+ at end itemize
+
+ at node java.lang.VMString, java.lang.VMThread, java.lang.VMRuntime, java.lang
+ at subsection @code{java.lang.VMString}
+ at code{VMString} is responsible for handling interned strings.  If two strings
+are equal (using the @code{equals()} method), then the results of calling
+the @code{intern()} method on each of them makes them equal
+(using @code{==}).  Thus, the same string object is always returned by
+ at code{intern} if the two strings are equal.  The default implementation
+is Java-based and implements @code{intern(String)} by maintaining a
+ at code{WeakHashMap} which links the strings to their @code{WeakReference}.
+A new mapping is created for each new string being @code{intern}ed.  
+A VM may implement this differently by implementing this method,
+which is @code{static} and the only one in @code{VMString}.
+
+ at node java.lang.VMThread, java.lang.VMMath, java.lang.VMString, java.lang
+ at subsection @code{java.lang.VMThread}
+
+ at code{VMThread} provides the link between Java's threads and the platform
+threading support.  A @code{VMThread} is created via a private constructor
+and linked to a @code{Thread} instance.  This occurs when the @code{Thread}
+instance is started by the static @code{create(Thread,long)} method (the second
+argument requests a certain stack size, usually zero).  The thread itself is
+executed via the @code{run()} method, which handles any problems with the
+running of the thread and its eventual death.
+
+ at code{VMThread} provides the following accessors and mutators for accessing
+the thread state via @code{VMThread},
+
+ at itemize @bullet
+ at item @code{getName()}
+ at item @code{setName(String)}
+ at item @code{getPriority()}
+ at item @code{setPriotity(int)}
+ at item @code{isDaemon()}
+ at end itemize
+
+all of which refer to the @code{Thread} instance. @code{setPriority(int)} also
+calls the appropriate native method.  @code{stop(Throwable)} similarly wraps
+a native method, merely adding in a check for the state of the thread.
+
+The default implementation also provides Java-based implementations of
+ at code{join(long,int)}, @code{sleep(long,int)} and
+ at code{holdsLock(Object)}.  @code{join} and @code{sleep} simply wait for
+the appropriate amount of time, with @code{join} additionally waiting
+for the thread instance to become @code{null}.  @code{holdsLock} simply
+checks if an object is locked by the current thread by trying to invoke
+the @code{notify} method, and catching the failing exception if this is
+not the case.
+
+The remainder of the class is a series of @code{native} methods, some of
+which are mandatory for VM implementation and others which provide optional
+or deprecated functionality.
+
+ at itemize @bullet
+ at item Mandatory Instance Methods
+ at itemize @bullet
+ at item @code{start(long)} -- The VM should create the native thread and start
+it running using the @code{run} method of the @code{VMThread} instance on
+which this method is called.
+ at item @code{interrupt()} -- The VM should interrupt the running thread and
+throw an appropriate exception.
+ at item @code{isInterrupted()} -- Checks the interrupted state of the thread.
+ at item @code{suspend()} -- The thread should be suspended until resumed.
+ at item @code{resume()} -- The thread should be resumed from its suspended state.
+This pair of methods are deprecated, due to the possibility of a deadlock
+occuring when a thread with locks is suspended.
+ at item @code{nativeSetPriority(int)} -- Called by @code{setPriority}
+to allow the setting to flow down to the native thread.
+ at item @code{nativeStop(Throwable)} -- The VM should stop the thread abnormally
+and throw the specified exception.  This is clearly deprecated, due to the
+ambiguous state an abruptly-stopped thread may leave.
+ at item @code{getState()} -- Returns the VM's impression of the current state
+of the thread.  The applicable states are supplied by the @code{State}
+enumeration in @code{java.lang.Thread}.
+ at end itemize
+ at item Mandatory Class Methods
+ at itemize @bullet
+ at item @code{currentThread()} -- Return a reference to the thread currently
+being executed.
+ at item @code{yield()} -- The VM should allow some other thread to run.
+The current thread maintains its locks even though it stops executing for
+the time being.
+ at item @code{interrupted()} -- A shortcut to obtaining the interrupted state
+of the current thread.
+ at end itemize
+ at item Other Methods
+ at itemize @bullet
+ at item @code{countStackFrames()} -- Returns a count of the number of stack
+frames in the thread.  This depends on the deprecated method @code{suspend()}
+having returned true, and is thus deprecated as a result.
+ at end itemize
+ at end itemize
+
+ at node java.lang.VMMath,, java.lang.VMThread, java.lang
+ at subsection @code{java.lang.VMMath}
+
+The @code{VMMath} class provides a series of native methods
+for some of the mathematical functions present in @code{java.lang.Math}.
+Classpath provides a default implementation of these which maps the
+functions to those provided by @code{fdlibm}.  VM implementors are welcome
+to replace this with more efficent implementations, as long as the accuracy
+contract of these methods, specified in @code{java.lang.Math}, is maintained.
+
+ at itemize @bullet
+ at item 1.0
+ at itemize @bullet
+ at item @code{sin(double)} -- Returns the sine value for the given angle.
+ at item @code{cos(double)} -- Returns the cosine value for the given angle.
+ at item @code{tan(double)} -- Returns the tangent value for the given angle.
+ at item @code{asin(double)} -- Returns the arc sine value for the given angle.
+ at item @code{acos(double)} -- Returns the arc cosine value for the given angle.
+ at item @code{atan(double)} -- Returns the arc tangent value for the given angle.
+ at item @code{atan2(double,double)} -- Returns the arc tangent of the ratio of
+the two arguments.
+ at item @code{exp(double)} -- Returns the exponent raised to the given power.
+ at item @code{log(double)} -- Returns the natural logarithm for the given value.
+ at item @code{sqrt(double)} -- Returns the square root of the value.
+ at item @code{pow(double,double)} -- Returns x to the power of y.
+ at item @code{IEEEremainder(double,double)} -- Returns the IEEE 754 remainder
+for the two values.
+ at item @code{ceil(double)} -- Returns the nearest integer >= the value.
+ at item @code{floor(double)} -- Returns the nearest integer <= the value.
+ at item @code{rint(double)} -- Returns the nearest integer or the even one
+if the distance between the two is equal.
+ at end itemize
+ at item 1.5
+ at itemize @bullet
+ at item @code{cbrt(double)} -- Returns the cube root of the value.
+ at item @code{cosh(double)} -- Returns the hyperbolic cosine value for the given
+angle.
+ at item @code{expm1(double)} -- Returns the exponent of the value minus one.
+ at item @code{hypot(double,double)} -- Returns the hypotenuse corresponding to
+x and y.
+ at item @code{log10(double)} -- Returns the base 10 logarithm of the given value.
+ at item @code{log1p(double)} -- Returns the natural logarithm of the value plus
+one.
+ at item @code{sinh(double)} -- Returns the hyperbolic sine value for the given
+angle.
+ at item @code{tanh(double)} -- Returns the hyperbolic tangent value for the given angle.
+ at end itemize
+ at end itemize
+
+ at node gnu.classpath, java.util, java.lang, Classpath Hooks
+ at section @code{gnu.classpath}
+
+The @code{gnu.classpath} package provides Classpath-specific functionality,
+primarily relating to the features in @code{java.lang}.  At present, this
+includes the context of a class (the stack) and the system properties.
+
+ at menu
+* gnu.classpath.VMStackWalker::
+* gnu.classpath.VMSystemProperties::
+* gnu.classpath.Unsafe::
+ at end menu
+
+ at node gnu.classpath.VMStackWalker,gnu.classpath.VMSystemProperties,gnu.classpath,gnu.classpath
+ at subsection @code{gnu.classpath.VMStackWalker}
+
+ at code{VMStackWalker} provides access to the class context or stack.  The
+default implementation consists of a @code{native} @code{static} method,
+ at code{getClassContext()}, which obtains the class context, and two helper
+methods which obtain the calling class (the 3rd element in the context array)
+and its class loader, respectively.
+
+ at itemize @bullet
+ at item @code{getClassContext()} -- The VM should return an array of
+ at code{Class} objects, each of which relates to the method currently being
+executed at that point on the stack.  Thus, the first item (index 0) is the
+class that contains this method.
+ at item @code{getCallingClass()} -- A Java-based helper method which returns
+the @code{Class} object which contains the method that called the method
+accessing @code{getCallingClass()}. 
+ at item @code{getCallingClassLoader()} -- Like the last, but returning the class
+loader of the class.
+ at end itemize
+
+ at node gnu.classpath.VMSystemProperties,gnu.classpath.Unsafe,gnu.classpath.VMStackWalker,gnu.classpath
+ at subsection @code{gnu.classpath.VMSystemProperties}
+
+ at code{VMSystemProperties} allows the VM to hook into the property creation
+process, both before and after the system properties are added by GNU
+Classpath.  The default implementation assumes that the VM will add its
+properties first, by making the pre-initialisation method @code{native},
+and that the Classpath properties may then be altered by a Java-based
+post-initialisation method.
+
+As these methods are called as part of the bootstrap process, caution should
+be used as to what classes are used, and properties should only be set
+using @code{Properties.setProperty()}.  Specifically, I/O classes should be
+avoided at this early stage.
+
+ at itemize @bullet
+ at item @code{preInit(Properties)} -- Allows the VM to add properties
+ at emph{before} the Classpath properties are added. The default implementation
+includes a full list of properties that @emph{must} be added by the VM, but
+additional VM-specific ones may also be added.  
+ at item @code{postInit(Properties)} -- Same as the last, but called after the
+Classpath properties have been added.  The main purpose of this is to allow
+the VM to alter the properties added by GNU Classpath to suit it.
+ at end itemize
+
+ at node gnu.classpath.Unsafe,,gnu.classpath.VMSystemProperties,gnu.classpath
+ at subsection @code{gnu.classpath.Unsafe}
+
+The @code{Unsafe} class provides access to some low-level unsafe operations
+as required by the addition of the java.util.concurrent classes.  These
+focus on direct memory access to the fields within the VM and providing
+atomic update methods.
+
+ at itemize @bullet
+ at item @code{objectFieldOffset(Field)} -- Provides the caller with the memory
+offset of a particular field.
+ at item @code{compareAndSwap*(Object,long,*,*)} -- One of these methods is
+provided for each of int, long and Object (hence the *s).  The value of
+a field pointed to by the given Object and offset is compared with the
+first value and replaced with the second if they are the same.  The reason
+for this method is to make this change operation atomic.
+ at item @code{put/get*(Object,long,*)} -- These are like the last set of
+methods, handling integers, longs and Objects, but the field is always
+changed on a put.  Different methods are provided for different semantics.
+Ordered variants perform a lazy put, in that the change does not
+immediately propogate to other threads, while the others provide
+volatile or 'normal' semantics.
+ at item @code{arrayBaseOffset(Class)} and @code{arrayIndexScale(Class)} --
+These two methods allow an array class to be traversed by pointer
+arithmetic, by gaining the address of the first element and then
+scaling appropriately for the later ones.
+ at item @code{park(boolean,long)} and @code{unpark(Thread)} -- These methods
+block and unblock threads respectively, with an optional timeout being
+provided for the blocking.  @code{unpark} is unsafe as the thread may have
+been destroyed by native code. 
+ at end itemize
+
+ at node java.util, java.io, gnu.classpath, Classpath Hooks
+ at section java.util
+
+The @code{java.util} VM hooks provide links between the mix of functionality
+present in that package, which includes collections, date and time handling
+and parsing.  At present, there is only one hook, which connects GNU Classpath
+to the timezone information provided by the underlying platform.
+
+ at menu
+* java.util.VMTimeZone::
+ at end menu
+
+ at node java.util.VMTimeZone,,java.util,java.util
+ at subsection @code{java.util.VMTimeZone}
+
+ at code{VMTimeZone} joins @code{TimeZone} to the platform timezone information
+via the static method, @code{getDefaultTimeZoneId()}.  The VM hook is
+expected to return a @code{TimeZone} instance that represents the current
+timezone in use by the platform.  The default implementation provides
+this functionality for POSIX or GNU-like systems, and VMs that want this
+functionality can keep this implementation and implement the native
+method, @code{getSystemTimeZoneId()}.  This method is only called when
+obtaining the timezone name from the @code{TZ} environment variable,
+ at code{/etc/timezone} and @code{/etc/localtime} all fail.  This fallback
+mechanism also means that a system which doesn't provide the above three
+methods, but does provide a timezone in string form, can still use this
+implementation.
+
+ at node java.io, java.security, java.util, Classpath Hooks
+ at section java.io
+
+The @code{java.io} package is heavily reliant on access to the I/O facilities
+of the underlying platform.  As far as its VM hooks go, they provide two
+areas of functionality to GNU Classpath, these being
+
+ at itemize @bullet
+ at item File and directory queries and manipulation
+ at item Serialization of objects
+ at end itemize
+
+The first corresponds directly to most of the @code{File} class, while
+the latter underlies the functionality provided by the
+ at code{ObjectInputStream} and @code{ObjectOutputStream}.  More low-level I/O
+is provided by @ref{java.nio}.
+
+ at menu
+* java.io.VMFile::
+* java.io.VMObjectInputStream::
+* java.io.VMObjectStreamClass::
+ at end menu
+
+ at node java.io.VMFile,java.io.VMObjectInputStream,java.io,java.io
+ at subsection @code{java.io.VMFile}
+
+ at code{VMFile} allows GNU Classpath's @code{File} representations to
+probe and modify the file system using the native functions of the
+platform.  The default implementation (which consists of both a
+ at code{VMFile} class and the native methods) is primarily UNIX-centric,
+working with POSIX functions and assuming case-sensitive filenames,
+without the restriction of the 8.3 format.  It consists mainly of
+ at code{static} @code{native} methods, with a few Java helper methods.
+The native methods represent the file as a string containing its path,
+rather than using the object itself.
+
+ at itemize @bullet
+ at item Native Methods
+ at itemize @bullet
+ at item @code{lastModified(String)} -- The native method should return a
+ at code{long} value that represents the last modified date of the file.
+ at item @code{setReadOnly(String)} -- Sets the file's permissions to read only,
+in whichever way this is realised by the platform.
+ at item @code{create(String)} -- Create the named file.
+ at item @code{list(String)} -- The native method opens the named directory,
+reads the contents and returns them as a Java @code{String} array.
+ at item @code{renameTo(String,String)} -- Renames the first file to the second.
+ at item @code{length(String)} -- Returns a @code{long} value representing
+the file size.
+ at item @code{exists(String)} -- Tests for the existence of the named file
+or directory.
+ at item @code{delete(String)} -- Deletes the file or directory.
+ at item @code{setLastModified(String,long)} -- Change the last modified time.
+ at item @code{mkdir(String)} -- Creates the named directory.
+ at item @code{isFile(String)} -- Tests that the named path references a file.
+ at item @code{canWrite(String)} -- Tests that the file can be written to.
+This method is @code{synchronized}, so the object is locked during the check.
+ at item @code{canRead(String)} -- Complement of the last method.
+ at item @code{isDirectory(String)} -- Tests that the named path references
+a directory.
+ at end itemize
+ at item Java Helper Methods
+ at itemize @bullet
+ at item @code{canWriteDirectory(File)} -- Checks that the directory can be
+written to, by trying to create a temporary file in it.
+ at item @code{listRoots()} -- Returns the root of a GNU filesystem i.e. `/'
+in an array.
+ at item @code{isHidden(String)} -- Checks whether the file starts with `.',
+which is how files are hidden on UNIX-style systems.
+ at item @code{getName(String)} -- Pulls the actual filename from the end of
+the path, by breaking off the characters after the last occurrence of the
+platform's file separator.
+ at item @code{getCanonicalForm(String)} -- This converts a UNIX path to
+its canonical form by removing the `.' and `..' sections that occur within.
+ at end itemize
+ at end itemize
+
+ at node java.io.VMObjectInputStream,java.io.VMObjectStreamClass,java.io.VMFile,java.io
+ at subsection @code{java.io.VMObjectInputStream}
+
+This class consists of two methods which provide functionality used in
+deserializing an object.  @code{currentClassLoader()} provides the first
+user-defined class loader from the class context
+(@xref{gnu.classpath.VMStackWalker},) via a @code{PrivilegedAction}.
+ at code{allocateObject(Class,Class,Constructor)} is a @code{native} method
+(a reference implementation is provided) which creates an object but
+calls the constructor of another class, which is a superclass of the
+object's class.
+
+ at node java.io.VMObjectStreamClass,,java.io.VMObjectInputStream,java.io
+ at subsection @code{java.io.VMObjectStreamClass}
+
+ at code{VMObjectStreamClass} is a series of @code{static} @code{native}
+methods that provide some of the groundwork for @code{ObjectStreamClass}
+and @code{ObjectStreamField}.  @code{hasClassInitializer(Class)} works
+with the former, and checks for the presence of a static initializer.
+The remaining methods are of the form @code{setXXXNative(Field,Object,XXX)}
+and support @code{ObjectStreamField}.  One exists for each of the main types
+(boolean, float, double, long, int, short, char, byte and object) and is used
+to set the specified field in the supplied instance to the given value.
+
+A default implementation is provided for all of them, so a VM implementation
+is optional.
+
+ at node java.security, java.net, java.io, Classpath Hooks
+ at section java.security
+
+The @code{java.security} package provides support for Java's security
+architecture.  
+
+ at menu
+* java.security.VMAccessController::
+* java.security.VMSecureRandom::
+ at end menu
+
+ at node java.security.VMAccessController,java.security.VMSecureRandom,java.security,java.security
+ at subsection @code{java.security.VMAccessController}
+
+The @code{AccessController} is used to perform privileged actions.  Its
+hook class, @code{VMAccessController}, maintains the
+ at code{AccessControlContext} and the default implementation is purely
+Java-based.  The VM may choose to replace this with their own.
+The methods in the reference version are as follows:
+
+ at itemize @bullet
+ at item @code{pushContext(AccessControlContext)} -- Adds a new context to the
+stack for the current thread.  This is called before a privileged action
+takes place.
+ at item @code{popContext()} -- Removes the top context from the stack.  This
+is performed after the privileged action takes place.
+ at item @code{getContext()} -- Either derives a context based on the 
+ at code{ProtectionDomain}s of the call stack (see the next method) or returns
+the top of the context stack.
+ at item @code{getStack()} -- Provides access to the call stack as a pair of
+arrays of classes and method names.  The actual implementation returns
+an empty array, indicating that there are no permissions.
+ at end itemize
+
+ at node java.security.VMSecureRandom,,java.security.VMAccessController,java.security
+ at subsection @code{java.security.VMSecureRandom}
+
+The @code{VMSecureRandom} class is used to provide access to
+cryptographically secure random numbers.  The default implementation
+of the class runs eight threads that increment counters in a tight
+loop, and XORs each counter to produce one byte of seed data. This is
+not very efficient, and is not guaranteed to be random (the thread
+scheduler is probably deterministic, after all). VM implementors
+should provide a version of this class, which implements the method
+ at code{generateSeed(byte[],int,int)}, so that it fills the buffer using
+a random seed from a system facility, such as a system entropy
+gathering device or hardware random number generator.  The parameters
+are the usual set of buffer, offset and length and the method returns
+the number of bytes actually generated, which may be less than that
+requested.
+
+ at node java.net, java.nio, java.security, Classpath Hooks
+ at section java.net
+
+The @code{java.net} package is heavily reliant on access to the networking
+facilities of the underlying platform.  The VM hooks provide information
+about the available network interfaces, and access to lookup facilities
+for network addresses.
+
+ at menu
+* java.net.VMInetAddress::
+* java.net.VMNetworkInterface::
+ at end menu
+
+ at node java.net.VMInetAddress,java.net.VMNetworkInterface,java.net,java.net
+ at subsection @code{java.net.VMInetAddress}
+
+ at code{VMInetAddress} is a series of @code{static} @code{native} methods
+which provide access to the platform's lookup facilities.  All the methods
+are implemented by GNU Classpath, making VM implementation optional, and
+are as follows:
+
+ at itemize @bullet
+ at item @code{getLocalHostname()} -- Wraps the @code{gethostname} function, and
+falls back on `localhost'.
+ at item @code{lookupInaddrAny()} -- Returns the value of @code{INADDR_ANY}.
+ at item @code{getHostByAddr(byte[])} -- Looks up the hostname based on an IP
+address.
+ at item @code{getHostByName(String)} -- The reverse of the last method, it
+returns the IP addresses which the given host name resolves to.
+ at end itemize
+
+ at node java.net.VMNetworkInterface,,java.net.VMInetAddress,java.net
+ at subsection @code{java.net.VMNetworkInterface}
+
+ at code{VMNetworkInterface} currently consists of a single @code{static}
+ at code{native} method, @code{getInterfaces()}, which retrieves the
+network interfaces available on the underlying platform as a @code{Vector}.
+The current GNU Classpath implementation is a native stub.
+
+ at node java.nio, java.nio.channels, java.net, Classpath Hooks
+ at section java.nio
+
+The @code{java.nio} package is part of the New I/O framework added in
+Java 1.4.  This splits I/O into the concepts of @emph{buffers},
+ at emph{charsets}, @emph{channels} and @emph{selectors}, and
+ at code{java.nio} defines the buffer classes.  As far as native and VM
+code is concerned, the new package needs support for low-level efficient
+buffer operations.
+
+ at menu
+* java.nio.VMDirectByteBuffer::
+ at end menu
+
+ at node java.nio.VMDirectByteBuffer,,java.nio,java.nio
+ at subsection @code{java.nio.VMDirectByteBuffer}
+
+A @code{ByteBuffer} maintains a buffer of bytes, and allows it to be
+manipulated using primitive operations such as @code{get}, @code{put},
+ at code{allocate} and @code{free}.  A direct buffer avoids intermediate
+copying, and uses native data which shouldn't be manipulated by a
+garbage collector.  The VM class consists of @code{static} @code{native}
+methods, all of which are given default implementations by GNU
+Classpath.
+
+ at itemize @bullet
+ at item @code{init()} -- Creates an instance of an appropriate
+ at code{gnu.classpath.RawData} class.  This class is not garbage
+collected, is created natively and is used in the other methods to reference
+the buffered data.
+ at item @code{allocate(int)} -- Allocates the memory for the buffer using
+ at code{malloc} and returns a reference to the @code{RawData} class.
+ at item @code{free(RawData)} -- Frees the memory used by the buffer.
+ at item @code{get(RawData,int)}  -- Returns the data at the specified index.
+ at item @code{get(RawData,int,byte[],int,int)} -- Copies a section of the
+data into a byte array using @code{memcpy}.
+ at item @code{put(RawData,int,byte)} -- Puts the given data in the buffer
+at the specified index.
+ at item @code{adjustAddress(RawData,int)} -- Adjusts the pointer into the buffer.
+ at item @code{shiftDown(RawData,int,int,int)} -- Moves the content of the buffer
+at an offset down to a new offset using @code{memmove}.
+ at end itemize
+ 
+ at node java.nio.channels, gnu.java.nio, java.nio, Classpath Hooks
+ at section java.nio.channels
+
+Channels provide the data for the buffers with the New I/O packages.
+For example, a channel may wrap a file or a socket.  The VM hooks,
+at the moment, simply allow the channels to be accessed by @code{java.io}
+streams.
+
+ at menu
+* java.nio.channels.VMChannels::
+ at end menu
+
+ at node java.nio.channels.VMChannels,,java.nio.channels,java.nio.channels
+ at subsection @code{java.nio.channels.VMChannels}
+
+ at code{VMChannels} provides the methods that create the channels or
+streams.  The default implementation is in pure Java and simply wraps
+the channels in standard I/O classes from @code{java.io}.
+
+ at itemize @bullet
+ at item @code{createStream(Class,Channel)} -- Creates a @code{FileChannel}
+which wraps an instance of the specified stream class, created by reflection.
+This method is private, and is used by the other two.
+ at item @code{newInputStream(ReadableByteChannel)} -- Wraps the channel
+in a @code{FileInputStream}.
+ at item @code{newOutputStream(WritableByteChannel)} -- Wraps the channel
+in a @code{FileOutputStream}.
+ at end itemize
+
+ at node gnu.java.nio, java.lang.reflect, java.nio.channels, Classpath Hooks
+ at section gnu.java.nio
+
+The @code{gnu.java.nio} class provides Classpath implementations of the
+interfaces provided by @code{java.nio}.  The VM classes provide the native
+support necessary to implement @emph{pipes} and @emph{selectors}.
+
+ at menu
+* gnu.java.nio.VMPipe::
+* gnu.java.nio.VMSelector::
+ at end menu
+
+ at node gnu.java.nio.VMPipe,gnu.java.nio.VMSelector,gnu.java.nio,gnu.java.nio
+ at subsection @code{gnu.java.nio.VMPipe}
+
+ at code{VMPipe} provides the native functionality for a uni-directional pipe
+between a source and a destination (sink) channel.  It consists of one 
+ at code{static} @code{native} method, @code{init(PipeImpl,SelectorProvider)},
+the reference implementation of which is currently a native stub.  Ideally,
+this should initialise the pipe at the native level.
+
+ at node gnu.java.nio.VMSelector,,gnu.java.nio.VMPipe,gnu.java.nio
+ at subsection @code{gnu.java.nio.VMSelector}
+
+A @code{Selector} selects between multiple @code{SelectableChannel}s based
+on their readiness and a key set.  The VM hook for the Classpath implementation
+of this is @code{VMSelector}, and this allows the actual @code{select()}
+operation to be performed.  This is represented by the @code{static}
+ at code{native} method, @code{select(int[],int[],int[],long)}, and a default
+implementation of this is provided.
+
+ at node java.lang.reflect, gnu.java.lang, gnu.java.nio, Classpath Hooks
+ at section @code{java.lang.reflect}
+ at code{java.lang.reflect} provides the interface to Java's reflection
+facilities.  Via reflection, programmers can obtain type information about
+a particular instance at runtime or dynamically create new instances.
+
+ at menu
+* java.lang.reflect.VMArray::
+ at end menu
+
+ at node java.lang.reflect.VMArray,,,java.lang.reflect
+ at subsection @code{java.lang.reflect.VMArray}
+
+The @code{VMArray} class provides a hook, @code{createObjectArray},
+which the VM uses to generate a new non-primitive array of a
+particular class and size.  The default implementation simply passes
+the job down to the standard JNI function, @code{NewObjectArray}.
+
+ at node gnu.java.lang, gnu.java.lang.management, java.lang.reflect, Classpath Hooks
+ at section @code{gnu.java.lang}
+
+ at code{gnu.java.lang} provides VM interfaces for the GNU
+implementations of features in java.lang.  Currently, this includes the
+implementation of instrumentation.
+
+ at menu
+* gnu.java.lang.VMInstrumentationImpl::
+ at end menu
+
+ at node gnu.java.lang.VMInstrumentationImpl,,,gnu.java.lang
+ at subsection @code{gnu.java.lang.VMInstrumentationImpl}
+
+The @code{gnu.java.lang.VMInstrumentationImpl} and
+ at code{gnu.java.lang.InstrumentationImpl} classes provide an implementation of the
+ at code{java.lang.instrument.Instrument} interface. 
+A @code{InstrumentationImpl} object should be created by the VM when agents
+are given in the command line (see the @code{java.lang.instrument} package
+documentation). The VM has to set the static field
+ at code{VMClassLoader.instrumenter} to this object. The VM should implement the
+static native methods of the @code{VMInstrumentationImpl} class.
+
+ at itemize @bullet
+ at item @code{isRedefineClassesSupported()} -- Returns true if the JVM supports
+class redefinition.
+ at item @code{redefineClasses()} -- Gives a set of classes with new bytecodes.
+The VM must redefine the classes by reading the new bytecodes.
+ at item @code{getAllLoadedClass()} -- Returns an array of all loaded classes.
+ at item @code{getInitiatedClass()} -- Returns an array of all classes loaded
+by a specific class loader.
+ at item @code{getObjectSize()} -- Gives the size of an object.
+ at end itemize
+
+Instrumentation allows to modify the bytecode of a class before it gets read
+by the VM. In GNU Classpath, the @code{ClassLoader.defineClass} method calls
+the @code{VMClassLoader.defineClassWithTransformers} method which first checks
+if @code{VMClassLoader.instrumenter} is @code{null}. If it's the case, it
+directly calls @code{VMClassLoader.defineClass}. If it's not the case, the
+method calls at first the @code{InstrumentationImpl.callTransformers} method,
+which calls each transformer registered to the @code{InstrumentationImpl}
+object and returns a new bytecode array. Then, it calls the
+ at code{VMClassLoader.defineClass} method with this new bytecode array.
+
+The second use of instrumentation is to redefine a class after it has been
+loaded by the VM. This is done in the Java application by calling the
+ at code{Instrumentation.redefineClasses} method of the standard interface on
+a @code{Instrumentation} object. The @code{InstrumentationImpl.redefineClasses}
+method calls the @code{VMInstrumentationImpl.redefineClasses} native method
+which must be implemented by the VM. The implementation should call the
+ at code{InstrumentationImpl.callTransformers} method.
+
+ at node gnu.java.lang.management, java.lang.management, gnu.java.lang, Classpath Hooks
+ at section @code{gnu.java.lang.management}
+
+ at code{gnu.java.lang.management} provides the VM interfaces for the GNU
+implementations of the management beans.  
+
+ at menu
+* gnu.java.lang.management.VMRuntimeMXBeanImpl::
+* gnu.java.lang.management.VMClassLoadingMXBeanImpl::
+* gnu.java.lang.management.VMThreadMXBeanImpl::
+* gnu.java.lang.management.VMMemoryMXBeanImpl::
+* gnu.java.lang.management.VMCompilationMXBeanImpl::
+* gnu.java.lang.management.VMMemoryPoolMXBeanImpl::
+* gnu.java.lang.management.VMMemoryManagerMXBeanImpl::
+* gnu.java.lang.management.VMGarbageCollectorMXBeanImpl::
+ at end menu
+
+ at node gnu.java.lang.management.VMRuntimeMXBeanImpl,gnu.java.lang.management.VMClassLoadingMXBeanImpl,,gnu.java.lang.management
+ at subsection @code{gnu.java.lang.management.VMRuntimeMXBeanImpl}
+
+The @code{gnu.java.lang.management.RuntimeMXBeanImpl} provides an
+implementation of the @code{java.lang.management.RuntimeMXBean} interface,
+and is supported by VM functionality in the form of
+ at code{gnu.java.lang.management.VMRuntimeMXBeanImpl}.  This provides a
+series of methods, which should be implemented by the virtual machine
+in order to provide the required information for the bean.  The VM
+methods are generally representative of information that is only
+available from the virtual machine, such as the command-line arguments
+it was given at startup.
+
+The methods are as follows:
+
+ at itemize @bullet
+ at item @code{(getInputArguments())} -- The VM should supply
+a @code{String} array containing each of the command-line
+arguments, excluding those that are directed at the
+ at code{main()} method.  The reference implementation expects
+this to be a native method.
+ at item @code{(getName())} -- The VM developer should choose
+an appropriate name for the virtual machine.  This name can
+be instance-specific e.g. it can include things like the
+process identifier or host name of the machine, which only
+apply to the current running instance.  Thus, the intention is
+that this name refers to the entity that the other information
+refers to, rather than the VM in general.  The reference
+implementation supplies a default concatenation of the VM
+name and version.
+ at item @code{(getStartTime())} -- This should return the number
+of milliseconds at which the virtual machine was started.
+The uptime property of the bean is provided relative to this
+value.  Again, the reference implementation also expects
+this method to be native.
+ at end itemize
+
+The virtual machine also needs to provide either the
+ at code{sun.boot.class.path} or @code{java.boot.class.path}
+property in order to support the optional boot class path
+retrieval functionality.
+
+ at node gnu.java.lang.management.VMClassLoadingMXBeanImpl,gnu.java.lang.management.VMThreadMXBeanImpl,gnu.java.lang.management.VMRuntimeMXBeanImpl,gnu.java.lang.management
+ at subsection @code{gnu.java.lang.management.VMClassLoadingMXBeanImpl}
+
+The @code{gnu.java.lang.management.ClassLoadingMXBeanImpl} provides an
+implementation of the @code{java.lang.management.ClassLoadingMXBean} interface,
+and is supported by VM functionality in the form of
+ at code{gnu.java.lang.management.VMClassLoadingMXBeanImpl}.  This provides a
+series of methods, which should be implemented by the virtual machine
+in order to provide the required information for the bean.  Implementing
+this bean requires the VM to monitor when classes are loaded and unloaded,
+and provide the option of verbose class loading output.
+
+The methods are as follows:
+
+ at itemize @bullet
+ at item @code{(getLoadedClassCount())} -- This should return
+the number of classes that are currently loaded by the VM.
+ at item @code{(getUnloadedClassCount())} -- This should return
+the number of classes that have been loaded by the VM, but
+have since been unloaded.
+ at item @code{(isVerbose())} -- This should return @code{true}
+or @code{false}, depending on whether verbose class loading
+output is turned or not, respectively.
+ at item @code{(setVerbose(boolean))} -- This should allow the
+verbose class loading output to be turned on and off.
+ at end itemize
+
+ at node gnu.java.lang.management.VMThreadMXBeanImpl,gnu.java.lang.management.VMMemoryMXBeanImpl,gnu.java.lang.management.VMClassLoadingMXBeanImpl,gnu.java.lang.management
+ at subsection @code{gnu.java.lang.management.VMThreadMXBeanImpl}
+
+The @code{gnu.java.lang.management.ThreadMXBeanImpl} provides an
+implementation of the @code{java.lang.management.ThreadMXBean} interface,
+and is supported by VM functionality in the form of
+ at code{gnu.java.lang.management.VMThreadMXBeanImpl}.  This provides a
+series of methods, which should be implemented by the virtual machine
+in order to provide the required information for the bean.  Implementing
+this bean requires the VM to monitor thread-related statistics such as
+how often the blocked and waiting states have been entered, as well as
+additional optional support for time and contention monitoring.
+
+Optional support is determined by the following properties:
+
+ at itemize @bullet
+ at item @code{gnu.java.lang.management.CurrentThreadTimeSupport} --
+This property should be present if the VM supports monitoring the
+time used by the current thread.  If time monitoring for all threads
+is supported, this need not be provided.
+ at item @code{gnu.java.lang.management.ThreadTimeSupport} --
+This property should be present if the VM supports monitoring the
+time used by all threads.
+ at item @code{gnu.java.lang.management.ThreadContentionSupport} --
+This property should be present if the VM supports thread contention
+monitoring.
+ at end itemize
+
+In addition, the property
+ at code{gnu.java.lang.management.ThreadTimeInitallyEnabled} may be
+set to the @code{String} value, @code{"true"}, if time monitoring
+is enabled at startup.
+
+The methods are as follows:
+
+ at itemize @bullet
+ at item @code{(findMonitorDeadlockedThreads())} -- This should return
+an array of thread identifiers which match threads involved in
+deadlock cycles (where each thread is waiting to obtain a lock
+held by one of the others).  This is specified as a native method
+in the reference implementation.
+ at item @code{(getAllThreads())} -- This should return an array of
+all live threads and set the @code{filled} variable to the number
+found.  A default implementation is provided.
+ at item @code{(getAllThreadIds())} -- This should return an array of
+all live thread identifiers.  An implementation is provided against
+ at code{getAllThreads()} by default.
+ at item @code{(getCurrentThreadCpuTime())} -- This should return the
+approximate number of nanoseconds of CPU time the current thread
+has used.  This is an optional native method, which is used by VMs
+supporting time monitoring.
+ at item @code{(getCurrentThreadUserTime())} -- This should return the
+approximate number of nanoseconds of user time the current thread
+has used.  This is an optional native method, which is used by VMs
+supporting time monitoring.
+ at item @code{(getDaemonThreadCount())} -- This should return the number
+of live daemon threads.  A default implementation is provided, based
+on @code{getAllThreads()}.
+ at item @code{(getPeakThreadCount())} -- The VM should maintain a record
+of the peak number of live threads, and return it when this method is
+called.  This is specified as a native method in the reference
+implementation.
+ at item @code{(resetPeakThreadCount())} -- This should reset the record
+of the peak number of live threads to the current number of live
+threads.  This is specified as a native method in the reference
+implementation.
+ at item @code{(getThreadCount())} -- This should return the number of
+live threads.  A default implementation is provided, based on
+ at code{getAllThreads()}.
+ at item @code{(getThreadCpuTime(long))} -- This should return the
+approximate number of nanoseconds of CPU time the specified thread
+has used.  This is an optional native method, which is used by VMs
+supporting time monitoring.
+ at item @code{(getThreadUserTime(long))} -- This should return the
+approximate number of nanoseconds of CPU time the specified thread
+has used.  This is an optional native method, which is used by VMs
+supporting time monitoring.
+ at item @code{(getThreadInfoForId(long, int))} -- This return an instance
+of @code{java.lang.management.ThreadInfo} for the specified thread.
+The class includes a private constructor which VMs should use to initialise
+it with the appropriate values for the thread.  The second argument
+given here specifies the depth of the stack trace supplied on construction
+of the instance.  Special values are 0 (return an empty array) and
+ at code{Integer.MAX_VALUE} (return the maximum depth possible).  This
+is specified as a native method in the reference implementation.
+ at item @code{(getTotalStartedThreadCount())} -- This should return the
+total number of threads that have been started by the VM, including ones
+that have died.  This is specified as a native method in the reference
+implementation.
+ at end itemize
+
+ at node gnu.java.lang.management.VMMemoryMXBeanImpl,gnu.java.lang.management.VMCompilationMXBeanImpl,gnu.java.lang.management.VMThreadMXBeanImpl,gnu.java.lang.management
+ at subsection @code{gnu.java.lang.management.VMMemoryMXBeanImpl}
+
+The @code{gnu.java.lang.management.MemoryMXBeanImpl} provides an
+implementation of the @code{java.lang.management.MemoryMXBean} interface,
+and is supported by VM functionality in the form of
+ at code{gnu.java.lang.management.VMMemoryMXBeanImpl}.  This provides a
+series of methods, which should be implemented by the virtual machine
+in order to provide the required information for the bean.  Implementing
+this bean requires the VM to monitor the levels of heap and non-heap
+memory, and provide the number of objects which are eligible for garbage
+collection.
+
+The methods are as follows:
+
+ at itemize @bullet
+ at item @code{(getHeapMemoryUsage())} -- This should return
+an instance of @code{java.lang.management.MemoryUsage} with
+values pertaining to the heap.  A default implementation is
+provided, based on @code{java.lang.Runtime}'s methods.
+ at item @code{(getNonHeapMemoryUsage())} -- This should return
+an instance of @code{java.lang.management.MemoryUsage} with
+values pertaining to non-heap memory.
+ at item @code{(getObjectPendingFinalizationCount())} -- Returns
+the number of objects which are no longer referenced, and which
+will thus be garbage collected on the next run of the garbage
+collector.
+ at item @code{(isVerbose())} -- This should return @code{true}
+or @code{false}, depending on whether verbose memory management
+output is turned or not, respectively.
+ at item @code{(setVerbose(boolean))} -- This should allow the
+verbose memory management output to be turned on and off.
+ at end itemize
+
+ at node gnu.java.lang.management.VMCompilationMXBeanImpl,gnu.java.lang.management.VMMemoryPoolMXBeanImpl,gnu.java.lang.management.VMMemoryMXBeanImpl,gnu.java.lang.management
+ at subsection @code{gnu.java.lang.management.VMCompilationMXBeanImpl}
+
+The @code{gnu.java.lang.management.CompilationMXBeanImpl} provides an
+implementation of the optional @code{java.lang.management.CompilationMXBean}
+interface, and is supported by VM functionality in the form of
+ at code{gnu.java.lang.management.VMCompilationMXBeanImpl}.  This provides a
+single method for returning the number of milliseconds the virtual
+machine's Just-In-Time (JIT) compiler has spent compiling.  Even if
+a JIT compiler is available and an instance of the bean supplied, this
+method is still optional.
+
+Optional support is determined by the following properties:
+
+ at itemize @bullet
+ at item @code{gnu.java.lang.compiler.name} -- This property should
+specify the name of the JIT compiler.  Classpath also uses this,
+within @code{java.lang.management.ManagementFactory}, to determine
+whether a bean should be created.  If this property is set to a
+non-null value, a bean will be created and its @code{getName()}
+method will return this value.
+ at item @code{gnu.java.lang.management.CompilationTimeSupport} --
+This property should be present if the VM supports monitoring the
+time spent compiling.
+ at end itemize
+
+Time support is implemented by the following method:
+
+ at itemize @bullet
+ at item @code{(getTotalCompilationTime())} -- This should return the
+number of milliseconds the JIT compiler has spent compiling.
+ at end itemize
+
+ at node gnu.java.lang.management.VMMemoryPoolMXBeanImpl,gnu.java.lang.management.VMMemoryManagerMXBeanImpl,gnu.java.lang.management.VMCompilationMXBeanImpl,gnu.java.lang.management
+ at subsection @code{gnu.java.lang.management.VMMemoryPoolMXBeanImpl}
+
+The @code{gnu.java.lang.management.MemoryPoolMXBeanImpl} provides an
+implementation of the optional @code{java.lang.management.MemoryPoolMXBean}
+interface, and is supported by VM functionality in the form of
+ at code{gnu.java.lang.management.VMMemoryPoolMXBeanImpl}.  Providing
+this interface requires implementing a number of methods for each supported
+pool.  These return statistics on memory usage, and, optionally, allows
+monitoring of when memory usage exceedes a preset threshold.
+
+Optional support is determined by the following properties:
+
+ at itemize @bullet
+ at item @code{gnu.java.lang.management.CollectionUsageThresholdSupport} --
+This property should be present if the VM supports setting a collection
+usage threshold and monitoring when it is matched or exceeded.  Collection
+usage thresholds are related to the remaining memory usage following a
+garbage collection cycle.
+ at item @code{gnu.java.lang.management.UsageThresholdSupport} --
+This property should be present if the VM supports setting a 
+usage threshold and monitoring when it is matched or exceeded.  
+ at end itemize
+
+The methods are as follows (all take a pool name as their
+first parameter):
+
+ at itemize @bullet
+ at item @code{(getCollectionUsage(String))} -- Returns a
+ at code{java.lang.management.MemoryUsage} object, containing the
+memory usage statistics following a garbage collection cycle
+for the specified pool.  This may also return @code{null} if
+the pool isn't an appropriate pool for this particular task.
+ at item @code{(getCollectionUsageThreshold(String))} -- Returns
+the pool's collection usage threshold, if supported.
+ at item @code{(getCollectionUsageThresholdCount(String))} -- Returns
+the number of times the specified pool has matched or exceeded
+its collection usage threshold, if supported.
+ at item @code{(getMemoryManagerNames(String))} -- Returns a list
+of names of memory managers which manage the specified pool.
+ at item @code{(getPeakUsage(String))} -- Returns a
+ at code{java.lang.management.MemoryUsage} object for the peak
+usage level of the specified pool.
+ at item @code{(getType(String))} -- Returns a string containing
+either @code{"HEAP"} or @code{"NON_HEAP"} which indicates the type of
+memory used by the specified pool.
+ at item @code{(getUsage(String))} -- Returns a
+ at code{java.lang.management.MemoryUsage} object for the current
+usage level of the specified pool.
+ at item @code{(getUsageThreshold(String))} -- Returns
+the pool's usage threshold, if supported.
+ at item @code{(getUsageThresholdCount(String))} -- Returns
+the number of times the specified pool has matched or exceeded
+its usage threshold, if supported.
+ at item @code{(isValid(String))} -- Returns true if the pool
+is still in use by the virtual machine.
+ at item @code{(resetPeakUsage(String))} -- Resets the peak usage
+levels to the current usage levels for the specified pool.
+ at item @code{(setCollectionUsageThreshold(String, long))} -- Sets
+the pool's collection usage threshold, if supported.
+ at item @code{(setUsageThreshold(String, long))} -- Sets
+the pool's usage threshold, if supported.
+ at end itemize
+
+ at node gnu.java.lang.management.VMMemoryManagerMXBeanImpl,gnu.java.lang.management.VMGarbageCollectorMXBeanImpl,gnu.java.lang.management.VMMemoryPoolMXBeanImpl,gnu.java.lang.management
+ at subsection @code{gnu.java.lang.management.VMMemoryManagerMXBeanImpl}
+
+The @code{gnu.java.lang.management.MemoryManagerMXBeanImpl} provides an
+implementation of the optional @code{java.lang.management.MemoryManagerMXBean}
+interface, and is supported by VM functionality in the form of
+ at code{gnu.java.lang.management.VMMemoryManagerMXBeanImpl}.  Providing
+this interface requires implementing two methods (each takes the name
+of the manager as the first argument):
+
+ at itemize @bullet
+ at item @code{(getMemoryPoolNames(String))} -- Returns a list of the
+memory pools that the manager maintains.  A default implementation
+which scans the results of @code{getMemoryManagerNames()} for each
+pool is provided.
+ at item @code{(isValid(String))} -- Returns true if the specified
+manager is still valid i.e. it is still in use by the virtual machine.
+ at end itemize
+
+ at node gnu.java.lang.management.VMGarbageCollectorMXBeanImpl,,gnu.java.lang.management.VMMemoryManagerMXBeanImpl,gnu.java.lang.management
+ at subsection @code{gnu.java.lang.management.VMGarbageCollectorMXBeanImpl}
+
+The @code{gnu.java.lang.management.GarbageCollectorMXBeanImpl} provides an
+implementation of the optional @code{java.lang.management.GarbageCollectorMXBean}
+interface, and is supported by VM functionality in the form of
+ at code{gnu.java.lang.management.VMGarbageCollectorMXBeanImpl}.  Providing
+this interface requires implementing two methods (each takes the name
+of the garbage collector as the first argument):
+
+ at itemize @bullet
+ at item @code{(getCollectionCount(String))} -- Returns the number of
+times the specified garbage collector has run.
+ at item @code{(getCollectionTime(String))} -- Returns the accumulated
+number of milliseconds for which the garbage collector has run.
+ at end itemize
+
+Note that each garbage collector is also a memory manager, and so an
+implementation of the @code{gnu.java.lang.management.VMMemoryManagerMXBeanImpl}
+methods for its name should also be provided.
+
+ at node java.lang.management, Classpath Callbacks, gnu.java.lang.management, Classpath Hooks
+ at section @code{java.lang.management}
+
+ at code{gnu.java.lang.management} provides the VM interfaces for the GNU
+implementations of the management beans.  
+
+ at menu
+* java.lang.management.VMManagementFactory::
+ at end menu
+
+ at node java.lang.management.VMManagementFactory,,,java.lang.management
+ at subsection @code{java.lang.management.VMManagementFactory}
+
+This VM interface provides the names of the memory pools, memory managers
+and garbage collectors for use by the @code{java.lang.management.ManagementFactory}
+in creating lists of appropriate beans for these types of managed object.
+
+The methods are as follows:
+
+ at itemize @bullet
+ at item @code{(getMemoryPoolNames())} -- Returns a list of the names
+of the current memory pools in use by the virtual machine.
+ at item @code{(getMemoryManagerNames())} -- Returns a list of the names
+of the current memory managers in use by the virtual machine.  This
+should not include those that are also garbage collectors.
+ at item @code{(getGarbageCollectorNames())} -- Returns a list of the names
+of the current garbage collectors in use by the virtual machine.
+ at end itemize
+
+ at node Classpath Callbacks, , java.lang.management, Classpath Hooks
+Some of the classes you implement for the VM will need to call back to
+package-private methods in Classpath:
+
+ at itemize @bullet
+ at item @code{java.lang.ThreadGroup.addThread(Thread)}
+Call this method from @code{Thread} when a new @code{Thread} is created, to add it to
+the group.
+
+ at item @code{java.lang.ThreadGroup.removeThread(Thread)}
+Call this method from @code{Thread} when a @code{Thread} is stopped or destroyed.
+
+ at item @code{gnu.java.lang.management.MemoryMXBeanImpl.fireThresholdExceededNotification(String, long, long, long, long)}
+If the monitoring of memory usage thresholds is supported, this method
+should be called when the normal usage of a memory pool crosses the
+threshold, in order to emit a notification.  Another notification
+should not be emitted until there is an intermittent period where the
+usage is again below the threshold.  The parameters are the memory
+pool name, the usage levels (init, used, committed and max) and the
+number of times the threshold has been crossed.
+
+ at item @code{gnu.java.lang.management.MemoryMXBeanImpl.fireCollectionThresholdExceededNotification(String, long, long, long, long)}
+If the monitoring of memory usage thresholds is supported, this method
+should be called when the usage of a memory pool after a garbage
+collection cycle crosses the threshold, in order to emit a
+notification.  Another notification should not be emitted until there
+is an intermittent period where the usage is again below the
+threshold.  The parameters are the memory pool name, the usage levels
+(init, used, committed and max) and the number of times the threshold
+has been crossed.
+
+ at end itemize
+
+ at node VM Hooks, JNI Implementation, Classpath Hooks, Top
+ at comment node-name, next, previous, up
+ at chapter VM Hooks
+
+VMs need to do some dirty work; there are some things in the VM that
+unfortunately are dependent on the internal structure of various
+classes.  This is a guide to all of the things the VM itself needs to
+know about classes.
+
+Some of the core classes, while being implemented by GNU Classpath,
+provide space for state (in the form of a @code{vmdata} object) to be
+stored by the VM, and can not be constructed normally.
+
+ at itemize @bullet
+ at item java.lang.Class
+ at item java.lang.ClassLoader
+ at end itemize
+
+The default implementations of some VM classes also follow this methodology,
+when it is intended that most VMs will keep the default.
+
+ at itemize @bullet
+ at item java.lang.VMThread
+ at item java.lang.VMThrowable
+ at end itemize
+
+Several core classes must be completely implemented by the VM for Classpath to
+work, although reference implementations are provided.  These classes are:
+
+ at itemize @bullet
+ at item java.lang.reflect.Constructor
+ at item java.lang.reflect.Method
+ at item java.lang.reflect.Field
+ at end itemize
+
+The following issues are of note;
+
+ at itemize @bullet
+ at item @code{java.lang.Class} @*
+The GNU Classpath implementation of @code{java.lang.Class} provides an
+object for storing the internal state of the class maintained by the VM.
+This is the only known place where this matters.  The class is
+constructed with this data by the VM.  Some VMs do not create the
+ at code{Class} object at the point where the class is defined; instead,
+they wait until a @code{Class} object is actually used.
+
+ at item Array Classes @*
+When you are creating an array class, you should set the
+ at code{ClassLoader} of the array class to the @code{ClassLoader} of its
+component type.  Whenever you add a class to a @code{ClassLoader}, you
+need to notify the @code{ClassLoader} and add the new @code{Class} to
+its internal cache of classes.  To do this, call
+ at code{ClassLoader.addVMCreatedClass(Class)}.  @emph{Note: this is
+written in anticipation of 1.2 support and does not apply just yet.}
+
+ at item Primordial Class Loader @*
+When the primordial class loader loads a class, it needs to tell
+Classpath what it has done in order for security stuff to work right.
+To do this, call the static method
+ at code{ClassLoader.newPrimordialClass(Class)}.
+
+Even the first few core classes need to do this; in order to do it,
+simply call this method @emph{after} the initial class loading has been
+done.  No harm will come, as long as you follow the guidelines in the
+ at pxref{Initialization} section.
+
+ at emph{Note: this is written in anticipation of 1.2 support and does not
+apply just yet.}
+
+ at item Top-level Exception Handler @*
+Exceptions take care of themselves in Classpath; all you need to do in
+the top-level exception handler is call @code{Throwable.printStackTrace()}.
+
+ at item Security and Traces @*
+There will eventually be a feature in the 1.2 security that keeps the
+ at code{AccessController} from having to evaluate @emph{all} of the
+ at code{ProtectionDomain}s every time a security check is made.  I think a common
+case is a single method doing a lot of things that require security
+checks.  However, I don't want to bog down the method stack too much, so
+this feature of the VM will have the @code{AccessController} for a thread
+calling out to the VM to tell it how high it was on the stack when it
+made the last security request.  Every time the stack goes lower than
+that number, the VM will decrement the number.  The @code{AccessController}
+will remember what the accumulated protection status was at every stack
+level (an @code{AccessControlContext}) and use that aggregated information to
+do the check.  I am not sure, however, whether the savings are
+substantial enough to outweigh the integer check and set after every
+method call.  I will investigate.
+
+ at item Threading @*
+I figured I'd put this here because a VM guy might be wondering about it.
+We implement @code{ThreadGroup}, but that class is almost entirely
+VM-independent.  The root @code{ThreadGroup}, a static field called
+ at code{ThreadGroup.root}, should be initialized by Classpath, but if you wish to
+reinitialize it yourself, there should be no harm.
+
+ at end itemize
+
+ at node JNI Implementation, JVMTI Implementation, VM Hooks, Top
+ at comment  node-name,  next,  previous,  up
+ at chapter JNI Implementation
+
+Classpath comes with its own implementation of @file{jni.h}.  This
+file can be customized by the VM in a few ways, by defining macros
+that affect the interpretation of the file.  These macros are all
+intended for use by a VM which uses GNU Classpath and which wants to
+use a single copy of @file{jni.h} for both internal and external use.
+
+ at itemize @bullet
+ at item _CLASSPATH_VM_JNI_TYPES_DEFINED
+Some VMs like to define JNI ``object'' types in a special way.  If
+this macro is defined, the Classpath @file{jni.h} will avoid defining
+these types.  By default, these types are defined in @file{jni.h}.
+The full list of types and macros treated this way is: @samp{jobject},
+ at samp{jclass}, @samp{jstring}, @samp{jthrowable}, @samp{jweak},
+ at samp{jarray}, @samp{jobjectArray}, @samp{jbyteArray},
+ at samp{jshortArray}, @samp{jintArray}, @samp{jlongArray},
+ at samp{jbooleanArray}, @samp{jcharArray}, @samp{jfloatArray},
+ at samp{jdoubleArray}, @samp{JNIEnv}, @samp{JavaVM}, @samp{JNI_TRUE}
+(macro), @samp{JNI_FALSE} (macro).
+
+ at item _CLASSPATH_VM_INTERNAL_TYPES_DEFINED
+If the VM has its own definitions for @samp{jfieldID} and
+ at samp{jmethodID}, then it should define this macro.  Otherwise,
+ at file{jni.h} will provide definitions for these types.
+
+ at item _CLASSPATH_JNIIMPEXP
+Three functions -- @samp{JNI_GetDefaultJavaVMInitArgs},
+ at samp{JNI_CreateJavaVM}, and @samp{JNI_GetCreatedJavaVMs} -- must be
+marked as @samp{JNIIMPORT} when seen by user code, but most likely
+should be marked as @samp{JNIEXPORT} when defined in the VM
+implementation.  This macro can be defined to one or the other by the
+VM as appropriate.  If this macro is not defined, it defaults to
+ at samp{JNIIMPORT}.
+
+ at item _CLASSPATH_JNIENV_CONTENTS
+A VM can add fields to the @samp{JNIEnv} structure by defining this to
+be a sequence of field declarations.
+
+ at end itemize
+
+ at node JVMTI Implementation, Miscellaneous VM Requirements, JNI Implementation, Top
+ at comment node-name, next, previous, up
+ at chapter JVMTI Implementation
+
+Classpath comes with its own implementation of @file{jvmti.h}.  This
+file can be customized by the VM in a few ways by defining macros that
+affect the interpretation of the file.  These macros are all intended
+for use for use by a VM which uses GNU Classpath and which wants to
+use a single copy of @file{jvmti.h} for both internal and external use.
+
+ at itemize @bullet
+ at item _CLASSPATH_VM_JVMTI_TYPES_DEFINED
+Some VMs like to define JVMTI ``object'' types in a special way.  If
+this macro is defined, the Classpath @file{jvmti.h} will avoid defining
+these types.  By default these types are defined in @file{jvmti.h}.  
+The full list of types and macros treated this way is: @samp{jthread},
+ at samp{jthreadGroup}, @samp{jlocation}, and @samp{jrawMonitorID}.  By
+default @samp{jrawMonitorID} is defined as an opaque pointer which
+must be defined by the VM.
+
+ at item _CLASSPATH_JVMTIENV_CONTENTS
+A VM can add fields to the @samp{jvmtiEnv} structure by defining this
+to be a sequence of field declarations.
+
+ at end itemize
+
+ at node Miscellaneous VM Requirements,  , JVMTI Implementation, Top
+ at comment  node-name,  next,  previous,  up
+ at chapter Miscellaneous VM Requirements
+
+Classpath places a few requirements on the VM that uses it.
+
+ at menu
+* JNI Version::                 
+* VM Threading Model::          
+* Boot Library Path Property::
+ at end menu
+
+ at node JNI Version, VM Threading Model, Miscellaneous VM Requirements, Miscellaneous VM Requirements
+ at comment  node-name,  next,  previous,  up
+ at section JNI Version
+
+Classpath currently uses only JNI 1.1, except for one JNI 1.2 function
+in the JNI Invocation API: GetEnv().  And GetEnv() is only used in the
+``portable native sync'' code, so it's only actually used by Jikes RVM
+and Kaffe.  
+
+A future direction will probably be to require that all VMs provide
+JNI 1.2.  If this poses problems, please raise them on the classpath
+mailing list. 
+
+ at node VM Threading Model, Boot Library Path Property, JNI Version, Miscellaneous VM Requirements
+ at comment  node-name,  next,  previous,  up
+ at section VM Threading Model
+
+Classpath's AWT peers use GTK+.  GTK+ uses GLIB.  Normally, Classpath
+will initialize GLIB's @dfn{gthreads} to use
+the platform's native threading model at footnote{The native threading
+model is pthreads on Linux and AIX, the two platforms Classpath
+currently runs on.}
+
+If the Java runtime doesn't use the native threading model, then you
+will want Classpath to tell GLIB to use the Java threading primitives
+instead.  Otherwise, GLIB would use the native threading model to
+perform operations such as creating thread-local data, and that just
+doesn't work on systems (such as Kaffe in some configurations, and
+such as Jikes RVM) that use @i{m}:@i{n} threading.
+
+Historically, enabling the Java threading primitives had been done at
+build time, by configuring classpath with the
+ at option{--portable-native-sync} option.  This had bad consequences,
+though -- it meant that the prebuild GNU Classpath package distributed
+with Debian GNU/Linux would not be usable with VMs that could
+otherwise have used it.  Instead, we encourage
+the use of the Java system property
+ at code{gnu.classpath.awt.gtk.portable.native.sync}.  A VM that wants
+GLIB to use the Java threading primitives should modify
+ at code{VMRuntime.insertSystemProperties()} to include code like the
+following:
+
+ at example
+static void insertSystemProperties(Properties @var{p}) 
+ at end example
+...
+ at example
+ at var{p}.put("gnu.classpath.awt.gtk.portable.native.sync", "true");
+ at end example
+
+So, the configure option
+ at option{--portable-native-sync} is deprecated, and should go away in a
+subsequent release of GNU Classpath.
+
+ at node Boot Library Path Property,  , VM Threading Model, Miscellaneous VM Requirements
+ at comment  node-name,  next,  previous,  up
+ at section Boot Library Path Property
+
+As of GNU Classpath 0.15 a system property named @code{gnu.classpath.boot.library.path}
+can be set by the VM to specify the directories which contain GNU Classpath's native
+libraries. Usually this value is given at configuration time and is then hardcoded
+in the VM. However for development purposes it is handy to switch to another installation
+by overriding the properties' value on the command line.
+
+A VM that does not support this feature can simply ignore the property.
+
+For compatibility reasons we suggest to set the default value of @code{java.library.path}
+to the value of the @code{LD_LIBRARY_PATH} environment if it exists on your platform.
+
+ at bye
+
+
+

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

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/Makefile.am (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/Makefile.am Thu Nov  8 16:56:19 2007
@@ -0,0 +1,112 @@
+## Input file for automake to generate the Makefile.in used by configure
+GLIBJ_CLASSPATH='$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip'
+
+# Setup the compiler to use the GNU Classpath library we just build
+if FOUND_GCJ
+JCOMPILER = $(GCJ) -encoding UTF-8 --bootclasspath $(GLIBJ_CLASSPATH) --classpath . -C
+else
+if FOUND_JIKES
+JCOMPILER = $(JIKES) $(JIKESENCODING) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(GLIBJ_CLASSPATH):.
+else
+if FOUND_GCJX
+JCOMPILER = $(GCJX) -encoding UTF-8 -bootclasspath '' -sourcepath '' -classpath $(GLIBJ_CLASSPATH):.
+else
+if FOUND_ECJ
+JCOMPILER = $(ECJ) -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
+else
+error dunno how to setup the JCOMPILER and compile
+endif
+endif
+endif
+endif
+
+# All our example java source files
+EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*/*.java
+
+# The example C source & header files
+EXAMPLE_C_FILES = $(srcdir)/gnu/classpath/examples/*/*.c
+EXAMPLE_CH_FILES = $(srcdir)/gnu/classpath/examples/*/*.h
+
+# The zip files with classes we want to produce.
+EXAMPLE_ZIP = examples.zip
+
+# Extra objects that will not exist until configure-time
+BUILT_SOURCES = $(EXAMPLE_ZIP)
+
+# the png icons we use in some of the examples.
+EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
+
+# The example specific README files.
+READMES = $(srcdir)/gnu/classpath/examples/CORBA/swing/README.html
+
+# All the files we find "interesting"
+ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_CH_FILES) $(EXAMPLE_ICONS) $(READMES)
+
+# Some architecture independent data to be installed.
+example_DATA = $(EXAMPLE_ZIP) README
+
+# Where we want these data files installed.
+exampledir = $(pkgdatadir)/examples
+
+# Make sure all sources and icons are also installed so users can use them.
+# (Be careful to strip off the srcdir part of the path when installing.)
+install-data-local:
+	srcdir_cnt=`echo $(srcdir) | wc -c`; \
+	for file in $(ALL_EXAMPLE_FILES); do \
+	  f=`echo $$file | cut -c$$srcdir_cnt-`; \
+	  fdir=`dirname $$f`; \
+	  if test ! -d $(DESTDIR)$(pkgdatadir)/examples/$$fdir; then \
+	    echo "$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/examples/$$fdir"; \
+	    $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/examples/$$fdir; \
+	  fi; \
+	  echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/examples/$$f"; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/examples/$$f; \
+	done
+	echo "$(INSTALL_DATA) Makefile.jawt $(DESTDIR)$(pkgdatadir)/examples/"
+	echo "$(INSTALL_DATA) Makefile.java2d $(DESTDIR)$(pkgdatadir)/examples/"
+	$(INSTALL_DATA) Makefile.jawt $(DESTDIR)$(pkgdatadir)/examples/
+	$(INSTALL_DATA) Makefile.java2d $(DESTDIR)$(pkgdatadir)/examples/
+
+uninstall-local:
+	srcdir_cnt=`echo $(srcdir) | wc -c`; \
+	for file in $(ALL_EXAMPLE_FILES); do \
+	  f=`echo $$file | cut -c$$srcdir_cnt-`; \
+	  echo "rm -f $(DESTDIR)$(pkgdatadir)/examples/$$f"; \
+	  rm -f $(DESTDIR)$(pkgdatadir)/examples/$$f; \
+	done
+	echo "rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.jawt"
+	echo "rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.java2d"
+	rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.jawt
+	rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.java2d
+
+# Make sure everything is included in the distribution.
+EXTRA_DIST = README Makefile.jawt.in Makefile.java2d.in
+dist-hook:
+	srcdir_cnt=`echo $(srcdir) | wc -c`; \
+	for file in $(ALL_EXAMPLE_FILES); do \
+	  f=`echo $$file | cut -c$$srcdir_cnt-`; \
+	  fdir=`dirname $$f`; \
+	  if test ! -d $(distdir)/$$fdir; then \
+	    echo "$(makeinstalldirs) $(distdir)/$$fdir"; \
+	    $(mkinstalldirs) $(distdir)/$$fdir; \
+	  fi; \
+	  echo "cp -p $$file $(distdir)/$$f"; \
+	  cp -p $$file $(distdir)/$$f; \
+	done
+
+# To generate the example zip just depend on the sources and ignore the
+# class files. Always regenerate all .class files and remove them immediatly.
+# And copy the png icons we use to the classes dir so they get also included.
+$(EXAMPLE_ZIP): $(EXAMPLE_JAVA_FILES)
+	mkdir -p classes/gnu/classpath/examples/icons
+	cp $(EXAMPLE_ICONS) classes/gnu/classpath/examples/icons
+	$(JCOMPILER) -d classes $(EXAMPLE_JAVA_FILES) 
+	(cd classes; \
+	if test "$(ZIP)" != ""; then $(ZIP) -r ../$(EXAMPLE_ZIP) .; fi; \
+	if test "$(FASTJAR)" != ""; then $(FASTJAR) cf ../$(EXAMPLE_ZIP) .; fi; \
+	cd ..)
+	rm -rf classes
+
+# Zip file be gone! (and make sure the classes are gone too)
+clean-local:
+	rm -rf $(EXAMPLE_ZIP) classes

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

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/Makefile.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/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 = examples
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/Makefile.java2d.in $(srcdir)/Makefile.jawt.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 = Makefile.jawt Makefile.java2d
+SOURCES =
+DIST_SOURCES =
+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)$(exampledir)"
+exampleDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(example_DATA)
+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@
+GLIBJ_CLASSPATH = '$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip'
+ at FOUND_ECJ_TRUE@@FOUND_GCJX_FALSE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE at JCOMPILER = $(ECJ) -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
+ at FOUND_GCJX_TRUE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE at JCOMPILER = $(GCJX) -encoding UTF-8 -bootclasspath '' -sourcepath '' -classpath $(GLIBJ_CLASSPATH):.
+ at FOUND_GCJ_FALSE@@FOUND_JIKES_TRUE at JCOMPILER = $(JIKES) $(JIKESENCODING) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(GLIBJ_CLASSPATH):.
+
+# Setup the compiler to use the GNU Classpath library we just build
+ at FOUND_GCJ_TRUE@JCOMPILER = $(GCJ) -encoding UTF-8 --bootclasspath $(GLIBJ_CLASSPATH) --classpath . -C
+
+# All our example java source files
+EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*/*.java
+
+# The example C source & header files
+EXAMPLE_C_FILES = $(srcdir)/gnu/classpath/examples/*/*.c
+EXAMPLE_CH_FILES = $(srcdir)/gnu/classpath/examples/*/*.h
+
+# The zip files with classes we want to produce.
+EXAMPLE_ZIP = examples.zip
+
+# Extra objects that will not exist until configure-time
+BUILT_SOURCES = $(EXAMPLE_ZIP)
+
+# the png icons we use in some of the examples.
+EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
+
+# The example specific README files.
+READMES = $(srcdir)/gnu/classpath/examples/CORBA/swing/README.html
+
+# All the files we find "interesting"
+ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_CH_FILES) $(EXAMPLE_ICONS) $(READMES)
+
+# Some architecture independent data to be installed.
+example_DATA = $(EXAMPLE_ZIP) README
+
+# Where we want these data files installed.
+exampledir = $(pkgdatadir)/examples
+
+# Make sure everything is included in the distribution.
+EXTRA_DIST = README Makefile.jawt.in Makefile.java2d.in
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+$(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  examples/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  examples/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
+Makefile.jawt: $(top_builddir)/config.status $(srcdir)/Makefile.jawt.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+Makefile.java2d: $(top_builddir)/config.status $(srcdir)/Makefile.java2d.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+install-exampleDATA: $(example_DATA)
+	@$(NORMAL_INSTALL)
+	test -z "$(exampledir)" || $(mkdir_p) "$(DESTDIR)$(exampledir)"
+	@list='$(example_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(exampleDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(exampledir)/$$f'"; \
+	  $(exampleDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(exampledir)/$$f"; \
+	done
+
+uninstall-exampleDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(example_DATA)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(exampledir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(exampledir)/$$f"; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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
+	$(MAKE) $(AM_MAKEFLAGS) \
+	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
+	  dist-hook
+check-am: all-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(DATA)
+installdirs:
+	for dir in "$(DESTDIR)$(exampledir)"; 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:
+
+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-local mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local install-exampleDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-exampleDATA uninstall-info-am uninstall-local
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	clean-local dist-hook distclean distclean-generic \
+	distclean-libtool distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am \
+	install-data-local install-exampleDATA install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am uninstall-exampleDATA uninstall-info-am \
+	uninstall-local
+
+ at FOUND_ECJ_FALSE@@FOUND_GCJX_FALSE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE at error dunno how to setup the JCOMPILER and compile
+
+# Make sure all sources and icons are also installed so users can use them.
+# (Be careful to strip off the srcdir part of the path when installing.)
+install-data-local:
+	srcdir_cnt=`echo $(srcdir) | wc -c`; \
+	for file in $(ALL_EXAMPLE_FILES); do \
+	  f=`echo $$file | cut -c$$srcdir_cnt-`; \
+	  fdir=`dirname $$f`; \
+	  if test ! -d $(DESTDIR)$(pkgdatadir)/examples/$$fdir; then \
+	    echo "$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/examples/$$fdir"; \
+	    $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/examples/$$fdir; \
+	  fi; \
+	  echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/examples/$$f"; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/examples/$$f; \
+	done
+	echo "$(INSTALL_DATA) Makefile.jawt $(DESTDIR)$(pkgdatadir)/examples/"
+	echo "$(INSTALL_DATA) Makefile.java2d $(DESTDIR)$(pkgdatadir)/examples/"
+	$(INSTALL_DATA) Makefile.jawt $(DESTDIR)$(pkgdatadir)/examples/
+	$(INSTALL_DATA) Makefile.java2d $(DESTDIR)$(pkgdatadir)/examples/
+
+uninstall-local:
+	srcdir_cnt=`echo $(srcdir) | wc -c`; \
+	for file in $(ALL_EXAMPLE_FILES); do \
+	  f=`echo $$file | cut -c$$srcdir_cnt-`; \
+	  echo "rm -f $(DESTDIR)$(pkgdatadir)/examples/$$f"; \
+	  rm -f $(DESTDIR)$(pkgdatadir)/examples/$$f; \
+	done
+	echo "rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.jawt"
+	echo "rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.java2d"
+	rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.jawt
+	rm -f $(DESTDIR)$(pkgdatadir)/examples/Makefile.java2d
+dist-hook:
+	srcdir_cnt=`echo $(srcdir) | wc -c`; \
+	for file in $(ALL_EXAMPLE_FILES); do \
+	  f=`echo $$file | cut -c$$srcdir_cnt-`; \
+	  fdir=`dirname $$f`; \
+	  if test ! -d $(distdir)/$$fdir; then \
+	    echo "$(makeinstalldirs) $(distdir)/$$fdir"; \
+	    $(mkinstalldirs) $(distdir)/$$fdir; \
+	  fi; \
+	  echo "cp -p $$file $(distdir)/$$f"; \
+	  cp -p $$file $(distdir)/$$f; \
+	done
+
+# To generate the example zip just depend on the sources and ignore the
+# class files. Always regenerate all .class files and remove them immediatly.
+# And copy the png icons we use to the classes dir so they get also included.
+$(EXAMPLE_ZIP): $(EXAMPLE_JAVA_FILES)
+	mkdir -p classes/gnu/classpath/examples/icons
+	cp $(EXAMPLE_ICONS) classes/gnu/classpath/examples/icons
+	$(JCOMPILER) -d classes $(EXAMPLE_JAVA_FILES) 
+	(cd classes; \
+	if test "$(ZIP)" != ""; then $(ZIP) -r ../$(EXAMPLE_ZIP) .; fi; \
+	if test "$(FASTJAR)" != ""; then $(FASTJAR) cf ../$(EXAMPLE_ZIP) .; fi; \
+	cd ..)
+	rm -rf classes
+
+# Zip file be gone! (and make sure the classes are gone too)
+clean-local:
+	rm -rf $(EXAMPLE_ZIP) classes
+# 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/examples/Makefile.java2d.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/Makefile.java2d.in?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/Makefile.java2d.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/Makefile.java2d.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,17 @@
+# @configure_input@
+
+srcdir = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+includedir = @includedir@
+libdir = @libdir@
+pkglibdir = $(libdir)/@PACKAGE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+
+all: $(srcdir)/gnu/classpath/examples/java2d/bench.c $(srcdir)/gnu/classpath/examples/java2d/bench.h
+	gcc -g -O0 -Wall -I$(srcdir)/gnu/classpath/examples/java2d $(GTK_CFLAGS) -L$(GTK_LIBS) \
+	-o cairobench $(srcdir)/gnu/classpath/examples/java2d/bench.c
+
+clean:
+	rm -f gnu/classpath/examples/java2d/bench

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

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/Makefile.jawt.in (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/Makefile.jawt.in Thu Nov  8 16:56:19 2007
@@ -0,0 +1,29 @@
+# @configure_input@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+includedir = @includedir@
+libdir = @libdir@
+pkglibdir = $(libdir)/@PACKAGE@
+
+all: gnu/classpath/examples/jawt/DemoJAWT.class libDemoJAWT.so
+	@echo "RUN with:"
+	@echo "  LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:.:$(pkglibdir) jamvm \\"
+	@echo "    gnu.classpath.examples.jawt.DemoJAWT"
+
+gnu/classpath/examples/jawt/DemoJAWT.class: gnu/classpath/examples/jawt/DemoJAWT.java
+	gcj -C gnu/classpath/examples/jawt/DemoJAWT.java
+
+DemoJAWT.h: gnu/classpath/examples/jawt/DemoJAWT.class
+	gcjh -jni gnu.classpath.examples.jawt.DemoJAWT -o DemoJAWT.h
+
+libDemoJAWT.so: gnu/classpath/examples/jawt/DemoJAWT.c DemoJAWT.h
+	gcc -g -O0 -Wall -I. -I/usr/X11R6/include -L. -L/usr/X11R6/lib \
+	-I$(includedir) -L$(pkglibdir) \
+	-lX11 -ljawtgnu -shared -o libDemoJAWT.so \
+	gnu/classpath/examples/jawt/DemoJAWT.c
+
+clean:
+	rm -f DemoJAWT.h
+	rm -f gnu/classpath/examples/jawt/DemoJAWT*.class
+	rm -f libDemoJAWT.so

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

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/README (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/README Thu Nov  8 16:56:19 2007
@@ -0,0 +1,89 @@
+This directory contains example programs that show how the GNU Classpath
+library can be used.
+
+Each example has its own package under gnu.classpath.examples and has a
+class Demo which contains a main() method to run that particular example.
+
+The examples can be compiled and run with gcj as follows:
+
+  gcj -o swingdemo --main=gnu.classpath.examples.swing.Demo \
+      gnu/classpath/examples/swing/Demo.java \
+      gnu/classpath/examples/swing/GNULookAndFeel.java
+  ./swingdemo
+
+Or with a traditional byte code interpreter like:
+
+  gcj -C gnu/classpath/examples/awt/Demo.java
+  gij gnu.classpath.examples.awt.Demo
+
+The installation also comes with an examples.zip archive that contains
+all needed resources and compiled byte code class files that can be
+run as follows:
+
+  kaffe -classpath examples.zip gnu.classpath.examples.awt.Demo
+  kaffe -classpath examples.zip gnu.classpath.examples.swing.Demo
+
+The jawt Demo needs some extra support library that currently needs to be
+build by hand.  The following assumes GNU Classpath was installed in
+/usr/local/classpath, if you installed it somewhere else then adjust the
+-I and -L paths accordingly. The included Makefile.jawt is setup this way.
+
+You can invoke it with:
+
+	make -f Makefile.jawt
+
+Or you can compile by hand as follows:
+
+  gcj -C gnu/classpath/examples/jawt/DemoJAWT.java
+  gcjh -jni gnu.classpath.examples.jawt.DemoJAWT -o DemoJAWT.h
+  gcc -g -O0 -Wall -I. -I/usr/X11R6/include -L. -L/usr/X11R6/lib \
+    -I/usr/local/classpath/include -L/usr/local/classpath/lib/classpath \
+    -lX11 -ljawtgnu -shared -o libDemoJAWT.so \
+    gnu/classpath/examples/jawt/DemoJAWT.c
+
+You can then run the example as follows:
+
+  export LD_LIBRARY_PATH=.:/usr/local/classpath/lib/classpath
+  jamvm gnu.classpath.examples.jawt.DemoJAWT
+
+The java2d benchmarking demos include a GTK widget to measure the native
+speed of some basic java2d options, without the JNI overhead.
+
+You can invoke it with:
+
+	make -f Makefile.java2d
+
+Or you can compile by hand as follows:
+
+  gcc -g -O0 -Wall -I./gnu/classpath/examples/java2d \
+    -o cairobench gnu/classpath/examples/java2d/bench.c \
+    `pkg-config --libs --cflags gtk+-2.0`
+
+You can then run the example as follows:
+
+  ./cairobench
+
+All example code is distributed under the GNU General Public License (GPL).
+
+The example icons used in some of the examples come from gnome-icon-theme
+version 1.2.3 and are also distributed under the GPL.
+All these images are stored in the directory gnu/classpath/examples/icons/.
+
+More free icons can be found in the gnome-icon-theme package:
+http://ftp.gnome.org/pub/GNOME/sources/gnome-icon-theme/
+
+
+GNU Classpath examples are 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 examples are distributed in the hope that they will be
+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 examples; see the file COPYING.  If not,
+write to the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,201 @@
+/* Demo.java -- Shows how to use Classpath transient naming service.
+   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. */
+
+
+package gnu.classpath.examples.CORBA.NamingService;
+
+import gnu.CORBA.IOR;
+import gnu.CORBA.NamingService.NamingServiceTransient;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+import org.omg.CosNaming.Binding;
+import org.omg.CosNaming.BindingHolder;
+import org.omg.CosNaming.BindingIterator;
+import org.omg.CosNaming.BindingIteratorHolder;
+import org.omg.CosNaming.BindingListHolder;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextExt;
+import org.omg.CosNaming.NamingContextExtHelper;
+import org.omg.CosNaming.NamingContextHelper;
+
+/**
+ * A simple test of the naming service.
+ *
+ * The main class of the GNU Classpath transient naming service is
+ * {@link gnu.CORBA.NamingService}. This class must be started
+ * before starting this example.
+ *
+ * This example should interoperate as with GNU Classpath naming
+ * service, as with Sun Microsystems transient and persistent
+ * naming services, included in releases 1.3 and 1.4 (tnameserv and
+ * orbd). To work with this example, the naming service must
+ * be started on the local host, at the port 900.
+ *
+ * The persistent naming service is currently under development.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class Demo
+{
+  public static void main(String[] an_args)
+  {
+    // We create the following naming graph:
+    // <ROOT CONTEXT>
+    //  |
+    //  +--- <c.d context>
+    //  |     |
+    //  |     +--- obj
+    //  |
+    //  +--- xobj
+    //
+    // Where both obj and xobj are CORBA objects, representing the
+    // default naming service.
+    //
+    System.out.println("Starting the GNU Classpath " +
+                       "built-in transient naming service"
+                      );
+    
+    final String[] args = an_args;
+
+    new Thread()
+      {
+        public void run()
+        {
+          NamingServiceTransient.main(args);
+        }
+      }.start();
+
+    System.out.println("Waiting for three seconds for naming service to start:");
+    try
+      {
+        Thread.sleep(3000);
+      }
+    catch (InterruptedException ex)
+      {
+      }
+
+    try
+      {
+        ORB orb = ORB.init(args, null);
+
+        Object no = orb.resolve_initial_references("NameService");
+
+        System.out.println("Naming service IOR:" + orb.object_to_string(no));
+
+        System.out.println(IOR.parse(orb.object_to_string(no)));
+
+        NamingContextExt namer = NamingContextExtHelper.narrow(no);
+
+        System.out.println("Naming service: " + namer.getClass().getName());
+
+        NamingContext second = namer.new_context();
+
+        namer.rebind_context(namer.to_name("c.d"), second);
+        namer.rebind(namer.to_name("xobj"), no);
+
+        second.rebind(namer.to_name("obj"), no);
+
+        NamingContext nsec =
+          NamingContextHelper.narrow(namer.resolve_str("c.d"));
+
+        System.out.println(namer.resolve(namer.to_name("c.d/obj")));
+
+        // In all cases, this must be the same object (the naming
+        // service itself).
+        System.out.println(nsec.resolve(new NameComponent[]
+                                        {
+                                          new NameComponent("obj", "")
+                                        }
+                                       )
+                          );
+        System.out.println(namer.resolve_str("xobj"));
+
+        // In all cases, this must be the same object (the naming
+        // service itself).
+        System.out.println(namer.resolve(new NameComponent[]
+                                         {
+                                           new NameComponent("c", "d"),
+                                           new NameComponent("obj", "")
+                                         }
+                                        )
+                          );
+
+        System.out.println(namer.resolve_str("c.d/obj"));
+
+        System.out.println("Test binding list iterator:");
+
+        BindingListHolder lh = new BindingListHolder();
+        BindingIteratorHolder lih = new BindingIteratorHolder();
+
+        namer.list(0, lh, lih);
+
+        BindingIterator iter = lih.value;
+        BindingHolder binding = new BindingHolder();
+
+        while (iter.next_one(binding))
+          {
+            Binding b = binding.value;
+            System.out.println("NAME: " + namer.to_string(b.binding_name) +
+                               " TYPE " + b.binding_type.value()
+                              );
+          }
+
+        System.out.println("Testing binding list:");
+
+        iter.destroy();
+
+        namer.list(Integer.MAX_VALUE, lh, lih);
+
+        for (int i = 0; i < lh.value.length; i++)
+          {
+            Binding b = lh.value [ i ];
+            System.out.println("NAME: " + namer.to_string(b.binding_name) +
+                               " TYPE " + b.binding_type.value()
+                              );
+          }
+      }
+    catch (Exception ex)
+      {
+        ex.printStackTrace();
+        System.exit(1);
+      }
+
+    System.exit(0);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,102 @@
+/* Demo.java -- Demonstrates simple CORBA client-server communications.
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication;
+
+import java.io.File;
+
+import gnu.classpath.examples.CORBA.SimpleCommunication.communication.DirectTest;
+import gnu.classpath.examples.CORBA.SimpleCommunication.communication.RequestTest;
+
+
+/**
+ * This sample illustrates the CORBA communication between server
+ * and client. In this simple example both server and client are
+ * started on the same virtual machine. For the real interoperability
+ * tests, however, the server is started on the platform (library+jvm) of
+ * one vendor, and the client on the platform of another vendor.
+ *
+ * The interoperability is currently tested with Sun Microystems
+ * jre 1.4.
+ *
+ * This example required the current folder to be writable to pass
+ * the IOR references via shared file.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class Demo
+{
+  public static void main(final String[] args)
+  {
+    File ior = new File("IOR.txt");
+    if (ior.exists())
+      ior.delete();
+
+    // Start the server.
+    new Thread()
+    {
+      public void run()
+      {
+        DemoServer.start_server(args);
+      }
+    }.start();
+
+    System.out.print("Waiting for the server to start ");
+    while (!ior.exists())
+      {
+        // Pause some time for the server to start.
+        try
+          {
+            Thread.sleep(200);
+          }
+        catch (InterruptedException ex)
+          {
+          }
+        System.out.print(".");
+      }
+    System.out.println("ok.");
+    System.out.println();    
+
+    // Test the stream oriented communication.
+    DirectTest.main(args);
+    // Test the request oriented communication.
+    RequestTest.main(args);
+
+    System.exit(0);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,118 @@
+/* DemoServer.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication;
+
+import gnu.classpath.examples.CORBA.SimpleCommunication.communication.DemoServant;
+
+import org.omg.CORBA.ORB;
+
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+
+/**
+ * This is the server class that handles the client requests,
+ * delegating the functionality to the {@link DemoServant}.
+ *
+ * When starting, the server writes the IOR.txt file into the current
+ * folder. With the information, stored in this file, the server
+ * should be reachable over Internet, unless blocked by security tools.
+ *
+ * This code is tested for interoperability with Sun Microsystems
+ * java implementation 1.4.2 (08.b03). Server, client of both can
+ * be started either on Sun's or on Classpath CORBA implementation,
+ * in any combinations.
+ *
+ * BE SURE TO START THIS SERVER BEFORE STARTING THE CLIENT.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class DemoServer
+{
+
+  public static void main(String[] args)
+  {
+    start_server(args);
+  }
+
+  public static ORB start_server(String[] args)
+  {
+    try
+      {
+        // Create and initialize the ORB.
+        final ORB orb = org.omg.CORBA.ORB.init(args, null);
+
+        // Create the servant and register it with the ORB.
+        DemoServant tester = new DemoServant();
+        orb.connect(tester);
+
+        // Storing the IOR reference.
+        String ior = orb.object_to_string(tester);
+        System.out.println("IOR: " + ior);
+
+        gnu.CORBA.IOR ii = gnu.CORBA.IOR.parse(ior);
+        System.out.println(ii);
+
+        // The file IOR.txt in the current folder will be used
+        // to find the object by clients.
+        FileOutputStream f = new FileOutputStream("IOR.txt");
+        PrintStream p = new PrintStream(f);
+        p.print(ior);
+        p.close();
+
+        System.out.println("The test server ready and waiting ...");
+
+        new Thread()
+          {
+            public void run()
+            {
+              // Start the thread, serving the invocations from clients.
+              orb.run();
+            }
+          }.start();
+
+        return orb;
+      }
+    catch (Exception e)
+      {
+        System.err.println("ERROR: " + e);
+        e.printStackTrace(System.out);
+        return null;
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,230 @@
+/* DemoServant.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+
+/**
+ * This class handles the actual server functionality in this test
+ * application. When the client calls the remote method, this
+ * finally results calling the method of this class.
+ *
+ * The parameters, passed to the server only, are just parameters of the
+ * java methods. The parameters that shuld be returned to client
+ * are wrapped into holder classes.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class DemoServant
+  extends _DemoTesterImplBase
+{
+  /**
+   * The field, that can be set and checked by remote client.
+   */
+  private int m_theField = 17;
+
+  /**
+   * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+   * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+   * encodings. Returs they generalization as a wide string.
+   */
+  public String passCharacters(String wide, String narrow)
+  {
+    System.out.println("SERVER: **** Wide and narrow string test.");
+    System.out.println("SERVER:   Received '" + narrow + "' and '" + wide +
+                       "'"
+                      );
+
+    return "return '" + narrow + "' and '" + wide + "'";
+  }
+
+  /**
+   * Accept and return parameters, having various types.
+   */
+  public int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short,
+                        StringHolder a_string, DoubleHolder a_double
+                       )
+  {
+    System.out.println("SERVER: ***** Test passing multiple parameters");
+    System.out.println("SERVER:   Received:");
+    System.out.println("SERVER:   octet " + an_octet.value);
+    System.out.println("SERVER:   short " + a_short.value);
+    System.out.println("SERVER:   string " + a_string.value);
+
+    // Returning incremented values.
+    an_octet.value++;
+    a_short.value++;
+
+    // OUT parameter, return only.
+    a_double.value = 1;
+    a_string.value += " [return]";
+    return 452572;
+  }
+
+  /**
+   * Accept and return the string arrays.
+   */
+  public String[] passStrings(String[] args)
+  {
+    System.out.println("SERVER: ***** Transferring string arrays");
+
+    String[] rt = new String[ args.length ];
+    for (int i = 0; i < args.length; i++)
+      {
+        System.out.println("SERVER:   " + args [ i ]);
+
+        // Returning the changed content.
+        rt [ i ] = args [ i ] + ":" + args [ i ];
+      }
+    return rt;
+  }
+
+  /**
+   * Accept and return the structures.
+   */
+  public StructureToReturn passStructure(StructureToPass in_structure)
+  {
+    System.out.println("SERVER: ***** Transferring structures");
+    System.out.println("SERVER:   Received " + in_structure.a + ":" +
+                       in_structure.b
+                      );
+
+    // Create and send back the returned structure.
+    StructureToReturn r = new StructureToReturn();
+    r.c = in_structure.a + in_structure.b;
+    r.n = 555;
+    r.arra = new int[] { 11, 22, 33 };
+    return r;
+  }
+
+  /**
+   * Pass and return the tree structure
+   */
+  public void passTree(TreeNodeHolder tree)
+  {
+    System.out.println("SERVER: ***** Transferring tree");
+
+    StringBuffer b = new StringBuffer();
+
+    // This both creates the tree string representation
+    // and changes the TreeNode names.
+    getImage(b, tree.value);
+    System.out.println("SERVER:   The tree was: " + b + ", returning changed.");
+  }
+
+  /**
+   * Just prints the hello message.
+   */
+  public void sayHello()
+  {
+    System.out.println("SERVER: ***** Hello, world!");
+  }
+
+  /**
+   * Get the value of our field.
+   */
+  public int theField()
+  {
+    System.out.println("SERVER: ***** Getting the field value, " + m_theField);
+    return m_theField;
+  }
+
+  /**
+   * Set the value of our field.
+   */
+  public void theField(int a_field)
+  {
+    System.out.println("SERVER: ***** Setting the field value to " + a_field);
+    m_theField = a_field;
+  }
+
+  /**
+   * Throw an exception.
+   *
+   * @param parameter specifies which exception will be thrown.
+   *
+   * @throws WeThrowThisException for the non negative parameter.
+   * @throws BAD_OPERATION for the negative parameter.
+   */
+  public void throwException(int parameter)
+                      throws WeThrowThisException
+  {
+    System.out.println("SERVER: ***** Testing exceptions");
+    if (parameter > 0)
+      {
+        System.out.println("SERVER:   Throwing the user exception, " +
+                           "specific field = "+parameter
+                          );
+        throw new WeThrowThisException(parameter);
+      }
+    else
+      {
+        System.out.println("SERVER:   Throwing " +
+                           "the BAD_OPERATION, minor 456, completed"
+                          );
+        throw new BAD_OPERATION(456, CompletionStatus.COMPLETED_YES);
+      }
+  }
+
+  /**
+   * Visit all tree nodes, getting the string representation
+   * and adding '++' to the TreeNode names.
+   *
+   * @param b the buffer to collect the string representation.
+   * @param n the rott tree TreeNode.
+   */
+  private void getImage(StringBuffer b, TreeNode n)
+  {
+    b.append(n.name);
+    n.name = n.name + "++";
+    b.append(": (");
+
+    for (int i = 0; i < n.children.length; i++)
+      {
+        getImage(b, n.children [ i ]);
+        b.append(' ');
+      }
+    b.append(") ");
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,111 @@
+/* DemoTester.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+
+/**
+ * The interface of our remote object. Some IDL compiles split it
+ * into "DemoTester" and "comTesterOperations", but we do not see
+ * much sense in doing this here.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public interface DemoTester
+{
+  /**
+   * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+   * Both types are mapped into java String.
+   *
+   * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+   * encodings.
+   */
+  String passCharacters(String wide, String narrow);
+
+  /**
+   * Passes various parameters in both directions.
+   * The parameters that must return the value are wrapped in holders.
+   */
+  int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short,
+                 StringHolder a_string, DoubleHolder a_double
+                );
+
+  /**
+   * Passes and returns the string sequence (flexible length).
+   */
+  String[] passStrings(String[] arg);
+
+  /**
+   * Passes and returns the structures.
+   */
+  StructureToReturn passStructure(StructureToPass in_structure);
+
+  /**
+   * Pass and return the tree structure
+   *
+   * @param tree the root TreeNode of the tree.
+   */
+  void passTree(TreeNodeHolder tree);
+
+  /**
+   * Just prints the "Hello" message.
+   */
+  void sayHello();
+
+  /**
+   * Gets the value of the field in our object.
+   */
+  int theField();
+
+  /**
+   * Sets the value for the field in our object.
+   */
+  void theField(int newTheField);
+
+  /**
+   *  Throws either 'WeThrowThisException' with the 'ourField' field
+   *  initialised to the passed positive value
+   *  or system exception (if the parameter is zero or negative).
+   */
+  void throwException(int parameter)
+               throws WeThrowThisException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,344 @@
+/* DirectTest.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+import org.omg.CORBA.UserException;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+/**
+ * This code uses CORBA to call various methods of the remote object,
+ * passing data structures in both directions. It finds the server by
+ * reading the IOR.txt file that must be present in the folder,
+ * where the program has been started.
+ *
+ * The IOR.txt file is written by the server
+ * {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}.
+ * The server should be reachable over Internet, unless blocked by
+ * security tools.
+ *
+ * This code is tested for interoperability with Sun Microsystems
+ * java implementation 1.4.2 (08.b03). Server, client of both can
+ * be started either on Sun's or on Classpath CORBA implementation,
+ * in any combinations.
+ *
+ * BE SURE TO START THE SERVER BEFORE STARTING THE CLIENT.
+ *
+ * This version uses direct casting. This is the most convenient
+ * method, but it is normally used together with the IDL compiler.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class DirectTest
+{
+  /*
+  * The IOR.txt file, used to find the server and the object on the server. is written when starting the accompanying
+  */
+  public static final String IOR_FILE = "IOR.txt";
+
+  /**
+   * The invocation target.
+   */
+  DemoTester object;
+
+  /**
+   * Get the object reference.
+   */
+  public static void main(String[] args)
+  {
+    try
+      {
+        ORB orb = org.omg.CORBA.ORB.init(args, null);
+
+        File f = new File(IOR_FILE);
+        char[] c = new char[ (int) f.length() ];
+        FileReader fr = new FileReader(f);
+        fr.read(c);
+        fr.close();
+
+        String ior = new String(c);
+        DirectTest we = new DirectTest();
+        we.object = (DemoTester) orb.string_to_object(ior);
+        we.Demo();
+        orb.shutdown(false);
+      }
+    catch (IOException ex)
+      {
+        System.out.println("Cannot find or read the IOR file " +
+                           "in the current folder"
+                          );
+        ex.printStackTrace();
+      }
+  }
+
+  /** Run all demos. */
+  public void Demo()
+  {
+    testHello();
+    testField();
+    testParameters();
+    testStringArray();
+    testStructure();
+    testWideNarrowStrings();
+    testTree();
+    testSystemException();
+    testUserException();
+  }
+
+  /**
+   * Test the field getter/setter.
+   */
+  public void testField()
+  {
+    System.out.println("***** Test the remote field getter/setter.");
+    System.out.println("The field value is now " + object.theField());
+    System.out.println("Setting it to 555");
+    object.theField(555);
+    System.out.println("The field value is now " + object.theField());
+  }
+
+  /** The simple invocation of the parameterless remote method. */
+  public void testHello()
+  {
+    System.out.println("***** Say hello (see the server console).");
+    object.sayHello();
+  }
+
+  /**
+   * Test passing multiple parameters in both directions.
+   */
+  public void testParameters()
+  {
+    System.out.println("***** Pass multiple parameters.");
+
+    // Holder classes are required to simulate passing
+    // "by reference" (modification is returned back to the server).
+    ByteHolder a_byte = new ByteHolder((byte) 0);
+    ShortHolder a_short = new ShortHolder((short) 3);
+    StringHolder a_string = new StringHolder("[string 4]");
+
+    // This is an 'out' parameter; the value must not be passed to servant.
+    DoubleHolder a_double = new DoubleHolder(56.789);
+
+    int returned = object.passSimple(a_byte, 2, a_short, a_string, a_double);
+
+    System.out.println("  Returned value " + returned);
+    System.out.println("  Returned parameters: ");
+    System.out.println("  octet " + a_byte.value);
+    System.out.println("  short " + a_short.value);
+    System.out.println("  string '" + a_string.value+"'");
+    System.out.println("  double " + a_double.value);
+  }
+
+  /**
+   * Test passing the string array, flexible size.
+   */
+  public void testStringArray()
+  {
+    System.out.println("***** Pass string array.");
+
+    String[] x = new String[] { "one", "two" };
+
+    // The array is passed as CORBA sequence, variable size is supported.
+    String[] y = object.passStrings(x);
+
+    for (int i = 0; i < y.length; i++)
+      {
+        System.out.println("  Passed " + x [ i ] + ", returned: " + y [ i ]);
+      }
+  }
+
+  /**
+   * Test passing the structures.
+   */
+  public void testStructure()
+  {
+    System.out.println("***** Pass structure");
+
+    StructureToPass arg = new StructureToPass();
+    arg.a = "A";
+    arg.b = "B";
+
+    StructureToReturn r = object.passStructure(arg);
+
+    System.out.println("  Fields of the returned structure:");
+
+    System.out.println("  c: " + r.c);
+    System.out.println("  n: " + r.n);
+
+    // The field r.arra is declared as the fixed size CORBA array.
+    System.out.println("  r[0]: " + r.arra [ 0 ]);
+    System.out.println("  r[1]: " + r.arra [ 1 ]);
+    System.out.println("  r[3]: " + r.arra [ 2 ]);
+  }
+
+  /**
+   * Test catching the system exception, thrown on the remote side.
+   */
+  public void testSystemException()
+  {
+    System.out.println("**** Test system exception:");
+    try
+      {
+        // Negative parameter = system exception.
+        object.throwException(-55);
+      }
+    catch (BAD_OPERATION ex)
+      {
+        System.out.println("  The expected BAD_OPERATION, minor code " +
+                           ex.minor + ", has been thrown on remote side."
+                          );
+      }
+    catch (UserException uex)
+      {
+        throw new InternalError();
+      }
+  }
+
+  /**
+   * Test passing the tree structure. Any shape of the tree is
+   * supported without rewriting the code.
+   */
+  public void testTree()
+  {
+    // Manually create the tree of nodes:
+    // Root
+    //  +-- a
+    //  |
+    //  +-- b
+    //      +-- ba
+    //      |   |
+    //      |   +-- bac
+    //      |
+    //      +-- bb
+    System.out.println("***** Pass and return the tree.");
+
+    TreeNode n = nod("Root");
+
+    n.children = new TreeNode[] { nod("a"), nod("b") };
+    n.children [ 1 ].children = new TreeNode[] { nod("ba"), nod("bb") };
+    n.children [ 1 ].children [ 0 ].children = new TreeNode[] { nod("bac") };
+
+    TreeNodeHolder nh = new TreeNodeHolder(n);
+
+    // The server should add '++' to each TreeNode name.
+    object.passTree(nh);
+
+    // Convert the returned tree to some strig representation.
+    StringBuffer img = new StringBuffer();
+    getImage(img, nh.value);
+
+    System.out.println("Returned tree: " + img.toString());
+  }
+
+  /**
+   * Test catching the user exception, thrown on the remote side.
+   */
+  public void testUserException()
+  {
+    System.out.println("**** Test user exception:");
+    try
+      {
+        // The user exception contains one user-defined field that will
+        // be initialised to the passed parameter.
+        object.throwException(123);
+        throw new InternalError();
+      }
+    catch (WeThrowThisException uex)
+      {
+        System.out.println("  The user exception with field " + uex.ourField +
+                           ", has been thrown on remote side."
+                          );
+      }
+  }
+
+  /**
+   * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+   * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+   * encodings.
+   */
+  public void testWideNarrowStrings()
+  {
+    System.out.println("**** Test 8 bit and 16 bit char strings");
+
+    String r = object.passCharacters("wide string", "narrow string");
+    System.out.println("  returned: '" + r + "'");
+  }
+
+  /**
+   * Get the string representation of the passed tree.
+   * @param b the string buffer to accumulate the representation.
+   * @param n the tree (root TreeNode).
+   */
+  private void getImage(StringBuffer b, TreeNode n)
+  {
+    b.append(n.name);
+    b.append(": (");
+
+    for (int i = 0; i < n.children.length; i++)
+      {
+        getImage(b, n.children [ i ]);
+        b.append(' ');
+      }
+    b.append(") ");
+  }
+
+  /**
+   * Create a TreeNode with the given header.
+   *
+   * @param hdr the TreeNode header.
+   * @return the created TreeNode.
+   */
+  private TreeNode nod(String hdr)
+  {
+    TreeNode n = new TreeNode();
+    n.children = new TreeNode[ 0 ];
+    n.name = hdr;
+
+    return n;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,284 @@
+/* RequestTest.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.UnknownUserException;
+
+/**
+ * This code uses CORBA to call various methods of the remote object,
+ * passing data structures in both directions. It finds the server by
+ * reading the IOR.txt file that must be present in the folder,
+ * where the program has been started.
+ *
+ * The IOR.txt file is written by the server
+ * {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}.
+ * The server should be reachable over Internet, unless blocked by
+ * security tools.
+ *
+ * This code is tested for interoperability with Sun Microsystems
+ * java implementation 1.4.2 (08.b03). Server, client of both can
+ * be started either on Sun's or on Classpath CORBA implementation,
+ * in any combinations.
+ *
+ * BE SURE TO START THE SERVER BEFORE STARTING THE CLIENT.
+ *
+ * Test invocations using org.omg.CORBA.Request. The methods are
+ * called by "name", like in java.lang.reflect.
+ * No need to have the local pre-compiled stub classes.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class RequestTest
+{
+  /*
+  * The IOR.txt file, used to find the server and the object on the server. is written when starting the accompanying
+  */
+  public static final String IOR_FILE = "IOR.txt";
+
+  /**
+   * The Object Request Brocker, used for various CORBA operations.
+   */
+  ORB orb;
+
+  /**
+   * Our remote object - the invocation target.
+   */
+  org.omg.CORBA.Object object;
+
+  /**
+   * Prepare for work. Read the file IOR.txt in the current folder
+   * and find the server using its information.
+   */
+  public static void main(String[] args)
+  {
+    RequestTest we = new RequestTest();
+
+    we.orb = org.omg.CORBA.ORB.init(new String[ 0 ], null);
+
+    char[] c = null;
+    try
+      {
+        File f = new File(IOR_FILE);
+        c = new char[ (int) f.length() ];
+
+        FileReader fr = new FileReader(f);
+        fr.read(c);
+        fr.close();
+      }
+    catch (IOException ex)
+      {
+        System.out.println("Unable to write the IOR.txt into the current folder");
+        ex.printStackTrace();
+      }
+
+    String ior = new String(c);
+
+    we.object = we.orb.string_to_object(ior);
+    we.Demo();
+    we.orb.shutdown(false);
+  }
+
+  /** Run all demos. */
+  public void Demo()
+  {
+    testHello();
+    try
+      {
+        testParameters();
+      }
+    catch (Exception ex)
+      {
+        // Not expected.
+        throw new InternalError();
+      }
+    testSystemException();
+    testWideNarrowStrings();
+  }
+
+  /**
+   * Send the hello message, one way.
+   */
+  public void testHello()
+  {
+    System.out.println("***** Test 'HELLO WORLD' (see the server console).");
+
+    Request hello =
+      object._create_request(null, "sayHello", orb.create_list(0), null);
+
+    // No response expected.
+    hello.send_oneway();
+  }
+
+  /**
+   * Test passing various parameters in both directions.
+   */
+  public void testParameters()
+                      throws Exception
+  {
+    System.out.println("***** Test passing multiple parameters:");
+
+    Request r =
+      object._create_request(null, "passSimple", orb.create_list(0), null);
+
+    r.add_inout_arg().insert_octet((byte) 0);
+    r.add_in_arg().insert_long(2);
+    r.add_inout_arg().insert_short((short) 3);
+    r.add_inout_arg().insert_string("[string 4]");
+    r.add_out_arg().type(orb.get_primitive_tc(TCKind.tk_double));
+
+    NVList para = r.arguments();
+
+    System.out.println(" --- Parameters before invocation: ");
+
+    System.out.println("  octet " + para.item(0).value().extract_octet());
+    System.out.println("  long (in parameter) " +
+                       para.item(1).value().extract_long()
+                      );
+    System.out.println("  short " + para.item(2).value().extract_short());
+    System.out.println("  string " + para.item(3).value().extract_string());
+
+    // For the last parameter, the value is not set.
+    r.set_return_type(orb.get_primitive_tc(TCKind.tk_long));
+
+    r.invoke();
+
+    para = r.arguments();
+
+    System.out.println(" --- Parameters after invocation:");
+
+    System.out.println("  octet " + para.item(0).value().extract_octet());
+    System.out.println("  long (in parameter, must not be changed) " +
+                       para.item(1).value().extract_long()
+                      );
+    System.out.println("  short " + para.item(2).value().extract_short());
+    System.out.println("  string " + para.item(3).value().extract_string());
+    System.out.println("  double " + para.item(4).value().extract_double());
+
+    System.out.println("  Returned value " + r.result().value().extract_long());
+  }
+
+  /**
+   * Test catching the system exception, thrown on the remote side.
+   */
+  public void testSystemException()
+  {
+    System.out.println("**** Test system exception:");
+    try
+      {
+        ExceptionList exList = orb.create_exception_list();
+        exList.add(WeThrowThisExceptionHelper.type());
+
+        Request rq =
+          object._create_request(null, "throwException", orb.create_list(1),
+                                 null, exList, null
+                                );
+
+        rq.add_in_arg().insert_long(-55);
+
+        rq.invoke();
+
+        throw new InternalError();
+      }
+    catch (BAD_OPERATION ex)
+      {
+        System.out.println("  The expected BAD_OPERATION, minor code " +
+                           ex.minor + ", has been thrown on remote side."
+                          );
+      }
+  }
+
+  /**
+   * Test catching the user exception, thrown on the remote side.
+   */
+  public void testUserException()
+  {
+    System.out.println("**** Test user exception:");
+
+    ExceptionList exList = orb.create_exception_list();
+    exList.add(WeThrowThisExceptionHelper.type());
+
+    Request rq =
+      object._create_request(null, "throwException", orb.create_list(1), null,
+                             exList, null
+                            );
+
+    rq.add_in_arg().insert_long(123);
+    rq.invoke();
+
+    UnknownUserException uku = (UnknownUserException) rq.env().exception();
+    WeThrowThisException our_exception = WeThrowThisExceptionHelper.extract(uku.except);
+
+    System.out.println("  Our user exception, field " + our_exception.ourField +
+                       ", has been thrown on remote side."
+                      );
+  }
+
+  /**
+   * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+   * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+   * encodings.
+   */
+  public void testWideNarrowStrings()
+                             throws BAD_OPERATION
+  {
+    System.out.println("**** Test 8 bit and 16 bit char strings");
+
+    Request rq =
+      object._create_request(null, "passCharacters", orb.create_list(0), null);
+
+    rq.add_in_arg().insert_wstring("wide string");
+    rq.add_in_arg().insert_string("narrow string");
+
+    rq.set_return_type(orb.get_primitive_tc(TCKind.tk_wstring));
+
+    rq.invoke();
+
+    System.out.println("  Returned ' " + rq.result().value().extract_wstring());
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,66 @@
+/* StructureToPass.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+
+/**
+ * The data structure, passed from to the server from client in our tests.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class StructureToPass
+  implements org.omg.CORBA.portable.IDLEntity
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /**
+   * The first string, stored in this structure (defined as
+   * "narrow string").
+   */
+  public String a;
+
+  /**
+   * The second string, stored in this structure (define as
+   * "wide" (usually Unicode) string.
+   */
+  public String b;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,104 @@
+/* StructureToPassHelper.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The helper operations for the {@link StructureToPass}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class StructureToPassHelper
+{
+  /**
+   * The repository ID of the {@link StructureToPass}.
+   */
+  private static String id =
+    "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass:1.0";
+
+  /**
+   * Get the repository id.
+   */
+  public static String id()
+  {
+    return id;
+  }
+
+  /**
+   * Read the structure from the CDR stram.
+   */
+  public static StructureToPass read(InputStream istream)
+  {
+    StructureToPass value = new StructureToPass();
+    value.a = istream.read_string();
+    value.b = istream.read_wstring();
+    return value;
+  }
+
+  /**
+   * Get the type code of this structure.
+   */
+  public static synchronized TypeCode type()
+  {
+    StructMember[] members = new StructMember[2];
+    TypeCode member = null;
+    member = OrbRestricted.Singleton.create_string_tc(0);
+    members[0] = new StructMember("a", member, null);
+    member = OrbRestricted.Singleton.create_string_tc(0);
+    members[1] = new StructMember("b", member, null);
+    return OrbRestricted.Singleton.create_struct_tc(StructureToPassHelper.id(),
+                                                    "StructureToPass", members);
+  }
+
+  /**
+   * Write the structure into the CDR stream.
+   */
+  public static void write(OutputStream ostream, StructureToPass value)
+  {
+    ostream.write_string(value.a);
+    ostream.write_wstring(value.b);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,37 @@
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+public final class StructureToPassHolder
+  implements Streamable
+{
+  public StructureToPass value;
+
+  public StructureToPassHolder()
+  {
+  }
+
+  public StructureToPassHolder(StructureToPass initialValue)
+  {
+    value = initialValue;
+  }
+
+  public void _read(InputStream i)
+  {
+    value = StructureToPassHelper.read(i);
+  }
+
+  public org.omg.CORBA.TypeCode _type()
+  {
+    return StructureToPassHelper.type();
+  }
+
+  public void _write(OutputStream o)
+  {
+    StructureToPassHelper.write(o, value);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,71 @@
+/* StructureToReturn.java --
+   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. */
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * This data structure is returned from the server to client in our tests.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class StructureToReturn
+  implements IDLEntity
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /**
+   * The string field.
+   */
+  public String c;
+
+  /**
+   * The CORBA array field. This field is handled as the fixed
+   * size CORBA array, but structures can also have the variable
+   * size CORBA sequences.
+   */
+  public int[] arra = new int[3];
+
+  /**
+   * The int (CORBA long) field.
+   */
+  public int n;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,117 @@
+/* StructureToReturnHelper.java --
+   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. */
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * This class defines the helper operations for {@link StructureToReturn}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class StructureToReturnHelper
+{
+  /**
+   * The repository id.
+   */
+  private static String _id =
+    "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn:1.0";
+
+  /**
+   * Return the repository id.
+   */
+  public static String id()
+  {
+    return _id;
+  }
+
+  /**
+   * Read the structure from the CDR stream.
+   */
+  public static StructureToReturn read(InputStream istream)
+  {
+    StructureToReturn value = new StructureToReturn();
+    value.n = istream.read_long();
+    value.c = istream.read_wstring();
+    value.arra = new int[ 3 ];
+
+    // Read the fixed size array.
+    for (int i = 0; i < 3; i++)
+      value.arra [ i ] = istream.read_long();
+    return value;
+  }
+
+  /**
+   * Create the typecode.
+   */
+  public static synchronized TypeCode type()
+  {
+    StructMember[] members = new StructMember[3];
+    TypeCode member = OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_long);
+    members[0] = new StructMember("n", member, null);
+    member = OrbRestricted.Singleton.create_string_tc(0);
+    members[1] = new StructMember("c", member, null);
+    member = OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_long);
+    member = OrbRestricted.Singleton.create_array_tc(3, member);
+    members[2] = new StructMember("arra", member, null);
+    return OrbRestricted.Singleton.create_struct_tc(
+                                                    StructureToReturnHelper.id(),
+                                                    "StructureToReturn",
+                                                    members);
+  }
+
+  /**
+   * Write the structure to the CDR stream.
+   */
+  public static void write(OutputStream ostream, StructureToReturn value)
+  {
+    ostream.write_long(value.n);
+    ostream.write_wstring(value.c);
+
+    // Write the fixed size array.
+    for (int i = 0; i < 3; i++)
+      ostream.write_long(value.arra [ i ]);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,60 @@
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * The holder for the structure, returned from the server.
+ */
+public final class StructureToReturnHolder
+  implements Streamable
+{
+  /**
+   * The enclosed structure.
+   */
+  public StructureToReturn value = null;
+
+  /**
+   * Create the empty holder.
+   */
+  public StructureToReturnHolder()
+  {
+  }
+
+  /**
+   * Crate the holder with the defined initial value.
+   */
+  public StructureToReturnHolder(StructureToReturn initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Read the value from the CDR stream.
+   */
+  public void _read(InputStream in)
+  {
+    value = StructureToReturnHelper.read(in);
+  }
+
+  /**
+   * Get the typecode of this structure.
+   */
+  public TypeCode _type()
+  {
+    return StructureToReturnHelper.type();
+  }
+
+  /**
+   * Write the value from the CDR stream.
+   * @param out
+   */
+  public void _write(OutputStream out)
+  {
+    StructureToReturnHelper.write(out, value);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* TreeNode.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+/**
+ * The support for the tree structure, used in the test of
+ * ability to pass and return the tree structure.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class TreeNode
+  implements org.omg.CORBA.portable.IDLEntity
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /** The TreeNode name */
+  public String name = null;
+
+  /** The TreeNode children. */
+  public TreeNode[] children = null;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,163 @@
+/* TreeNodeHelper.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * This class is used for various helper operations around the
+ * tree {@link} structure.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class TreeNodeHelper
+{
+  /**
+   * The TreeNode repository id, used to identify the structure.
+   */
+  private static String _id =
+    "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode:1.0";
+
+  /**
+   * Caches the typecode, allowing to compute it only once.
+   */
+  private static TypeCode typeCode;
+
+  /**
+   * This is used to handle the recursive object references in
+   * CORBA - supported way. The tree TreeNode definition is recursive,
+   * as the TreeNode contains the sequence of the nodes as its field.
+   */
+  private static boolean active;
+
+  /**
+   * Extract the tree TreeNode from the unversal CORBA wrapper, Any.
+   */
+  public static TreeNode extract(Any a)
+  {
+    return read(a.create_input_stream());
+  }
+
+  /**
+   * Get the TreeNode string identifer.
+   */
+  public static String id()
+  {
+    return _id;
+  }
+
+  /**
+   * Insert the TreeNode into the universal CORBA wrapper, Any.
+   */
+  public static void insert(Any a, TreeNode that)
+  {
+    OutputStream out = a.create_output_stream();
+    a.type(type());
+    write(out, that);
+    a.read_value(out.create_input_stream(), type());
+  }
+
+  /**
+   * Read the TreeNode from the common data reprentation (CDR) stream.
+   */
+  public static TreeNode read(InputStream istream)
+  {
+    TreeNode value = new TreeNode();
+    value.name = istream.read_string();
+
+    int _len0 = istream.read_long();
+    value.children = new TreeNode[ _len0 ];
+    for (int i = 0; i < value.children.length; ++i)
+      value.children [ i ] = TreeNodeHelper.read(istream);
+    return value;
+  }
+
+  /**
+   * Get the TreeNode type code definition.
+   */
+  public static synchronized TypeCode type()
+  {
+    // Compute the type code only once.
+    if (typeCode == null)
+      {
+        synchronized (TypeCode.class)
+          {
+            if (typeCode == null)
+              {
+                // To avoid the infinite recursion loop, the
+                // recursive reference is handled in specific way.
+                if (active)
+                  return OrbRestricted.Singleton.create_recursive_tc(_id);
+                active = true;
+
+                // List all memebers of the TreeNode structure.
+                StructMember[] members = new StructMember[ 2 ];
+                TypeCode memberType;
+                memberType = OrbRestricted.Singleton.create_string_tc(0);
+                members [ 0 ] = new StructMember("name", memberType, null);
+                memberType = OrbRestricted.Singleton.create_recursive_tc("");
+                members [ 1 ] = new StructMember("children", memberType, null);
+                typeCode =
+                  OrbRestricted.Singleton.create_struct_tc(TreeNodeHelper.id(), "TreeNode", members);
+                active = false;
+              }
+          }
+      }
+    return typeCode;
+  }
+
+  /**
+   * Write the TreeNode into the common data reprentation (CDR) stream.
+   */
+  public static void write(OutputStream ostream, TreeNode value)
+  {
+    ostream.write_string(value.name);
+    ostream.write_long(value.children.length);
+    for (int i = 0; i < value.children.length; ++i)
+      TreeNodeHelper.write(ostream, value.children [ i ]);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,100 @@
+/* TreeNodeHolder.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * The TreeNode holder is a wrapper about the TreeNode data structure. It
+ * can be used where the TreeNode must be passed both to and from
+ * the method being called. The same structure holds the tree,
+ * as it can be represented as a root TreeNode with children.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class TreeNodeHolder
+  implements Streamable
+{
+  /**
+   * Stores the TreeNode value.
+   */
+  public TreeNode value;
+
+  /**
+   * Creates the TreeNode holder with the null initial value.
+   */
+  public TreeNodeHolder()
+  {
+  }
+
+  /**
+   * Creates the TreeNode holder with the given initial value.
+   */
+  public TreeNodeHolder(TreeNode initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Reads the TreeNode value from the common data representation (CDR)
+   * stream.
+   */
+  public void _read(InputStream in)
+  {
+    value = TreeNodeHelper.read(in);
+  }
+
+  /**
+   * Writes the TreeNode value into common data representation (CDR)
+   * stream.
+   * @return
+   */
+  public TypeCode _type()
+  {
+    return TreeNodeHelper.type();
+  }
+
+  public void _write(OutputStream out)
+  {
+    TreeNodeHelper.write(out, value);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,75 @@
+/* WeThrowThisException.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * Our user exception, thrown in the tests of handling the exceptions,
+ * thrown on remote side. The exception contains the user - defined
+ * data field that is transferred from client to the server when the
+ * exception is thrown.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class WeThrowThisException
+  extends UserException
+  implements IDLEntity
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /**
+   * Our specific field, transferred to client.
+   */
+  public int ourField;
+
+  /**
+   * Create the exception.
+   *
+   * @param _ourField the value of our specific field.
+   */
+  public WeThrowThisException(int _ourField)
+  {
+    ourField = _ourField;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,118 @@
+/* WeThrowThisExceptionHelper.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+/**
+ * The class, providing various helper operations with our user
+ * exception.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class WeThrowThisExceptionHelper
+{
+  /**
+   * The exception repository id. This name is also used to find the
+   * mapping local CORBA class.
+   */
+  private static String _id =
+    "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException:1.0";
+
+  /**
+   * Get the exception repository id.
+   */
+  public static String id()
+  {
+    return _id;
+  }
+
+  /**
+   * Extract the exception from the given Any where it might be
+   * wrapped.
+   */
+  public static WeThrowThisException extract(Any a)
+  {
+    return read(a.create_input_stream());
+  }
+
+  /**
+   * Read the exception from the CDR stream.
+   */
+  public static WeThrowThisException read(org.omg.CORBA.portable.InputStream istream)
+  {
+    WeThrowThisException value = new WeThrowThisException(0);
+
+    // The repository ID is not used
+    istream.read_string();
+    value.ourField = istream.read_long();
+    return value;
+  }
+
+  /**
+   * Create the type code of this exception.
+   */
+  public static synchronized TypeCode type()
+  {
+    StructMember[] members = new StructMember[ 1 ];
+    TypeCode member = null;
+    member = OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_long);
+    members [ 0 ] = new StructMember("ourField", member, null);
+    return OrbRestricted.Singleton.create_struct_tc(WeThrowThisExceptionHelper.id(),
+                                       "WeThrowThisException", members
+                                      );
+  }
+
+  /**
+   * Write the exception into the CDR stream.
+   */
+  public static void write(org.omg.CORBA.portable.OutputStream ostream,
+                           WeThrowThisException value
+                          )
+  {
+    ostream.write_string(id());
+    ostream.write_long(value.ourField);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,209 @@
+/* _DemoTesterImplBase.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.InvokeHandler;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+
+/**
+ * The base for the class that is actually implementing the functionality
+ * of the object on the server side ({@link DemoServant} of our case).
+ * 
+ * Following CORBA standards, the name of this class must start from
+ * underscore and end by the "ImplBase".
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class _DemoTesterImplBase
+  extends ObjectImpl
+  implements DemoTester, InvokeHandler
+{
+/**
+ * When the server receives the request message from client, it
+ * calls this method.
+ *
+ * @param a_method the method name.
+ * @param in the CDR stream, from where the implementing code must
+ * read the method parameters.
+ * @param rh the response handler, used to get the stream where
+ * the returned values must be written.
+ *
+ * @return the stream, obtained from the response handler.
+ */
+  public OutputStream _invoke(String a_method, InputStream in,
+                              ResponseHandler rh
+                             )
+  {
+    OutputStream out;
+
+    /* Get the field value. */
+    if (a_method.equals("_get_theField"))
+      {
+        int result = (int) 0;
+        result = theField();
+        out = rh.createReply();
+        out.write_long(result);
+      }
+    else
+    /* Set the field value. */
+    if (a_method.equals("_set_theField"))
+      {
+        int newTheField = in.read_long();
+        theField(newTheField);
+        out = rh.createReply();
+      }
+    else
+    /* Logs calls to the file. */
+    if (a_method.equals("sayHello"))
+      {
+        sayHello();
+        out = rh.createReply();
+      }
+    else
+    /* Passes various parameters in both directions. */
+    if (a_method.equals("passSimple"))
+      {
+        ByteHolder an_octet = new ByteHolder();
+        an_octet.value = in.read_octet();
+
+        int a_long = in.read_long();
+        ShortHolder a_short = new ShortHolder();
+        a_short.value = in.read_short();
+
+        StringHolder a_string = new StringHolder();
+        a_string.value = in.read_string();
+
+        DoubleHolder a_double = new DoubleHolder();
+        int result = passSimple(an_octet, a_long, a_short, a_string, a_double);
+        out = rh.createReply();
+        out.write_long(result);
+        out.write_octet(an_octet.value);
+        out.write_short(a_short.value);
+        out.write_string(a_string.value);
+        out.write_double(a_double.value);
+      }
+    else
+    /* Passes the 'wide' (usually Unicode) string and the ordinary string. */
+    if (a_method.equals("passCharacters"))
+      {
+        String wide = in.read_wstring();
+        String narrow = in.read_string();
+        String result = null;
+        result = passCharacters(wide, narrow);
+        out = rh.createReply();
+        out.write_wstring(result);
+      }
+    else
+    /*
+      Throws either 'WeThrowThisException' with the 'ourField' field
+      initialised to the passed positive value
+      or system exception (if the parameter is zero or negative).
+     */
+    if (a_method.equals("throwException"))
+      {
+        try
+          {
+            int parameter = in.read_long();
+            throwException(parameter);
+            out = rh.createReply();
+          }
+        catch (WeThrowThisException exception)
+          {
+            out = rh.createExceptionReply();
+            WeThrowThisExceptionHelper.write(out, exception);
+          }
+      }
+    else
+    /* Passes and returns the structures. */
+    if (a_method.equals("passStructure"))
+      {
+        StructureToPass in_structure = StructureToPassHelper.read(in);
+        StructureToReturn result = null;
+        result = passStructure(in_structure);
+        out = rh.createReply();
+        StructureToReturnHelper.write(out, result);
+      }
+    else
+    /* Passes and returns the string sequence. */
+    if (a_method.equals("passStrings"))
+      {
+        String[] arg = StringSeqHelper.read(in);
+        String[] result = null;
+        result = passStrings(arg);
+        out = rh.createReply();
+        StringSeqHelper.write(out, result);
+      }
+    else
+    /** Pass and return the tree structure */
+    if (a_method.equals("passTree"))
+      {
+        TreeNodeHolder tree = new TreeNodeHolder();
+        tree.value = TreeNodeHelper.read(in);
+        passTree(tree);
+        out = rh.createReply();
+        TreeNodeHelper.write(out, tree.value);
+      }
+
+    else
+      throw new BAD_OPERATION("No method: " + a_method, 0,
+                              CompletionStatus.COMPLETED_MAYBE
+                             );
+
+    return out;
+  }
+
+  /**
+   * Return an array of this object repository ids.
+   */
+  public String[] _ids()
+  {
+    // They are the same as for the stub.
+    return _DemoTesterStub._ids;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,429 @@
+/* _DemoTesterStub.java --
+   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. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+
+/**
+ * The stub (proxy) class, representing the remote object on the client
+ * side. It has all the same methods as the actual implementation
+ * on the server side. These methods contain the code for remote
+ * invocation.
+ * 
+ * Following CORBA standards, the name of this class must start from
+ * underscore and end by the "Stub".
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class _DemoTesterStub
+  extends ObjectImpl
+  implements DemoTester
+{
+  /**
+   * A string array of DemoTester repository ids.
+   */
+  public static String[] _ids =
+    {
+      "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester:1.0"
+    };
+
+  /**
+   * Return an array of DemoTester repository ids.
+   */
+  public String[] _ids()
+  {
+    return _ids;
+  }
+
+  /**
+   * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+   * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+   * encodings.
+   */
+  public String passCharacters(String wide, String narrow)
+  {
+    InputStream in = null;
+    try
+      {
+        // Get the output stream.
+        OutputStream out = _request("passCharacters", true);
+
+        // Write the parameters.
+
+        // The first string is passed as "wide"
+        // (usually 16 bit UTF-16) string.
+        out.write_wstring(wide);
+
+        // The second string is passed as "narrow"
+        // (usually 8 bit ISO8859_1) string.
+        out.write_string(narrow);
+
+        // Do the invocation.
+        in = _invoke(out);
+
+        // Read the method return value.
+        String result = in.read_wstring();
+        return result;
+      }
+    catch (ApplicationException ex)
+      {
+        // The exception has been throws on remote side, but we
+        // do not expect any. Throw the MARSHAL exception.
+        in = ex.getInputStream();
+        throw new MARSHAL(ex.getId());
+      }
+    catch (RemarshalException _rm)
+      {
+        // This exception means that the parameters must be re-written.
+        return passCharacters(wide, narrow);
+      }
+    finally
+      {
+        // Release the resources, associated with the reply stream.
+        _releaseReply(in);
+      }
+  }
+
+  /**
+   * Passes various parameters in both directions. The parameters that
+   * shoud also return the values are wrapped into holders.
+   */
+  public int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short,
+                        StringHolder a_string, DoubleHolder a_double
+                       )
+  {
+    InputStream in = null;
+    try
+      {
+        // Get the stream where the parameters must be written:
+        OutputStream out = _request("passSimple", true);
+
+        // Write the parameters.
+        out.write_octet(an_octet.value);
+        out.write_long(a_long);
+        out.write_short(a_short.value);
+        out.write_string(a_string.value);
+
+        // Invoke the method.
+        in = _invoke(out);
+
+        // Read the returned values.
+        int result = in.read_long();
+
+        // Read the inout and out parameters.
+        an_octet.value = in.read_octet();
+        a_short.value = in.read_short();
+        a_string.value = in.read_string();
+        a_double.value = in.read_double();
+        return result;
+      }
+    catch (ApplicationException ex)
+      {
+        // Handle excepion on remote side.
+        in = ex.getInputStream();
+        throw new MARSHAL(ex.getId());
+      }
+    catch (RemarshalException _rm)
+      {
+        // Handle instruction to resend the parameters.
+        return passSimple(an_octet, a_long, a_short, a_string, a_double);
+      }
+    finally
+      {
+        _releaseReply(in);
+      }
+  }
+
+  /**
+    Passes and returns the string sequence.
+    */
+  public String[] passStrings(String[] arg)
+  {
+    InputStream in = null;
+    try
+      {
+        // Get the stream where the parameters must be written:
+        OutputStream out = _request("passStrings", true);
+
+        // Wrap the string array using the string sequence helper.
+        StringSeqHelper.write(out, arg);
+
+        // Invoke the method.
+        in = _invoke(out);
+
+        // Read the returned result using the string sequence helper.
+        String[] result = StringSeqHelper.read(in);
+        return result;
+      }
+    catch (ApplicationException ex)
+      {
+        // Handle the exception, thrown on remote side.
+        in = ex.getInputStream();
+        throw new MARSHAL(ex.getId());
+      }
+    catch (RemarshalException _rm)
+      {
+        return passStrings(arg);
+      }
+    finally
+      {
+        _releaseReply(in);
+      }
+  }
+
+  /**
+    Passes and returns the structures.
+    */
+  public StructureToReturn passStructure(StructureToPass in_structure)
+  {
+    InputStream in = null;
+    try
+      {
+        // Get the stream where the parameters must be written.
+        OutputStream out = _request("passStructure", true);
+
+        // Write the structure, using its helper.
+        StructureToPassHelper.write(out, in_structure);
+
+        // Invoke the method.
+        in = _invoke(out);
+
+        // Read the returned structer, using another helper.
+        StructureToReturn result = StructureToReturnHelper.read(in);
+        return result;
+      }
+    catch (ApplicationException ex)
+      {
+        in = ex.getInputStream();
+        throw new MARSHAL(ex.getId());
+      }
+    catch (RemarshalException _rm)
+      {
+        return passStructure(in_structure);
+      }
+    finally
+      {
+        _releaseReply(in);
+      }
+  }
+
+  /**
+   * Pass and return the tree structure
+   */
+  public void passTree(TreeNodeHolder tree)
+  {
+    InputStream in = null;
+    try
+      {
+        // Get the stream where the parameters must be written.
+        OutputStream out = _request("passTree", true);
+
+        // Write the tree (TreeNode with its chilred, grandchildren and so on),
+        // using the appropriate helper.
+        TreeNodeHelper.write(out, tree.value);
+
+        // Call the method.
+        in = _invoke(out);
+
+        // Read the returned tree.
+        tree.value = TreeNodeHelper.read(in);
+      }
+    catch (ApplicationException ex)
+      {
+        // Handle eception on remote side.
+        in = ex.getInputStream();
+        throw new MARSHAL(ex.getId());
+      }
+    catch (RemarshalException _rm)
+      {
+        passTree(tree);
+      }
+    finally
+      {
+        _releaseReply(in);
+      }
+  }
+
+  /**
+   * One way call of the remote method.
+   */
+  public void sayHello()
+  {
+    InputStream in = null;
+    try
+      {
+        // As we do not expect any response, the second
+        // parameter is 'false'.
+        OutputStream out = _request("sayHello", false);
+        in = _invoke(out);
+      }
+    catch (ApplicationException ex)
+      {
+        in = ex.getInputStream();
+        throw new MARSHAL(ex.getId());
+      }
+    catch (RemarshalException _rm)
+      {
+        sayHello();
+      }
+    finally
+      {
+        _releaseReply(in);
+      }
+  }
+
+  /**
+   * Get the field value.
+   */
+  public int theField()
+  {
+    InputStream in = null;
+    try
+      {
+        // The special name of operation instructs just to get
+        // the field value rather than calling the method.
+        OutputStream out = _request("_get_theField", true);
+        in = _invoke(out);
+
+        int result = in.read_long();
+        return result;
+      }
+    catch (ApplicationException ex)
+      {
+        in = ex.getInputStream();
+        throw new MARSHAL(ex.getId());
+      }
+    catch (RemarshalException _rm)
+      {
+        return theField();
+      }
+    finally
+      {
+        _releaseReply(in);
+      }
+  }
+
+  /**
+   * Set the field value.
+   */
+  public void theField(int newTheField)
+  {
+    InputStream in = null;
+    try
+      {
+        // The special name of operation instructs just to set
+        // the field value rather than calling the method.
+        OutputStream out = _request("_set_theField", true);
+        out.write_long(newTheField);
+        in = _invoke(out);
+      }
+    catch (ApplicationException ex)
+      {
+        in = ex.getInputStream();
+        throw new MARSHAL(ex.getId());
+      }
+    catch (RemarshalException _rm)
+      {
+        theField(newTheField);
+      }
+    finally
+      {
+        _releaseReply(in);
+      }
+  }
+
+  /**
+   * The server side exception tests.
+   *
+   * @param parameter the server throws the user exception in the case
+   * of the positive value of this argument, and system
+   * exception otherwise.
+   *
+   * @throws WeThrowThisException
+   */
+  public void throwException(int parameter)
+                      throws WeThrowThisException
+  {
+    InputStream in = null;
+    try
+      {
+        // Get stream.
+        OutputStream out = _request("throwException", true);
+
+        // Write parameter.
+        out.write_long(parameter);
+
+        // Call method.
+        in = _invoke(out);
+      }
+    catch (ApplicationException ex)
+      {
+        in = ex.getInputStream();
+
+        // Get the exception id.
+        String id = ex.getId();
+
+        // If this is the user exception we expect to catch, read and throw
+        // it here. The system exception, if thrown, is handled by _invoke.
+        if (id.equals("IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException:1.0")
+           )
+          throw WeThrowThisExceptionHelper.read(in);
+        else
+          throw new MARSHAL(id);
+      }
+    catch (RemarshalException _rm)
+      {
+        throwException(parameter);
+      }
+    finally
+      {
+        _releaseReply(in);
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/README.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/README.html?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/README.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/README.html Thu Nov  8 16:56:19 2007
@@ -0,0 +1,493 @@
+<html>
+  <head>
+    <title>Five-in-a-row v 0.0</title>
+  </head>
+  <body LANG="en-US">
+    <h1>
+      <i>Five-in-a-row
+      </i> 0.0 supplementary documentation
+    </h1>
+    <h3>Introduction and rules
+    </h3>
+    <p>
+      <i>Five-in-a-row
+      </i> is a two player strategy game. The players
+      are connected via network using CORBA-based RMI/IIOP protocol and
+      make they moves with the help of the Swing-based
+      interface. While playing, the users can also chat.
+    </p>
+    <p>The system consists of the single server and any number of
+      interconnected players. The person, willing to play, starts the
+      client and connects the server. The server redirects call to the
+      partner that has previously connected the same server, also willing
+      to play.
+    </p>
+    <p>The game desk is a field where it is possible to set O's
+      and X'es, one per move. The goal is to get five O's in a row while
+      preventing your partner from getting five X's in a row. Vertical,
+      horizontal and diagonal rows are allowed. The system detects the
+      loss-victory situation on the desk, but currently does not serve as a
+      playing partner, requiring at least two human players for this game.
+    </p>
+    <p>Both players can at any time reset the game (restarting it with
+      the same player) or leave the game (disconnecting). The disconnected
+      player can contact the game manager again, requesting to find another
+      partner.
+    </p>
+    <p>Simple as it is, the application has some features of the typical
+      role playing game that frequently just has more states, actions,
+      possible moves and also provides far richer graphics environment. The
+      game manger serves as a World-Wide-Pub where you can always find a
+      partner to play.
+
+      The players can made both unsynchronized (chatting, game reset and
+      leaving) and synchronized (moves) actions. The game state changes
+      while playing, and the set of the available actions depends on the
+      current state. Finally, the mouse and canvas are involved. However
+      using RMI/IIOP machinery allowed to implement all this functionality
+      with just 13 classes (plus 4 generated), all of them being rather
+      simple.
+      
+      This example refers to the standard classes only and must be buildable
+      from your IDE as long as it has any java 1.4 compiler.       
+    </p>
+    <p>
+      The used IIOP protocol must ensure interoperability, allowing players
+      to use different java virtual machines and operating systems.
+      The processors may have the opposite byte order.
+    </p>
+    <h3>Configuration and run
+    </h3>
+    <p>The game manager server executable class is
+      <i>gnu.classpath.examples.CORBA.swing.x5.X5Server
+      </i>. After start,
+      it will print to console the Internet address that must be entered to
+      the client to reach the manager.
+    </p>
+    <p>The client executable class it
+      <i>gnu.classpath.examples.CORBA.swing.x5.Demo
+      </i>.
+    </p>
+    <p>The game should run with GNU Classpath
+      0.19 and Sun Microsystems java 1.5.0_04. Due later fixed bugs it will
+      not run with the older versions of these two implementations.
+    </p>
+    <p>The game manager HTTP server uses port
+      1500. Hence all firewalls between the server and the player must be
+      configured to allow HTTP on 1500. The ports, used by the RMI/IIOP are
+      not persistent. GNU Classpath is configured to take ports 1501, 1502
+      and 1503 (the firewalls must allow to use them for RMI/IIOP). The
+      CORBA implementation other than Classpath may use different port
+      values. Unfortunately, there is no standard method to configure the
+      used port range in a vendor-independent way.
+    </p>
+    <h3>The game server
+    </h3>
+    <p>The game manager is first reachable via http:// protocol (for
+      instance http://123.456.7.89:1500). The simple server at this port
+      always serves much longer string, representing the CORBA stringified
+      object reference (IOR). The
+      <i>Five-in-a-row 
+      </i>client uses
+      this reference to find and access the remote game server object.
+    </p>
+    <p>If the server player queue is empty, it simply queues this player.
+      If the queue is not empty, the server introduces the arrived player
+      and queued player to each other as leaves the them alone. When
+      playing, the two clients communicate with each other directly, so the
+      server is just a “meeting point” where the players can
+      find each other. The game server is a console-only application.
+    </p>
+    <p>The initial server http:// address must be transferred to players
+      by some other means of communication (web chat, E-mail, link in a web
+      site and so on). The server writes this address to the specified
+      file, and the client can also take the default value from the same
+      file. This is convenient when all applications run on a single
+      machine, but also may be used to transfer the address via shared
+      filesystem.
+    </p>
+    <h3>The game client
+    </h3>
+    <p>The clients are Swing-based GUI applications, capable for remote
+      communication with each other and with the game manager. They have a
+      set of predefined states and switch between these states in
+      accordance to the preprogrammed logic. The client states are defined
+      in the
+      <i>State
+      </i> interface. They are displayed in the bottom left
+      corner of the window and are summarized in the following table:
+    </p>
+    <table BORDER=1 CELLPADDING=4 CELLSPACING=0 WIDTH="100%">
+      <thead>
+        <tr BGCOLOR="#ccccff">
+          <th BGCOLOR="#e6e6ff">
+            Our state
+          </th>
+          <th BGCOLOR="#e6e6ff">
+            Partner state
+          </th>
+          <th BGCOLOR="#e6e6ff">
+            Possible actions
+          </th>
+          <th BGCOLOR="#e6e6ff">
+            Comment
+          </th>
+        </tr>
+      </thead>
+      <tbody>
+        <tr>
+          <td>
+            Disconnected
+          </td>
+          <td>
+            Partner not accessible
+          </td>
+          <td>
+            Connect
+          </td>
+          <td>
+            Initial state.
+          </td>
+        </tr>
+        <tr>
+          <td>
+            Queued
+          </td>
+          <td>
+            Partner not accessible
+          </td>
+          <td>
+            Leave
+          </td>
+          <td>
+            Queued by the game manager.
+          </td>
+        </tr>
+        <tr>
+          <td>
+            I think.
+          </td>
+          <td>
+            I wait for your move
+          </td>
+          <td>
+            Make move, reset game, leave, chat.
+          </td>
+          <td>
+            The person who waited for another player to come starts
+            the game first.
+          </td>
+        </tr>
+        <tr>
+          <td>
+            I wait for your move
+          </td>
+          <td>
+            I think
+          </td>
+          <td>
+            Chat, reset game, leave.
+          </td>
+          <td>
+            After the partner makes the move, the state changes to
+            <i>I think
+            </i>, unless the end of game situation is detected by
+            the desk analyzer.
+          </td>
+        </tr>
+        <tr>
+          <td>
+            I have lost
+          </td>
+          <td>
+            I have won
+          </td>
+          <td>
+            Chat, reset game, leave.
+          </td>
+          <td>
+            Can be entered with the help of the desk analyzer only.
+          </td>
+        </tr>
+        <tr>
+          <td>
+            I have won
+          </td>
+          <td>
+            I have lost
+          </td>
+          <td>
+            Chat, reset game, leave
+          </td>
+          <td>
+            Can be entered with the help of the desk analyzer only.
+          </td>
+        </tr>
+        <tr>
+          <td>
+            Error
+          </td>
+          <td>
+            Any
+          </td>
+          <td>
+            Chat, leave
+          </td>
+          <td>
+            This should never happen under normal work, but the demo
+            program may be modified by the user.
+          </td>
+        </tr>
+      </tbody>
+    </table>
+    <br>
+    <br>
+    As it is seen, being in one of the states, the client expects to
+    be the partner client in a certain defined state, and both clients
+    change they states in a synchronized manner. Each state has its own
+    set of the available actions and each action either preserves the
+    current state (chat, reset) or changes it following the rules. For
+    this simple example, the state change rules are obvious.
+    <h3>The used RMI-IIOP architecture
+    </h3>
+    Both player and game manager servants are derived from the
+    <i>org.omg.PortableServer.Servant
+    </i> and, being servants, are simply
+    connected to the
+    <i>POA
+    </i>with
+    <i>POA.servant_to_reference
+    </i>. The
+    first remote object (game manager) is found using the stringified
+    object reference. No naming service is involved.
+</p>
+Where required, the CORBA objects are narrowed into required
+player and game manager interfaces using method
+<i>PortableRemoteObject.narrow(org.omg.CORBA.Object object, Class
+  interface_class)
+</i>, passing the actual interface of the object as
+the second parameter. After narrowing, the remote side obtains
+possibility to invoke remote methods, defined in the interface of
+this object. After the first remote object is found, other objects
+can be simply passed as the method parameters. For instance, the game
+manager introduces another player by passing its reference as a
+parameter to the method
+<i>Player.start_game.
+</i>
+<h3>Class and interface summary
+</h3>
+<table BORDER=1 CELLPADDING=3 CELLSPACING=0 WIDTH="100%">
+  <col>
+  <col>
+  <tr>
+    <th COLSPAN=2 BGCOLOR="#e6e6ff">
+      Executables classes
+    </th>
+  </tr>
+  <tr>
+    <td>
+      Demo
+    </td>
+    <td>
+      The main executable class of the game client.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      X5Server
+    </td>
+    <td>
+      The main executable class of the game manager server.
+    </td>
+  </tr>
+</table>
+<p></p>
+<table BORDER=1 CELLPADDING=3 CELLSPACING=0 WIDTH="100%">
+  <tr BGCOLOR="#ccccff">
+    <th COLSPAN=2 BGCOLOR="#e6e6ff">
+      Interface Summary
+    </th>
+  </tr>
+  <tr>
+    <td>
+      GameManager
+    </td>
+    <td>
+      The game manager interface.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      Player
+    </td>
+    <td>
+      Defines remote methods that are invoked by another player or by
+      the challenge server.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      State
+    </td>
+    <td>
+      Defines the states in that the player can be.
+    </td>
+  </tr>
+</table>
+ 
+<table BORDER=1 CELLPADDING=3 CELLSPACING=0 WIDTH="100%">
+  <col>
+  <col>
+  <tr BGCOLOR="#ccccff">
+    <th COLSPAN=2 BGCOLOR="#e6e6ff">
+      Class Summary
+    </th>
+  </tr>
+  <tr>
+    <td>
+      _GameManager_Stub
+    </td>
+    <td>
+      Normally generated with rmic compiler, this class represents
+      the GameManager Stub on the client side.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      _GameManagerImpl_Tie
+    </td>
+    <td>
+      Normally generated with rmic compiler, this class represents
+      the GameManager Tie on the client side.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      _Player_Stub
+    </td>
+    <td>
+      Generate with rmic, command line rmic -iiop -poa -keep
+      gnu.classpath.examples.CORBA.swing.x5.PlayerImpl (the compiled
+      package must be present in the current folder).
+    </td>
+  </tr>
+  <tr>
+    <td>
+      _PlayerImpl_Tie
+    </td>
+    <td>
+      Generate with rmic, command line rmic -iiop -poa -keep
+      gnu.classpath.examples.CORBA.swing.x5.PlayerImpl (the compiled
+      package must be present in the current folder).
+    </td>
+  </tr>
+  <tr>
+    <td>
+      ChatConstants
+    </td>
+    <td>
+      The chat color code constants, used to indicate who is talking.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      ClientFrame
+    </td>
+    <td>
+      The JFrame of the GUI client.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      GameManagerImpl
+    </td>
+    <td>
+      The manager connects two players into the game.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      IorReader
+    </td>
+    <td>
+      Reads the remote URL.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      OrbStarter
+    </td>
+    <td>
+      Starts the ORBs, involved into this application.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      PlayerImpl
+    </td>
+    <td>
+      The implementation of the PlayerCommunicator, providing the
+      local functionality.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      PlayingDesk
+    </td>
+    <td>
+      Manages actions, related to the game rules and also does all
+      painting.
+    </td>
+  </tr>
+</table>
+<h3>See also
+</h3>
+<p>
+  <a HREF="http://www.javascripter.net/games/xo/xo.htm">http://www.javascripter.net/games/xo/xo.htm
+  </a>
+</p>
+<p>
+  <a HREF="http://www.leepoint.net/notes-java/45examples/55games/five/five.html">http://www.leepoint.net/notes-java/45examples/55games/five/five.html
+  </a>
+</p>
+<p>Copyright
+</p>
+<p>
+  <font COLOR="#b3b3b3">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.
+  </font>
+</p>
+<p>
+  <br>
+  <br>
+</p>
+<p>
+First version written by <a href="http://savannah.gnu.org/users/audriusa">
+Audrius Meškauskas</a>
+</p>
+</body>
+</html>

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,307 @@
+/* CanvasWorld.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+
+/**
+ * The purpose of this simple example is to check if the mouse events are
+ * correctly received in a scrollable canvas and also if the canvas are
+ * correctly repainted. The similar canvas are used in various games and
+ * interactive demonstrations. 
+ * 
+ * The user can set one of the three possible figures with the different
+ * mouse buttons. The figure must be set where the user have clicked the
+ * mouse.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class CanvasWorld
+  extends JComponent
+  implements MouseListener, State
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * Red oval, set by the left mouse button.
+   */
+  public static final int RED = 0;
+
+  /**
+   * Black cross, set by the right mouse button.
+   */
+  public static final int BLACK = 1;
+  
+  /**
+   * Blue and smaller oval, set by the middle mouse button.
+   */
+  public static final int HINT = 2;
+  
+  /**
+   * The message string is displayed at the top of the window.
+   */
+  String message = "Click left, right or middle button in to set the figure";
+  
+  /**
+   * The additinal message, related to the mouse events.
+   */
+  String mouse = "No mouse event so far";
+
+  /**
+   * The grid spacing.
+   */
+  static int W = 16;
+
+  /**
+   * The radius of the dots being painted.
+   */
+  static int R = W / 3;
+
+  /**
+   * The collection of the red dots.
+   */
+  ArrayList reds = new ArrayList();
+
+  /**
+   * The collection of the black crosses.
+   */
+  ArrayList blacks = new ArrayList();
+  
+  /**
+   * The collection of the smaller blue crosses.
+   */
+  ArrayList hints = new ArrayList();
+
+  public CanvasWorld()
+  {
+    try
+      {
+        addMouseListener(this);
+      }
+    catch (Exception e)
+      {
+        throw new AssertionError(e);
+      }
+  }
+
+  /**
+   * Paint this component.
+   */
+  public void paintComponent(Graphics g)
+  {
+    int w = getWidth();
+    int h = getHeight();
+
+    g.setColor(Color.white);
+    g.fillRect(0, 0, w, h);
+
+    drawGrid(w, h, g);
+    
+    g.setColor(Color.black);
+    
+    g.drawString(message, W, W);
+    g.drawString(mouse, W, 2*W);
+    
+    drawFigures(g);
+  }
+
+  /**
+   * Check for the presence of the given point in the collection.
+   */
+  public final boolean pointPresent(int x, int y, Collection in)
+  {
+    Iterator iter = in.iterator();
+    Point p;
+    while (iter.hasNext())
+      {
+        p = (Point) iter.next();
+        if (p.x == x && p.y == y)
+          return true;
+      }
+    return false;
+  }
+
+  public void drawGrid(int w, int h, Graphics g)
+  {
+    g.setColor(Color.lightGray);
+
+    int xs = 2*W+W/2;
+    
+    // Draw vertical lines:
+    for (int x = 0; x < w; x += W)
+      {
+        g.drawLine(x, xs, x, h);
+      }
+
+    // Draw horizontal lines:
+    for (int y = 3*W; y < h; y += W)
+      {
+        g.drawLine(0, y, w, y);
+      }
+      
+    g.setColor(Color.gray);
+  }
+
+  public void drawFigures(Graphics g)
+  {
+    g.setColor(Color.red);
+    drawDots(reds, g, RED);
+
+    g.setColor(Color.black);
+    drawDots(blacks, g, BLACK);
+    
+    g.setColor(Color.blue);
+    drawDots(hints, g, HINT);
+  }
+
+  public Point makePoint(int x, int y)
+  {
+    return new Point(x / W, y / W);
+  }
+
+  /**
+   * Draw a collection of dots (the collor must be set before calling the
+   * method).
+   */
+  public void drawDots(Collection dots, Graphics g, int mode)
+  {
+    Iterator iter = dots.iterator();
+    int x;
+    int y;
+
+    int hW = W / 2;
+    int RR = R * 2;
+    int hR = R / 2;
+    Point p;
+    while (iter.hasNext())
+      {
+        p = (Point) iter.next();
+        x = p.x * W + hW;
+        y = p.y * W + hW;
+
+        if (mode == RED)
+          g.drawOval(x - R, y - R, RR, RR);
+        else if (mode == BLACK)
+          {
+            g.drawLine(x - R, y - R, x + R, y + R);
+            g.drawLine(x - R, y + R, x + R, y - R);
+          }
+        else
+          {
+            // Hint.
+            g.drawOval(x - hR, y - hR, R, R);
+          }
+      }
+  }
+
+  public void mouseClicked(MouseEvent e)
+  {
+    int x = e.getX();
+    int y = e.getY();
+
+    Point p = makePoint(x, y);
+
+    // Ignore clicks on the occupied cells.
+    if (pointPresent(p.x, p.y, reds) || (pointPresent(p.x, p.y, blacks)))
+      {
+        message = "Clicked on the occupied cell.";
+        return;
+      }
+    else
+      message = "Figure set at ["+p.x+","+p.y+"]";
+
+    if (e.getButton() == MouseEvent.BUTTON1)
+      reds.add(p);
+    else if (e.getButton() == MouseEvent.BUTTON3)
+      blacks.add(p);
+    else if (e.getButton() == MouseEvent.BUTTON2)
+      hints.add(p);
+    repaint();
+  }
+
+  public void mouseEntered(MouseEvent m)
+  {
+    mouse = "Mouse entered.";
+    repaint();  
+  }
+
+  public void mousePressed(MouseEvent m)
+  {
+    mouse = "Mouse pressed at "+m.getX()+","+m.getY();
+    repaint();
+  }
+
+  public void mouseReleased(MouseEvent m)
+  {
+    mouse = "Mouse released at "+m.getX()+","+m.getY();    
+    repaint();
+  }
+
+  public void mouseExited(MouseEvent m)
+  {
+    mouse = "Mouse exited";
+    repaint();
+  }
+  
+  public static void main(String[] args)
+  {
+    JFrame frame = new JFrame();
+    CanvasWorld world = new CanvasWorld();
+    world.setPreferredSize(new Dimension(1000,1000));
+    frame.add(new JScrollPane(world));
+    frame.setSize(400, 200);
+    frame.setVisible(true);
+  }
+
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* ChatConstants.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Color;
+
+/**
+ * The chat color code constants, used to indicate who is talking.
+ * Additionally, the red color is reseved for the most important messages,
+ * related to the start and end of the game.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class ChatConstants
+{
+  /**
+   * Messages from the local system.
+   */
+  public static byte SYSTEM = 0;
+
+  /**
+   * Mirrored messsages from the local player.
+   */
+  public static byte SELF = 1;
+
+  /**
+   * Messages from the remote player.
+   */
+  public static byte REMOTE_PLAYER = 2;
+
+  /**
+   * Messages from the game server/
+   */
+  public static byte GAME_SERVER = 3;
+  
+  /**
+   * The array of the used colors.
+   */
+  public static Color[] colors =
+    new Color[]
+    {
+      Color.black, new Color(0, 80, 0), new Color(0, 0, 128), Color.blue
+    };
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,417 @@
+/* ClientFrame.java --
+ 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. */
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.event.*;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+import java.rmi.RemoteException;
+
+import javax.rmi.PortableRemoteObject;
+
+import javax.swing.*;
+import java.awt.Dimension;
+
+/**
+ * The JFrame of the GUI client.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class ClientFrame
+  extends JFrame
+{
+  /**
+   * The size of the playing field.
+   */
+  public final Dimension DESK_SIZE = 
+	new Dimension(624, 352-PlayingDesk.W);
+
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  // Define the application components:
+
+  /**
+   * Central panel where the main action takes place.
+   */
+  PlayingDesk desk = new PlayingDesk();
+
+  /**
+   * The scroll pane for canvas.
+   */
+  JScrollPane scroll = new JScrollPane();
+
+  /**
+   * Will remember the manager IOR.
+   */
+  String mior = "";
+
+  // The bottom panel contains the area that is used both to enter URL and
+  // for chatting.
+  JPanel pnBottom = new JPanel();
+
+  BorderLayout layBottom = new BorderLayout();
+
+  JTextField taUrl = new JTextField();
+
+  // The top primitive chatting panel, composed from labels.
+  JPanel pnChat = new JPanel();
+
+  GridLayout layChat = new GridLayout();
+
+  JLabel lbC3 = new JLabel();
+
+  JLabel lbC2 = new JLabel();
+
+  JLabel lbC1 = new JLabel();
+
+  // The button panel.
+  JPanel pnButtons = new JPanel();
+
+  GridLayout layButtons = new GridLayout();
+
+  JButton bLeave = new JButton();
+
+  JButton bConnect = new JButton();
+
+  JButton bExit = new JButton();
+
+  JButton bReset = new JButton();
+
+  JLabel lbState = new JLabel();
+
+  JButton bChat = new JButton();
+  
+  JButton bPaste = new JButton();
+
+  public ClientFrame()
+  {
+    try
+      {
+        jbInit();
+      }
+    catch (Exception e)
+      {
+        e.printStackTrace();
+      }
+  }
+
+  private void jbInit()
+    throws Exception
+  {
+    desk.frame = this;
+
+    pnBottom.setLayout(layBottom);
+
+    pnChat.setLayout(layChat);
+    layChat.setColumns(1);
+    layChat.setRows(3);
+
+    lbC1.setText("This program needs the game server (see README on how to start it).");
+    lbC2.setText("Enter the game server address (host:port)");
+    lbC3.setText("Pressing \'Connect\' with the empty address will start the server on "
+      + "the local machine.");
+    bLeave.setEnabled(true);
+    bLeave.setToolTipText("Leave if either you have lost or do not want longer to play with "
+      + "this partner.");
+    bLeave.setText("Leave game");
+    bLeave.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        bLeave_actionPerformed(e);
+      }
+    });
+    bConnect.setToolTipText("Connect your playing partner");
+    bConnect.setText("Connect");
+    bConnect.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        bConnect_actionPerformed(e);
+      }
+    });
+    pnButtons.setLayout(layButtons);
+    bExit.setToolTipText("Exit this program");
+    bExit.setText("Exit");
+    bExit.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        bExit_actionPerformed(e);
+      }
+    });
+    layButtons.setHgap(2);
+    bReset.setToolTipText("Restart the game. The partner may choose to exit!");
+    bReset.setText("Reset game");
+    bReset.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        bReset_actionPerformed(e);
+      }
+    });
+    lbState.setText("Disconnected");
+    bChat.setToolTipText("Send message to player. Reuse the address "+
+                         "field to enter the message.");
+    bChat.setText("Chat");
+    bChat.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        bChat_actionPerformed(e);
+      }
+    });
+    
+    bPaste.setText("Paste");
+    bPaste.setToolTipText("Paste, same as Ctrl-V");
+    bPaste.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        bPaste_actionPerformed(e);
+      }
+    });
+    
+    desk.setMaximumSize(DESK_SIZE);
+    desk.setPreferredSize(DESK_SIZE);
+    
+    scroll.getViewport().add(desk, null);
+    getContentPane().add(scroll, BorderLayout.CENTER);
+    getContentPane().add(pnBottom, BorderLayout.SOUTH);
+
+    pnBottom.add(taUrl, BorderLayout.CENTER);
+    pnBottom.add(pnChat, BorderLayout.NORTH);
+
+    pnChat.add(lbC1, null);
+    pnChat.add(lbC2, null);
+    pnChat.add(lbC3, null);
+    pnBottom.add(pnButtons, BorderLayout.SOUTH);
+    pnButtons.add(lbState, null);
+    pnButtons.add(bConnect, null);
+    pnButtons.add(bChat, null);
+    pnButtons.add(bLeave, null);
+    pnButtons.add(bReset, null);
+    pnButtons.add(bExit, null);
+    pnButtons.add(bPaste, null);    
+
+    desk.player.set_current_state(State.DISCONNECTED);
+  }
+
+  /**
+   * Handles exit procedure.
+   */
+  protected void processWindowEvent(WindowEvent e)
+  {
+    super.processWindowEvent(e);
+    if (e.getID() == WindowEvent.WINDOW_CLOSING)
+      {
+        bExit_actionPerformed(null);
+      }
+  }
+
+  /**
+   * Handles the connection procedure.
+   */
+  void bConnect_actionPerformed(ActionEvent e)
+  {
+    try
+      {
+        int state = desk.player.get_current_state();
+
+        if (state == State.DISCONNECTED || state == State.ERROR)
+          {
+            talk(ChatConstants.colors[0], "Connecting...");
+
+            if (desk.manager == null)
+              {
+                mior = taUrl.getText().trim();
+
+                // Obtain the manager object:
+                org.omg.CORBA.Object object = null;
+
+                try
+                  {
+                    object = desk.orb.string_to_object(mior);
+                  }
+                catch (Exception exc)
+                  {
+                    // Maybe CORBA 3.0.3 is not completely implemented?
+                    if (mior.startsWith("http://") || mior.startsWith("ftp://")
+                      || mior.startsWith("file://"))
+                      object = desk.orb.string_to_object(IorReader.readUrl(mior));
+                    else
+                      throw exc;
+                  }
+
+                desk.manager = (GameManager) PortableRemoteObject.narrow(
+                  object, GameManager.class);
+
+                // Export the desk.player as a remote object.
+                PortableRemoteObject.exportObject(desk.player);
+              }
+
+            desk.player.set_current_state(State.QUEUED);
+            desk.manager.requestTheGame(desk.player);
+          }
+
+        // Save the specified IOR for the future use:
+        File gmf = new File(OrbStarter.WRITE_URL_TO_FILE);
+        FileWriter f = new FileWriter(gmf);
+        BufferedWriter b = new BufferedWriter(f);
+
+        b.write(mior);
+        b.close();
+      }
+    catch (Exception ex)
+      {
+        talk(Color.red, "The manager is not reachable by this address.");
+        talk(Color.red, ex.getMessage());
+        desk.player.set_current_state(State.DISCONNECTED);
+      }
+  }
+
+  /**
+   * Display the new message with the given color. Shift the other messages over
+   * the labels.
+   */
+  public void talk(Color color, String text)
+  {
+    lbC1.setText(lbC2.getText());
+    lbC1.setForeground(lbC2.getForeground());
+
+    lbC2.setText(lbC3.getText());
+    lbC2.setForeground(lbC3.getForeground());
+
+    lbC3.setText(text);
+    lbC3.setForeground(color);
+  }
+
+  /**
+   * Exit this program.
+   */
+  void bExit_actionPerformed(ActionEvent e)
+  {
+    try
+      {
+        if (desk.player.get_current_state() != State.DISCONNECTED
+          && desk.player.partner != null)
+          {
+            desk.player.partner.receive_chat(ChatConstants.REMOTE_PLAYER,
+              "I close the program!");
+            desk.player.partner.disconnect();
+          }
+      }
+    catch (RemoteException ex)
+      {
+        // We will print the exception because this is a demo application that
+        // may be modified for learning purposes.
+        ex.printStackTrace();
+      }
+    System.exit(0);
+  }
+
+  void bReset_actionPerformed(ActionEvent e)
+  {
+    if (desk.player.partner != null)
+      {
+        try
+          {
+            desk.player.partner.receive_chat(ChatConstants.REMOTE_PLAYER,
+              "Your partner restarted the game.");
+
+            desk.player.start_game(desk.player.partner, false);
+            desk.player.partner.start_game(desk.player, true);
+          }
+        catch (RemoteException ex)
+          {
+            // We will print the exception because this is a demo application
+            // that
+            // may be modified for learning purposes.
+            ex.printStackTrace();
+          }
+      }
+    else
+      talk(Color.black, "You have not started the game yet.");
+  }
+
+  void bLeave_actionPerformed(ActionEvent e)
+  {
+    desk.player.leave();
+  }
+
+  void bChat_actionPerformed(ActionEvent e)
+  {
+    try
+      {
+        if (desk.player.partner != null)
+          {
+            String message = taUrl.getText();
+            desk.player.partner.receive_chat(ChatConstants.REMOTE_PLAYER, message);
+            talk(ChatConstants.colors[ChatConstants.SELF], message);
+            taUrl.setText("");
+          }
+        else
+          {
+            talk(Color.black, "Sorry, not connected to anybody");
+          }
+      }
+    catch (RemoteException ex)
+      {
+        // We will print the exception because this is a demo application that
+        // may be modified for learning purposes.
+        ex.printStackTrace();
+      }
+  }
+  
+  /**
+   * Work around our keyboard shortcut handling that is still not working
+   * properly.
+   */
+  void bPaste_actionPerformed(ActionEvent e)
+  {
+    taUrl.paste();
+  }  
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,99 @@
+/* Demo.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+/**
+ * The main executable class of the game client.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class Demo
+{
+
+  public static void main(String[] args)
+  {
+    ClientFrame frame = new ClientFrame();
+    frame.setSize(new Dimension(640, 480));
+    frame.setTitle("Make vertical, horizontal or diagonal line of 5 dots. "
+      + "Click mouse to set the dot.");
+    frame.validate();
+
+    // Center the window
+    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+    Dimension frameSize = frame.getSize();
+    if (frameSize.height > screenSize.height)
+      {
+        frameSize.height = screenSize.height;
+      }
+    if (frameSize.width > screenSize.width)
+      {
+        frameSize.width = screenSize.width;
+      }
+    frame.setLocation((screenSize.width - frameSize.width) / 2,
+      (screenSize.height - frameSize.height) / 2);
+    frame.setVisible(true);
+
+    // Set the ior.
+    try
+      {
+        if (OrbStarter.WRITE_URL_TO_FILE != null)
+          {
+            File saved_ior = new File(OrbStarter.WRITE_URL_TO_FILE);
+            if (saved_ior.exists())
+              {
+                FileReader f = new FileReader(saved_ior);
+                String s = new BufferedReader(f).readLine();
+                frame.taUrl.setText(s);
+              }
+          }
+      }
+    catch (Exception e)
+      {
+        // We will print the exception, because this is a demo program -
+        // expected to be modified by user.
+        e.printStackTrace();
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,68 @@
+/* GameManager.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * The game manager interface.
+ * 
+ * Defines the operations of the game server that connects two players into
+ * the game. The game server does not participate in the game itself.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public interface GameManager extends Remote
+{
+  /**
+   * Register the newPlayer as the person who is willing to play. When another
+   * player calls this method, the Manager connects them by calling
+   * {@link PlayerCommunicator#start_game}. The manager provides the partner
+   * and sets (randomly) the starting side.
+   */
+  void requestTheGame(Player newPlayer) throws RemoteException;
+
+  /**
+   * Unregister the player that left and is no longer waiting for a playing
+   * partner to come.
+   * @throws RemoteException
+   */
+  void unregister(Player player) throws RemoteException;
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,135 @@
+/* GameManagerImpl.java --
+ 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. */
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.RemoteException;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+
+/**
+ * The manager connects two players into the game.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class GameManagerImpl
+  implements GameManager
+{
+  /**
+   * The game manager IOR.
+   */
+  static String ior;
+
+  /**
+   * The game manager ORB.
+   */
+  static ORB orb;
+
+  /**
+   * True if the manager started ok.
+   */
+  static boolean ok;
+
+  /**
+   * Another player that is already waiting for the game.
+   */
+  Player queuedPlayer = null;
+
+  public synchronized void requestTheGame(Player newPlayer)
+    throws RemoteException
+  {
+    System.out.println("Game requested");
+
+    if (queuedPlayer == null)
+      {
+        // No other player so far.
+        newPlayer.receive_chat(ChatConstants.GAME_SERVER,
+          "Request registered, waiting for the other player to come...");
+        System.out.println("Player queued.");
+        queuedPlayer = newPlayer;
+      }
+    else if (queuedPlayer.equals(newPlayer))
+      {
+        // The same player applies again.
+        newPlayer.receive_chat(ChatConstants.GAME_SERVER,
+          "No other player so far... Please wait.");
+      }
+    else
+      {
+        // As the queued player waited for the game, we allow him/her
+        // to start the game. This is a reward for waiting.
+        newPlayer.receive_chat(ChatConstants.GAME_SERVER,
+          "The other player is waiting. The game started, your "
+            + "partner begins...");
+        queuedPlayer.receive_chat(ChatConstants.GAME_SERVER,
+          "The other player arrived. Lets play, you begin the game now...");
+
+        newPlayer.start_game(queuedPlayer, false);
+        queuedPlayer.start_game(newPlayer, true);
+
+        queuedPlayer = null;
+        System.out.println("Players connected.");
+      }
+  }
+
+  /**
+   * Unregister the player who left and is no longer waiting for another side.
+   */
+  public void unregister(Player player)
+    throws RemoteException
+  {
+    if (queuedPlayer != null)
+      {
+        // We need to verify the identity of the player being unregistered.
+        // The stubs, being derived from the org.omg.CORBA.Object, have the
+        // method for this. This method compares the player host address,
+        // used port and the object key.
+        if (player instanceof Object && queuedPlayer instanceof Object)
+          {
+            Object a = (Object) player;
+            Object b = (Object) queuedPlayer;
+
+            if (a._is_equivalent(b))
+              queuedPlayer = null;
+          }
+        else
+          queuedPlayer = null;
+      }
+    System.out.println("Unregistering player");
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,124 @@
+/* IorReader.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.DATA_CONVERSION;
+
+/**
+ * Reads the remote URL. Following formal/04-03-12, CORBA should be able to do 
+ * this without the help of this class. However some popular class libraries
+ * are written using the older CORBA specifications and may not handle 
+ * functionality, require by this game. This class substitutes the functionality,
+ * ensuring that these implementations will also start and we will be able
+ * to test the interoperability.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class IorReader
+{
+  /**
+   * Read IOR from the remote URL.
+   */
+  public static String readUrl(String url)
+  {
+    URL u;
+    try
+      {
+        u = new URL(url);
+      }
+    catch (MalformedURLException mex)
+      {
+        throw new BAD_PARAM("Malformed URL: '" + url + "'");
+      }
+
+    try
+      {
+        InputStreamReader r = new InputStreamReader(u.openStream());
+
+        StringBuffer b = new StringBuffer();
+        int c;
+
+        while ((c = r.read()) > 0)
+          b.append((char) c);
+
+        return b.toString().trim();
+      }
+    catch (Exception exc)
+      {
+        DATA_CONVERSION d = new DATA_CONVERSION("Reading " + url + " failed.");
+        throw d;
+      }
+  }
+  
+  /**
+   * Read IOR from the file in the local file system.
+   */
+  public static String readFile(String file)
+  {
+    File f = new File(file);
+    if (!f.exists())
+      {
+        DATA_CONVERSION err = new DATA_CONVERSION(f.getAbsolutePath()
+          + " does not exist.");
+        throw err;
+      }
+    try
+      {
+        char[] c = new char[(int) f.length()];
+        FileReader fr = new FileReader(f);
+        fr.read(c);
+        fr.close();
+        return new String(c).trim();
+      }
+    catch (IOException ex)
+      {
+        DATA_CONVERSION d = new DATA_CONVERSION();
+        d.initCause(ex);
+        throw (d);
+      }
+  }  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,236 @@
+/* OrbStarter.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.RemoteException;
+import java.util.Properties;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.ORB;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.Servant;
+
+/**
+ * Starts the ORBs, involved into this application.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class OrbStarter
+{
+  /**
+   * The game manager name server port. This server allows to access the game
+   * manager by host (IP) and port rather than by the rather long IOR string.
+   */
+  static int MANAGER_NAMER_PORT = 1500;
+	  
+  /**
+   * The used port range (understood and used by GNU Classpath only).
+   */
+  static String USED_PORT_RANGE = "1501-1503";
+	  
+  /**
+   * Specify the file where under start the game manager writes its IOR.
+   * You may specify the path if the game manager and player clients have
+   * access to some share file system or if you prefer to write IOR to
+   * floppy and then read from the floppy on the client side. Both clients
+   * and server will use this constant. Set to null not to write the IOR.
+   */
+  static String WRITE_URL_TO_FILE = "game_manager_ior.txt";	
+	
+  /**
+   * Start the manager ORB.
+   * @return the manager URL if it starts.
+   */
+  public static String startManager(final String[] args)
+  {
+    GameManagerImpl.ior = null;
+    GameManagerImpl.ok = false;
+
+    final Properties p = new Properties();
+    p.put("gnu.CORBA.ListenerPort", USED_PORT_RANGE);
+
+    try
+      {
+        new Thread()
+        {
+          public void run()
+          {
+            try
+              {
+                GameManagerImpl.orb = ORB.init(args, p);
+
+                // Obtain the root poa:
+                POA rootPOA = POAHelper.narrow(GameManagerImpl.orb.resolve_initial_references("RootPOA"));
+
+                GameManagerImpl impl = new GameManagerImpl();
+
+                PortableRemoteObject.exportObject(impl);
+
+                // Construct the tie that is also the servant.
+                Tie tie = new _GameManagerImpl_Tie();
+
+                // Set the invocation target for this tie.
+                tie.setTarget(impl);
+
+                // Obtain the reference to the corresponding CORBA object:
+                org.omg.CORBA.Object object = rootPOA.servant_to_reference((Servant) tie);
+
+                GameManagerImpl.ok = true;
+
+                // Activate the root POA.
+                rootPOA.the_POAManager().activate();
+
+                // Get the IOR URL that must be passed to clients.
+                GameManagerImpl.ior = GameManagerImpl.orb.object_to_string(object);
+
+                GameManagerImpl.orb.run();
+              }
+            catch (Exception exc)
+              {
+                exc.printStackTrace();
+                GameManagerImpl.ior = "Unable to start the ORB: " + exc;
+              }
+          }
+        }.start();
+
+        // Wait the thread to enter orb.run.
+        long t = System.currentTimeMillis();
+        while (GameManagerImpl.ior == null
+          && System.currentTimeMillis() - t < 20000)
+          {
+            Thread.sleep(100);
+          }
+
+        return GameManagerImpl.ior;
+      }
+    catch (Exception e)
+      {
+        e.printStackTrace();
+        return "Exception: " + e;
+      }
+  }
+  
+  /**
+   * Start the client ORB.
+   */
+  public static String startPlayer(final Player player, final PlayingDesk desk)
+  {
+    desk.ior = null;
+    desk.ok = false;
+    
+    final Properties p = new Properties();
+    p.put("gnu.CORBA.ListenerPort", USED_PORT_RANGE);
+    
+    try
+      {
+        new Thread()
+        {
+          public void run()
+          {
+            try
+              {
+                desk.orb = ORB.init(new String[0], p);
+
+                POA rootPOA = POAHelper.narrow(desk.orb.resolve_initial_references("RootPOA"));
+                rootPOA.the_POAManager().activate();
+
+                // Construct the tie.
+                Tie tie = new _PlayerImpl_Tie();
+
+                // Set the implementing class (invocation target).
+                tie.setTarget(new PlayerImpl());
+
+                // Connect the tie as POA servant.
+                org.omg.CORBA.Object object = rootPOA.servant_to_reference((Servant) tie);
+
+                // Get the stringified reference.
+                desk.ior = desk.orb.object_to_string(object);
+
+                // Mark that the object was created OK.
+                desk.ok = true;
+                desk.orb.run();
+              }
+            catch (Exception exc)
+              {
+                exc.printStackTrace();
+                desk.ior = "Unable to start the ORB: " + exc;
+              }
+          }
+        }.start();
+
+        long t = System.currentTimeMillis();
+        while (desk.ior == null && System.currentTimeMillis() - t < 20000)
+          {
+            Thread.sleep(100);
+          }
+      }
+    catch (Exception e)
+      {
+        e.printStackTrace();
+        return "Exception: " + e;
+      }
+
+    // Add shutdown hook to unregister from the manager.
+    Runtime.getRuntime().addShutdownHook(new Thread()
+    {
+      public void run()
+      {
+        if (desk.manager != null && player != null)
+          {
+            try
+              {
+                desk.manager.unregister(player);
+              }
+            catch (RemoteException ex)
+              {
+                // We will print the exception because this is a demo
+                // application that
+                // may be modified for learning purposes.
+                ex.printStackTrace();
+              }
+            desk.manager = null;
+          }
+      }
+    });
+    return desk.ior;
+  }  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Player.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Player.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Player.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Player.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,96 @@
+/* Player.java --
+ 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. */
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Point;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * Defines remote methods that are invoked by another player or by the
+ * challenge server.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public interface Player extends Remote
+{
+  /**
+   * Receive the invitation to play from the patner or the game manager.
+   *
+   * @param address the address (host and port) of the remote partner.
+   * @param youStart if true, the game manager instructs to start
+   * the game first (another side is instructed to start the game second).
+   *
+   * @return true on success.
+   */
+  boolean start_game(Player otherPlayer, boolean youStart)
+    throws RemoteException;
+
+  /**
+   * Get the state of the local player (one of the constants, defined
+   * in this interface).
+   */
+  int get_current_state() throws RemoteException;
+
+  /**
+   * Receive the chat message from the friend or challenge server (remote).
+   * Possible at any state, always remote.
+   *
+   * @param color the color code, used to highlight the message.
+   * @param text the message text.
+   */
+  void receive_chat(byte color, String test) throws RemoteException;
+
+  /**
+   * Indicated that the remote side leaves the game (capitulating).
+   */
+  void disconnect() throws RemoteException;
+
+  /**
+   * Receive friends move (possible at I_WAIT_FOR_YOUR_MOVE).
+   *
+   * @param x grid position.
+   * @param y grid position.
+   *
+   * @param sessionId the session id, must match (otherwise the call is ignored).
+   * @param victory if not a null, the friend thinks that it has won, the parameter
+   * containing the ends of the builded line.
+   */
+  void receive_move(int x, int y, Point[] victory) throws RemoteException;
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,275 @@
+/* PlayerImpl.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Color;
+import java.awt.Point;
+
+import java.rmi.RemoteException;
+
+/**
+ * The implementation of the PlayerCommunicator, providing the local
+ * functionality. Apart remote methods, the class also defines some local
+ * methods, needed for the co-ordinated work with the game user interface.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class PlayerImpl
+  implements Player, State
+{
+  /**
+   * The playing table.
+   */
+  PlayingDesk desk;
+
+  /**
+   * The state of this player (one of the constants, defined in the player
+   * interface.
+   */
+  private int state = DISCONNECTED;
+
+  /**
+   * The other player.
+   */
+  Player partner;
+
+  /**
+   * Called when the local player refuses to continue the game.
+   */
+  public void leave()
+  {
+    try
+      {
+        if (state == I_THINK || state == I_WAIT_FOR_YOUR_MOVE)
+          {
+            partner.receive_chat(ChatConstants.REMOTE_PLAYER,
+              "Your partner has left the game.");
+            partner.disconnect();
+          }
+        else if (state == State.QUEUED)
+          {
+            if (desk.manager != null)
+              desk.manager.unregister(desk.player);
+            receive_chat(ChatConstants.SYSTEM,
+              "Do not be so pessimistic, try to play first!");
+          }
+        set_current_state(State.DISCONNECTED);
+
+        desk.frame.bChat.setEnabled(false);
+        desk.frame.bLeave.setEnabled(false);
+        desk.frame.bConnect.setEnabled(true);
+        desk.frame.taUrl.setText(desk.frame.mior);
+      }
+    catch (RemoteException ex)
+      {
+        // We will print the exception because this is a demo application that
+        // may be modified for learning purposes.
+        ex.printStackTrace();
+      }
+  }
+
+  /**
+   * Called when we make the move. The PlayingTable is responsible for checking
+   * the correctness of the move and detecting the victory.
+   * 
+   * @param x x position of the new dot.
+   * @param y y position of the new dot.
+   * 
+   * @param victory array of two memebers, representing the endpoints of the
+   * drawn line (victory detected) or null if no such yet exists.
+   */
+  public void we_move(int x, int y, Point[] victory)
+  {
+    try
+      {
+        set_current_state(I_WAIT_FOR_YOUR_MOVE);
+        partner.receive_move(x, y, victory);
+      }
+    catch (RemoteException ex)
+      {
+        // We will print the exception because this is a demo application that
+        // may be modified for learning purposes.
+        ex.printStackTrace();
+
+        state = ERROR;
+      }
+  }
+
+  /**
+   * Set the current state.
+   */
+  public void set_current_state(int new_state)
+  {
+    state = new_state;
+
+    if (state == DISCONNECTED)
+      {
+        setStatus("Disconnected");
+      }
+    else if (state == I_THINK)
+      {
+        setStatus("Our move");
+      }
+    else if (state == I_WAIT_FOR_YOUR_MOVE)
+      {
+        setStatus("Partner's move");
+      }
+    else if (state == ERROR)
+      {
+        setStatus("Error.");
+      }
+    else if (state == I_HAVE_LOST)
+      {
+        setStatus("We lost");
+      }
+    else if (state == I_HAVE_WON)
+      {
+        setStatus("Victory");
+      }
+    else if (state == QUEUED)
+      {
+        setStatus("Queued");
+      }
+    else
+      {
+        setStatus("State " + state);
+      }
+
+    boolean connected = state != State.DISCONNECTED;
+
+    desk.frame.bConnect.setEnabled(!connected && state != State.QUEUED);
+    desk.frame.bReset.setEnabled(connected);
+    desk.frame.bLeave.setEnabled(connected);
+    desk.frame.bChat.setEnabled(connected);
+  }
+
+  /**
+   * Show the state in the status line.
+   */
+  public void setStatus(String status)
+  {
+    desk.frame.lbState.setText(status);
+  }
+
+  /**
+   * Receive the invitation to play from the patner or the game manager.
+   * 
+   * @param address the address (host and port) of the remote partner.
+   * @param youStart if true, the game manager instructs to start the game first
+   * (another side is instructed to start the game second).
+   * 
+   * Game server may also chat a little bit with both players, saying that the
+   * game has started.
+   * 
+   * @return true on success.
+   */
+  public boolean start_game(Player otherPlayer, boolean youStart)
+    throws RemoteException
+  {
+    partner = otherPlayer;
+    desk.reset();
+
+    if (youStart)
+      {
+        set_current_state(I_THINK);
+      }
+    else
+      {
+        set_current_state(I_WAIT_FOR_YOUR_MOVE);
+      }
+
+    desk.frame.taUrl.setText("");
+
+    return true;
+  }
+
+  /**
+   * Get the state of the local player (one of the constants, defined in this
+   * interface).
+   */
+  public int get_current_state()
+    throws RemoteException
+  {
+    return state;
+  }
+
+  /**
+   * Receive the chat message from the friend or challenge server (remote).
+   * Possible at any state, always remote.
+   * 
+   * @param color the color code, used to highlight the message.
+   * @param text the message text.
+   */
+  public void receive_chat(byte color, String text)
+    throws RemoteException
+  {
+    if (color >= ChatConstants.colors.length)
+      color = ChatConstants.REMOTE_PLAYER;
+
+    desk.frame.talk(ChatConstants.colors[color], text);
+  }
+
+  /**
+   * Indicated that the remote side leaves the game (capitulating).
+   */
+  public void disconnect()
+    throws RemoteException
+  {
+    desk.frame.talk(Color.red, "The partner leaves the game.");
+    partner = null;
+    set_current_state(DISCONNECTED);
+
+    desk.frame.taUrl.setText(desk.frame.mior);
+  }
+
+  /**
+   * Receive friends move (possible at I_WAIT_FOR_YOUR_MOVE).
+   * 
+   * @param x grid position.
+   * @param y grid position.
+   * @param victory if not a null, the friend thinks that it has won, the
+   * parameter containing the ends of the builded line.
+   */
+  public void receive_move(int x, int y, Point[] victory)
+    throws RemoteException
+  {
+    // The state changes are handled by the PlayingTable
+    desk.friendsMove(x, y, victory);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,512 @@
+/* PlayingDesk.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.swing.JComponent;
+
+import org.omg.CORBA.ORB;
+
+/**
+ * Manages actions, related to the game rules and also does all painting.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class PlayingDesk
+  extends JComponent
+  implements MouseListener, State
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * Indicates that the field point state is the red oval.
+   */
+  public static final int RED = 0;
+
+  /**
+   * Indicates that the field point state is the black cross.
+   */
+  public static final int BLACK = 1;
+
+  /**
+   * Indicates that the field point state is the hint, suggested by the fan.
+   */
+  public static final int HINT = 2;
+
+  /**
+   * The access to the main frame methods.
+   */
+  ClientFrame frame;
+
+  /**
+   * The access to the player communicator.
+   */
+  PlayerImpl player;
+
+  /**
+   * The game manager.
+   */
+  GameManager manager;
+
+  /**
+   * The player ORB.
+   */
+  ORB orb;
+
+  /**
+   * The player IOR.
+   */
+  String ior;
+
+  /**
+   * True if the player ORB started ok.
+   */
+  boolean ok;
+
+  /**
+   * The grid spacing.
+   */
+  static int W = 16;
+
+  /**
+   * The radius of the dots being painted.
+   */
+  static int R = W / 3;
+
+  /**
+   * The collection of the red dots.
+   */
+  ArrayList reds = new ArrayList();
+
+  /**
+   * The collection of the black dots.
+   */
+  ArrayList blacks = new ArrayList();
+
+  /**
+   * The array of hints.
+   */
+  ArrayList hints = new ArrayList();
+
+  /**
+   * When the game is completed, obtains the value of the two end points of the
+   * created line.
+   */
+  Point[] endOfGame;
+
+  public PlayingDesk()
+  {
+    try
+      {
+        player = new PlayerImpl();
+        player.desk = this;
+
+        OrbStarter.startPlayer(player, this);
+
+        jbInit();
+      }
+    catch (Exception e)
+      {
+        e.printStackTrace();
+      }
+  }
+
+  /**
+   * Paint this component.
+   */
+  public void paintComponent(Graphics g)
+  {
+    int w = getWidth();
+    int h = getHeight();
+
+    g.setColor(Color.white);
+    g.fillRect(0, 0, w, h);
+
+    drawGrid(w, h, g);
+    drawFigures(g);
+  }
+
+  /**
+   * Check maybe a game is finished after setting the point N
+   */
+  public Point[] checkFinished(Collection x, Point N)
+  {
+    Iterator iter = x.iterator();
+    Point p;
+
+    // The victory, if happens, must occur inside these boundaries:
+    int ax = N.x - 5;
+    int bx = N.x + 5;
+
+    int ay = N.y - 5;
+    int by = N.y + 5;
+
+    while (iter.hasNext())
+      {
+        p = (Point) iter.next();
+
+        if (p.x > ax && p.x < bx && p.y > ay && p.y < by)
+          {
+            // Check the vertical line down
+            if (pointPresent(p.x, p.y + 1, x))
+              if (pointPresent(p.x, p.y + 2, x))
+                if (pointPresent(p.x, p.y + 3, x))
+                  if (pointPresent(p.x, p.y + 4, x))
+                    return new Point[] { p, new Point(p.x, p.y + 4) };
+
+            // Check the horizontal line left
+            if (pointPresent(p.x + 1, p.y, x))
+              if (pointPresent(p.x + 2, p.y, x))
+                if (pointPresent(p.x + 3, p.y, x))
+                  if (pointPresent(p.x + 4, p.y, x))
+                    return new Point[] { p, new Point(p.x + 4, p.y) };
+
+            // Check the diagonal line right down.
+            if (pointPresent(p.x + 1, p.y + 1, x))
+              if (pointPresent(p.x + 2, p.y + 2, x))
+                if (pointPresent(p.x + 3, p.y + 3, x))
+                  if (pointPresent(p.x + 4, p.y + 4, x))
+                    return new Point[] { p, new Point(p.x + 4, p.y + 4) };
+
+            // Check the diagonal line left down.
+            if (pointPresent(p.x - 1, p.y + 1, x))
+              if (pointPresent(p.x - 2, p.y + 2, x))
+                if (pointPresent(p.x - 3, p.y + 3, x))
+                  if (pointPresent(p.x - 4, p.y + 4, x))
+                    return new Point[] { p, new Point(p.x - 4, p.y + 4) };
+          }
+      }
+    return null;
+  }
+
+  /**
+   * Called when the "end of the game" situation is detected.
+   */
+  public void drawFinishLine(int xa, int ya, int xb, int yb, Graphics g)
+  {
+    g.setColor(Color.blue);
+
+    int hW = W / 2;
+    g.drawLine(xa * W + hW, ya * W + hW, xb * W + hW, yb * W + hW);
+  }
+
+  /**
+   * Check for the presence of the given point in the collection.
+   */
+  public final boolean pointPresent(int x, int y, Collection in)
+  {
+    Iterator iter = in.iterator();
+    Point p;
+    while (iter.hasNext())
+      {
+        p = (Point) iter.next();
+        if (p.x == x && p.y == y)
+          return true;
+      }
+    return false;
+  }
+
+  public void drawGrid(int w, int h, Graphics g)
+  {
+    g.setColor(Color.lightGray);
+
+    // Draw vertical lines:
+    for (int x = 0; x < w; x += W)
+      {
+        g.drawLine(x, 0, x, h);
+      }
+
+    // Draw horizontal lines:
+    for (int y = 0; y < h; y += W)
+      {
+        g.drawLine(0, y, w, y);
+      }
+      
+    g.setColor(Color.gray);
+    g.drawRect(0,0, frame.DESK_SIZE.width, frame.DESK_SIZE.height);
+    g.drawRect(0,0, frame.DESK_SIZE.width+3, frame.DESK_SIZE.height+3);    
+  }
+
+  public void drawFigures(Graphics g)
+  {
+    g.setColor(Color.red);
+    drawDots(reds, g, RED);
+
+    g.setColor(Color.black);
+    drawDots(blacks, g, BLACK);
+
+    g.setColor(Color.lightGray);
+    drawDots(hints, g, HINT);
+
+    if (endOfGame != null)
+      drawFinishLine(endOfGame[0].x, endOfGame[0].y, endOfGame[1].x,
+        endOfGame[1].y, g);
+  }
+
+  public Point makePoint(int x, int y)
+  {
+    return new Point(x / W, y / W);
+  }
+
+  /**
+   * Draw a collection of dots (the collor must be set before calling the
+   * method).
+   */
+  public void drawDots(Collection dots, Graphics g, int mode)
+  {
+    Iterator iter = dots.iterator();
+    int x;
+    int y;
+
+    int hW = W / 2;
+    int RR = R * 2;
+    int hR = R / 2;
+    Point p;
+    while (iter.hasNext())
+      {
+        p = (Point) iter.next();
+        x = p.x * W + hW;
+        y = p.y * W + hW;
+
+        if (mode == RED)
+          g.drawOval(x - R, y - R, RR, RR);
+        else if (mode == BLACK)
+          {
+            g.drawLine(x - R, y - R, x + R, y + R);
+            g.drawLine(x - R, y + R, x + R, y - R);
+          }
+        else
+          {
+            // Hint.
+            g.drawOval(x - hR, y - hR, R, R);
+          }
+      }
+  }
+
+  private void jbInit()
+    throws Exception
+  {
+    addMouseListener(this);
+  }
+
+  public void mouseClicked(MouseEvent e)
+  {
+    try
+      {
+        int state = player.get_current_state();
+
+        // Check if the state is correct.
+        if (state == I_WAIT_FOR_YOUR_MOVE)
+          {
+            frame.talk(Color.black,
+              "It is now time for our partner's move, not ours. Please wait.");
+          }
+        else if (state == DISCONNECTED)
+          {
+            frame.talk(Color.black,
+              "We are not connected to the playing partner yet.");
+          }
+        else if (state == I_HAVE_LOST)
+          {
+            frame.talk(Color.black,
+              "We have already lost this battle, but why not to try again?");
+          }
+        else if (state == I_HAVE_WON)
+          {
+            frame.talk(Color.black,
+              "The victory is ours, nothing more to do here.");
+          }
+        else if (player.partner == null)
+          frame.talk(Color.black, "No other player so far.");
+        else
+          {
+            int x = e.getX();
+            int y = e.getY();
+
+            if (x>frame.DESK_SIZE.width ||
+                y>frame.DESK_SIZE.height)
+            {
+              frame.talk(Color.black,"Outside the game area.");
+              return;
+            }
+
+            Point p = makePoint(x, y);
+
+            // Ignore clicks on the occupied cells.
+            if (pointPresent(p.x, p.y, reds)
+              || (pointPresent(p.x, p.y, blacks)))
+              {
+                frame.talk(Color.black,
+                  "This is against the rules, select the unoccupied cell.");
+                return;
+              }
+
+            reds.add(p);
+
+            endOfGame = checkFinished(reds, p);
+            repaint();
+
+            if (endOfGame != null)
+              {
+                frame.talk(Color.red, "Our move " + p.x + "-" + p.y
+                  + " and we win!");
+                player.set_current_state(I_HAVE_WON);
+              }
+            else
+              {
+                frame.talk(Color.black, "Our move " + p.x + "-" + p.y
+                  + ". Waiting for the other side move...");
+                player.set_current_state(I_WAIT_FOR_YOUR_MOVE);
+              }
+
+            player.partner.receive_move(p.x, p.y, endOfGame);
+          }
+      }
+    catch (RemoteException ex)
+      {
+        // We will print the exception because this is a demo application
+        // that may be modified for learning purposes.
+        ex.printStackTrace();
+      }
+  }
+
+  /**
+   * Handle the move of the other playing side.
+   */
+  public void friendsMove(int x, int y, Point[] victory)
+  {
+    try
+      {
+        int state = player.get_current_state();
+        if (state != I_WAIT_FOR_YOUR_MOVE || pointPresent(x, y, blacks))
+          {
+            stateFailed("Move " + x + "-" + y);
+          }
+        else
+          {
+            blacks.add(new Point(x, y));
+
+            if (victory != null)
+              {
+                frame.talk(Color.red,
+                  " We have lost this time, unfortunately..");
+                player.set_current_state(I_HAVE_LOST);
+                endOfGame = victory;
+              }
+            else
+              {
+                frame.talk(Color.black, "Partner goes " + x + "-" + y
+                  + ". Your move?");
+                player.set_current_state(I_THINK);
+              }            
+            repaint();            
+          }
+      }
+    catch (RemoteException rex)
+      {
+        rex.printStackTrace();
+      }
+  }
+
+  /**
+   * Prepare for the new game.
+   */
+  public void reset()
+  {
+    blacks.clear();
+    reds.clear();
+    hints.clear();
+    endOfGame = null;
+    repaint();
+  }
+
+  public void mouseEntered(MouseEvent m)
+  {
+    // Nothing to do.
+  }
+
+  public void mousePressed(MouseEvent m)
+  {
+    // Nothing to do.
+  }
+
+  public void mouseReleased(MouseEvent m)
+  {
+    // Nothing to do.
+  }
+
+  public void mouseExited(MouseEvent m)
+  {
+    // Nothing to do.
+  }
+
+  /**
+   * The systems detected the error conditions. The game cannot continue (the
+   * chat is still possible).
+   */
+  public void stateFailed(String reason)
+  {
+    try
+      {
+        player.receive_chat(ChatConstants.REMOTE_PLAYER,
+          "Wrong move, game cannot continue (our state was "
+            + player.get_current_state() + ")");
+        frame.talk(Color.red, "The remote side violates communicating rules.");
+        player.set_current_state(State.ERROR);
+      }
+    catch (RemoteException ex)
+      {
+        // We will print the exception because this is a demo application
+        // that may be modified for learning purposes.
+        ex.printStackTrace();
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/State.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/State.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/State.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/State.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,82 @@
+/* State.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+/**
+ * Defines the states in that the player can be.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public interface State {
+  /**
+   * The initial ("disconnected") state.
+   */
+  int DISCONNECTED = 0;
+  
+  /**
+   * The state, indicating that the player has been queued for the game and
+   * waiting for the partner to come.
+   */
+  int QUEUED = 1;
+
+  /**
+   * The "my move" state.
+   */
+  int I_THINK = 2;
+
+  /**
+   * The "friend's move" state.
+   */
+  int I_WAIT_FOR_YOUR_MOVE = 3;
+
+  /**
+   * States that we have won.
+   */
+  int I_HAVE_WON = 4;
+
+  /**
+   * States that we have lost.
+   */
+  int I_HAVE_LOST = 5;
+  
+  /**
+   * The "inconsistent" state when it is not possible to continue the game.
+   */
+  int ERROR = -1;
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,175 @@
+/* GameManagerAddressServer.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * The main executable class of the game manager server.
+ * 
+ * The manager address server returns the IOR address string of the game
+ * manager. Hence the user does not need to enter the rather long IOR address
+ * string and only needs to specify the host and port of the machine where the
+ * game manager is running.
+ * 
+ * The manager address server starts the main game manager as well.
+ * 
+ * This server acts as a HTTP server that always returns the same response. This
+ * primitive functionality is sufficient for its task.
+ * 
+ * The more complex CORBA applications should use the name service instead. We
+ * do not use the name service as this would require to start additional
+ * external application, specific for the different java platforms.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class X5Server
+{
+  /**
+   * Start the game manager.
+   */
+  public static void main(String[] args)
+  {
+    // Start the game manager, write the IOR to the agreed location.
+    OrbStarter.startManager(args);
+
+    if (!GameManagerImpl.ok)
+      {
+        System.out.println("Unable to start the game manager:");
+        System.exit(1);
+      }
+
+    // Print the IOR.
+    System.out.println(GameManagerImpl.ior);
+
+    String manager_address = null;
+
+    // Start the game manager server.
+    ServerSocket nameServer = null;
+    try
+      {
+        nameServer = new ServerSocket(OrbStarter.MANAGER_NAMER_PORT);
+
+        System.out.println("The game manager is listening at:");
+        manager_address = "http://"
+          + InetAddress.getLocalHost().getHostAddress() + ":"
+          + nameServer.getLocalPort();
+
+        System.out.println(manager_address);
+
+        System.out.println("Enter this address to the "
+          + "input field of the game client.");
+
+        System.out.println("Use ^C to stop the manager.");
+      }
+    catch (Exception ex)
+      {
+        System.out.println("The port " + OrbStarter.MANAGER_NAMER_PORT
+          + " is not available. The game manager namer will not start.");
+        System.exit(1);
+      }
+
+    // Write the IOR to the local file system.
+    if (OrbStarter.WRITE_URL_TO_FILE != null)
+      {
+        try
+          {
+            File gmf = new File(OrbStarter.WRITE_URL_TO_FILE);
+            FileWriter f = new FileWriter(gmf);
+            BufferedWriter b = new BufferedWriter(f);
+
+            b.write(manager_address);
+            b.close();
+          }
+        catch (IOException e)
+          {
+            System.out.println("Local filesystem not accessible."
+              + "Read IOR from console.");
+          }
+      }
+
+    // Do forever.
+    while (true)
+      {
+        try
+          {
+            Socket socket = nameServer.accept();
+
+            System.out.println("Connected.");
+
+            // Set the two minutes timeout.
+            socket.setSoTimeout(1000 * 120);
+
+            OutputStream out = socket.getOutputStream();
+
+            int length = GameManagerImpl.ior.length();
+
+            StringBuffer b = new StringBuffer();
+            b.append("HTTP/1.0 200 OK\r\n");
+            b.append("Content-Length: " + length + "\r\n");
+            b.append("Connection: close\r\n");
+            b.append("Content-Type: text/plain; charset=UTF-8\r\n");
+            b.append("\r\n");
+
+            b.append(GameManagerImpl.ior);
+
+            out.write(b.toString().getBytes("UTF-8"));
+
+            socket.shutdownOutput();
+
+            if (!socket.isClosed())
+              socket.close();
+
+            System.out.println("Completed.");
+          }
+        catch (Exception exc)
+          {
+            exc.printStackTrace();
+            System.out.println("Network problem.");
+          }
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,209 @@
+/* _GameManagerImpl_Tie.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.Remote;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.PortableServer.Servant;
+
+/**
+ * Normally generated with rmic compiler, this class represents the GameManager
+ * Tie on the client side. The Game Manager methods contain the code for remote
+ * invocation.
+ * 
+ * This class is normally generated with rmic or grmic from the 
+ * {@link GameManagerImpl}. See tools/gnu/classpath/tools/giop/README.
+ * 
+ * In this example the class was manually edited and commented for better
+ * understanding of functionality.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class _GameManagerImpl_Tie
+  extends Servant
+  implements Tie
+{
+  /**
+   * The target, where remote invocations are forwarded.
+   */
+  private GameManagerImpl target = null;
+
+  /**
+   * The GameManager repository Id.
+   */
+  private static final String[] _type_ids = 
+  { "RMI:gnu.classpath.examples.CORBA.swing.x5.GameManager:0000000000000000" };
+
+  /**
+   * Set the target where the remote invocations are forwarded.
+   */
+  public void setTarget(Remote a_target)
+  {
+    this.target = (GameManagerImpl) a_target;
+  }
+
+  /**
+   * Get the target where the remote invocations are forwarded.
+   */
+  public Remote getTarget()
+  {
+    return target;
+  }
+
+  /**
+   * Get the CORBA object for that this Tie is currently serving the request.
+   * The same tie may serve multiple requests for the different objects in
+   * parallel threads.
+   */
+  public org.omg.CORBA.Object thisObject()
+  {
+    return _this_object();
+  }
+
+  /**
+   * Deactivate this object.
+   */
+  public void deactivate()
+  {
+    try
+      {
+        _poa().deactivate_object(_poa().servant_to_id(this));
+      }
+    catch (org.omg.PortableServer.POAPackage.WrongPolicy exception)
+      {
+      }
+    catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception)
+      {
+      }
+    catch (org.omg.PortableServer.POAPackage.ServantNotActive exception)
+      {
+      }
+  }
+
+  /**
+   * Get the ORB for this tie.
+   */
+  public ORB orb()
+  {
+    return _orb();
+  }
+
+  /**
+   * Set the ORB for this tie.
+   */
+  public void orb(ORB orb)
+  {
+    try
+      {
+        ((org.omg.CORBA_2_3.ORB) orb).set_delegate(this);
+      }
+    catch (ClassCastException e)
+      {
+        throw new org.omg.CORBA.BAD_PARAM(
+          "POA Servant requires an instance of org.omg.CORBA_2_3.ORB");
+      }
+  }
+
+  /**
+   * Return all interfaces, supported by this method.
+   */
+  public String[] _all_interfaces(org.omg.PortableServer.POA poa,
+    byte[] objectId)
+  {
+    return _type_ids;
+  }
+
+  /**
+   * This method is invoked by CORBA system to handle the remote invocation.
+   * 
+   * @param method the name of the method being invoked.
+   * @param _in the stream to read the method parameters.
+   * @param reply the responsed handler that can create the output stream to
+   * write the parameters being returned.
+   */
+  public OutputStream _invoke(String method, InputStream _in,
+    ResponseHandler reply)
+    throws SystemException
+  {
+    try
+      {
+        org.omg.CORBA_2_3.portable.InputStream in = 
+          (org.omg.CORBA_2_3.portable.InputStream) _in;
+        if (method.equals("requestTheGame"))
+          {
+            Player p = (Player) PortableRemoteObject.narrow(
+              in.read_Object(), Player.class);
+            target.requestTheGame(p);
+
+            OutputStream out = reply.createReply();
+            return out;
+          }
+        else if (method.equals("unregister"))
+          {
+            Player p = (Player) PortableRemoteObject.narrow(
+              in.read_Object(), Player.class);
+            target.unregister(p);
+
+            OutputStream out = reply.createReply();
+            return out;
+          }
+        else
+          throw new BAD_OPERATION();
+      }
+    catch (SystemException ex)
+      {
+        throw ex;
+      }
+    catch (Throwable ex)
+      {
+        ex.printStackTrace();
+        throw new UnknownException(ex);
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,207 @@
+/* _GameManager_Stub.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+/**
+ * Normally generated with rmic compiler, this class represents the GameManager
+ * Stub on the client side. The Game Manager methods contain the code for
+ * remote invocation.
+ * 
+ * This class is normally generated with rmic from the {@link GameManagerImpl}:
+ * <pre>
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.GameManagerImpl
+ * </pre>
+ * (the compiled package must be present in the current folder).
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class _GameManager_Stub extends Stub implements GameManager
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  private static final String[] _type_ids =
+    { "RMI:gnu.classpath.examples.CORBA.swing.x5.GameManager:0000000000000000" };
+
+  public String[] _ids()
+  {
+    return _type_ids;
+  }
+  
+  /**
+   * Notify the manager that the player is no longer willing to play and
+   * should be removed from the queue.
+   */
+  public void unregister(Player p)
+    throws RemoteException
+  {
+    if (!Util.isLocal(this))
+      {
+        try
+          {
+            org.omg.CORBA.portable.InputStream in = null;
+            try
+              {
+                OutputStream out = _request("unregister", true);
+                Util.writeRemoteObject(out, p);
+                _invoke(out);
+              }
+            catch (ApplicationException ex)
+              {
+                in = ex.getInputStream();
+
+                String id = in.read_string();
+                throw new UnexpectedException(id);
+              }
+            catch (RemarshalException ex)
+              {
+                unregister(p);
+              }
+            finally
+              {
+                _releaseReply(in);
+              }
+          }
+        catch (SystemException ex)
+          {
+            throw Util.mapSystemException(ex);
+          }
+      }
+    else
+      {
+        ServantObject so =
+          _servant_preinvoke("requestTheGame", GameManager.class);
+        if (so == null)
+          {
+            unregister(p);
+            return;
+          }
+        try
+          {
+            ((GameManager) so.servant).unregister(p);
+          }
+        catch (Throwable ex)
+          {
+            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+            throw Util.wrapException(exCopy);
+          }
+        finally
+          {
+            _servant_postinvoke(so);
+          }
+      }
+  }
+  
+  /**
+   * The method that the user should invoke.
+   */
+  public void requestTheGame(Player arg0) throws RemoteException
+  {
+    if (!Util.isLocal(this))
+      {
+        try
+          {
+            org.omg.CORBA.portable.InputStream in = null;
+            try
+              {
+                OutputStream out = _request("requestTheGame", true);
+                Util.writeRemoteObject(out, arg0);
+                _invoke(out);
+              }
+            catch (ApplicationException ex)
+              {
+                in = ex.getInputStream();
+
+                String id = in.read_string();
+                throw new UnexpectedException(id);
+              }
+            catch (RemarshalException ex)
+              {
+                requestTheGame(arg0);
+              }
+            finally
+              {
+                _releaseReply(in);
+              }
+          }
+        catch (SystemException ex)
+          {
+            throw Util.mapSystemException(ex);
+          }
+      }
+    else
+      {
+        ServantObject so =
+          _servant_preinvoke("requestTheGame", GameManager.class);
+        if (so == null)
+          {
+            requestTheGame(arg0);
+            return;
+          }
+        try
+          {
+            Player arg0Copy = (Player) Util.copyObject(arg0, _orb());
+            ((GameManager) so.servant).requestTheGame(arg0Copy);
+          }
+        catch (Throwable ex)
+          {
+            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+            throw Util.wrapException(exCopy);
+          }
+        finally
+          {
+            _servant_postinvoke(so);
+          }
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,209 @@
+/* _PlayerImpl_Tie.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Point;
+import java.rmi.Remote;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.PortableServer.Servant;
+
+/**
+ * Generate with rmic, command line
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
+ * (the compiled package must be present in the current folder).
+ * 
+ * This class is normally generated with rmic or grmic from the 
+ * {@link PlayerImpl}. See tools/gnu/classpath/tools/giop/README.
+ * 
+ * In this example the class was manually edited and commented for better 
+ * understanding of functionality.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class _PlayerImpl_Tie extends Servant implements Tie
+{
+  private PlayerImpl target = null;
+  private static final String[] _type_ids =
+    { "RMI:gnu.classpath.examples.CORBA.swing.x5.Player:0000000000000000" };
+
+  public void setTarget(Remote a_target)
+  {
+    this.target = (PlayerImpl) a_target;
+  }
+
+  public Remote getTarget()
+  {
+    return target;
+  }
+
+  public org.omg.CORBA.Object thisObject()
+  {
+    return _this_object();
+  }
+
+  public void deactivate()
+  {
+    try
+      {
+        _poa().deactivate_object(_poa().servant_to_id(this));
+      }
+    catch (org.omg.PortableServer.POAPackage.WrongPolicy exception)
+      {
+      }
+    catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception)
+      {
+      }
+    catch (org.omg.PortableServer.POAPackage.ServantNotActive exception)
+      {
+      }
+  }
+
+  public ORB orb()
+  {
+    return _orb();
+  }
+
+  public void orb(ORB orb)
+  {
+    try
+      {
+        ((org.omg.CORBA_2_3.ORB) orb).set_delegate(this);
+      }
+    catch (ClassCastException e)
+      {
+        throw new org.omg.CORBA.BAD_PARAM(
+          "POA Servant requires an instance of org.omg.CORBA_2_3.ORB"
+        );
+      }
+  }
+
+  public String[] _all_interfaces(org.omg.PortableServer.POA poa,
+    byte[] objectId
+  )
+  {
+    return _type_ids;
+  }
+
+  public OutputStream _invoke(String method, InputStream _in,
+    ResponseHandler reply
+  ) throws SystemException
+  {
+    try
+      {
+        org.omg.CORBA_2_3.portable.InputStream in =
+          (org.omg.CORBA_2_3.portable.InputStream) _in;
+        switch (method.charAt(9))
+          {
+            case 101 :
+              if (method.equals("start_game"))
+                {
+                  Player arg0 =
+                    (Player) PortableRemoteObject.narrow(in.read_Object(),
+                      Player.class
+                    );
+                  boolean arg1 = in.read_boolean();
+                  boolean result = target.start_game(arg0, arg1);
+                  OutputStream out = reply.createReply();
+                  out.write_boolean(result);
+                  return out;
+                }
+
+            case 104 :
+              if (method.equals("receive_chat"))
+                {
+                  byte arg0 = in.read_octet();
+                  String arg1 = (String) in.read_value(String.class);
+                  target.receive_chat(arg0, arg1);
+
+                  OutputStream out = reply.createReply();
+                  return out;
+                }
+
+            case 111 :
+              if (method.equals("receive_move"))
+                {
+                  int arg0 = in.read_long();
+                  int arg1 = in.read_long();
+                  Point[] arg2 = (Point[]) in.read_value(Point[].class);
+                  target.receive_move(arg0, arg1, arg2);
+
+                  OutputStream out = reply.createReply();
+                  return out;
+                }
+
+            case 114 :
+              if (method.equals("_get_J_current_state"))
+                {
+                  int result = target.get_current_state();
+                  OutputStream out = reply.createReply();
+                  out.write_long(result);
+                  return out;
+                }
+
+            case 116 :
+              if (method.equals("disconnect"))
+                {
+                  target.disconnect();
+
+                  OutputStream out = reply.createReply();
+                  return out;
+                }
+          }
+        throw new BAD_OPERATION("No such method: '"+method+"'");
+      }
+    catch (SystemException ex)
+      {
+        throw ex;
+      }
+    catch (Throwable ex)
+      {
+        throw new UnknownException(ex);
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,397 @@
+/* _Player_Stub.java --
+ 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. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Point;
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+/**
+ * Generate with rmic, command line
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
+ * (the compiled package must be present in the current folder).
+ * 
+ * This class is normally generated with rmic from the {@link GameManagerImpl}:
+ * <pre>
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.GameManagerImpl
+ * </pre>
+ * (the compiled package must be present in the current folder).
+ * 
+ * In this example the class was manually edited and commented for better 
+ * understanding of functionality.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org) 
+ */
+public class _Player_Stub extends Stub implements Player
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  private static final String[] _type_ids =
+    { "RMI:gnu.classpath.examples.CORBA.swing.x5.Player:0000000000000000" };
+
+  public String[] _ids()
+  {
+    return _type_ids;
+  }
+  
+  public boolean start_game(Player arg0, boolean arg1)
+    throws RemoteException
+  {
+    if (!Util.isLocal(this))
+      {
+        try
+          {
+            org.omg.CORBA.portable.InputStream in = null;
+            try
+              {
+                OutputStream out = _request("start_game", true);
+                Util.writeRemoteObject(out, arg0);
+                out.write_boolean(arg1);
+                in = _invoke(out);
+                return in.read_boolean();
+              }
+            catch (ApplicationException ex)
+              {
+                in = ex.getInputStream();
+
+                String id = in.read_string();
+                throw new UnexpectedException(id);
+              }
+            catch (RemarshalException ex)
+              {
+                return start_game(arg0, arg1);
+              }
+            finally
+              {
+                _releaseReply(in);
+              }
+          }
+        catch (SystemException ex)
+          {
+            throw Util.mapSystemException(ex);
+          }
+      }
+    else
+      {
+        ServantObject so = _servant_preinvoke("start_game", Player.class);
+        if (so == null)
+          {
+            return start_game(arg0, arg1);
+          }
+        try
+          {
+            Player arg0Copy = (Player) Util.copyObject(arg0, _orb());
+            return ((Player) so.servant).start_game(arg0Copy, arg1);
+          }
+        catch (Throwable ex)
+          {
+            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+            throw Util.wrapException(exCopy);
+          }
+        finally
+          {
+            _servant_postinvoke(so);
+          }
+      }
+  }
+
+  public int get_current_state() throws RemoteException
+  {
+    if (!Util.isLocal(this))
+      {
+        try
+          {
+            org.omg.CORBA.portable.InputStream in = null;
+            try
+              {
+                OutputStream out = _request("_get_J_current_state", true);
+                in = _invoke(out);
+                return in.read_long();
+              }
+            catch (ApplicationException ex)
+              {
+                in = ex.getInputStream();
+
+                String id = in.read_string();
+                throw new UnexpectedException(id);
+              }
+            catch (RemarshalException ex)
+              {
+                return get_current_state();
+              }
+            finally
+              {
+                _releaseReply(in);
+              }
+          }
+        catch (SystemException ex)
+          {
+            throw Util.mapSystemException(ex);
+          }
+      }
+    else
+      {
+        ServantObject so =
+          _servant_preinvoke("_get_J_current_state", Player.class);
+        if (so == null)
+          {
+            return get_current_state();
+          }
+        try
+          {
+            return ((Player) so.servant).get_current_state();
+          }
+        catch (Throwable ex)
+          {
+            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+            throw Util.wrapException(exCopy);
+          }
+        finally
+          {
+            _servant_postinvoke(so);
+          }
+      }
+  }
+
+  public void receive_chat(byte arg0, String arg1) throws RemoteException
+  {
+    if (!Util.isLocal(this))
+      {
+        try
+          {
+            org.omg.CORBA_2_3.portable.InputStream in = null;
+            try
+              {
+                org.omg.CORBA_2_3.portable.OutputStream out =
+                  (org.omg.CORBA_2_3.portable.OutputStream) _request("receive_chat",
+                    true
+                  );
+                out.write_octet(arg0);
+                out.write_value(arg1, String.class);
+                _invoke(out);
+              }
+            catch (ApplicationException ex)
+              {
+                in =
+                  (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+
+                String id = in.read_string();
+                throw new UnexpectedException(id);
+              }
+            catch (RemarshalException ex)
+              {
+                receive_chat(arg0, arg1);
+              }
+            finally
+              {
+                _releaseReply(in);
+              }
+          }
+        catch (SystemException ex)
+          {
+            throw Util.mapSystemException(ex);
+          }
+      }
+    else
+      {
+        ServantObject so = _servant_preinvoke("receive_chat", Player.class);
+        if (so == null)
+          {
+            receive_chat(arg0, arg1);
+            return;
+          }
+        try
+          {
+            ((Player) so.servant).receive_chat(arg0, arg1);
+          }
+        catch (Throwable ex)
+          {
+            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+            throw Util.wrapException(exCopy);
+          }
+        finally
+          {
+            _servant_postinvoke(so);
+          }
+      }
+  }
+
+  public void disconnect() throws RemoteException
+  {
+    if (!Util.isLocal(this))
+      {
+        try
+          {
+            org.omg.CORBA.portable.InputStream in = null;
+            try
+              {
+                OutputStream out = _request("disconnect", true);
+                _invoke(out);
+              }
+            catch (ApplicationException ex)
+              {
+                in = ex.getInputStream();
+
+                String id = in.read_string();
+                throw new UnexpectedException(id);
+              }
+            catch (RemarshalException ex)
+              {
+                disconnect();
+              }
+            finally
+              {
+                _releaseReply(in);
+              }
+          }
+        catch (SystemException ex)
+          {
+            throw Util.mapSystemException(ex);
+          }
+      }
+    else
+      {
+        ServantObject so = _servant_preinvoke("disconnect", Player.class);
+        if (so == null)
+          {
+            disconnect();
+            return;
+          }
+        try
+          {
+            ((Player) so.servant).disconnect();
+          }
+        catch (Throwable ex)
+          {
+            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+            throw Util.wrapException(exCopy);
+          }
+        finally
+          {
+            _servant_postinvoke(so);
+          }
+      }
+  }
+
+  public void receive_move(int arg0, int arg1, Point[] arg2)
+    throws RemoteException
+  {
+    if (!Util.isLocal(this))
+      {
+        try
+          {
+            org.omg.CORBA_2_3.portable.InputStream in = null;
+            try
+              {
+                org.omg.CORBA_2_3.portable.OutputStream out =
+                  (org.omg.CORBA_2_3.portable.OutputStream) _request("receive_move",
+                    true
+                  );
+                out.write_long(arg0);
+                out.write_long(arg1);
+                out.write_value(cast_array(arg2), Point[].class);
+                _invoke(out);
+              }
+            catch (ApplicationException ex)
+              {
+                in =
+                  (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+
+                String id = in.read_string();
+                throw new UnexpectedException(id);
+              }
+            catch (RemarshalException ex)
+              {
+                receive_move(arg0, arg1, arg2);
+              }
+            finally
+              {
+                _releaseReply(in);
+              }
+          }
+        catch (SystemException ex)
+          {
+            throw Util.mapSystemException(ex);
+          }
+      }
+    else
+      {
+        ServantObject so = _servant_preinvoke("receive_move", Player.class);
+        if (so == null)
+          {
+            receive_move(arg0, arg1, arg2);
+            return;
+          }
+        try
+          {
+            Point[] arg2Copy = (Point[]) Util.copyObject(arg2, _orb());
+            ((Player) so.servant).receive_move(arg0, arg1, arg2Copy);
+          }
+        catch (Throwable ex)
+          {
+            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+            throw Util.wrapException(exCopy);
+          }
+        finally
+          {
+            _servant_postinvoke(so);
+          }
+      }
+  }
+
+  // This method is required as a work-around for
+  // a bug in the JDK 1.1.6 verifier.
+  private Serializable cast_array(Object obj)
+  {
+    return (Serializable) obj;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1018 @@
+/* AnimationApplet.java -- An example of an old-style AWT applet
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+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. */
+
+package gnu.classpath.examples.awt;
+
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.Toolkit;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class AicasGraphicsBenchmark extends Panel
+{
+  /**
+   * Default number of test-iterations.
+   */
+  private static final int DEFAULT_TEST_SIZE = 1000;
+
+  /**
+   * Default screen size.
+   */
+  private static final int DEFAULT_SCREEN_WIDTH  = 320;
+  private static final int DEFAULT_SCREEN_HEIGHT = 240;
+
+  /**
+   * AWT tests.
+   */
+  private static final int AWTTEST_LINES = 1 << 0;
+  private static final int AWTTEST_RECT = 1 << 1;
+  private static final int AWTTEST_POLYLINE = 1 << 2;
+  private static final int AWTTEST_POLYGON = 1 << 3;
+  private static final int AWTTEST_ARC = 1 << 4;
+  private static final int AWTTEST_OVAL = 1 << 5;
+  private static final int AWTTEST_ROUNDRECT = 1 << 6;
+  private static final int AWTTEST_STRING = 1 << 7;
+  private static final int AWTTEST_TRANSPARENTIMAGE = 1 << 8;
+  private static final int AWTTEST_IMAGE = 1 << 9;
+
+  private static final int AWTTEST_NONE = 0;
+  private static final int AWTTEST_ALL  =   AWTTEST_LINES
+                                          | AWTTEST_RECT
+                                          | AWTTEST_POLYLINE
+                                          | AWTTEST_POLYGON
+                                          | AWTTEST_ARC
+                                          | AWTTEST_OVAL
+                                          | AWTTEST_ROUNDRECT
+                                          | AWTTEST_STRING
+                                          | AWTTEST_TRANSPARENTIMAGE
+                                          | AWTTEST_IMAGE
+                                          ;
+
+  int iterations = 1;
+  private int screenWidth = DEFAULT_SCREEN_WIDTH;  
+  private int screenHeight = DEFAULT_SCREEN_HEIGHT;  
+  boolean doubleBufferFlag = true;
+  private int awtTests = AWTTEST_ALL;
+
+  private Label testLabel;
+
+  private String testContext = "";
+
+  Logger logger = Logger.getLogger("AicasGraphicsBenchmark");
+
+  private Image pngTestImage;
+  private Image gifTestImage;
+
+  private TestSet testSetMap = new TestSet();
+
+  public AicasGraphicsBenchmark()
+  {
+    pngTestImage = loadImage("aicas.png");
+    gifTestImage = loadImage("palme.gif");
+
+    setLayout(new BorderLayout());
+    testLabel = new Label();
+    add(testLabel,BorderLayout.NORTH);
+    add(new GraphicsTest(),BorderLayout.CENTER);
+  }
+
+  void setTestContext(String testName)
+  {
+    logger.logp(Level.INFO, "AicasGraphicsBenchmark", "recordTest",
+                "--- Starting new test context: " + testName);
+    testContext = testName;
+    testLabel.setText(testName);
+  }
+
+  private void recordTest(String testName, long time)
+  {
+    logger.logp(Level.INFO, "AicasGraphicsBenchmark", "recordTest",
+                testContext + ": " + testName + " duration (ms): " + time);
+    TestRecorder recorder = testSetMap.getTest(testName);
+    if (recorder == null)
+      {
+        recorder = new TestRecorder(testName);
+        testSetMap.putTest(testName,recorder);
+      }
+    recorder.addRun(time);
+  }
+
+  void printReport()
+  {
+    for (Iterator i = testSetMap.testIterator(); i.hasNext(); )
+    {
+      TestRecorder recorder = testSetMap.getTest((String)i.next());
+      System.out.println("TEST " + recorder.getTestName() + ": average "
+                         + recorder.getAverage() + "ms ["
+                         + recorder.getMinTime() + "-" + recorder.getMaxTime()
+                         + "]");
+    }
+  }
+
+  public static void main(String[] args)
+  {
+    int awtTests;
+    int i;
+    boolean endOfOptionsFlag;
+    AicasGraphicsBenchmark speed= new AicasGraphicsBenchmark();
+
+    // Parse arguments.
+    i = 0;
+    endOfOptionsFlag = false;
+    awtTests = AWTTEST_NONE;
+    while (i < args.length)
+      {
+        if (!endOfOptionsFlag)
+          {
+            if (args[i].equals("--help") || args[i].equals("-help")
+                || args[i].equals("-h"))
+              {
+                System.out.println("Usage: AicasGraphicsBenchmark [<options>] [<test>  ...]");
+                System.out.println("");
+                System.out.println("Options: -i|--iterations=<n|-1> - number of iterations (-1 is infinite)");
+                System.out.println("         -w|--width=<n>         - screen width; default "+DEFAULT_SCREEN_WIDTH);
+                System.out.println("         -h|--height=<n>        - screen height; default "+DEFAULT_SCREEN_HEIGHT);
+                System.out.println("         -n|--noDoubleBuffer    - disable double-buffering test");
+                System.out.println("");
+                System.out.println("Tests: line");
+                System.out.println("       rect");
+                System.out.println("       polyline");
+                System.out.println("       polygon");
+                System.out.println("       arc");
+                System.out.println("       oval");
+                System.out.println("       roundrect");
+                System.out.println("       string");
+                System.out.println("       transparentimage");
+                System.out.println("       image");
+                System.exit(1);
+              }
+            else if ((args[i].startsWith("-i=")
+                || args[i].startsWith("--iterations=")))
+              {
+                speed.iterations =
+                  Integer.parseInt(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if ((args[i].equals("-i") || args[i].equals("--iterations")))
+              {
+                if ((i + 1) >= args.length)
+                  {
+                    System.err.println("ERROR: No argument given for option '"
+                                       + args[i] + "'!");
+                    System.exit(2);
+                  }
+                speed.iterations = Integer.parseInt(args[i + 1]);
+                i += 2;
+                continue;
+              }
+            else if ((args[i].startsWith("-w=")
+                || args[i].startsWith("--width=")))
+              {
+                speed.screenWidth =
+                  Integer.parseInt(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if ((args[i].equals("-w") || args[i].equals("--width")))
+              {
+                if ((i + 1) >= args.length)
+                  {
+                    System.err.println("ERROR: No argument given for option '"
+                                       + args[i] + "'!");
+                    System.exit(2);
+                  }
+                speed.screenWidth = Integer.parseInt(args[i + 1]);
+                i += 2;
+                continue;
+              }
+            else if ((args[i].startsWith("-h=")
+                || args[i].startsWith("--height=")))
+              {
+                speed.screenHeight =
+                  Integer.parseInt(args[i].substring(args[i].indexOf('=') + 1));
+                i+=1;
+                continue;
+              }
+            else if ((args[i].equals("-h") || args[i].equals("--height")))
+              {
+                if ((i+1) >= args.length)
+                  {
+                    System.err.println("ERROR: No argument given for option '"
+                                       + args[i] + "'!");
+                    System.exit(2);
+                  }
+                speed.screenHeight = Integer.parseInt(args[i + 1]);
+                i += 2;
+                continue;
+              }
+            else if ((args[i].equals("-n")
+                || args[i].equals("--noDoubleBuffer")))
+              {
+                speed.doubleBufferFlag = false;
+                i += 1;
+                continue;
+              }
+            else if (args[i].equals("--"))
+              {
+                endOfOptionsFlag = true;
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("-"))
+              {
+                System.err.println("ERROR: Unknown option '" + args[i] + "'!");
+                System.exit(2);
+              }
+          }
+        StringTokenizer tokenizer = new StringTokenizer(args[i], " +,");
+        while (tokenizer.hasMoreTokens())
+          {
+            String s = tokenizer.nextToken().toLowerCase();
+            if (s.equals("line"))
+              awtTests |= AWTTEST_LINES;
+            else if (s.equals("rect"))
+              awtTests |= AWTTEST_RECT;
+            else if (s.equals("polyline"))
+              awtTests |= AWTTEST_POLYLINE;
+            else if (s.equals("polygon"))
+              awtTests |= AWTTEST_POLYGON;
+            else if (s.equals("arc"))
+              awtTests |= AWTTEST_ARC;
+            else if (s.equals("oval"))
+              awtTests |= AWTTEST_OVAL;
+            else if (s.equals("roundrect"))
+              awtTests |= AWTTEST_ROUNDRECT;
+            else if (s.equals("string"))
+              awtTests |= AWTTEST_STRING;
+            else if (s.equals("transparentimage"))
+              awtTests |= AWTTEST_TRANSPARENTIMAGE;
+            else if (s.equals("image"))
+              awtTests |= AWTTEST_IMAGE;
+            else
+              {
+                System.err.println("Unknown AWT test '" + s + "'!");
+                System.exit(2);
+              }
+          }
+        i += 1;
+      }
+    if (awtTests != AWTTEST_NONE)
+      speed.awtTests = awtTests;
+
+    // Create graphics.
+    final Frame frame = new Frame("AicasGraphicsBenchmark");
+
+    frame.addWindowListener(new WindowAdapter()
+    {
+      public void windowClosing(WindowEvent e)
+      {
+        frame.setVisible(false);
+        System.exit(0);
+      }
+    });
+
+    frame.add(speed,BorderLayout.CENTER);
+    frame.setSize(speed.screenWidth,speed.screenHeight);
+    frame.setVisible(true);
+
+    // Insets are correctly set only after the native peer was created.
+    Insets insets = frame.getInsets();
+    // The internal size of the frame should be 320x240.
+    frame.setSize(320 + insets.right + insets.left,
+                  240 + insets.top + insets.bottom);
+  }
+
+  private Image loadImage(String imageName)
+  {
+    Image result = null;
+    logger.logp(Level.INFO, "AicasGraphicsBenchmark", "loadImage",
+                "Loading image: " + imageName);
+    URL url = getClass().getResource(imageName);
+    if (url != null)
+      {
+        result = Toolkit.getDefaultToolkit().getImage(url);
+        prepareImage(result, this);
+      }
+    else
+      {
+        logger.logp(Level.WARNING, "AicasGraphicsBenchmark", "loadImage",
+                    "Could not locate image resource in class path: "
+                    + imageName);
+      }
+    return result;
+  }
+
+  /**
+   * Executes the test methods.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  void runTestSet(Graphics g, Dimension size)
+  {
+    if ((awtTests & AWTTEST_LINES) != 0)
+      test_drawLine(g, size);
+    if ((awtTests & AWTTEST_RECT) != 0)
+      test_drawRect(g, size);
+    if ((awtTests & AWTTEST_RECT) != 0)
+      test_fillRect(g, size);
+    if ((awtTests & AWTTEST_POLYLINE) != 0)
+      test_drawPolyline(g, size);
+    if ((awtTests & AWTTEST_POLYGON) != 0)
+      test_drawPolygon(g, size);
+    if ((awtTests & AWTTEST_POLYGON) != 0)
+      test_fillPolygon(g,size);
+    if ((awtTests & AWTTEST_ARC) != 0)
+      test_drawArc(g,size);
+    if ((awtTests & AWTTEST_ARC) != 0)
+      test_fillArc(g,size);
+    if ((awtTests & AWTTEST_OVAL) != 0)
+      test_drawOval(g, size);
+    if ((awtTests & AWTTEST_OVAL) != 0)
+      test_fillOval(g, size);
+    if ((awtTests & AWTTEST_ROUNDRECT) != 0)
+      test_fillRoundRect(g, size);
+    if ((awtTests & AWTTEST_STRING) != 0)
+      test_drawString(g, size);
+    if ((awtTests & AWTTEST_TRANSPARENTIMAGE) != 0)
+      test_drawTransparentImage(g,size);
+    if ((awtTests & AWTTEST_IMAGE) != 0)
+      test_drawImage(g,size);
+  }
+
+  /**
+   * Gets a new random Color.
+   *
+   * @returna new random Color
+   */
+  private Color getNextColor()
+  {
+    return new Color((int) (Math.random() * 254) + 1,
+                     (int) (Math.random() * 254) + 1,
+                     (int) (Math.random() * 254) + 1);
+  }
+
+  /**
+   * Draws random lines within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawLine(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i=0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int x1 = (int) (Math.random() * (size.width-minSize));
+        int y1 = (int) (Math.random() * (size.height-minSize));
+        int x2 = (int) (Math.random() * (size.width-minSize));
+        int y2 = (int) (Math.random() * (size.height-minSize));
+        g.drawLine(x1, y1, x2, y2);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("drawLine " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random rectangles within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawRect(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i=0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int x1 = (int) (Math.random() * (size.width-minSize));
+        int y1 = (int) (Math.random() * (size.height-minSize));
+        int x2 = (int) (Math.random() * (size.width-minSize));
+        int y2 = (int) (Math.random() * (size.height-minSize));
+        g.drawRect(x1, y1, x2, y2);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("drawRect " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random rectangles within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillRect(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int x1 = (int) (Math.random() * (size.width-minSize));
+        int y1 = (int) (Math.random() * (size.height-minSize));
+        int x2 = (int) (Math.random() * (size.width-minSize));
+        int y2 = (int) (Math.random() * (size.height-minSize));
+        g.fillRect(x1, y1, x2, y2);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("fillRect " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random polylines within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawPolyline(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    long startTime = System.currentTimeMillis();
+    for (int i=0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int points = (int)(Math.random() * 6) + 3;
+        int[] x_coords = new int[points];
+        int[] y_coords = new int[points];
+        for (int j = 0; j < points; j+=1)
+          {
+            x_coords[j] = (int)(Math.random() * (size.width));
+            y_coords[j] = (int)(Math.random() * (size.height));
+          }
+        g.drawPolyline(x_coords,y_coords, points);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("drawPolyline " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random polygons within the given dimensions.
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawPolygon(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    long startTime = System.currentTimeMillis();
+    for (int i=0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int points = (int) (Math.random() * 6) + 3;
+        int[] xcoords = new int[points];
+        int[] ycoords = new int[points];
+        for(int j = 0; j < points; j+=1)
+          {
+            xcoords[j] = (int) (Math.random() * (size.width));
+            ycoords[j] = (int) (Math.random() * (size.height));
+          }
+        g.drawPolygon(xcoords, ycoords, points);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("drawPolygon " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random filled polygons within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillPolygon(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    long startTime = System.currentTimeMillis();
+    for (int i=0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int points = (int) (Math.random() * 6) + 3;
+        int[] xcoords = new int[points];
+        int[] ycoords = new int[points];
+        for (int j = 0; j < points; j+=1)
+          {
+            xcoords[j] = (int) (Math.random() * (size.width));
+            ycoords[j] = (int) (Math.random() * (size.height));
+          }
+        g.fillPolygon(xcoords, ycoords, points);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("fillPolygon " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random arcs within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawArc(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    int minSize;
+    long startTime;
+    long endTime;
+    minSize = 10;
+    startTime = System.currentTimeMillis();
+    for (int i=0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int x = (int) (Math.random() * (size.width - minSize + 1));
+        int y = (int) (Math.random() * (size.height - minSize + 1));
+        int width = (int) (Math.random() * (size.width - x - minSize) + minSize);
+        int height = (int) (Math.random() * (size.height - y - minSize) + minSize);
+        int startAngle = (int) (Math.random() * 360);
+        int arcAngle = (int) (Math.random() * 360 - startAngle);
+        g.drawArc(x, y, width, height, startAngle, arcAngle);
+      }
+    endTime = System.currentTimeMillis();
+    recordTest("drawArc " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random filled arcs within the given dimensions.
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillArc(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    int minSize;
+    long startTime;
+    long endTime;
+    minSize = 10;
+    startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+    {
+      g.setColor(getNextColor());
+      int x = (int) (Math.random() * (size.width - minSize + 1));
+      int y = (int) (Math.random() * (size.height - minSize + 1));
+      int width = (int)(Math.random() * (size.width - x - minSize) + minSize);
+      int height = (int)(Math.random() * (size.height - y - minSize) + minSize);
+      int startAngle = (int)(Math.random() * 360);
+      int arcAngle = (int)(Math.random() * 360);
+      g.fillArc(x, y, width, height, startAngle, arcAngle);
+
+    }
+    endTime = System.currentTimeMillis();
+    recordTest("fillArc " + maxTests + " times", (endTime - startTime));
+  }
+
+  /**
+   * Draws random ovals within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawOval(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    int minSize;
+    long startTime;
+    long endTime;
+    minSize = 10;
+    startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int x = (int)(Math.random() * (size.width - minSize + 1));
+        int y = (int)(Math.random() * (size.height - minSize + 1));
+        int width = (int)(Math.random() * (size.width - x - minSize) + minSize);
+        int height = (int)(Math.random() * (size.height - y - minSize) + minSize);
+        g.drawOval(x, y, Math.min(width, height), Math.min(width, height));
+      }
+    endTime = System.currentTimeMillis();
+    recordTest("drawOval " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random filled ovals within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillOval(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    int minSize;
+    long startTime;
+    long endTime;
+    minSize = 10;
+    startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int x = (int) (Math.random() * (size.width - minSize + 1));
+        int y = (int) (Math.random() * (size.height - minSize + 1));
+        int width = (int) (Math.random() * (size.width - x - minSize) + minSize);
+        int height = (int) (Math.random() * (size.height - y - minSize) + minSize);
+        g.fillOval(x, y, width,height);
+      }
+    endTime = System.currentTimeMillis();
+    recordTest("fillOval " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random filled rounded rectangles within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillRoundRect(Graphics g, Dimension size)
+  {
+    int maxTests = DEFAULT_TEST_SIZE;
+    int minSize;
+    long startTime;
+    long endTime;
+    minSize = 10;
+    startTime = System.currentTimeMillis();
+    for (int i=0; i < maxTests; i+=1)
+      {
+        g.setColor(getNextColor());
+        int x = (int) (Math.random() * (size.width - minSize + 1));
+        int y = (int) (Math.random() * (size.height - minSize + 1));
+        int width = (int) (Math.random() * (size.width - x - minSize) + minSize);
+        int height = (int) (Math.random() * (size.height - y - minSize) + minSize);
+        int arcWidth = (int) (Math.random() * (width - 1) + 1);
+        int arcHeight = (int) (Math.random() * (height - 1) + 5);
+        g.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
+      }
+    endTime = System.currentTimeMillis();
+    recordTest("fillRoundRect " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random images within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawImage(Graphics g, Dimension size)
+  {
+    if (gifTestImage == null)
+      {
+        logger.logp(Level.WARNING, "AicasGraphicsBenchmark", "runTestSet",
+                    "Skipping 'test_drawImage' due to missing resource.");
+        return;
+      }
+    
+    int maxTests = DEFAULT_TEST_SIZE / 2;
+    if(maxTests == 0)
+      maxTests = 1;
+    int imageWidth = gifTestImage.getWidth(this);
+    int imageHeight = gifTestImage.getHeight(this);
+    long  startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int x = (int) (Math.random() * (size.width - imageWidth + 1));
+        int y = (int) (Math.random() * (size.height - imageHeight + 1));
+        g.drawImage(gifTestImage, x, y, this);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("drawImage " + maxTests + " times", (endTime-startTime));
+  }
+
+  /**
+   * Draws random transparent images within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawTransparentImage(Graphics g, Dimension size)
+  {
+    if (pngTestImage == null)
+      {
+        logger.logp(Level.WARNING, "AicasGraphicsBenchmark", "runTestSet",
+                    "Skipping 'test_drawTransparentImage' due to missing resource.");
+        return;
+      }
+
+    
+    int maxTests = DEFAULT_TEST_SIZE / 5;
+    if(maxTests == 0)
+      maxTests = 1;
+    int imageWidth = pngTestImage.getWidth(this);
+    int imageHeight = pngTestImage.getHeight(this);
+    long  startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        g.setColor(getNextColor());
+        int x = (int) (Math.random() * (size.width - imageWidth + 1));
+        int y = (int) (Math.random() * (size.height - imageHeight + 1));
+        g.drawImage(pngTestImage, x, y, this);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("draw transparent image " + maxTests + " times",
+               (endTime-startTime));
+  }
+
+  /**
+   * Draws random strings within the given dimensions.
+   *
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawString(Graphics g, Dimension size)
+  {
+      int maxTests = DEFAULT_TEST_SIZE;
+      String testString = "HelloWorld";
+      int stringWidth = g.getFontMetrics().stringWidth(testString);
+      int stringHeight = g.getFontMetrics().getHeight();
+      
+      long startTime = System.currentTimeMillis();
+      for(int i = 0; i < maxTests; i += 1)
+        {
+          g.setColor(getNextColor());
+          g.drawString(testString, (int) (Math.random() * (size.width - stringWidth + 1)),(int)(Math.random() * (size.height - stringHeight + 1)) + stringHeight);
+        }
+      long endTime = System.currentTimeMillis();
+      recordTest("drawString " + maxTests + " times", (endTime-startTime));
+  }
+
+  private class GraphicsTest extends Canvas implements Runnable
+  {
+    Thread paintThread;
+    boolean done = false;
+    boolean doPaint = false;
+    boolean withClipping = false;
+
+    public GraphicsTest()
+    {
+      paintThread = new Thread(this);
+      paintThread.start();
+    }
+
+    public void run()
+    {
+      int runCount = 0;
+      while (!done)
+        {
+          runCount++;
+
+          try
+            {
+              synchronized (this)
+                {
+                  while (!doPaint)
+                    {
+                      try
+                        {
+                          wait(200);
+                        }
+                      catch (InterruptedException exception)
+                        {
+                          return;
+                        }
+                    }
+                }
+
+              if (iterations != 0)
+                System.out.println("--- run...(" + runCount + "/" + iterations
+                                   + ") ------------------------------------------------------");
+
+              Graphics g = getGraphics();
+              Dimension size = getSize();
+              logger.logp(Level.INFO, "AicasGraphicsBenchmark.GraphicsTest", "run",
+              "Start testing non-double-buffered drawing");
+              runSet_noClipping(g,size);
+              runSet_zeroClipping(g, size);
+              runSet_withClipping(g, size);
+              g.dispose();
+
+              if (doubleBufferFlag)
+                {
+                  logger.logp(Level.INFO, "AicasGraphicsBenchmark.GraphicsTest",
+                              "run", "Start testing double-buffered drawing");
+                  Graphics canvas = getGraphics();
+                  Image doublebuffer = createImage(size.width,size.height);
+                  g = doublebuffer.getGraphics();
+                  runSet_noClipping(g,size);
+                  g.dispose();
+                  canvas.drawImage(doublebuffer, 0, 0, this);
+
+                  g = doublebuffer.getGraphics();
+                  runSet_withClipping(g, size);
+                  g.dispose();
+                  canvas.drawImage(doublebuffer, 0, 0, this);
+
+                  g = doublebuffer.getGraphics();
+                  runSet_zeroClipping(g, size);
+                  g.dispose();
+                  canvas.drawImage(doublebuffer, 0, 0, this);
+                  canvas.dispose();
+                }
+
+              printReport();
+
+              if (iterations != 0)
+                {
+                  if (iterations != -1)
+                    iterations--;
+                }
+              else
+                {
+                  System.out.println("--- done --------------------------------------------------------");
+                  synchronized (this)
+                    {
+                      doPaint = false;
+                    }
+                  done = true;
+                }
+            }
+          catch (Error error)
+            {
+              System.err.println("Error: " + error);
+              System.exit(129);
+            }
+        }
+      System.exit(0);
+    }
+
+    private void runSet_zeroClipping(Graphics g, Dimension size)
+    {
+      int clipped_width;
+      int clipped_height;
+      int clipped_x;
+      int clipped_y;
+
+      clipped_width = 0;
+      clipped_height = 0;
+      clipped_x = (size.width) / 2;
+      clipped_y = (size.height) / 2;
+      g.setClip(0, 0, size.width, size.height);
+      g.setColor(Color.BLACK);
+      g.fillRect(0, 0, size.width, size.height);
+      g.setColor(Color.WHITE);
+      g.drawRect(0, 0, size.width - 1, size.height - 1);
+      g.fillRect(clipped_x - 1, clipped_y - 1, clipped_width + 2, clipped_height + 2);
+
+      g.clipRect(clipped_x, clipped_y, clipped_width, clipped_height);
+      g.setColor(Color.BLACK);
+      g.fillRect(0, 0, size.width, size.height);
+
+      setTestContext("clipping to zero");
+
+      runTestSet(g, size);
+    }
+
+    private void runSet_withClipping(Graphics g, Dimension size)
+    {
+      int clipped_width = 2 * size.width / 3;
+      int clipped_height = 2 * size.height / 3;
+      int clipped_x = (size.width - clipped_width) / 2;
+      int clipped_y = (size.height - clipped_height) / 2;
+
+      g.setClip(0,0,size.width,size.height);
+
+      g.setColor(Color.BLACK);
+      g.fillRect(0, 0, size.width, size.height);
+      g.setColor(Color.GREEN);
+      g.drawRect(0, 0, size.width - 1, size.height - 1);
+      g.setColor(Color.WHITE);
+      g.fillRect(clipped_x - 1, clipped_y - 1, clipped_width + 2, clipped_height + 2);
+
+      g.clipRect(clipped_x, clipped_y, clipped_width, clipped_height);
+      g.setColor(Color.BLACK);
+      g.fillRect(0, 0, size.width, size.height);
+
+      setTestContext("with clipping");
+
+      runTestSet(g, size);
+    }
+
+    public void runSet_noClipping(Graphics g, Dimension size)
+    {
+      g.setColor(Color.BLACK);
+      g.fillRect(0, 0, size.width, size.height);
+
+      setTestContext("without clipping");
+
+      runTestSet(g, size);
+    }
+
+    public void paint(Graphics g)
+    {
+      synchronized(this)
+        {
+          doPaint=true;
+          notify();
+        }
+    }
+  }
+}
+
+class TestContext
+{
+}
+
+class TestSet
+{
+  private Map testsMap = new TreeMap();
+
+  public void putTest(String testName, TestRecorder recoder)
+  {
+    testsMap.put(testName,recoder);
+  }
+
+  public TestRecorder getTest(String testName)
+  {
+    return (TestRecorder)testsMap.get(testName);
+  }
+
+  public Iterator testIterator()
+  {
+    return testsMap.keySet().iterator();
+  }
+}
+
+class TestRecorder
+{
+  String test;
+  long   totalTime = 0;
+  long   minTime   = Long.MAX_VALUE;
+  long   maxTime   = Long.MIN_VALUE;
+  int    runCount  = 0;
+
+  /**
+   * @return Returns the maxTime.
+   */
+  public final long getMaxTime()
+  {
+    return maxTime;
+  }
+
+  /**
+   * @return Returns the minTime.
+   */
+  public final long getMinTime()
+  {
+    return minTime;
+  }
+
+  /**
+   * @return Returns the test name.
+   */
+  public final String getTestName()
+  {
+    return test;
+  }
+
+  public final double getAverage()
+  {
+    return ((double)totalTime) / ((double)runCount);
+  }
+
+  public TestRecorder(String testName)
+  {
+    test = testName;
+  }
+
+  public void addRun(long time)
+  {
+    totalTime += time;
+    if(minTime > time)
+      minTime = time;
+    if(maxTime < time)
+      maxTime = time;
+    runCount += 1;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/AnimationApplet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/AnimationApplet.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/AnimationApplet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/AnimationApplet.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,233 @@
+/* AnimationApplet.java -- An example of an old-style AWT applet
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+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. */
+
+package gnu.classpath.examples.awt;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.*;
+
+
+/**
+ * AnimationApplet demonstrates the need for Xflush calls in
+ * GdkGraphics.c.  To see how this demo can fail in their absence,
+ * remove the contents of schedule_flush in GdkGraphics.c.  The
+ * animation will be so choppy that it is effectively stopped.
+ */
+public class AnimationApplet
+  extends Applet
+  implements Runnable
+{
+  boolean going = false;
+  Thread animThread = null;
+  int SPEED = 5;
+  int circleX = 0;
+  int circleY = 0;
+  int circleXold = 0;
+  int circleYold = 0;
+  int circleXdelta = 0;
+  int circleYdelta = 0;
+  int circleDiameter = 0;
+  int autoCircleX = 0;
+  int autoCircleY = 0;
+  int autoCircleXold = 0;
+  int autoCircleYold = 0;
+  int autoCircleXdelta = (int) (0.66 * SPEED);
+  int autoCircleYdelta = (int) (1.33 * SPEED);
+  int boardWidth = 0;
+  int boardHeight = 0;
+  int CIRCLE_SIZE = 5;
+
+  private Graphics appletGraphics;
+
+  // Update the circles' location values.
+  private void moveCircles()
+  {
+    circleX += circleXdelta;
+    if (circleX < 0)
+      circleX = 0;
+    if (circleX > boardWidth - circleDiameter)
+      circleX = boardWidth - circleDiameter;
+
+    circleY += circleYdelta;
+    if (circleY < 0)
+      circleY = 0;
+    if (circleY > boardHeight - circleDiameter)
+      circleY = boardHeight - circleDiameter;
+
+    autoCircleX += autoCircleXdelta;
+    if (autoCircleX < 0)
+      {
+        autoCircleX = 0;
+        autoCircleXdelta = -autoCircleXdelta;
+      }
+    if (autoCircleX > boardWidth - circleDiameter)
+      {
+        autoCircleX = boardWidth - circleDiameter;
+        autoCircleXdelta = -autoCircleXdelta;
+      }
+
+    autoCircleY += autoCircleYdelta;
+    if (autoCircleY < 0)
+      {
+        autoCircleY = 0;
+        autoCircleYdelta = -autoCircleYdelta;
+      }
+    if (autoCircleY > boardHeight - circleDiameter)
+      {
+        autoCircleY = boardHeight - circleDiameter;
+        autoCircleYdelta = -autoCircleYdelta;
+      }
+  }
+
+  // Clear the circle in the old location and paint a new circle
+  // in the new location.
+  private void paintCircles()
+  {
+    appletGraphics.setColor(Color.BLUE);
+    appletGraphics.fillOval(circleXold, circleYold, circleDiameter,
+                            circleDiameter);
+    appletGraphics.setColor(Color.YELLOW);
+    appletGraphics.fillOval(circleX, circleY, circleDiameter,
+                            circleDiameter);
+
+    appletGraphics.setColor(Color.BLUE);
+    appletGraphics.fillOval(autoCircleXold, autoCircleYold, circleDiameter,
+                            circleDiameter);
+    appletGraphics.setColor(Color.WHITE);
+    appletGraphics.fillOval(autoCircleX, autoCircleY, circleDiameter,
+                            circleDiameter);
+  }
+
+  // Override Applet.run.
+  public void run()
+  {
+    while (animThread != null)
+      {
+        circleXold = circleX;
+        circleYold = circleY;
+        autoCircleXold = autoCircleX;
+        autoCircleYold = autoCircleY;
+
+        moveCircles();
+        paintCircles();
+
+        if (animThread != null)
+          {
+            try
+              {
+                Thread.sleep(20);
+              }
+            catch (InterruptedException e)
+              {
+              }
+          }
+      }
+  }
+
+  // Override Applet.paint.
+  public void paint(Graphics g)
+  {
+    boardWidth = this.getSize().width;
+    boardHeight = this.getSize().height;
+    g.setColor(Color.BLUE);
+    g.fillRect(0, 0, boardWidth, boardHeight);
+    if (!going)
+      {
+        FontMetrics fm = appletGraphics.getFontMetrics();
+        appletGraphics.setColor(Color.WHITE);
+        String msg = "Click to Start";
+        appletGraphics.drawString(msg,
+                                  (boardWidth >> 1) - (fm.stringWidth(msg) >> 1),
+                                  (boardHeight >> 1) - (fm.getHeight() >> 1));
+      }
+  }
+
+  // Override Applet.destroy.
+  public void destroy()
+  {
+    // animThread.stop();
+    animThread = null;
+  }
+
+  // Override Applet.init.
+  public void init()
+  {
+    boardWidth = this.getSize().width;
+    boardHeight = this.getSize().height;
+    going = false;
+    appletGraphics = getGraphics();
+    appletGraphics.setFont(new Font(appletGraphics.getFont().getName(),
+                                    Font.BOLD, 15));
+  }
+
+  // Override Component.preferredSize for when we're run standalone.
+  public Dimension preferredSize ()
+  {
+    return new Dimension (400, 400);
+  }
+
+  // Override Applet.handleEvent, the old-style AWT-event handler.
+  public boolean handleEvent(Event event)
+  {
+    switch (event.id)
+      {
+      case Event.MOUSE_DOWN:
+        if (!going)
+          {
+            going = true;
+            circleDiameter = boardWidth / CIRCLE_SIZE;
+            circleX = (boardWidth - circleDiameter) >> 1;
+            circleY = (boardHeight - circleDiameter) >> 1;
+            circleXdelta = 0;
+            circleYdelta = 0;
+            repaint();
+            animThread = new Thread(this);
+            animThread.start();
+          }
+        break;
+      case Event.KEY_ACTION:
+      case Event.KEY_PRESS:
+        if (event.key == Event.LEFT)
+          circleXdelta = -SPEED;
+        else if (event.key == Event.RIGHT)
+          circleXdelta = SPEED;
+        else if (event.key == Event.UP)
+          circleYdelta = -SPEED;
+        else if (event.key == Event.DOWN)
+          circleYdelta = SPEED;
+        break;
+      case Event.KEY_ACTION_RELEASE:
+      case Event.KEY_RELEASE:
+        if (event.key == Event.LEFT && circleXdelta < 0)
+          circleXdelta = 0;
+        else if (event.key == Event.RIGHT && circleXdelta > 0)
+          circleXdelta = 0;
+        else if (event.key == Event.UP && circleYdelta < 0)
+          circleYdelta = 0;
+        else if (event.key == Event.DOWN && circleYdelta > 0)
+          circleYdelta = 0;
+        break;
+      default:
+        break;
+      }
+    return false;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/Demo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/Demo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/Demo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/awt/Demo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1189 @@
+/* Demo.java -- Shows examples of AWT components
+   Copyright (C) 1998, 1999, 2002, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+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. */
+
+package gnu.classpath.examples.awt;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Canvas;
+import java.awt.Checkbox;
+import java.awt.CheckboxGroup;
+import java.awt.CheckboxMenuItem;
+import java.awt.Choice;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.DisplayMode;
+import java.awt.FileDialog;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.GridLayout;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.Label;
+import java.awt.List;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.MenuShortcut;
+import java.awt.Panel;
+import java.awt.ScrollPane;
+import java.awt.TextField;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DragSourceContext;
+import java.awt.dnd.DragSourceDragEvent;
+import java.awt.dnd.DragSourceDropEvent;
+import java.awt.dnd.DragSourceEvent;
+import java.awt.dnd.DragSourceListener;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.dnd.DropTargetEvent;
+import java.awt.dnd.DropTargetListener;
+import java.awt.dnd.InvalidDnDOperationException;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+class Demo
+{
+  public static void main(String args[])
+  {
+    MainWindow f = new MainWindow();
+    f.show();
+  }
+  
+  static interface SubWindow
+  {
+    public void init ();
+  }
+  
+  static class PrettyPanel extends Panel
+  {
+    Insets myInsets;
+    
+    public PrettyPanel ()
+    {
+      myInsets = new Insets (10, 10, 10, 10);
+    }
+    public Insets getInsets ()
+    {
+      return myInsets;
+    }
+  }
+  
+  static abstract class PrettyFrame extends Frame
+  {
+    public PrettyFrame ()
+    {
+      ((BorderLayout) getLayout ()).setHgap (5);
+      ((BorderLayout) getLayout ()).setVgap (5);
+    }
+    
+    public Insets getInsets()
+    {
+      Insets oldInsets = super.getInsets ();
+      return new Insets (oldInsets.top+10,
+			 oldInsets.left+10,
+			 oldInsets.bottom+10,
+			 oldInsets.right+10);
+    }
+  }
+
+  static abstract class SubFrame extends PrettyFrame implements SubWindow
+  {
+    boolean initted = false;
+    
+    public void setVisible (boolean visible)
+    {
+      if (!initted && visible)
+	init();
+      super.setVisible (visible);
+    } 
+  }
+
+  static class MainWindow extends PrettyFrame implements ActionListener 
+  {
+    Button closeButton;
+    
+    Hashtable windows;
+    Vector buttons;
+    
+    void addSubWindow (String name, SubWindow w)
+    {
+      Button b = new Button (name);
+      b.addActionListener (this);
+      
+      buttons.addElement (b);
+      windows.put (b, w);    
+    }
+    
+    MainWindow () 
+    {
+      MenuBar mb = new MenuBar ();
+      Menu menu = new Menu ("File");
+      Menu submenu = new Menu ("Testing", true);
+      submenu.add (new CheckboxMenuItem ("FooBar"));
+      submenu.add (new CheckboxMenuItem ("BarFoo"));
+      menu.add (submenu);
+      menu.add (new MenuItem("Orange"));
+      MenuItem quit = new MenuItem("Quit", new MenuShortcut('Q'));
+      quit.addActionListener(new ActionListener()
+        {
+          public void actionPerformed(ActionEvent e)
+          {
+            System.exit(0);
+          }
+        });
+      menu.add(quit);
+      mb.add (menu);
+
+      menu = new Menu("Edit", true);
+      menu.add(new MenuItem("Cut"));
+      menu.add(new MenuItem("Copy"));
+      menu.add(new MenuItem("Paste"));
+      mb.add (menu);
+
+      Menu helpMenu = new Menu("Help");
+      helpMenu.add(new MenuItem("About"));
+      mb.add(helpMenu);
+      mb.setHelpMenu(helpMenu);
+      
+      setMenuBar (mb);
+      
+      String version = System.getProperty("gnu.classpath.version");
+      add (new Label ("GNU Classpath " + version), "North");
+      
+      closeButton = new Button ("Close");
+      closeButton.addActionListener (this);
+      closeButton.setFont (new Font ("Serif", Font.BOLD | Font.ITALIC, 18));
+      add (closeButton, "South");
+      
+      windows = new Hashtable ();
+      buttons = new Vector ();
+      
+      addSubWindow ("Buttons", new ButtonsWindow ());
+      addSubWindow ("Cursors", new CursorsWindow ());
+      addSubWindow ("Dialog", new DialogWindow (this));
+      addSubWindow ("File", new FileWindow (this));
+      addSubWindow ("Labels", new LabelWindow ());
+      addSubWindow ("List", new ListWindow ());
+      addSubWindow ("Radio Buttons", new RadioWindow ());
+      addSubWindow ("TextField", new TextFieldWindow ());
+      addSubWindow ("RandomTests", new TestWindow (this));
+      addSubWindow ("RoundRect", new RoundRectWindow ());
+      addSubWindow ("Animation", new AnimationWindow ());
+      addSubWindow ("Resolution", new ResolutionWindow ());
+      addSubWindow ("Fullscreen", new FullscreenWindow ());
+      addSubWindow ("Drag n' Drop", new DragDropWindow ());
+
+      Panel sp = new Panel();
+      PrettyPanel p = new PrettyPanel();
+      p.setLayout (new GridLayout (windows.size(), 1));
+      
+      for (Enumeration e = buttons.elements (); e.hasMoreElements (); )
+	{
+	  p.add ((Button) e.nextElement ());
+	}
+      
+      sp.add (p);
+      add (sp, "Center");
+      
+      setTitle ("AWT Demo");
+      pack();
+    }
+    
+    public void actionPerformed (ActionEvent evt)
+    {
+      Button source = (Button) evt.getSource ();
+      
+      if (source==closeButton)
+	{
+	  dispose();
+	  System.exit (0);
+	}
+      
+      Window w = (Window) windows.get (source);
+      if (w.isVisible ())
+	w.dispose ();
+      else 
+	{
+	  if (w instanceof Dialog)
+	    {
+	      w.show();
+	    }
+	  else
+	    {
+	      w.setVisible (true);
+	    }
+	}
+    }
+  }
+  
+  static class ButtonsWindow extends SubFrame implements ActionListener
+  {
+    Button b[] = new Button [9];
+    
+    public void init ()
+    {
+      initted = true;
+      Panel p = new Panel ();
+      p.setLayout (new GridLayout (0, 3, 5, 5));
+      
+      for (int i=0; i<9; i++) 
+	{
+	  b[i]=new Button ("button" + (i+1));
+	  b[i].addActionListener (this);
+	}
+      
+      p.add (b[0]);
+      p.add (b[6]);
+      p.add (b[4]);
+      p.add (b[8]);
+      p.add (b[1]);
+      p.add (b[7]);
+      p.add (b[3]);
+      p.add (b[5]);
+      p.add (b[2]);
+      
+      add (p, "North");
+      
+      Button cb = new Button ("close");
+      cb.addActionListener(new ActionListener () {
+	  public void actionPerformed (ActionEvent e) {
+	    dispose();
+	  }
+	});
+      add (cb, "South");
+      setTitle ("Buttons");
+      pack();
+    }
+    
+    public void actionPerformed (ActionEvent evt)
+    {
+      Button source = (Button) evt.getSource ();
+      
+      for (int i = 0; i < 9; i++)
+	{
+	  if (source == b[i])
+	    {
+	      int i2 = ((i + 1) == 9) ? 0 : (i + 1);
+	      if (b[i2].isVisible())
+		b[i2].setVisible(false);
+	      else 
+		b[i2].setVisible(true);
+	    }
+	}
+    }
+  }
+  
+  
+  static class DialogWindow extends Dialog implements SubWindow
+  {
+    Label text;
+    Frame parent;
+    boolean initted = false;
+    
+    public DialogWindow (Frame f)
+    {
+      super (f, true);
+      
+      this.parent = f;
+      
+      addWindowListener (new WindowAdapter ()
+	{
+	  public void windowClosing (WindowEvent e)
+	  {
+	    text.setVisible (false);
+	    hide ();
+	  }
+	});
+    }
+    
+    public void setVisible (boolean visible)
+    {
+      if (!initted && visible)
+	init();
+      super.setVisible (visible);
+    }
+    
+    public void show ()
+    {
+      if (!initted)
+	init();
+      super.show ();
+    }
+    
+    public void init ()
+    {
+      text = new Label ("Dialog Test");
+      text.setAlignment (Label.CENTER);
+      
+      add (text, "North");
+      text.setVisible (false);
+      
+      Panel p = new PrettyPanel();
+      
+      Button cb = new Button ("OK");
+      cb.addActionListener(new ActionListener () {
+	  public void actionPerformed (ActionEvent e) 
+	  {
+	    text.setVisible (false);
+	    hide();
+	  }
+	});
+      
+      p.setLayout (new GridLayout (1, 3));
+      ((GridLayout) p.getLayout ()).setHgap (5);
+      ((GridLayout) p.getLayout ()).setVgap (5);
+      p.add (cb);
+      
+      Button toggle = new Button ("Toggle");
+      p.add (toggle);
+      
+      toggle.addActionListener(new ActionListener () {
+	  public void actionPerformed (ActionEvent e) 
+	  {
+	    if (text.isVisible ())
+	      text.setVisible (false);
+	    else 
+	      text.setVisible (true);
+	    doLayout();
+	  }
+	});
+      
+      Button subdlg = new Button ("SubDialog");
+      p.add (subdlg);
+      
+      subdlg.addActionListener(new ActionListener () {
+	  public void actionPerformed (ActionEvent e) 
+	  {
+            DialogWindow sw = new DialogWindow (parent);
+            sw.show ();
+	  }
+	});
+      
+      add (p, "South");
+      setTitle ("Dialog");
+      pack();
+    }
+  }
+  
+  static class CursorsWindow extends SubFrame implements ItemListener
+  {
+    Choice cursorChoice;
+    Canvas cursorCanvas;
+    
+    public void init ()
+    {
+      cursorChoice = new Choice();
+      cursorChoice.add ("Default");
+      cursorChoice.add ("Crosshair");
+      cursorChoice.add ("Text");
+      cursorChoice.add ("Wait");
+      cursorChoice.add ("Southwest Resize");
+      cursorChoice.add ("Southeast Resize");
+      cursorChoice.add ("Northwest Resize");
+      cursorChoice.add ("Northeast Resize");
+      cursorChoice.add ("North Resize");
+      cursorChoice.add ("South Resize");
+      cursorChoice.add ("West Resize");
+      cursorChoice.add ("East Resize");
+      cursorChoice.add ("Hand");
+      cursorChoice.add ("Move");
+      
+      cursorChoice.addItemListener(this);
+      
+      add (cursorChoice, "North");
+      
+      cursorCanvas = new Canvas () 
+	{ 
+	  public void paint (Graphics g) 
+	  {
+	    Dimension d = this.getSize();
+	    g.setColor(Color.white);
+	    g.fillRect(0, 0, d.width, d.height/2);
+	    g.setColor(Color.black);
+	    g.fillRect(0, d.height/2, d.width, d.height/2);
+	    g.setColor(this.getBackground());
+	    g.fillRect(d.width/3, d.height/3, d.width/3,
+			d.height/3);
+	  }
+	};
+      
+      cursorCanvas.setSize (80,80);
+      
+      add (cursorCanvas, "Center");
+      
+      Button cb = new Button ("Close");
+      cb.addActionListener(new ActionListener () {
+	  public void actionPerformed (ActionEvent e) {
+	    dispose();
+	  }
+	});
+      
+      add (cb, "South");
+      setTitle ("Cursors");
+      pack();
+    }
+    
+    public void itemStateChanged (ItemEvent e)
+    {
+      int index = cursorChoice.getSelectedIndex();
+      cursorCanvas.setCursor(Cursor.getPredefinedCursor(index));
+    }
+  }
+  
+  static class TextFieldWindow extends SubFrame implements ItemListener
+  {
+    Checkbox editable, visible, sensitive;
+    TextField text;
+    
+    public void init ()
+    {
+      initted = true;
+      text = new TextField ("hello world");
+      add (text, "North");
+      
+      Panel p = new Panel();
+      p.setLayout (new GridLayout (3, 1));
+      ((GridLayout) p.getLayout ()).setHgap (5);
+      ((GridLayout) p.getLayout ()).setVgap (5);
+      
+      editable = new Checkbox("Editable", true);
+      p.add (editable);
+      editable.addItemListener (this);
+      
+      visible = new Checkbox("Visible", true);
+      p.add (visible);
+      visible.addItemListener (this);
+      
+      sensitive = new Checkbox("Sensitive", true);
+      p.add (sensitive);
+      sensitive.addItemListener (this);
+      
+      add (p, "Center");
+      
+      Button cb = new Button ("Close");
+      cb.addActionListener(new ActionListener () {
+	  public void actionPerformed (ActionEvent e) {
+	    dispose();
+	  }
+	});
+      
+      add (cb, "South");
+      setTitle ("TextField");
+      pack();
+    }
+    
+    public void itemStateChanged (ItemEvent e)
+    {
+      boolean on=true;
+      
+      if (e.getStateChange () == ItemEvent.DESELECTED)
+	on=false;
+      if (e.getSource() == editable)
+	text.setEditable (on);
+      if (e.getSource() == visible)
+	if (on)
+	  text.setEchoChar ((char) 0);
+	else
+	  text.setEchoChar ('*');
+      if (e.getSource() == sensitive)
+	text.setEnabled (on);
+      
+    }
+  }
+  
+  static class FileWindow extends FileDialog implements SubWindow
+  {
+    boolean initted = false;
+    
+    public FileWindow (MainWindow mw)
+    {
+      super (mw);
+    }
+    
+    public void setVisible (boolean visible)
+    {
+      if (!initted && visible)
+	init();
+      super.setVisible (visible);
+    }
+    
+    public void init() 
+    {
+      initted = true;
+    }
+  }
+  
+  static class LabelWindow extends SubFrame
+  {
+    public void init ()
+    {
+      initted = true;
+      
+      Panel p = new Panel();
+      p.setLayout (new GridLayout (3, 1));
+      ((GridLayout) p.getLayout ()).setHgap (5);
+      ((GridLayout) p.getLayout ()).setVgap (5);
+      
+      p.add (new Label ("left justified label", Label.LEFT));
+      p.add (new Label ("center justified label", Label.CENTER));
+      p.add (new Label ("right justified label", Label.RIGHT));
+      
+      add (p, "Center");
+      
+      Button cb = new Button ("Close");
+      cb.addActionListener(new ActionListener () {
+	  public void actionPerformed (ActionEvent e) {
+	    dispose();
+	  }
+	});
+      
+      add (cb, "South");
+      setTitle ("Labels");
+      pack();
+    }
+  }
+  
+  static class ListWindow extends SubFrame
+  {
+    public void init ()
+    {
+      initted = true;
+      
+      Panel p = new Panel ();
+      p.setLayout (new GridLayout (3, 1));
+      
+      List l = new List (5, true);
+      for (int i = 0; i < 10; i++)
+	l.add ("List item " + i);
+
+      p.add (l);
+
+      add (p, "Center");
+      
+      Button cb = new Button ("Close");
+      cb.addActionListener(new ActionListener () {
+	  public void actionPerformed (ActionEvent e) {
+	    dispose();
+	  }
+	});
+      
+      add (cb, "South");
+      setTitle ("List");
+      pack();
+    }
+  }    
+  
+  
+  static class RadioWindow extends SubFrame
+  {
+    public void init ()
+    {
+      initted = true;
+      
+      Panel p = new Panel();
+      p.setLayout (new GridLayout (3, 1));
+      ((GridLayout) p.getLayout ()).setHgap (5);
+      ((GridLayout) p.getLayout ()).setVgap (5);
+      
+      final CheckboxGroup cg = new CheckboxGroup();
+      final Checkbox[] boxes = new Checkbox[3];
+      for (int i = 0; i < 3; ++i)
+	{
+	  boxes[i] = new Checkbox("button" + i, cg, i == 0);
+	  p.add(boxes[i]);
+	}
+      
+      add (p, "North");
+      
+      p = new Panel();
+      p.setLayout (new GridLayout (1, 3));
+      ((GridLayout) p.getLayout ()).setHgap (5);
+      ((GridLayout) p.getLayout ()).setVgap (5);
+      
+      for (int i = 0; i < 3; ++i)
+	{
+	  final int val = i;
+	  Button tweak = new Button ("Set " + i);
+	  tweak.addActionListener(new ActionListener ()
+	    {
+	      public void actionPerformed (ActionEvent e)
+	      {
+		cg.setSelectedCheckbox(boxes[val]);
+	      }
+	    });
+	  p.add(tweak);
+	}
+      
+      add (p, "Center");
+      
+      Button cb = new Button ("Close");
+      cb.addActionListener(new ActionListener () {
+	  public void actionPerformed (ActionEvent e) {
+	    dispose();
+	  }
+	});
+      
+      add (cb, "South");
+      setTitle ("Radio Buttons");
+      pack();
+    }
+  }
+  
+  static class TestWindow extends SubFrame
+  {
+    static int xs = 5, ys = 5;
+    final Frame parent;
+    
+    public TestWindow(Frame f)
+    {
+      parent = f;
+    }
+
+    public void init()
+    {
+      initted = true;
+      
+      addWindowListener (new WindowAdapter ()
+        {
+          public void windowClosing (WindowEvent e)
+          {
+            hide ();
+          }
+        });
+
+      Panel pan = new Panel();
+      
+      final Label l = new Label ("Pithy Message:");
+      l.setCursor (Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR));
+      pan.add (l);
+      
+      TextField tf = new TextField("Hello world!");
+      pan.add(tf);
+      add(pan,"North");
+      
+      final Image img;
+      URL imageurl;
+      imageurl = this.getClass()
+	.getResource("/gnu/classpath/examples/icons/big-warning.png");
+      img = Toolkit.getDefaultToolkit().createImage(imageurl);
+
+      final Canvas ch = new Canvas()
+	{ 
+	  public void paint (Graphics g)
+	  {
+	    g.drawImage(img, xs + 25, ys + 25, this);
+
+	    Font font = new Font ("Serif", Font.PLAIN, 18); 
+	    g.setFont (font);
+	    g.setXORMode (Color.red);
+
+	    g.drawString("Hi Red!", xs + 15, ys + 10);
+	    g.setColor (Color.blue);
+	    g.drawLine (xs, ys, xs + 100, ys + 100);
+	    
+	  }
+	};
+      ch.setSize(150, 150);
+      add(ch, "Center");
+
+      final ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
+      final Panel p = new Panel();
+      p.add(new Button("Stop"));
+      p.add(new Button("evil"));
+      p.add(new Button("hoarders"));
+      p.add(new Button("use"));
+      p.add(new Button("GNU!"));
+
+      sp.add(p);
+      add(sp, "South");
+
+      Panel east_panel = new Panel();
+      east_panel.setLayout(new GridLayout (0,1));
+
+      CheckboxGroup group = new CheckboxGroup();
+      Checkbox cb = new Checkbox("one", group, true);
+      east_panel.add(cb);
+      cb = new Checkbox("two", group, false);
+      east_panel.add(cb);
+
+      add(east_panel,"East");
+
+      final Button wb = new Button();
+      wb.setLabel("Hello World!");
+      wb.addActionListener(new ActionListener()
+	{
+	  public void actionPerformed (ActionEvent e)
+	  {
+	    l.setText ("Hello World!");
+	    
+	    final Dialog d = new Dialog(parent);
+	    d.setLayout(new FlowLayout());
+	    d.setModal(true);
+	    Button b = new Button("foobar");
+	    b.addMouseListener(new MouseAdapter()
+	      {
+		public void mousePressed (MouseEvent me)
+		{
+		  d.hide ();
+		}
+	      });
+	    d.add (b);
+
+	    List ch = new List();
+	    ch.add("Ding");
+	    ch.add("September");
+	    ch.add("Red");
+	    ch.add("Quassia");
+	    ch.add("Pterodactyl");
+	    d.add(ch);
+
+	    d.pack ();
+	    d.show ();
+	  }
+	});
+
+      wb.addMouseListener(new MouseAdapter()
+	{
+	  public void mousePressed(MouseEvent e) {
+	    xs++;
+	    ys++;
+	    ch.repaint ();
+	  }
+	});
+      
+      add(wb,"West");
+      
+      pack();
+      show();
+      
+      sp.setScrollPosition (10,0);
+      
+      Toolkit t = Toolkit.getDefaultToolkit();
+      t.beep();
+    }
+  }
+  
+  static class ResolutionWindow extends SubFrame
+  {
+    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+    
+    public void init ()
+    {
+      initted = true;
+      
+      setTitle("Change Screen Resolution");
+      final List list = new List();
+      DisplayMode[] modes = gd.getDisplayModes();
+      
+      for (int i=0;i<modes.length;i++ )
+        list.add(modes[i].getWidth()  + "x"
+                 + modes[i].getHeight()
+                 + ((modes[i].getBitDepth() != DisplayMode.BIT_DEPTH_MULTI)
+                   ? "x" + modes[i].getBitDepth() + "bpp"
+                   : "")
+                 + ((modes[i].getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN)
+                   ? "@" + modes[i].getRefreshRate() + "Hz"
+                   : ""));
+      
+      ActionListener al = new ActionListener()
+      {
+        public void actionPerformed(ActionEvent ae)
+        {
+          int i = list.getSelectedIndex();
+          gd.setDisplayMode(gd.getDisplayModes()[i]);
+        }
+      };
+      
+      Button b = new Button("Switch");
+      Button c = new Button("Close");
+      
+      list.addActionListener(al);
+      b.addActionListener(al);
+      
+      c.addActionListener(new ActionListener () {
+        public void actionPerformed (ActionEvent e) {
+          dispose();
+        }
+      });
+      
+      setLayout(new GridLayout(3, 1, 5, 5));
+      add(list);
+      add(b);
+      add(c);
+      
+      pack();
+    }
+  }
+
+  static class DragDropWindow
+      extends SubFrame
+      implements ActionListener, DropTargetListener
+  {
+    DragLabel source = new DragLabel("Drag and drop me to the following Button",
+                                     Label.CENTER);
+
+    Button target = new Button();
+
+    public void init()
+    {
+      source.setForeground(Color.red);
+      add(source, BorderLayout.NORTH);
+
+      target.addActionListener(this);
+      add(target, BorderLayout.SOUTH);
+
+      new DropTarget(target, DnDConstants.ACTION_COPY_OR_MOVE, this);
+
+      setSize(205, 100);
+
+      pack();
+    }
+
+    public void actionPerformed(ActionEvent e)
+    {
+      Button b = (Button) e.getSource();
+      b.setLabel("");
+    }
+
+    public void dragEnter(DropTargetDragEvent e)
+    {
+    }
+
+    public void dragExit(DropTargetEvent e)
+    {
+    }
+
+    public void dragOver(DropTargetDragEvent e)
+    {
+    }
+
+    public void drop(DropTargetDropEvent e)
+    {
+      try
+        {
+          Transferable t = e.getTransferable();
+
+          if (e.isDataFlavorSupported(DataFlavor.stringFlavor))
+            {
+              e.acceptDrop(e.getDropAction());
+
+              String s;
+              s = (String) t.getTransferData(DataFlavor.stringFlavor);
+
+              target.setLabel(s);
+
+              e.dropComplete(true);
+            }
+          else
+            e.rejectDrop();
+        }
+      catch (java.io.IOException e2)
+        {
+        }
+      catch (UnsupportedFlavorException e2)
+        {
+        }
+    }
+
+    public void dropActionChanged(DropTargetDragEvent e)
+    {
+    }
+
+    class DragLabel
+        extends Label
+        implements DragGestureListener, DragSourceListener
+    {
+      private DragSource ds = DragSource.getDefaultDragSource();
+
+      public DragLabel(String s, int alignment)
+      {
+        super(s, alignment);
+        int action = DnDConstants.ACTION_COPY_OR_MOVE;
+        ds.createDefaultDragGestureRecognizer(this, action, this);
+      }
+
+      public void dragGestureRecognized(DragGestureEvent e)
+      {
+        try
+          {
+            Transferable t = new StringSelection(getText());
+            e.startDrag(DragSource.DefaultCopyNoDrop, t, this);
+          }
+        catch (InvalidDnDOperationException e2)
+          {
+            System.out.println(e2);
+          }
+      }
+
+      public void dragDropEnd(DragSourceDropEvent e)
+      {
+        if (e.getDropSuccess() == false)
+          return;
+
+        int action = e.getDropAction();
+        if ((action & DnDConstants.ACTION_MOVE) != 0)
+          setText("");
+      }
+
+      public void dragEnter(DragSourceDragEvent e)
+      {
+        DragSourceContext ctx = e.getDragSourceContext();
+
+        int action = e.getDropAction();
+        if ((action & DnDConstants.ACTION_COPY) != 0)
+          ctx.setCursor(DragSource.DefaultCopyDrop);
+        else
+          ctx.setCursor(DragSource.DefaultCopyNoDrop);
+      }
+
+      public void dragExit(DragSourceEvent e)
+      {
+      }
+
+      public void dragOver(DragSourceDragEvent e)
+      {
+      }
+
+      public void dropActionChanged(DragSourceDragEvent e)
+      {
+      }
+    }
+  }
+  
+  static class FullscreenWindow extends SubFrame
+  {
+    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+    
+    public void init ()
+    {
+      initted = true;
+      
+      setTitle("Fullscreen Exclusive Mode");
+
+      ActionListener al = new ActionListener()
+      {
+        public void actionPerformed(ActionEvent ae)
+        {
+          if (gd.getFullScreenWindow() == FullscreenWindow.this)
+            gd.setFullScreenWindow(null);
+          else
+            gd.setFullScreenWindow(FullscreenWindow.this);
+        }
+      };
+      
+      Button b = new Button("Toggle Fullscreen");
+      Button c = new Button("Close");
+      
+      b.addActionListener(al);
+      
+      c.addActionListener(new ActionListener () {
+        public void actionPerformed (ActionEvent e) {
+          gd.setFullScreenWindow(null);
+          dispose();
+        }
+      });
+      
+      setLayout(new GridLayout(3, 1, 5, 5));
+      add(b);
+      add(c);
+      
+      pack();
+    }
+  }
+
+  static class RoundRectWindow extends SubFrame
+  {
+    public void init ()
+    {
+      initted = true;
+      setTitle("RoundRect");
+      setLayout(new BorderLayout());
+      add(new DrawRoundRect(), "West");
+      Button cb = new Button ("Close");
+      cb.addActionListener(new ActionListener () {
+          public void actionPerformed (ActionEvent e) {
+            dispose();
+          }
+        });
+      add(cb, "Center");
+      add(new FillRoundRect(), "East");
+      pack();
+    }
+
+    static class DrawRoundRect extends Panel 
+    { 
+      
+      public Dimension getPreferredSize() 
+      { 
+	return new Dimension(500, 500); 
+      } 
+
+      public void paint( Graphics g )  
+      {  
+	// left side 
+	
+	// rectangles should be identical 
+	g.setColor(Color.red); 
+	g.drawRect(50, 50, 300, 100); 
+	g.setColor(Color.black); 
+	g.drawRoundRect(50, 50, 300, 100, 0, 0); 
+	
+	// small round corners 
+	g.setColor(Color.red); 
+	g.drawRect(50, 200, 300, 100); 
+	g.setColor(Color.black); 
+	g.drawRoundRect(50, 200, 300, 100, 25, 25); 
+	
+	// round ends  
+	g.setColor(Color.red); 
+	g.drawRect(50, 350, 300, 100); 
+	g.setColor(Color.black); 
+	g.drawRoundRect(50, 350, 300, 100, 25, 100); 
+	
+	// right side 
+	
+	// circle only 
+	g.setColor(Color.blue); 
+	g.drawOval(375, 50, 100, 100); 
+	
+	// round rectangle should exactly cover circle 
+	g.setColor(Color.blue); 
+	g.drawOval(375, 200, 100, 100); 
+	g.setColor(Color.black); 
+	g.drawRoundRect(375, 200, 100, 100, 100, 100); 
+	
+	// round rectangle should look like a circle 
+	g.setColor(Color.red); 
+	g.drawRect(375, 350, 100, 100); 
+	g.setColor(Color.black); 
+	g.drawRoundRect(375, 350, 100, 100, 100, 100); 
+      } 
+    }
+
+    static class FillRoundRect extends Panel 
+    { 
+      
+      public Dimension getPreferredSize() 
+      { 
+	return new Dimension(500, 500); 
+      } 
+      
+      public void paint( Graphics g )  
+      {  
+	// left side 
+	
+	// rectangles should be identical 
+	g.setColor(Color.red); 
+	g.fillRect(50, 50, 300, 100); 
+	g.setColor(Color.black); 
+	g.fillRoundRect(50, 50, 300, 100, 0, 0); 
+	
+	// small round corners 
+	g.setColor(Color.red); 
+	g.fillRect(50, 200, 300, 100); 
+	g.setColor(Color.black); 
+	g.fillRoundRect(50, 200, 300, 100, 25, 25); 
+	
+	// round ends  
+	g.setColor(Color.red); 
+	g.fillRect(50, 350, 300, 100); 
+	g.setColor(Color.black); 
+	g.fillRoundRect(50, 350, 300, 100, 25, 100); 
+	
+	// right side 
+	
+	// circle only 
+	g.setColor(Color.blue); 
+	g.fillOval(375, 50, 100, 100); 
+	
+	// round rectangle should exactly cover circle 
+	g.setColor(Color.blue); 
+	g.fillOval(375, 200, 100, 100); 
+	g.setColor(Color.black); 
+	g.fillRoundRect(375, 200, 100, 100, 100, 100); 
+	
+	// round rectangle should look like a circle 
+	g.setColor(Color.red); 
+	g.fillRect(375, 350, 100, 100); 
+	g.setColor(Color.black); 
+	g.fillRoundRect(375, 350, 100, 100, 100, 100); 
+      } 
+    }
+  }
+
+  static class AnimationWindow extends SubFrame
+  {
+    AnimationApplet a;
+    public void init ()
+    {
+      initted = true;
+      setTitle("Animation");
+      Button cb = new Button ("Close");
+      cb.addActionListener(new ActionListener () {
+          public void actionPerformed (ActionEvent e) 
+          {
+            if (a != null)
+              {
+                a.destroy();
+                dispose();
+              }
+          }
+        });
+      a = new AnimationApplet();
+      add(a, "Center");
+      add(cb, "South");
+      pack();
+    }
+
+    public void show()
+    {
+      super.show();
+      a.init();
+      a.run();
+    }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/datatransfer/Demo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/datatransfer/Demo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/datatransfer/Demo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/datatransfer/Demo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,652 @@
+/* Demo.java -- And example of copy/paste datatransfer
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+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. */
+
+package gnu.classpath.examples.datatransfer;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.datatransfer.*;
+
+import java.io.*;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Random;
+
+/**
+ * An example how datatransfer works for copying and pasting data to
+ * and from other programs.
+ */
+class Demo
+  extends Frame
+  implements ActionListener, ItemListener, FlavorListener
+{
+  public static void main(String args[])
+  {
+    new Demo();
+  }
+
+  private TextArea text;
+  private Button copyText;
+  private Button pasteText;
+
+  private ImageComponent image;
+  private Button copyImage;
+  private Button pasteImage;
+
+  private ObjectComponent object;
+  private Button copyObject;
+  private Button pasteObject;
+
+  private FilesComponent files;
+  private Button copyFiles;
+  private Button pasteFiles;
+
+  private FlavorsComponent flavors;
+  private FlavorDetailsComponent details;
+
+  private Demo()
+  {
+    super("GNU Classpath datatransfer");
+
+    /* Add all the different panel to the main window in one row. */
+    setLayout(new GridLayout(5, 1, 10, 10));
+    add(createTextPanel());
+    add(createImagePanel());
+    add(createObjectPanel());
+    add(createFilesPanel());
+    add(createFlavorsPanel());
+
+    /* Add listeners for the various buttons and events we are
+       interested in. */
+    addWindowListener(new WindowAdapter ()
+      {
+	public void windowClosing (WindowEvent e)
+	{
+	  dispose();
+	}
+      });
+    flavors.addItemListener(this);
+    Toolkit t = Toolkit.getDefaultToolkit();
+    Clipboard c = t.getSystemClipboard();
+    c.addFlavorListener(this);
+
+    /* Show time! */
+    pack();
+    show();
+  }
+
+  /**
+   * The Text Panel will show simple text that can be copied and pasted.
+   */
+  private Panel createTextPanel()
+  {
+    Panel textPanel = new Panel();
+    textPanel.setLayout(new BorderLayout());
+    text = new TextArea("GNU Everywhere!",
+			2, 80,
+			TextArea.SCROLLBARS_VERTICAL_ONLY);
+    text.setEditable(false);
+    text.setEnabled(true);
+    Panel textButtons = new Panel();
+    textButtons.setLayout(new FlowLayout());
+    copyText = new Button("Copy text");
+    copyText.addActionListener(this);
+    pasteText = new Button("Paste text");
+    pasteText.addActionListener(this);
+    textButtons.add(copyText);
+    textButtons.add(pasteText);
+    textPanel.add(text, BorderLayout.CENTER);
+    textPanel.add(textButtons, BorderLayout.SOUTH);
+    return textPanel;
+  }
+
+  /**
+   * The Image Panel shows an image that can be copied to another
+   * program or be replaced by pasting in an image from another
+   * application.
+   */
+  private Panel createImagePanel()
+  {
+    Panel imagePanel = new Panel();
+    imagePanel.setLayout(new BorderLayout());
+    URL imageurl = this.getClass()
+      .getResource("/gnu/classpath/examples/icons/big-fullscreen.png");
+    Image img = Toolkit.getDefaultToolkit().createImage(imageurl);
+    image = new ImageComponent(img);
+    Panel imageButtons = new Panel();
+    copyImage = new Button("Copy image");
+    copyImage.addActionListener(this);
+    pasteImage = new Button("Paste image");
+    pasteImage.addActionListener(this);
+    imageButtons.add(copyImage);
+    imageButtons.add(pasteImage);
+    imagePanel.add(image, BorderLayout.CENTER);
+    imagePanel.add(imageButtons, BorderLayout.SOUTH);
+    return imagePanel;
+  }
+
+  /**
+   * The Object Panel holds a simple (Point) object that can be copied
+   * and pasted to another program that supports exchanging serialized
+   * objects.
+   */
+  private Panel createObjectPanel()
+  {
+    Panel objectPanel = new Panel();
+    objectPanel.setLayout(new BorderLayout());
+    Random random = new Random();
+    int x = (byte) random.nextInt();
+    int y = (byte) random.nextInt();
+    object = new ObjectComponent(new Point(x, y));
+    Panel objectButtons = new Panel();
+    copyObject = new Button("Copy object");
+    copyObject.addActionListener(this);
+    pasteObject = new Button("Paste object");
+    pasteObject.addActionListener(this);
+    objectButtons.add(copyObject);
+    objectButtons.add(pasteObject);
+    objectPanel.add(object, BorderLayout.CENTER);
+    objectPanel.add(objectButtons, BorderLayout.SOUTH);
+    return objectPanel;
+  }
+  
+  /**
+   * The Files Panel shows the files from the current working
+   * directory. They can be copied and pasted between other
+   * applications that support the exchange of file lists.
+   */
+  private Panel createFilesPanel()
+  {
+    Panel filesPanel = new Panel();
+    filesPanel.setLayout(new BorderLayout());
+    files = new FilesComponent(new File(".").listFiles());
+    Panel filesButtons = new Panel();
+    copyFiles = new Button("Copy files");
+    copyFiles.addActionListener(this);
+    pasteFiles = new Button("Paste files");
+    pasteFiles.addActionListener(this);
+    filesButtons.add(copyFiles);
+    filesButtons.add(pasteFiles);
+    filesPanel.add(files, BorderLayout.CENTER);
+    filesPanel.add(filesButtons, BorderLayout.SOUTH);
+    return filesPanel;
+  }
+  
+  /**
+   * The Flavors Panel shows the different formats (mime-types) that
+   * data on the clipboard is available in. By clicking on a flavor
+   * details about the representation class and object is given.
+   */
+  private Panel createFlavorsPanel()
+  {
+    Panel flavorsPanel = new Panel();
+    flavorsPanel.setLayout(new BorderLayout());
+    Label flavorsHeader = new Label("Flavors on clipboard:");
+    Toolkit t = Toolkit.getDefaultToolkit();
+    Clipboard c = t.getSystemClipboard();
+    DataFlavor[] dataflavors = c.getAvailableDataFlavors();
+    flavors = new FlavorsComponent(dataflavors);
+    details = new FlavorDetailsComponent(null);
+    flavorsPanel.add(flavorsHeader, BorderLayout.NORTH);
+    flavorsPanel.add(flavors, BorderLayout.CENTER);
+    flavorsPanel.add(details, BorderLayout.SOUTH);
+    return flavorsPanel;
+  }
+
+  /**
+   * FlavorListener implementation that updates the Flavors Panel
+   * whenever a change in the mime-types available has been detected.
+   */
+  public void flavorsChanged(FlavorEvent event)
+  {
+    Toolkit t = Toolkit.getDefaultToolkit();
+    Clipboard c = t.getSystemClipboard();
+    DataFlavor[] dataflavors = c.getAvailableDataFlavors();
+    flavors.setFlavors(dataflavors);
+    details.setDataFlavor(null);
+  }
+
+  /**
+   * ItemChangeListener implementation that updates the flavor details
+   * whenever the user selects a different representation of the data
+   * available on the clipboard.
+   */
+  public void itemStateChanged(ItemEvent evt)
+  {
+    DataFlavor df = null;
+    String s = flavors.getSelectedItem();
+    if (s != null)
+      {
+	try
+	  {
+	    df = new DataFlavor(s);
+	  }
+	catch (ClassNotFoundException cnfe)
+	  {
+	    cnfe.printStackTrace();
+	  }
+      }
+    details.setDataFlavor(df);
+  }
+  
+  /**
+   * ActionListener implementations that will copy or past data
+   * to/from the clipboard when the user requests that for the text,
+   * image, object of file component.
+   */
+  public void actionPerformed (ActionEvent evt)
+  {
+    Button b = (Button) evt.getSource();
+    Toolkit t = Toolkit.getDefaultToolkit();
+    Clipboard c = t.getSystemClipboard();
+    if (b == copyText)
+      c.setContents(new StringSelection(text.getText()), null);
+
+    if (b == pasteText)
+      {
+	String s = null;
+	try
+	  {
+	    s = (String) c.getData(DataFlavor.stringFlavor);
+	  }
+	catch (UnsupportedFlavorException dfnse)
+	  {
+	  }
+	catch (IOException ioe)
+	  {
+	  }
+	catch (ClassCastException cce)
+	  {
+	  }
+	if (s == null)
+	  t.beep();
+	else
+	  text.setText(s);
+      }
+
+    if (b == copyImage)
+      c.setContents(new ImageSelection(image.getImage()), null);
+
+    if (b == pasteImage)
+      {
+	Image i = null;
+	try
+	  {
+	    i = (Image) c.getData(DataFlavor.imageFlavor);
+	  }
+	catch (UnsupportedFlavorException dfnse)
+	  {
+	  }
+	catch (IOException ioe)
+	  {
+	  }
+	catch (ClassCastException cce)
+	  {
+	  }
+	if (i == null)
+	  t.beep();
+	else
+	  image.setImage(i);
+      }
+
+    if (b == copyObject)
+      c.setContents(new ObjectSelection(object.getObject()), null);
+
+    if (b == pasteObject)
+      {
+	Serializable o = null;
+	try
+	  {
+	    o = (Serializable) c.getData(ObjectSelection.objFlavor);
+	  }
+	catch (UnsupportedFlavorException dfnse)
+	  {
+	  }
+	catch (IOException ioe)
+	  {
+	  }
+	catch (ClassCastException cce)
+	  {
+	  }
+	if (o == null)
+	  t.beep();
+	else
+	  object.setObject(o);
+      }
+
+    if (b == copyFiles)
+      c.setContents(new FilesSelection(files.getFiles()), null);
+
+    if (b == pasteFiles)
+      {
+	java.util.List fs = null;
+	try
+	  {
+	    fs = (java.util.List) c.getData(DataFlavor.javaFileListFlavor);
+	  }
+	catch (UnsupportedFlavorException dfnse)
+	  {
+	  }
+	catch (IOException ioe)
+	  {
+	  }
+	catch (ClassCastException cce)
+	  {
+	  }
+	if (fs == null)
+	  t.beep();
+	else
+	  files.setFiles(fs);
+      }
+  }
+
+  /**
+   * Simple awt component that shows an settable image.
+   */
+  static class ImageComponent extends Component
+  {
+    private Image image;
+
+    ImageComponent(Image image)
+    {
+      setSize(20, 20);
+      setImage(image);
+    }
+
+    Image getImage()
+    {
+      return image;
+    }
+
+    void setImage(Image image)
+    {
+      this.image = image;
+      repaint();
+    }
+
+    public void paint(Graphics g)
+    {
+      g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
+    }
+  }
+
+  /**
+   * Simple awt component that shows a settable Serializable object.
+   */
+  static class ObjectComponent extends TextArea
+  {
+    private Serializable object;
+
+    ObjectComponent(Serializable object)
+    {
+      super("", 2, 80, TextArea.SCROLLBARS_NONE);
+      setEditable(false);
+      setEnabled(false);
+      setObject(object);
+    }
+
+    Serializable getObject()
+    {
+      return object;
+    }
+
+    void setObject(Serializable object)
+    {
+      this.object = object;
+      setText("Class: " + object.getClass().getName()
+	      + "\n"
+	      + "toString(): " + object.toString());
+      repaint();
+    }
+  }
+
+  /**
+   * Simple awt component that shows a settable list of Files.
+   */
+  static class FilesComponent extends List
+  {
+    private File[] files;
+    
+    FilesComponent(File[] files)
+    {
+      super(4, true);
+      setFiles(files);
+    }
+    
+    File[] getFiles()
+    {
+      String[] strings = getSelectedItems();
+      if (strings == null || strings.length == 0)
+	return (File[]) files.clone();
+      
+      File[] fs = new File[strings.length];
+      for (int i = 0; i < strings.length; i++)
+	fs[i] = new File(strings[i]);
+      return fs;
+    }
+    
+    void setFiles(File[] files)
+    {
+      this.files = files;
+      removeAll();
+      for (int i = 0; i < files.length; i++)
+        {
+	  addItem(files[i].toString());
+	  select(i);
+        }
+    }
+    
+    void setFiles(java.util.List list)
+    {
+      File[] fs = new File[list.size()];
+      int i = 0;
+      Iterator it = list.iterator();
+      while (it.hasNext())
+	fs[i++] = (File) it.next();
+      
+      setFiles(fs);
+    }
+  }
+
+  /**
+   * Simple awt component that shows a settable list of DataFlavors.
+   */
+  static class FlavorsComponent extends List
+  {
+    FlavorsComponent(DataFlavor[] flavors)
+    {
+      super(4);
+      setFlavors(flavors);
+    }
+
+    void setFlavors(DataFlavor[] flavors)
+    {
+      removeAll();
+      for (int i = 0; i < flavors.length; i++)
+	{
+	  addItem(flavors[i].getMimeType());
+	}
+    }
+  }
+
+  /**
+   * Simple awt component that shows the details for and an object as
+   * found on the system clipboard as represented by a given
+   * DataFlavor.
+   */
+  static class FlavorDetailsComponent extends TextArea
+  {
+    private DataFlavor df;
+
+    FlavorDetailsComponent(DataFlavor df)
+    {
+      super("", 2, 80, TextArea.SCROLLBARS_NONE);
+      setEditable(false);
+      setEnabled(false);
+      setDataFlavor(df);
+    }
+
+    void setDataFlavor(DataFlavor df)
+    {
+      if (df == this.df
+	  || (df != null && df.equals(this.df)))
+	return;
+
+      this.df = df;
+
+      if (df == null)
+	setText("No flavor selected");
+      else
+	{
+	  Object o = null;
+	  Throwable exception = null;
+	  try
+	    {
+	      Toolkit t = Toolkit.getDefaultToolkit();
+	      Clipboard c = t.getSystemClipboard();
+	      o = c.getData(df);
+	    }
+	  catch (Throwable t)
+	    {
+	      exception = t;
+	    }
+	  if (o != null)
+	    {
+	      setText("Data: " + o.getClass().getName()
+		      + "\n"
+		      + o);
+	    }
+	  else
+	    {
+	      setText("Error retrieving: " + df
+		      + "\n"
+		      + exception != null ? exception.toString() : "");
+	    }
+	}
+      repaint();
+    }
+  }
+
+  /**
+   * Helper class to put an Image on a clipboard as
+   * DataFlavor.imageFlavor.
+   */
+  static class ImageSelection implements Transferable
+  {
+    private final Image img;
+
+    ImageSelection(Image img)
+    {
+      this.img = img;
+    }
+
+    static DataFlavor[] flavors = new DataFlavor[] { DataFlavor.imageFlavor };
+    public DataFlavor[] getTransferDataFlavors()
+    {
+      return (DataFlavor[]) flavors.clone();
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor flavor)
+    {
+      return flavor.equals(DataFlavor.imageFlavor);
+    }
+
+    public Object getTransferData(DataFlavor flavor)
+      throws UnsupportedFlavorException
+    {
+      if (!isDataFlavorSupported(flavor))
+	throw new UnsupportedFlavorException(flavor);
+
+      return img;
+    }
+  }
+
+  /**
+   * Helper class to put an Object on a clipboard as Serializable
+   * object.
+   */
+  static class ObjectSelection implements Transferable
+  {
+    private final Serializable obj;
+
+    ObjectSelection(Serializable obj)
+    {
+      this.obj = obj;
+    }
+
+    static DataFlavor objFlavor = new DataFlavor(Serializable.class,
+						 "Serialized Object");
+    static DataFlavor[] flavors = new DataFlavor[] { objFlavor };
+    public DataFlavor[] getTransferDataFlavors()
+    {
+      return (DataFlavor[]) flavors.clone();
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor flavor)
+    {
+      return flavor.equals(objFlavor);
+    }
+
+    public Object getTransferData(DataFlavor flavor)
+      throws UnsupportedFlavorException
+    {
+      if (!isDataFlavorSupported(flavor))
+	throw new UnsupportedFlavorException(flavor);
+
+      return obj;
+    }
+  }
+
+  /**
+   * Helper class to put a List of Files on the clipboard as
+   * DataFlavor.javaFileListFlavor.
+   */
+  static class FilesSelection implements Transferable
+  {
+    private final File[] files;
+
+    FilesSelection(File[] files)
+    {
+      this.files = files;
+    }
+
+    static DataFlavor[] flavors = new DataFlavor[]
+      { DataFlavor.javaFileListFlavor };
+    public DataFlavor[] getTransferDataFlavors()
+    {
+      return (DataFlavor[]) flavors.clone();
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor flavor)
+    {
+      return flavor.equals(DataFlavor.javaFileListFlavor);
+    }
+
+    public Object getTransferData(DataFlavor flavor)
+      throws UnsupportedFlavorException
+    {
+      if (!isDataFlavorSupported(flavor))
+	throw new UnsupportedFlavorException(flavor);
+
+      return Arrays.asList(files);
+    }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/html/Demo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/html/Demo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/html/Demo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/html/Demo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,131 @@
+/* Demo.java -- 
+   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. */
+
+package gnu.classpath.examples.html;
+
+import gnu.javax.swing.text.html.parser.HTML_401F;
+
+import gnu.xml.dom.html2.DomHTMLParser;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.StringReader;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.html2.HTMLDocument;
+
+/**
+ * This example demonstrates how to parse HTML input into
+ * org.w3c.dom.html2 document model.
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class Demo
+{
+  /**
+   * The sample HTML to parse.
+   */
+  static String input = "<!--2-->a<b iD=1>x</b>y<b><i>c</b>d</i>e";  
+  
+  public static void main(String[] args)
+  {
+    try
+      {
+        // Create a parser, using our DTD.
+        DomHTMLParser p = new DomHTMLParser(HTML_401F.getInstance());
+        HTMLDocument d = p.parseDocument(new StringReader(input));
+        
+        // Print the input HTML.
+        System.out.println(input);
+        
+        // Print the parsed data structure.
+        print(System.out, d, 0);
+      }
+    catch (IOException ex)
+      {
+        ex.printStackTrace();
+      }
+  }
+
+  /**
+   * Print the parsed data structure.
+   * 
+   * @param stream the output
+   * @param node the node
+   * @param ident the identation
+   */
+  static void print(PrintStream stream, Node node, int ident)
+  {
+    if (node == null)
+      return;
+
+    StringBuffer tab = new StringBuffer();
+    stream.println();
+    for (int i = 0; i < ident; i++)
+      {
+        tab.append(' ');
+      }
+
+    stream.print(tab + node.getNodeName());
+    if (node.getNodeValue() != null)
+      {
+        stream.println();
+        stream.print(tab + " '" + node.getNodeValue() + "'");
+      }
+
+    NamedNodeMap attributes = node.getAttributes();
+    if (attributes != null && attributes.getLength() != 0)
+      {
+        stream.print(' ');
+        for (int i = 0; i < attributes.getLength(); i++)
+          {
+            Node a = attributes.item(i);
+            stream.print(a.getNodeName() + "='" + a.getNodeValue() + "'");
+          }
+      }
+
+    ident += 2;
+
+    NodeList childs = node.getChildNodes();
+    if (childs != null)
+      for (int i = 0; i < childs.getLength(); i++)
+        {
+          print(stream, childs.item(i), ident);
+        }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/badge.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/badge.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/badge.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/big-fullscreen.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/big-fullscreen.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/big-fullscreen.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/big-home.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/big-home.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/big-home.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/big-warning.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/big-warning.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/big-warning.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-copy.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-copy.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-copy.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-cut.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-cut.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-cut.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-go-back.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-go-back.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-go-back.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-go-down.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-go-down.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-go-down.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-go-forward.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-go-forward.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-go-forward.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-mic.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-mic.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-mic.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-new.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-new.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-new.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-open.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-open.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-open.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-paste.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-paste.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-paste.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-quit.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-quit.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-quit.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-save-as.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-save-as.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-save-as.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-save.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-save.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-save.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-spell-check.png
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-spell-check.png?rev=43913&view=auto

==============================================================================
Binary file - no diff available.

Propchange: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/icons/stock-spell-check.png

------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmark.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmark.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmark.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmark.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1571 @@
+/* J2dBenchmark.java -- Benchmarking utility for java2d,
+   based on the Aicas AWT benchmarker
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath examples.
+
+ 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. */
+
+package gnu.classpath.examples.java2d;
+
+import java.awt.AlphaComposite;
+import java.awt.BasicStroke;
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GradientPaint;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.Label;
+import java.awt.MediaTracker;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.TexturePaint;
+import java.awt.Toolkit;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Arc2D;
+import java.awt.geom.CubicCurve2D;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Line2D;
+import java.awt.geom.QuadCurve2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.image.BufferedImage;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class J2dBenchmark
+    extends Panel
+{
+  /**
+   * Default number of test-iterations.
+   */
+  protected static final int DEFAULT_TEST_SIZE = 1000;
+
+  /**
+   * Default screen size.
+   */
+  protected static final int DEFAULT_SCREEN_WIDTH = 320;
+
+  protected static final int DEFAULT_SCREEN_HEIGHT = 240;
+
+  /**
+   * Java2D tests.
+   */
+  protected static final int J2DTEST_ARC = 1 << 0;
+
+  protected static final int J2DTEST_CUBICCURVE = 1 << 1;
+
+  protected static final int J2DTEST_ELLIPSE = 1 << 2;
+
+  protected static final int J2DTEST_GENERALPATH = 1 << 3;
+
+  protected static final int J2DTEST_LINE = 1 << 4;
+
+  protected static final int J2DTEST_QUADCURVE = 1 << 5;
+
+  protected static final int J2DTEST_RECTANGLE = 1 << 6;
+
+  protected static final int J2DTEST_ROUNDRECTANGLE = 1 << 7;
+
+  protected static final int J2DTEST_IMAGE = 1 << 8;
+
+  protected static final int J2DTEST_NONE = 0;
+
+  /*
+  private static final int J2DTEST_ALL = J2DTEST_ARC | J2DTEST_CUBICCURVE
+                                         | J2DTEST_ELLIPSE
+                                         | J2DTEST_GENERALPATH | J2DTEST_LINE
+                                         | J2DTEST_QUADCURVE
+                                         | J2DTEST_RECTANGLE
+                                         | J2DTEST_ROUNDRECTANGLE
+                                         | J2DTEST_IMAGE;
+  */
+  private static final int J2DTEST_ALL = J2DTEST_ARC | J2DTEST_CUBICCURVE
+                                         | J2DTEST_ELLIPSE
+                                         | J2DTEST_LINE
+                                         | J2DTEST_QUADCURVE
+                                         | J2DTEST_RECTANGLE
+                                         | J2DTEST_ROUNDRECTANGLE
+                                         | J2DTEST_IMAGE;
+
+  int iterations = 1;
+
+  protected int screenWidth = DEFAULT_SCREEN_WIDTH;
+
+  protected int screenHeight = DEFAULT_SCREEN_HEIGHT;
+
+  protected boolean noClippingFlag = true;
+
+  protected boolean withClippingFlag = true;
+
+  protected boolean zeroClippingFlag = true;
+
+  protected boolean singleBufferFlag = true;
+
+  protected boolean doubleBufferFlag = true;
+
+  protected boolean gradientFlag = false;
+
+  protected String texture = null;
+
+  protected boolean strokeFlag = false;
+
+  protected float composite = 1;
+
+  protected int xtranslate = 0;
+
+  protected int ytranslate = 0;
+
+  protected double xshear = 0;
+
+  protected double yshear = 0;
+
+  protected double rotate = 0;
+
+  protected boolean antialiasFlag = false;
+
+  protected AffineTransform affineTransform = null;
+
+  protected int awtTests = J2DTEST_ALL;
+
+  protected int testSize = DEFAULT_TEST_SIZE;
+
+  private Label testLabel;
+
+  private String testContext = "";
+
+  Logger logger = Logger.getLogger("J2dGraphicsBenchmark");
+
+  private Image pngTestImage;
+
+  private Image gifTestImage;
+
+  protected BufferedImage textureImage;
+
+  protected TestSet testSetMap = new TestSet();
+
+  public String init()
+  {
+    boolean loadError = false;
+    pngTestImage = loadImage("aicas.png");
+    gifTestImage = loadImage("palme.gif");
+
+    if (texture != null)
+      {
+        textureImage = loadBufferedImage(texture);
+
+        if (textureImage == null)
+          {
+            logger.logp(Level.WARNING, "J2dGraphicsBenchmark", "init",
+                        "Unable to load texture - defaulting "
+                            + "to solid colours");
+            texture = null;
+            loadError = true;
+          }
+      }
+
+    setLayout(new BorderLayout());
+    testLabel = new Label();
+    add(testLabel, BorderLayout.NORTH);
+    add(new GraphicsTest(), BorderLayout.CENTER);
+
+    if (loadError)
+      return "Unable to load image";
+    else
+      return null;
+  }
+
+  void setTestContext(String testName)
+  {
+    logger.logp(Level.INFO, "J2dGraphicsBenchmark", "recordTest",
+                "--- Starting new test context: " + testName);
+    testContext = testName;
+    testLabel.setText(testName);
+  }
+
+  private void recordTest(String testName, long time)
+  {
+    logger.logp(Level.INFO, "J2dGraphicsBenchmark", "recordTest",
+                testContext + ": " + testName + " duration (ms): " + time);
+    TestRecorder recorder = testSetMap.getTest(testName);
+    if (recorder == null)
+      {
+        recorder = new TestRecorder(testName);
+        testSetMap.putTest(testName, recorder);
+      }
+    recorder.addRun(time);
+  }
+
+  void printReport()
+  {
+    for (Iterator i = testSetMap.testIterator(); i.hasNext();)
+      {
+        TestRecorder recorder = testSetMap.getTest((String) i.next());
+        System.out.println("TEST " + recorder.getTestName() + ": average "
+                           + recorder.getAverage() + "ms ["
+                           + recorder.getMinTime() + "-"
+                           + recorder.getMaxTime() + "]");
+      }
+  }
+
+  void testComplete()
+  {
+    System.exit(0);
+  }
+
+  public static void main(String[] args)
+  {
+    int awtTests;
+    int i;
+    boolean endOfOptionsFlag;
+    J2dBenchmark speed = new J2dBenchmark();
+
+    // Parse arguments.
+    i = 0;
+    endOfOptionsFlag = false;
+    awtTests = J2DTEST_NONE;
+    while (i < args.length)
+      {
+        if (! endOfOptionsFlag)
+          {
+            if (args[i].equals("--help") || args[i].equals("-help")
+                || args[i].equals("-h"))
+              {
+                System.out.println("Usage: J2dBenchmark [<options>] [<test>  ...]");
+                System.out.println("");
+                System.out.println("Options: -i|--iterations=<n|-1> - number of iterations (-1 is infinite; default "
+                                   + speed.iterations + ")");
+                System.out.println("         -w|--width=<n>         - screen width; default "
+                                   + DEFAULT_SCREEN_WIDTH);
+                System.out.println("         -h|--height=<n>        - screen height; default "
+                                   + DEFAULT_SCREEN_HEIGHT);
+                System.out.println("         -d|--noDoubleBuffer    - disable double-buffering test");
+                System.out.println("         -s|--testsize=<n>      - size of each test; default "
+                                   + DEFAULT_TEST_SIZE);
+                System.out.println("         -c|--noClipping        - disable clipping test");
+                System.out.println("         -z|--noZeroClipping    - disable clipping to zero test");
+                System.out.println("");
+                System.out.println("Additional options:");
+                System.out.println("         --with-gradients       - enable gradients (not compatible with --texture)");
+                System.out.println("         --with-stroking        - enable random stroking");
+                System.out.println("         --texture=<file>       - enable texturing with this file (not compatible with --with-gradients)");
+                System.out.println("         --composite=<n|-1>     - set alpha composite level; -1 for random; default 1.0 (no transparency)");
+                System.out.println("         --anti-alias=<on|off>  - set anti-aliasing hint (not all implementations respect this); default off");
+                System.out.println("         --x-translate=<n>      - set x-axis translation; default 0");
+                System.out.println("         --y-translate=<n>      - set y-axis translation; default 0");
+                System.out.println("         --x-shear=<n>          - set x-axis shear; default 0");
+                System.out.println("         --y-shear=<n>          - set y-axis shear; default 0");
+                System.out.println("         --rotate=<n|-1>        - set rotation (radians); -1 for random; default: 0 (none)");
+                System.out.println("");
+                System.out.println("Tests: arc");
+                System.out.println("       cubiccurve");
+                System.out.println("       ellipse");
+                // System.out.println(" generalpath");
+                System.out.println("       line");
+                System.out.println("       quadcurve");
+                System.out.println("       rectangle");
+                System.out.println("       roundrectangle");
+                System.out.println("       image");
+                System.exit(1);
+              }
+            else if ((args[i].startsWith("-i=") || args[i].startsWith("--iterations=")))
+              {
+                speed.iterations = Integer.parseInt(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if ((args[i].equals("-i") || args[i].equals("--iterations")))
+              {
+                if ((i + 1) >= args.length)
+                  {
+                    System.err.println("ERROR: No argument given for option '"
+                                       + args[i] + "'!");
+                    System.exit(2);
+                  }
+                speed.iterations = Integer.parseInt(args[i + 1]);
+                i += 2;
+                continue;
+              }
+            else if ((args[i].startsWith("-w=") || args[i].startsWith("--width=")))
+              {
+                speed.screenWidth = Integer.parseInt(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if ((args[i].equals("-w") || args[i].equals("--width")))
+              {
+                if ((i + 1) >= args.length)
+                  {
+                    System.err.println("ERROR: No argument given for option '"
+                                       + args[i] + "'!");
+                    System.exit(2);
+                  }
+                speed.screenWidth = Integer.parseInt(args[i + 1]);
+                i += 2;
+                continue;
+              }
+            else if ((args[i].startsWith("-h=") || args[i].startsWith("--height=")))
+              {
+                speed.screenHeight = Integer.parseInt(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if ((args[i].equals("-h") || args[i].equals("--height")))
+              {
+                if ((i + 1) >= args.length)
+                  {
+                    System.err.println("ERROR: No argument given for option '"
+                                       + args[i] + "'!");
+                    System.exit(2);
+                  }
+                speed.screenHeight = Integer.parseInt(args[i + 1]);
+                i += 2;
+                continue;
+              }
+            else if ((args[i].equals("-d") || args[i].equals("--noDoubleBuffer")))
+              {
+                speed.doubleBufferFlag = false;
+                i += 1;
+                continue;
+              }
+            else if ((args[i].startsWith("-s=") || args[i].startsWith("--testsize=")))
+              {
+                if ((i + 1) >= args.length)
+                  {
+                    System.err.println("ERROR: No argument given for option '"
+                                       + args[i] + "'!");
+                    System.exit(2);
+                  }
+                speed.testSize = Integer.parseInt(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if ((args[i].equals("-s") || args[i].equals("--testsize")))
+              {
+                if ((i + 1) >= args.length)
+                  {
+                    System.err.println("ERROR: No argument given for option '"
+                                       + args[i] + "'!");
+                    System.exit(2);
+                  }
+                speed.testSize = Integer.parseInt(args[i + 1]);
+                i += 2;
+                continue;
+              }
+            else if ((args[i].equals("-c") || args[i].equals("--noClipping")))
+              {
+                speed.noClippingFlag = false;
+                i += 1;
+                continue;
+              }
+            else if ((args[i].equals("-z") || args[i].equals("--noZeroClipping")))
+              {
+                speed.zeroClippingFlag = false;
+                i += 1;
+                continue;
+              }
+            else if (args[i].equals("--with-gradients"))
+              {
+                speed.gradientFlag = true;
+                i += 1;
+                continue;
+              }
+            else if (args[i].equals("--with-stroking"))
+              {
+                speed.strokeFlag = true;
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("--texture="))
+              {
+                speed.texture = args[i].substring(args[i].indexOf('=') + 1);
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("--composite="))
+              {
+                speed.composite = Float.parseFloat(args[i].substring(args[i].indexOf('=') + 1));
+                if (speed.composite != - 1
+                    && (speed.composite < 0 || speed.composite > 1))
+                  {
+                    System.err.println("ERROR: Invalid value for composite (must be between 0 and 1, or -1 for random)");
+                    System.exit(2);
+                  }
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("--anti-alias="))
+              {
+                speed.antialiasFlag = (args[i].substring(args[i].indexOf('=') + 1).equals("on"));
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("--x-translate="))
+              {
+                speed.xtranslate = Integer.parseInt(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("--y-translate="))
+              {
+                speed.ytranslate = Integer.parseInt(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("--x-shear="))
+              {
+                speed.xshear = Double.parseDouble(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("--y-shear="))
+              {
+                speed.yshear = Double.parseDouble(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("--rotate="))
+              {
+                speed.rotate = Double.parseDouble(args[i].substring(args[i].indexOf('=') + 1));
+                i += 1;
+                continue;
+              }
+
+            else if (args[i].equals("--"))
+              {
+                endOfOptionsFlag = true;
+                i += 1;
+                continue;
+              }
+            else if (args[i].startsWith("-"))
+              {
+                System.err.println("ERROR: Unknown option '" + args[i] + "'!");
+                System.exit(2);
+              }
+          }
+        StringTokenizer tokenizer = new StringTokenizer(args[i], " +,");
+        while (tokenizer.hasMoreTokens())
+          {
+            String s = tokenizer.nextToken().toLowerCase();
+            if (s.equals("arc"))
+              awtTests |= J2DTEST_ARC;
+            else if (s.equals("cubiccurve"))
+              awtTests |= J2DTEST_CUBICCURVE;
+            else if (s.equals("ellipse"))
+              awtTests |= J2DTEST_ELLIPSE;
+            else if (s.equals("generalpath"))
+              awtTests |= J2DTEST_GENERALPATH;
+            else if (s.equals("line"))
+              awtTests |= J2DTEST_LINE;
+            else if (s.equals("quadcurve"))
+              awtTests |= J2DTEST_QUADCURVE;
+            else if (s.equals("rectangle"))
+              awtTests |= J2DTEST_RECTANGLE;
+            else if (s.equals("roundrectangle"))
+              awtTests |= J2DTEST_ROUNDRECTANGLE;
+            else if (s.equals("image"))
+              awtTests |= J2DTEST_IMAGE;
+            else
+              {
+                System.err.println("Unknown AWT test '" + s + "'!");
+                System.exit(2);
+              }
+          }
+        i += 1;
+      }
+    if (awtTests != J2DTEST_NONE)
+      speed.awtTests = awtTests;
+
+    // Create graphics.
+    speed.init();
+    final Frame frame = new Frame("J2dGraphicsBenchmark");
+
+    frame.addWindowListener(new WindowAdapter()
+    {
+      public void windowClosing(WindowEvent e)
+      {
+        frame.setVisible(false);
+        System.exit(0);
+      }
+    });
+
+    frame.add(speed, BorderLayout.CENTER);
+    frame.setSize(speed.screenWidth, speed.screenHeight);
+    frame.setVisible(true);
+
+    // Insets are correctly set only after the native peer was created.
+    Insets insets = frame.getInsets();
+    // The internal size of the frame should be 320x240.
+    frame.setSize(320 + insets.right + insets.left, 240 + insets.top
+                                                    + insets.bottom);
+  }
+
+  private Image loadImage(String imageName)
+  {
+    Image result = null;
+    logger.logp(Level.INFO, "J2dGraphicsBenchmark", "loadImage",
+                "Loading image: " + imageName);
+    URL url = getClass().getResource(imageName);
+    if (url != null)
+      {
+        result = Toolkit.getDefaultToolkit().getImage(url);
+        prepareImage(result, this);
+      }
+    else
+      {
+        logger.logp(Level.WARNING, "J2dGraphicsBenchmark", "loadImage",
+                    "Could not locate image resource in class path: "
+                        + imageName);
+      }
+    return result;
+  }
+
+  private BufferedImage loadBufferedImage(String imageName)
+  {
+    BufferedImage result = null;
+    logger.logp(Level.INFO, "J2dGraphicsBenchmark", "loadImage",
+                "Loading image: " + imageName);
+
+    // Try to load image out of classpath before trying an absolute filename
+    URL url = getClass().getResource(imageName);
+    Image img;
+    if (url != null)
+      img = Toolkit.getDefaultToolkit().getImage(url);
+    else
+      img = Toolkit.getDefaultToolkit().getImage(imageName);
+
+    if (img != null)
+      {
+        // Wait for image to load
+        try
+          {
+            MediaTracker tracker = new MediaTracker(this);
+            tracker.addImage(img, 1);
+            tracker.waitForAll();
+
+            prepareImage(img, this);
+            result = new BufferedImage(img.getWidth(this), img.getHeight(this),
+                                       BufferedImage.TYPE_INT_RGB);
+            result.createGraphics().drawImage(img, 0, 0, this);
+          }
+        catch (InterruptedException e)
+          {
+          }
+        catch (IllegalArgumentException e)
+          {
+          }
+      }
+
+    if (result == null)
+      {
+        logger.logp(Level.WARNING, "J2dGraphicsBenchmark", "loadBufferedImage",
+                    "Could not locate image resource in class path: "
+                        + imageName);
+      }
+    return result;
+  }
+
+  /**
+   * Executes the test methods.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  void runTestSet(Graphics2D g, Dimension size)
+  {
+    // Any user-specified options (ie set transforms, rendering hints)
+    prepareGraphics((Graphics2D) g);
+
+    if ((awtTests & J2DTEST_ARC) != 0)
+      {
+        test_drawArc(g, size);
+        test_fillArc(g, size);
+      }
+
+    if ((awtTests & J2DTEST_CUBICCURVE) != 0)
+      {
+        test_drawCubicCurve(g, size);
+      }
+
+    if ((awtTests & J2DTEST_ELLIPSE) != 0)
+      {
+        test_drawEllipse(g, size);
+        test_fillEllipse(g, size);
+      }
+
+    if ((awtTests & J2DTEST_GENERALPATH) != 0)
+      {
+        // Current implementation doesn't work
+        test_drawGeneralPath(g, size);
+        test_fillGeneralPath(g, size);
+      }
+
+    if ((awtTests & J2DTEST_LINE) != 0)
+      {
+        test_drawLine(g, size);
+      }
+
+    if ((awtTests & J2DTEST_QUADCURVE) != 0)
+      {
+        test_drawQuadCurve(g, size);
+      }
+
+    if ((awtTests & J2DTEST_RECTANGLE) != 0)
+      {
+        test_drawRectangle(g, size);
+        test_fillRectangle(g, size);
+      }
+
+    if ((awtTests & J2DTEST_ROUNDRECTANGLE) != 0)
+      {
+        test_drawRoundRectangle(g, size);
+        test_fillRoundRectangle(g, size);
+      }
+
+    if ((awtTests & J2DTEST_IMAGE) != 0)
+      {
+        test_drawImage(g, size);
+        test_drawTransparentImage(g, size);
+      }
+  }
+
+  /**
+   * Reset all graphics settings to the standard, default values
+   * 
+   * @param g the object to apply settings to
+   */
+  private void resetGraphics(Graphics2D g)
+  {
+    g.setTransform(new AffineTransform());
+    g.setStroke(new BasicStroke());
+    g.setComposite(AlphaComposite.SrcOut);
+  }
+
+  /**
+   * Sets initial user graphics options
+   * 
+   * @param g the object to apply settings to
+   */
+  private void prepareGraphics(Graphics2D g)
+  {
+    // Transforms
+    if (affineTransform != null)
+      g.setTransform(affineTransform);
+
+    else if (xtranslate != 0 || ytranslate != 0 || xshear != 0 || yshear != 0)
+      {
+        g.translate(xtranslate, ytranslate);
+        g.shear(xshear, yshear);
+      }
+
+    if (rotate > 0)
+      g.rotate(rotate * Math.PI, screenWidth / 2, screenHeight / 2);
+
+    // Composite (transparency)
+    if (composite > 0)
+      {
+        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
+                                                  composite));
+      }
+
+    // Textures
+    if (texture != null)
+      g.setPaint(new TexturePaint(textureImage,
+                                  new Rectangle(0, 0, textureImage.getWidth(),
+                                                textureImage.getHeight())));
+
+    // Anti-alias setting
+    if (antialiasFlag)
+      g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING,
+                                             RenderingHints.VALUE_ANTIALIAS_ON));
+    else
+      g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING,
+                                             RenderingHints.VALUE_ANTIALIAS_OFF));
+  }
+
+  /**
+   * Gets new random settings
+   * 
+   * @param g the object to set parameters for
+   * @param size the screen size
+   */
+  private void setRandom(Graphics2D g, Dimension size)
+  {
+    // Set colour / paint
+    if (gradientFlag)
+      {
+        Color c1 = new Color((int) (Math.random() * 254) + 1,
+                             (int) (Math.random() * 254) + 1,
+                             (int) (Math.random() * 254) + 1);
+
+        Color c2 = new Color((int) (Math.random() * 254) + 1,
+                             (int) (Math.random() * 254) + 1,
+                             (int) (Math.random() * 254) + 1);
+
+        g.setPaint(new GradientPaint(0, 0, c1, screenWidth / 5,
+                                     screenHeight / 5, c2, true));
+      }
+
+    else if (texture == null)
+      g.setPaint(new Color((int) (Math.random() * 254) + 1,
+                           (int) (Math.random() * 254) + 1,
+                           (int) (Math.random() * 254) + 1));
+
+    // Set stroke width and options
+    if (strokeFlag)
+      {
+        int cap = (int) (Math.random() * 3 + 1);
+        if (cap == 1)
+          cap = BasicStroke.CAP_SQUARE;
+        else if (cap == 2)
+          cap = BasicStroke.CAP_BUTT;
+        else
+          cap = BasicStroke.CAP_ROUND;
+
+        int join = (int) (Math.random() * 3 + 1);
+        if (join == 1)
+          join = BasicStroke.JOIN_MITER;
+        else if (join == 2)
+          join = BasicStroke.JOIN_BEVEL;
+        else
+          join = BasicStroke.JOIN_ROUND;
+
+        float[] dashes = { 10, 10 };
+        g.setStroke(new BasicStroke((int) (Math.random() * 10), cap, join, 10f,
+                                    dashes, 0));
+      }
+
+    // Composite / transparency
+    if (composite == - 1)
+      {
+        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
+                                                  (float) Math.random()));
+      }
+
+    // Transformations
+    if (rotate == - 1)
+      g.rotate(Math.random() * Math.PI * 2);
+  }
+
+  /**
+   * Draws random arcs within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawArc(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize;
+    long startTime;
+    long endTime;
+    minSize = 10;
+    startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x = (int) (Math.random() * (size.width - minSize + 1));
+        int y = (int) (Math.random() * (size.height - minSize + 1));
+        int width = (int) (Math.random() * (size.width - x - minSize) + minSize);
+        int height = (int) (Math.random() * (size.height - y - minSize) + minSize);
+        int startAngle = (int) (Math.random() * 360);
+        int arcAngle = (int) (Math.random() * 360 - startAngle);
+
+        Arc2D arc = new Arc2D.Double(x, y, width, height, startAngle, arcAngle,
+                                     Arc2D.OPEN);
+        g.draw(arc);
+      }
+    endTime = System.currentTimeMillis();
+    recordTest("draw(Arc2D.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random filled arcs within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillArc(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize;
+    long startTime;
+    long endTime;
+    minSize = 10;
+    startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x = (int) (Math.random() * (size.width - minSize + 1));
+        int y = (int) (Math.random() * (size.height - minSize + 1));
+        int width = (int) (Math.random() * (size.width - x - minSize) + minSize);
+        int height = (int) (Math.random() * (size.height - y - minSize) + minSize);
+        int startAngle = (int) (Math.random() * 360);
+        int arcAngle = (int) (Math.random() * 360);
+
+        Arc2D arc = new Arc2D.Double(x, y, width, height, startAngle, arcAngle,
+                                     Arc2D.OPEN);
+        g.fill(arc);
+      }
+    endTime = System.currentTimeMillis();
+    recordTest("fill(Arc2D.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random cubic curves within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawCubicCurve(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x1 = (int) (Math.random() * (size.width - minSize));
+        int y1 = (int) (Math.random() * (size.height - minSize));
+        int xc1 = (int) (Math.random() * (size.width - minSize));
+        int yc1 = (int) (Math.random() * (size.height - minSize));
+        int xc2 = (int) (Math.random() * (size.width - minSize));
+        int yc2 = (int) (Math.random() * (size.height - minSize));
+        int x2 = (int) (Math.random() * (size.width - minSize));
+        int y2 = (int) (Math.random() * (size.height - minSize));
+
+        CubicCurve2D curve = new CubicCurve2D.Double(x1, y1, xc1, yc1, xc2,
+                                                     yc2, x2, y2);
+        g.draw(curve);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("draw(CubicCurve2D.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random ellipses within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawEllipse(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x1 = (int) (Math.random() * (size.width - minSize));
+        int y1 = (int) (Math.random() * (size.height - minSize));
+        int x2 = (int) (Math.random() * (size.width - minSize));
+        int y2 = (int) (Math.random() * (size.height - minSize));
+        Ellipse2D ellipse = new Ellipse2D.Double(x1, y1, x2, y2);
+        g.draw(ellipse);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("draw(Ellipse.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random ellipses within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillEllipse(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x1 = (int) (Math.random() * (size.width - minSize));
+        int y1 = (int) (Math.random() * (size.height - minSize));
+        int x2 = (int) (Math.random() * (size.width - minSize));
+        int y2 = (int) (Math.random() * (size.height - minSize));
+        Ellipse2D ellipse = new Ellipse2D.Double(x1, y1, x2, y2);
+        g.fill(ellipse);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("fill(Ellipse.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  // TODO: fix the GeneralPath methods.
+  /**
+   * Draws random polygons within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawGeneralPath(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    long startTime = System.currentTimeMillis();
+
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int points = (int) (Math.random() * 6) + 2;
+        GeneralPath shape = new GeneralPath();
+        shape.moveTo((float) Math.random() * (size.width),
+                     (float) Math.random() * (size.height));
+        for (int j = 0; j < points; j += 1)
+          {
+            shape.lineTo((float) (Math.random() * (size.width)),
+                         (float) (Math.random() * (size.height)));
+          }
+        g.draw(shape);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("draw(GeneralPath) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random filled polygons within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillGeneralPath(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    long startTime = System.currentTimeMillis();
+
+    GeneralPath shape = new GeneralPath();
+    shape.moveTo((float) Math.random() * (size.width), (float) Math.random()
+                                                       * (size.height));
+
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int points = (int) (Math.random() * 6) + 2;
+        for (int j = 0; j < points; j += 1)
+          {
+            shape.lineTo((float) (Math.random() * (size.width)),
+                         (float) (Math.random() * (size.height)));
+          }
+        g.fill(shape);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("fill(GeneralPath) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random lines within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawLine(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x1 = (int) (Math.random() * (size.width - minSize));
+        int y1 = (int) (Math.random() * (size.height - minSize));
+        int x2 = (int) (Math.random() * (size.width - minSize));
+        int y2 = (int) (Math.random() * (size.height - minSize));
+        Line2D line = new Line2D.Double(x1, y1, x2, y2);
+        g.draw(line);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("draw(Line2D.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random quadratic curves within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawQuadCurve(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x1 = (int) (Math.random() * (size.width - minSize));
+        int y1 = (int) (Math.random() * (size.height - minSize));
+        int xc = (int) (Math.random() * (size.width - minSize));
+        int yc = (int) (Math.random() * (size.height - minSize));
+        int x2 = (int) (Math.random() * (size.width - minSize));
+        int y2 = (int) (Math.random() * (size.height - minSize));
+
+        QuadCurve2D curve = new QuadCurve2D.Double(x1, y1, xc, yc, x2, y2);
+        g.draw(curve);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("draw(QuadCurve2D.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random rectangles within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawRectangle(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x1 = (int) (Math.random() * (size.width - minSize));
+        int y1 = (int) (Math.random() * (size.height - minSize));
+        int x2 = (int) (Math.random() * (size.width - minSize));
+        int y2 = (int) (Math.random() * (size.height - minSize));
+        Rectangle2D rect = new Rectangle2D.Double(x1, y1, x2, y2);
+        g.draw(rect);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("draw(Rectangle.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random rectangles within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillRectangle(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize = 10;
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x1 = (int) (Math.random() * (size.width - minSize));
+        int y1 = (int) (Math.random() * (size.height - minSize));
+        int x2 = (int) (Math.random() * (size.width - minSize));
+        int y2 = (int) (Math.random() * (size.height - minSize));
+        Rectangle2D rect = new Rectangle2D.Double(x1, y1, x2, y2);
+        g.fill(rect);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("fill(Rectangle.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random rounded rectangles within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawRoundRectangle(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize;
+    long startTime;
+    long endTime;
+    minSize = 10;
+    startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x = (int) (Math.random() * (size.width - minSize + 1));
+        int y = (int) (Math.random() * (size.height - minSize + 1));
+        int width = (int) (Math.random() * (size.width - x - minSize) + minSize);
+        int height = (int) (Math.random() * (size.height - y - minSize) + minSize);
+        int arcWidth = (int) (Math.random() * (width - 1) + 1);
+        int arcHeight = (int) (Math.random() * (height - 1) + 5);
+        RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width,
+                                                            height, arcWidth,
+                                                            arcHeight);
+        g.draw(rect);
+      }
+    endTime = System.currentTimeMillis();
+    recordTest("draw(RoundRectangle.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random filled rounded rectangles within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_fillRoundRectangle(Graphics2D g, Dimension size)
+  {
+    int maxTests = testSize;
+    int minSize;
+    long startTime;
+    long endTime;
+    minSize = 10;
+    startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x = (int) (Math.random() * (size.width - minSize + 1));
+        int y = (int) (Math.random() * (size.height - minSize + 1));
+        int width = (int) (Math.random() * (size.width - x - minSize) + minSize);
+        int height = (int) (Math.random() * (size.height - y - minSize) + minSize);
+        int arcWidth = (int) (Math.random() * (width - 1) + 1);
+        int arcHeight = (int) (Math.random() * (height - 1) + 5);
+        RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width,
+                                                            height, arcWidth,
+                                                            arcHeight);
+        g.fill(rect);
+      }
+    endTime = System.currentTimeMillis();
+    recordTest("fill(RoundRectangle.Double) " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  /**
+   * Draws random images within the given dimensions.
+   * 
+   * @param g The Graphics2D object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawImage(Graphics2D g, Dimension size)
+  {
+    if (gifTestImage == null)
+      {
+        logger.logp(Level.WARNING, "J2dGraphicsBenchmark", "runTestSet",
+                    "Skipping 'test_drawImage' due to missing resource.");
+        return;
+      }
+
+    int maxTests = testSize / 2;
+    if (maxTests == 0)
+      maxTests = 1;
+    int imageWidth = gifTestImage.getWidth(this);
+    int imageHeight = gifTestImage.getHeight(this);
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x = (int) (Math.random() * (size.width - imageWidth + 1));
+        int y = (int) (Math.random() * (size.height - imageHeight + 1));
+        g.drawImage(gifTestImage, x, y, this);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("drawImage " + maxTests + " times", (endTime - startTime));
+  }
+
+  /**
+   * Draws random transparent images within the given dimensions.
+   * 
+   * @param g The Graphics object that is used to paint.
+   * @param size The size of the canvas.
+   */
+  private void test_drawTransparentImage(Graphics2D g, Dimension size)
+  {
+    if (pngTestImage == null)
+      {
+        logger.logp(Level.WARNING, "AicasGraphicsBenchmark", "runTestSet",
+                    "Skipping 'drawTransparentImage' due to missing resource.");
+        return;
+      }
+
+    int maxTests = testSize / 5;
+    if (maxTests == 0)
+      maxTests = 1;
+    int imageWidth = pngTestImage.getWidth(this);
+    int imageHeight = pngTestImage.getHeight(this);
+    long startTime = System.currentTimeMillis();
+    for (int i = 0; i < maxTests; i += 1)
+      {
+        setRandom(g, size);
+        int x = (int) (Math.random() * (size.width - imageWidth + 1));
+        int y = (int) (Math.random() * (size.height - imageHeight + 1));
+        g.drawImage(pngTestImage, x, y, this);
+      }
+    long endTime = System.currentTimeMillis();
+    recordTest("draw transparent image " + maxTests + " times",
+               (endTime - startTime));
+  }
+
+  private class GraphicsTest
+      extends Canvas
+      implements Runnable
+  {
+    Thread paintThread;
+
+    boolean done = false;
+
+    boolean doPaint = false;
+
+    boolean withClipping = false;
+
+    public GraphicsTest()
+    {
+      paintThread = new Thread(this);
+      paintThread.start();
+    }
+
+    public void run()
+    {
+      int runCount = 0;
+      while (! done)
+        {
+          runCount++;
+
+          try
+            {
+              synchronized (this)
+                {
+                  while (! doPaint)
+                    {
+                      try
+                        {
+                          wait(200);
+                        }
+                      catch (InterruptedException exception)
+                        {
+                          return;
+                        }
+                    }
+                }
+
+              // if (iterations != 0)
+              // System.out.println("--- run...("
+              // + runCount
+              // + "/"
+              // + iterations
+              // + ") ------------------------------------------------------");
+
+              Graphics g = getGraphics();
+              Dimension size = getSize();
+
+              if (singleBufferFlag)
+                {
+                  logger.logp(Level.INFO, "J2dGraphicsBenchmark.GraphicsTest",
+                              "run",
+                              "Start testing non-double-buffered drawing");
+
+                  if (noClippingFlag)
+                    runSet_noClipping((Graphics2D) g, size, runCount);
+
+                  if (withClippingFlag)
+                    runSet_withClipping((Graphics2D) g, size, runCount);
+
+                  if (zeroClippingFlag)
+                    runSet_zeroClipping((Graphics2D) g, size, runCount);
+
+                  g.dispose();
+                }
+
+              if (doubleBufferFlag)
+                {
+                  logger.logp(Level.INFO, "J2dGraphicsBenchmark.GraphicsTest",
+                              "run", "Start testing double-buffered drawing");
+                  Graphics canvas = getGraphics();
+                  Image doublebuffer = createImage(size.width, size.height);
+
+                  if (noClippingFlag)
+                    {
+                      g = doublebuffer.getGraphics();
+                      runSet_noClipping((Graphics2D) g, size,
+                                        "double buffering", runCount);
+                      g.dispose();
+                      canvas.drawImage(doublebuffer, 0, 0, this);
+                    }
+
+                  if (withClippingFlag)
+                    {
+                      g = doublebuffer.getGraphics();
+                      runSet_withClipping((Graphics2D) g, size,
+                                          "double buffering", runCount);
+                      g.dispose();
+                      canvas.drawImage(doublebuffer, 0, 0, this);
+                    }
+
+                  if (zeroClippingFlag)
+                    {
+                      g = doublebuffer.getGraphics();
+                      runSet_zeroClipping((Graphics2D) g, size,
+                                          "double buffering", runCount);
+                      g.dispose();
+                      canvas.drawImage(doublebuffer, 0, 0, this);
+                      canvas.dispose();
+                    }
+                }
+
+              printReport();
+
+              if (iterations != 1)
+                {
+                  if (iterations != - 1)
+                    iterations--;
+                }
+              else
+                {
+                  // System.out.println("--- done
+                  // --------------------------------------------------------");
+                  synchronized (this)
+                    {
+                      doPaint = false;
+                    }
+                  done = true;
+                }
+            }
+          catch (Error error)
+            {
+              System.err.println("Error: " + error);
+              System.exit(129);
+            }
+        }
+      testComplete();
+    }
+
+    private void runSet_zeroClipping(Graphics2D g, Dimension size, int runCount)
+    {
+      runSet_zeroClipping(g, size, "", runCount);
+    }
+
+    private void runSet_zeroClipping(Graphics2D g, Dimension size,
+                                     String context, int runCount)
+    {
+      int clipped_width;
+      int clipped_height;
+      int clipped_x;
+      int clipped_y;
+
+      clipped_width = 0;
+      clipped_height = 0;
+      clipped_x = (size.width) / 2;
+      clipped_y = (size.height) / 2;
+
+      // Reset any transforms from past tests
+      resetGraphics(g);
+
+      Rectangle fullWindow = new Rectangle(0, 0, size.width, size.height);
+      g.setClip(fullWindow);
+      g.setPaint(Color.BLACK);
+      g.fill(fullWindow);
+
+      Rectangle windowBorder = new Rectangle(0, 0, size.width - 1,
+                                             size.width - 1);
+      g.setPaint(Color.WHITE);
+      g.draw(windowBorder);
+
+      Rectangle innerBorder = new Rectangle(clipped_x - 1, clipped_y - 1,
+                                            clipped_width + 2,
+                                            clipped_height + 2);
+      g.fill(innerBorder);
+
+      Rectangle innerBox = new Rectangle(clipped_x, clipped_y, clipped_width,
+                                         clipped_height);
+      g.clip(innerBox);
+      g.setPaint(Color.BLACK);
+      g.fill(fullWindow);
+
+      if (context.equals(""))
+        setTestContext("(" + runCount + ") clipping to zero");
+      else
+        setTestContext("(" + runCount + ") clipping to zero (" + context + ")");
+
+      runTestSet(g, size);
+    }
+
+    private void runSet_withClipping(Graphics2D g, Dimension size, int runCount)
+    {
+      runSet_withClipping(g, size, "", runCount);
+    }
+
+    private void runSet_withClipping(Graphics2D g, Dimension size,
+                                     String context, int runCount)
+    {
+      int clipped_width = 2 * size.width / 3;
+      int clipped_height = 2 * size.height / 3;
+      int clipped_x = (size.width - clipped_width) / 2;
+      int clipped_y = (size.height - clipped_height) / 2;
+
+      // Reset any transforms from past tests
+      resetGraphics(g);
+
+      Rectangle fullWindow = new Rectangle(0, 0, size.width, size.height);
+      g.setClip(fullWindow);
+
+      g.setPaint(Color.BLACK);
+      g.fill(fullWindow);
+
+      Rectangle windowBorder = new Rectangle(0, 0, size.width - 1,
+                                             size.height - 1);
+      g.setPaint(Color.GREEN);
+      g.draw(windowBorder);
+
+      Rectangle innerBorder = new Rectangle(clipped_x - 1, clipped_y - 1,
+                                            clipped_width + 2,
+                                            clipped_height + 2);
+      g.setPaint(Color.WHITE);
+      g.fill(innerBorder);
+
+      Rectangle innerBox = new Rectangle(clipped_x, clipped_y, clipped_width,
+                                         clipped_height);
+      g.clip(innerBox);
+
+      g.setPaint(Color.BLACK);
+      g.fill(fullWindow);
+
+      if (context.equals(""))
+        setTestContext("(" + runCount + ") with clipping ");
+      else
+        setTestContext("(" + runCount + ") with clipping (" + context + ")");
+
+      runTestSet(g, size);
+    }
+
+    private void runSet_noClipping(Graphics2D g, Dimension size, int runCount)
+    {
+      runSet_noClipping(g, size, "", runCount);
+    }
+
+    private void runSet_noClipping(Graphics2D g, Dimension size,
+                                   String context, int runCount)
+    {
+      // Reset any transforms from past tests
+      resetGraphics(g);
+
+      Rectangle fullWindow = new Rectangle(0, 0, size.width, size.height);
+      g.setPaint(Color.BLACK);
+      g.fill(fullWindow);
+
+      if (context.equals(""))
+        setTestContext("(" + runCount + ") without clipping");
+      else
+        setTestContext("(" + runCount + ") without clipping (" + context + ")");
+
+      runTestSet(g, size);
+    }
+
+    public void paint(Graphics g)
+    {
+      synchronized (this)
+        {
+          doPaint = true;
+          notify();
+        }
+    }
+  }
+}
+
+class TestContext
+{
+}
+
+class TestSet
+{
+  private Map testsMap = new TreeMap();
+
+  public void putTest(String testName, TestRecorder recoder)
+  {
+    testsMap.put(testName, recoder);
+  }
+
+  public TestRecorder getTest(String testName)
+  {
+    return (TestRecorder) testsMap.get(testName);
+  }
+
+  public Iterator testIterator()
+  {
+    return testsMap.keySet().iterator();
+  }
+}
+
+class TestRecorder
+{
+  String test;
+
+  long totalTime = 0;
+
+  long minTime = Long.MAX_VALUE;
+
+  long maxTime = Long.MIN_VALUE;
+
+  int runCount = 0;
+
+  /**
+   * @return Returns the maxTime.
+   */
+  public final long getMaxTime()
+  {
+    return maxTime;
+  }
+
+  /**
+   * @return Returns the minTime.
+   */
+  public final long getMinTime()
+  {
+    return minTime;
+  }
+
+  /**
+   * @return Returns the test name.
+   */
+  public final String getTestName()
+  {
+    return test;
+  }
+
+  public final long getAverage()
+  {
+    return (totalTime / runCount);
+  }
+
+  public TestRecorder(String testName)
+  {
+    test = testName;
+  }
+
+  public void addRun(long time)
+  {
+    totalTime += time;
+    if (minTime > time)
+      minTime = time;
+    if (maxTime < time)
+      maxTime = time;
+    runCount += 1;
+  }
+}





More information about the llvm-commits mailing list