Commit ee9dd372 by Tom Tromey

Initial revision

From-SVN: r26263
parent 140fa895
This source diff could not be displayed because it is too large. You can view the blob instead.
March 2, 1999
The libgcj library is licensed under the terms of the GNU Library
General Public License.
You should have received a copy of the GNU Library General Public
License along with libjava; see the file COPYING.LIB. If not, write
to the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
/* Name of this package. */
#undef PACKAGE
/* Version number of this package. */
#undef VERSION
/* Define this if you want runtime debugging enabled. */
#undef DEBUG
/* Define if using POSIX threads that have the mutexattr functions. */
#undef HAVE_PTHREAD_MUTEXATTR_INIT
/* Define this if you prefer size over speed for java.lang.Character. */
#undef COMPACT_CHARACTER
/* Define if you have memcpy. */
#undef HAVE_MEMCPY
/* Define if you have memmove. */
#undef HAVE_MEMMOVE
/* Define if you have strerror. */
#undef HAVE_STRERROR
/* Define if you have fsync. */
#undef HAVE_FSYNC
/* Define if you have sleep. */
#undef HAVE_SLEEP
/* Define if you have __int32_t and __uint32_t. */
#undef HAVE_INT32_DEFINED
/* Define if you're running eCos. */
#undef ECOS
/* */
#undef HAVE_LOCALTIME
/* */
#undef HAVE_MKTIME
/* Define if using POSIX threads on Linux. */
#undef LINUX_THREADS
/* Define if you have the `ctime_r' function. */
#undef HAVE_CTIME_R
/* Define if you have the `gmtime_r' function. */
#undef HAVE_GMTIME_R
/* Define if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
/* Define if inet6 structures are defined in netinet/in.h. */
#undef HAVE_INET6
/* Define it socklen_t typedef is in sys/socket.h. */
#undef HAVE_SOCKLEN_T
/* Define if Boehm GC in use. */
#undef HAVE_BOEHM_GC
/* Define if gethostname is declared in <unistd.h>. */
#undef HAVE_GETHOSTNAME_DECL
/* Define if gethostbyname_r returns `int'. */
#undef GETHOSTBYNAME_R_RETURNS_INT
/* Define if gethostbyaddr_r returns `int'. */
#undef GETHOSTBYADDR_R_RETURNS_INT
/* Define if struct tm has tm_gmtoff field. */
#undef STRUCT_TM_HAS_GMTOFF
/* Define if global `timezone' exists. */
#undef HAVE_TIMEZONE
/* Define if you have the appropriate function. */
#undef HAVE_ACCESS
#undef HAVE_STAT
#undef HAVE_MKDIR
#undef HAVE_RENAME
#undef HAVE_RMDIR
#undef HAVE_UNLINK
#undef HAVE_REALPATH
#undef HAVE_READDIR_R
#undef HAVE_GETHOSTBYNAME_R
#undef HAVE_GETHOSTBYADDR_R
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIBGCJ_CONFIGURE,
[
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl We may get other options which we dont document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
libgcj_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(libgcj_basedir)
AC_CANONICAL_HOST
dnl Still use "libjava" here to placate dejagnu.
AM_INIT_AUTOMAKE(libjava, 0.0.7)
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
# Likewise for AC_PROG_CXX.
AC_DEFUN(LIB_AC_PROG_CXX,
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
dnl plays around with CXXFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_PROG_CXX_G
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-O2"
fi
else
GXX=
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
])
LIB_AC_PROG_CXX
# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont
# run it explicitly here, it will be run implicitly before
# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
AC_CANONICAL_BUILD
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which cant create executables. So we include AC_EXEEXT to keep
# automake happy, but we dont execute it, since we dont care about
# the result.
if false; then
AC_EXEEXT
fi
# configure.host sets the following important variables
# libgcj_cflags - host specific C compiler flags
# libgcj_cxxflags - host specific C++ compiler flags
# libgcj_javaflags - host specific Java compiler flags
libgcj_cflags=
libgcj_cxxflags=
libgcj_javaflags=
. [$]{libgcj_basedir}/configure.host
case [$]{libgcj_basedir} in
/* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{libgcj_basedir} ;;
*) libgcj_flagbasedir='[$](top_builddir)/'[$]{libgcj_basedir} ;;
esac
LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
AC_SUBST(LIBGCJ_CFLAGS)
AC_SUBST(LIBGCJ_CXXFLAGS)
AC_SUBST(LIBGCJ_JAVAFLAGS)
])dnl
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIBGCJ_CONFIGURE,
[
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl We may get other options which we dont document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
libgcj_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
libgcj_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(libgcj_basedir)
AC_CANONICAL_HOST
dnl Still use "libjava" here to placate dejagnu.
AM_INIT_AUTOMAKE(libjava, 0.0.7)
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
# Likewise for AC_PROG_CXX.
AC_DEFUN(LIB_AC_PROG_CXX,
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
dnl plays around with CXXFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_PROG_CXX_G
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-O2"
fi
else
GXX=
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
])
LIB_AC_PROG_CXX
# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont
# run it explicitly here, it will be run implicitly before
# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
AC_CANONICAL_BUILD
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which cant create executables. So we include AC_EXEEXT to keep
# automake happy, but we dont execute it, since we dont care about
# the result.
if false; then
AC_EXEEXT
fi
# configure.host sets the following important variables
# libgcj_cflags - host specific C compiler flags
# libgcj_cxxflags - host specific C++ compiler flags
# libgcj_javaflags - host specific Java compiler flags
libgcj_cflags=
libgcj_cxxflags=
libgcj_javaflags=
. [$]{libgcj_basedir}/configure.host
case [$]{libgcj_basedir} in
/* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{libgcj_basedir} ;;
*) libgcj_flagbasedir='[$](top_builddir)/'[$]{libgcj_basedir} ;;
esac
LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
AC_SUBST(LIBGCJ_CFLAGS)
AC_SUBST(LIBGCJ_CXXFLAGS)
AC_SUBST(LIBGCJ_JAVAFLAGS)
])dnl
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN(AM_MAINTAINER_MODE,
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT($USE_MAINTAINER_MODE)
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
# Define a conditional.
AC_DEFUN(AM_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
dnl This file resides in the same directory as the config header
dnl that is generated. We must strip everything past the first ":",
dnl and everything past the last "/".
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
<<am_indx=1
for am_file in <<$1>>; do
case " <<$>>CONFIG_HEADERS " in
*" <<$>>am_file "*<<)>>
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
;;
esac
am_indx=`expr "<<$>>am_indx" + 1`
done<<>>dnl>>)
changequote([,]))])
# classes.pl - A perl program to generate most of the contents of
# javaprims.h automatically.
# Copyright (C) 1998, 1999 Cygnus Solutions
#
# This file is part of libjava.
#
# This software is copyrighted work licensed under the terms of the
# Libjava License. Please consult the file "LIBJAVA_LICENSE" for
# details.
# Usage: cd <top-srcdir> ; perl classes.pl.
# Can also be run from the `include' directory; this lets us
# more easily insert the output into javaprims.h (which is where it goes).
use DirHandle;
if (-d 'java')
{
# Ok here.
}
elsif (-d '../java')
{
chdir ('..');
}
else
{
die "couldn't find java directory\n";
}
&scan ('java', 2);
exit 0;
sub scan
{
local ($dir, $indent) = @_;
local (@subdirs) = ();
local (@classes) = ();
local ($d) = new DirHandle $dir;
local (*JFILE);
local ($name);
if (defined $d)
{
while (defined ($name = $d->read))
{
next if $name eq 'CVS';
next if $name eq '.';
next if $name eq '..';
if ($dir eq 'java'
&& $name ne 'lang'
&& $name ne 'util'
&& $name ne 'io')
{
# We only generate decls for java.lang, java.io, and
# java.util.
next;
}
if (-d ($dir . '/' . $name))
{
push (@subdirs, $name);
next;
}
next unless $name =~ /\.java$/;
open (FILE, "< $dir/$name");
while (<FILE>)
{
# NOTE: we don't skip `/*' comments.
s,//.*$,,;
# For now assume that class names start with upper
# case letter.
next unless /(class|interface) ([A-Z][A-Za-z0-9]+)/;
push (@classes, $2);
}
close (FILE);
}
undef $d;
}
local ($spaces) = ' ' x $indent;
local ($classname);
($classname = $dir) =~ s/^.*\///;
print $spaces, "namespace ", $classname, "\n";
print $spaces, "{\n";
foreach (sort @classes)
{
print $spaces, " class ", $_, ";\n";
}
print "\n" if scalar @classes > 0 && scalar @subdirs > 0;
local ($first) = 1;
foreach (sort @subdirs)
{
print "\n" unless $first;
$first = 0;
&scan ("$dir/$_", $indent + 2);
}
print $spaces, "};\n";
}
This source diff could not be displayed because it is too large. You can view the blob instead.
# configure.host
# This shell script handles all host based configuration for libgcj.
# It sets various shell variables based on the the host and the
# configuration options. You can modify this shell script without
# needing to rerun autoconf.
# This shell script should be invoked as
# . configure.host
# If it encounters an error, it will exit with a message.
# It uses the following shell variables:
# host The configuration host
# host_cpu The configuration host CPU
# target_optspace --enable-target-optspace ("yes", "no", "")
# It sets the following shell variables:
# libgcj_cflags Special CFLAGS to use when building
# libgcj_cxxflags Special CXXFLAGS to use when building
# libgcj_javaflags Special JAVAFLAGS to use when building
libgcj_flags=
libgcj_cflags=
libgcj_cxxflags=
libgcj_javaflags=
case "${target_optspace}:${host}" in
yes:*)
libgcj_flags="${libgcj_flags} -Os"
;;
:m32r-* | :d10v-* | :d30v-*)
libgcj_flags="${libgcj_flags} -Os"
;;
no:* | :*)
# Nothing.
;;
esac
AM_RUNTESTFLAGS=
# Set any host dependent compiler flags.
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
echo "$target"
case "${host}" in
mips-tx39-*|mipstx39-unknown-*)
libgcj_flags="${libgcj_flags} -G 0"
LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
;;
i686-*|i586-*)
libgcj_flags="${libgcj_flags} -ffloat-store"
;;
*)
;;
esac
libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"
// Functions for Exception Support for Java.
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
#include "exception"
#include <stddef.h>
#include <java/lang/Class.h>
#include <java/lang/NullPointerException.h>
#include <cni.h>
#include <jvm.h>
// eh-common.h needs gansidecl.h.
#include "gansidecl.h"
#include "eh-common.h"
typedef struct {
__eh_info eh_info;
void *value;
} java_eh_info;
/* Language-specific EH info pointer, throw routine, and language/version
info routines. All defined in libgcc2. */
extern "C" java_eh_info **__get_eh_info ();
extern "C" void __throw () __attribute__ ((__noreturn__));
extern "C" short __get_eh_table_version (void *table);
extern "C" short __get_eh_table_language (void *table);
extern "C" void * malloc (size_t);
extern "C" void free (void *);
extern "C" void *
_Jv_type_matcher (java_eh_info *info, void* match_info,
void *exception_table)
{
if (__get_eh_table_language (exception_table) != EH_LANG_Java)
return NULL;
/* we don't worry about version info yet, there is only one version! */
if (match_info != NULL)
{
// The match_info is either a (java::lang::Class*) or
// match_info is one more than a (Utf8Const*).
if (sizeof(void*) != sizeof(size_t))
abort();
size_t mi = (size_t) match_info;
if ((mi & 1) != 0)
match_info = _Jv_FindClass ((Utf8Const*) (mi - 1), NULL);
if (! _Jv_IsInstanceOf ((jobject) info->value, (jclass) match_info))
return NULL;
}
return info->value;
}
/* Compiler hook to return a pointer to java exception object. The value
is cleared, so if the exception needs to be rethrown, it should be set
again */
extern "C" void *
_Jv_exception_info (void)
{
java_eh_info *info = *(__get_eh_info ());
void *ptr;
if (info == NULL)
abort ();
ptr = info->value;
/* clear the value so another throw is an error */
info->value = NULL;
return ptr;
}
/* Allocate an exception info structure for java. Called the first time
an exception is thrown. */
extern "C" void
_Jv_eh_alloc ()
{
/* FIXME: we should use _Jv_AllocBytes here. However, libgcc2
apparently can sometimes free() this value itself. */
java_eh_info *p = (java_eh_info *) malloc (sizeof (java_eh_info));
if (p == 0)
terminate ();
p->value = 0;
java_eh_info ** info_ptr = __get_eh_info ();
/* There should NOT be an exception info pointer already. */
if (*info_ptr != NULL)
abort ();
*info_ptr = p;
}
/* Deallocate the current exception info structure. Called at shutdown time. */
extern "C" void
_Jv_eh_free ()
{
java_eh_info ** info_ptr = __get_eh_info ();
if (*info_ptr == NULL)
abort ();
/* FIXME: ideally we should just let the GC handle this. */
free (*info_ptr);
*info_ptr = NULL;
}
/* Perform a throw, Java style. Throw will unwind through this call, so
there better not be any handlers or exception thrown here. */
/* Initialize an __eh_info structure with this libraries matching info. */
extern "C" void
_Jv_setup_eh_info (__eh_info *)
{
}
extern "C" void
_Jv_Throw (void *value)
{
if (value == NULL)
value = (void *) new java::lang::NullPointerException ();
java_eh_info *ehinfo = *(__get_eh_info ());
if (ehinfo == NULL)
{
_Jv_eh_alloc ();
ehinfo = *(__get_eh_info ());
}
ehinfo->eh_info.match_function = _Jv_type_matcher;
ehinfo->eh_info.language = EH_LANG_Java;
ehinfo->eh_info.version = 1;
ehinfo->value = value;
__throw();
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
public abstract class BytesToUnicode
{
/** Buffer to read bytes from.
* The characters inbuffer[inpos] ... inbuffer[inlength-1] are available. */
public byte[] inbuffer;
/** Starting index in buffer to read bytes from. */
public int inpos;
/** End of valid bytes in buffer. */
public int inlength;
static Class defaultDecodingClass;
static synchronized void getDefaultDecodingClass()
{
// Test (defaultDecodingClass == null) again in case of race condition.
if (defaultDecodingClass == null)
{
String encoding = System.getProperty("file.encoding");
String className = "gnu.gcj.convert.Input_"+encoding;
try
{
defaultDecodingClass = Class.forName(className);
}
catch (ClassNotFoundException ex)
{
throw new NoClassDefFoundError("missing default encoding "
+ encoding + " (class "
+ className + " not found)");
}
}
}
public abstract String getName();
public static BytesToUnicode getDefaultDecoder()
{
try
{
if (defaultDecodingClass == null)
getDefaultDecodingClass();
return (BytesToUnicode) defaultDecodingClass.newInstance();
}
catch (Throwable ex)
{
return new Input_8859_1();
}
}
/** Get a byte-stream->char-stream converter given an encoding name. */
public static BytesToUnicode getDecoder (String encoding)
throws java.io.UnsupportedEncodingException
{
String className = "gnu.gcj.convert.Input_"+encoding;
Class decodingClass;
try
{
decodingClass = Class.forName(className);
return (BytesToUnicode) decodingClass.newInstance();
}
catch (Throwable ex)
{
throw new java.io.UnsupportedEncodingException(encoding
+ " (" + ex + ')');
}
}
/** Make input bytes available to the conversion.
* @param buffer source of input bytes
* @param pos index of first available byte
* @param length one more than index of last available byte
*/
public final void setInput(byte[] buffer, int pos, int length)
{
inbuffer = buffer;
inpos = pos;
inlength = length;
}
/** Convert bytes to chars.
* Input bytes are taken from this.inbuffer. The available input
* bytes start at inbuffer[inpos], and end at inbuffer[inlength-1].
* @param outbuffer buffer for the converted character
* @param outpos position in buffer to start putting converted characters
* @param outlength the maximum number of characters to read
* @return number of chars placed in outbuffer.
* Also, this.inpos is incremented by the number of bytes consumed.
*
* (Note the asymmetry in that the input upper bound is inbuffer[inlength-1],
* while the output upper bound is outbuffer[outpos+outlength-1]. The
* justification is that inlength is like the count field of a
* BufferedInputStream, while the outlength parameter is like the
* length parameter of a read request.)
*/
public abstract int read (char[] outbuffer, int outpos, int outlength);
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
import java.io.*;
public class Convert
{
static void error (String message)
{
System.err.print("convert: ");
System.err.println(message);
System.err.println("Usage: convert [--from srcEncoding] [--to dstEncoding]");
System.err.println(" [inputfile [outputfile]]");
System.exit(-1);
}
static void missing (String arg)
{
error("missing arg after `" + arg + "' option");
}
public static void main (String[] args)
{
String inName = "-";
String outName = "-";
String inEncodingName = null;
String outEncodingName = "JavaSrc";
int seenNames = 0;
boolean reverse = false;
for (int i = 0; i < args.length; i++)
{
String arg = args[i];
if (arg.length() == 0)
error("zero-length argument");
if (arg.charAt(0) == '-')
{
if (arg.equals("-encoding") || arg.equals("--encoding")
|| args.equals("-from") || arg.equals("--from"))
{
if (++i == args.length) missing(arg);
inEncodingName = args[i];
}
else if (arg.equals("-to") || arg.equals("--to"))
{
if (++i == args.length) missing(arg);
outEncodingName = args[i];
}
else if (arg.equals("-i"))
{
if (++i == args.length) missing(arg);
inName = args[i];
}
else if (arg.equals("-o"))
{
if (++i == args.length) missing(arg);
outName = args[i];
}
else if (arg.equals("-reverse") || arg.equals("--reverse"))
{
reverse = true;
}
else if (arg.equals("-"))
{
switch (seenNames)
{
case 0:
inName = "-";
seenNames++;
break;
case 1:
outName = "-";
seenNames++;
break;
default:
error("too many `-' arguments");
}
}
else
error("unrecognized argument `" + arg + "'");
}
else
{
switch (seenNames)
{
case 0:
inName = arg;
seenNames++;
break;
case 1:
outName = arg;
seenNames++;
break;
default:
error("too many filename arguments");
}
}
}
if (reverse)
{
String tmp = inEncodingName;
inEncodingName = outEncodingName;
outEncodingName = tmp;
}
try
{
BytesToUnicode inDecoder
= inEncodingName == null ? BytesToUnicode.getDefaultDecoder()
: BytesToUnicode.getDecoder(inEncodingName);
UnicodeToBytes outEncoder
= outEncodingName == null ? UnicodeToBytes.getDefaultEncoder()
: UnicodeToBytes.getEncoder(outEncodingName);
InputStream inStream = inName == "-" ? System.in
: new FileInputStream(inName);
OutputStream outStream;
if (outName == "-")
outStream = System.out;
else
outStream = new FileOutputStream(outName);
InputStreamReader in
= new InputStreamReader(inStream, inEncodingName);
OutputStreamWriter out
= new OutputStreamWriter(outStream, outEncodingName);
char[] buffer = new char[2048];
for (;;)
{
int count = in.read(buffer);
if (count < 0)
break;
out.write(buffer, 0, count);
}
in.close();
out.close();
}
catch (java.io.IOException ex)
{
System.err.print("convert exception: ");
System.err.println(ex);
System.exit(-1);
}
}
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
public class Input_8859_1 extends BytesToUnicode
{
public String getName() { return "8859_1"; }
public int read (char[] outbuffer, int outpos, int outlength)
{
int origpos = outpos;
// Make sure fields of this are in registers.
int inpos = this.inpos;
byte[] inbuffer = this.inbuffer;
int inavail = this.inlength - inpos;
int outavail = outlength - outpos;
if (outavail > inavail)
outavail = inavail;
while (--outavail >= 0)
{
outbuffer[outpos++] = (char) (inbuffer[inpos++] & 0xFF);
}
this.inpos = inpos;
return outpos - origpos;
}
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
public class Input_EUCJIS extends BytesToUnicode
{
public String getName() { return "EUCJIS"; }
int codeset = 0;
int first_byte;
public native int read (char[] outbuffer, int outpos, int outlength);
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
public class Input_UTF8 extends BytesToUnicode
{
public String getName() { return "UTF8"; }
int partial = 0;
int partial_bytes_expected = 0;
//int suggogate_second = -1;
public int read (char[] outbuffer, int outpos, int outlength)
{
int origpos = outpos;
for (;;)
{
if (outpos >= outlength)
break;
if (inpos >= inlength)
break;
int b = inbuffer[inpos++];
if (b >= 0)
outbuffer[outpos++] = (char) b;
else
{
if ((b & 0xC0) == 0x80) // Continuation byte
{
partial = (partial << 6) | (b & 0x3F);
--partial_bytes_expected;
if (partial_bytes_expected == 1)
{
if (partial > (0xFFFF>>6))
{
// The next continuation byte will cause the result
// to exceed 0xFFFF, so we must use a surrogate pair.
// The "Unicode scalar value" (see D28 in section 3.7
// of the Unicode Standard 2.0) is defined as:
// value == (hi-0xD800)*0x400+(lo-0xDC00)+0x10000,
// where (hi, lo) is the Unicode surrogate pair.
// After reading the first three bytes, we have:
// partial == (value >> 6).
// Substituting and simplifying, we get:
// partial == (hi-0xD800)*0x10+((lo-0xDC00)>>6)+0x400.
// The definition lo>=0xDC00 && lo<=0xDFFF implies
// that (lo-0xDC00)>>6 is in the range 0..15.
// Hence we can infer (partial-0x400)>>4 == (hi-0xDB00)
// and we can emit the high-surrogate without waiting
// for the final byte:
outbuffer[outpos++] = (char) (0xDA00+(partial>>4));
// Now we want to set it up so that when we read
// the final byte on the next iteration, we will
// get the low-surrogate without special handling.
// I.e. we want:
// lo == (next_partial << 6) | (next & 0x3F)
// where next is the next input byte and next_partial
// is the value of partial at the end of this
// iteration. This implies: next_partial == lo >> 6.
// We can simplify the previous:
// partial == (hi-0xD800)*0x10+((lo-0xDC00)>>6)+0x400,
// to: partial == (hi-0xD800)*0x10+(lo>>6)+0x90.
// Inserting the values of hi and next_partial,
// and simplifying, we get: partial ==
// ( (partial-0x400)&~0xF) + next_partial + 0x90.
// Solving for next_partial, we get:
// next_partial = partial+0x400-0x90-(partial&~0xF):
// or: next_partial = (partial&0xF) + 0x370. Hence:
partial = (partial & 0xF) + 0x370;
}
}
else if (partial_bytes_expected == 0)
{
outbuffer[outpos++] = (char) partial;
partial = 0;
partial_bytes_expected = 0;
}
}
else // prefix byte
{
if ((b & 0xE) == 0xC0)
{
partial = b & 0x1F;
partial_bytes_expected = 1;
}
else if ((b & 0xF) == 0xF0)
{
partial = b & 0xF;
partial_bytes_expected = 2;
}
else
{
partial = b & 7;
partial_bytes_expected = 3;
}
}
}
}
return outpos - origpos;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
public class Output_8859_1 extends UnicodeToBytes
{
public String getName() { return "8859_1"; }
/**
* @return number of chars converted. */
public int write (char[] inbuffer, int inpos, int inlength)
{
int count = this.count;
byte[] buf = this.buf;
int avail = buf.length - count;
if (inlength > avail)
inlength = avail;
for (int i = inlength; --i >= 0; )
{
buf[count++] = (byte) inbuffer[inpos++];
}
this.count = count;
return inlength;
}
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
/** Convert Unicode to Ascii with \ u XXXX-escapes. */
public class Output_JavaSrc extends UnicodeToBytes
{
public String getName() { return "JavaSrc"; }
// Number of bytes remaining before pending_char has been written.
int todo;
int pending_char;
public int write (char[] inbuffer, int inpos, int inlength)
{
int start_pos = inpos;
int avail = buf.length - count;
for (;;)
{
if (avail == 0)
break;
switch (todo)
{
case 1:
if (pending_char == '\\')
{
buf[count++] = (byte) '\\';
avail--;
todo = 0;
continue;
}
/* ... else fall through ... */
case 2:
case 3:
case 4:
todo--;
int digit = ((int) pending_char >> (todo * 4)) & 0xF;
buf[count++] = (byte) Character.forDigit(digit, 16);
avail--;
continue;
case 5:
buf[count++] = (byte) 'u';
avail--;
todo = 4;
continue;
default:
;
}
if (inlength == 0)
break;
char ch = inbuffer[inpos++];
inlength--;
if (ch == '\\')
{
buf[count++] = (byte) '\\';
pending_char = ch;
todo = 1;
avail--;
}
else if (ch < 127)
{
buf[count++] = (byte) ch;
avail--;
}
else
{
buf[count++] = (byte) '\\';
pending_char = ch;
todo = 5;
avail--;
}
}
return inpos - start_pos;
}
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
public class Output_UTF8 extends UnicodeToBytes
{
public String getName() { return "UTF8"; }
/** True if a surrogate pair should be emitted as a single UTF8 sequence.
* Otherwise, a surrogate pair is treated as two separate characters.
* Also, '\0' is emitted as {0} if true, and as {0xC0,0x80} if false. */
public boolean standardUTF8;
// Saves the previous char if it was a high-surrogate.
char hi_part;
// Value of imcomplete character.
int value;
// Number of continuation bytes still to emit.
int bytes_todo;
public int write (char[] inbuffer, int inpos, int inlength)
{
int start_pos = inpos;
int avail = buf.length - count;
for (;;)
{
if (inlength == 0 || avail == 0)
break;
// The algororith is made more complicated because we want to write
// at least one byte in the output buffer, if there is room for
// that byte, and at least one input character is available.
// This makes the code more robust, since client code will
// always "make progress", even in the complicated cases,
// where the output buffer only has room for only *part* of a
// multi-byte sequence, or the input char buffer only has half
// of a surrogate pair (when standardUTF8 is set), or both.
// Handle continuation characters we did not have room for before.
if (bytes_todo > 0)
{
do
{
bytes_todo--;
buf[count++] = (byte)
(((value >> (bytes_todo * 6)) & 0xC0) | 0x80);
avail--;
}
while (bytes_todo > 0 && avail > 0);
continue;
}
char ch = inbuffer[inpos++];
inlength--;
if (ch < 128 && (ch != 0 || standardUTF8))
{
avail--;
buf[count++] = (byte) ch;
}
else if (ch <= 0x07FF)
{
buf[count++] = (byte) (0xC0 | (ch >> 6));
if (--avail > 0)
{
buf[count++] = (byte) ((ch & 0x3F) | 0x80);
avail--;
}
else
{
value = ch;
bytes_todo = 1;
break;
}
}
else if (ch >= 0xD800 && ch <= 0xDFFF && standardUTF8)
{
if (ch <= 0xDBFF) // High surrogates
{
// The first byte is (0xF0 | value>>18), where value is the
// Unicode scalar value of the combine character - which
// we may not know yet. But from substituting:
// value == (hi-0xD800)*0x400+(lo-0xDC00)+0x10000,
// hi==ch, and cancelling we get:
buf[count++] = (byte) (0xF0 | ((ch-0xD800) >> 8));
avail--;
hi_part = ch;
}
else // Low surrogates
{
value = (hi_part - 0xD800) * 0x400 + (ch - 0xDC00) + 0x10000;
bytes_todo = 3;
}
}
else
{
buf[count++] = (byte) (0xE0 | (ch >> 12));
value = ch;
avail--;
bytes_todo = 2;
}
}
return inpos - start_pos;
}
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.convert;
public abstract class UnicodeToBytes
{
/** Buffer to emit bytes to.
* The locations buf[count] ... buf[buf.length-1] are available. */
public byte[] buf;
public int count;
static Class defaultEncodingClass;
static synchronized void getDefaultEncodingClass()
{
// Test (defaultEncodingClass == null) again in case of race condition.
if (defaultEncodingClass == null)
{
String encoding = System.getProperty("file.encoding");
String className = "gnu.gcj.convert.Output_"+encoding;
try
{
defaultEncodingClass = Class.forName(className);
}
catch (ClassNotFoundException ex)
{
throw new NoClassDefFoundError("missing default encoding "
+ encoding + " (class "
+ className + " not found)");
}
}
}
public abstract String getName();
public static UnicodeToBytes getDefaultEncoder()
{
try
{
if (defaultEncodingClass == null)
getDefaultEncodingClass();
return (UnicodeToBytes) defaultEncodingClass.newInstance();
}
catch (Throwable ex)
{
return new Output_8859_1();
}
}
/** Get a char-stream->byte-stream converter given an encoding name. */
public static UnicodeToBytes getEncoder (String encoding)
throws java.io.UnsupportedEncodingException
{
String className = "gnu.gcj.convert.Output_"+encoding;
Class encodingClass;
try
{
encodingClass = Class.forName(className);
return (UnicodeToBytes) encodingClass.newInstance();
}
catch (Throwable ex)
{
throw new java.io.UnsupportedEncodingException(encoding + " ("
+ ex + ')');
}
}
public final void setOutput(byte[] buffer, int count)
{
this.buf = buffer;
this.count = count;
}
/** Convert chars to bytes.
* Converted bytes are written to buf, starting at count.
* @param inbuffer sources of characters to convert
* @param inpos index of initial character ininbuffer to convert
* @param inlength number of characters to convert
* @return number of chars converted
* Also, this.count is increment by the number of bytes converted.
*/
public abstract int write (char[] inbuffer, int inpos, int inlength);
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <stdio.h>
struct chval
{
unsigned char b1; /* 1st byte */
unsigned char b2; /* 2nd byte */
unsigned short uc; /* unicode value */
};
#define MAP(B1, B2, C) { B1, B2, C },
struct chval chtab_0208[] = {
#include "JIS0208.h"
{ 255, 255, 0}
};
struct chval chtab_0212[] = {
#include "JIS0212.h"
{ 255, 255, 0}
};
#undef MAP
struct chval sorted[] = {
#define MAP(B1, B2, C) { B1, B2, C },
#include "JIS0208.h"
#undef MAP
#define MAP(B1, B2, C) { 0x80|B1, B2, C },
#include "JIS0212.h"
#undef MAP
};
struct chval *chtab;
int
compare (void *p1, void *p2)
{
struct chval *c1 = (struct chval *) p1;
struct chval *c2 = (struct chval *) p2;
return (int) c1->uc - (int) c2->uc;
}
int
main(int argc, char** argv)
{
FILE *out = stdout;
unsigned min1 = 256, max1 = 0, min2 = 256, max2 = 0, count = 0;
unsigned short low1_uc = 0xFFFF, high1_uc = 0;
unsigned short low2_uc = 0xFFFF, high2_uc = 0;
int i; int row, col;
if (strcmp (argv[1], "JIS0208") == 0)
chtab = chtab_0208;
else if (strcmp (argv[1], "JIS0212") == 0)
chtab = chtab_0212;
else if (strcmp (argv[1], "toJIS") == 0)
{
int i;
int count = sizeof(sorted)/sizeof(struct chval);
qsort (sorted, count, sizeof(struct chval),
compare);
for (i = 0; i < count; i++)
{
fprintf (out, " 0x%04x -> 0x%02x, 0x%02x\n",
sorted[i].uc, sorted[i].b1, sorted[i].b2);
}
exit(0);
}
else
{
fprintf (stderr, "bad argument!");
exit (-1);
}
for (i = 0; chtab[i].b1 != 255; i++)
{
if (chtab[i].b1 < min1) min1 = chtab[i].b1;
if (chtab[i].b2 < min2) min2 = chtab[i].b2;
if (chtab[i].b1 > max1) max1 = chtab[i].b1;
if (chtab[i].b2 > max2) max2 = chtab[i].b2;
count++;
}
fprintf(stderr, "1st byte ranges from %d to %d.\n", min1, max1);
fprintf(stderr, "2nd byte ranges from %d to %d.\n", min2, max2);
fprintf(out,"/* This file is automatically generated from %s.TXT. */\n",
argv[1]);
fprintf(out, "unsigned short %s_to_Unicode[%d][%d] = {\n",
argv[1], max1 - min1 + 1, max2 - min2 + 1);
i = 0;
for (row = min1; row <= max1; row++)
{
fprintf(out, "/* 1st byte: %d */ { ", row);
if (row < chtab[i].b1)
{
fprintf(out, "0 }, /* unused row */\n");
}
else if (row > chtab[i].b1)
{
fprintf (stderr, "error - char table out of order!\n");
exit (-1);
}
else
{
fprintf(out, "\n");
for (col = min2; col <= max2; col++)
{
if (row == chtab[i].b1 && col == chtab[i].b2)
{
unsigned uc = chtab[i].uc;
if (uc < 0x2000)
{
if (uc > high1_uc)
high1_uc = uc;
if (uc < low1_uc)
low1_uc = uc;
}
else
{
if (uc > high2_uc)
high2_uc = uc;
if (uc < low2_uc)
low2_uc = uc;
}
fprintf (out, " /* 2nd byte: %d */ 0x%04x",
chtab[i].b2, uc);
i++;
}
else if (row < chtab[i].b1
|| (row == chtab[i].b1 && col < chtab[i].b2))
{
fprintf (out, " 0");
}
else
{
fprintf (stderr, "error - char table our of order!\n");
exit (-1);
}
if (col != max2)
fprintf (out, ",\n");
}
fprintf(out, row == max1 ? "}\n" : "},\n");
}
}
fprintf(out, "};\n");
fprintf(stderr, "total number of characters is %d.\n", count);
fprintf(stderr, "Range is 0x%04x-0x%04x and 0x%04x-0x%04x.\n",
low1_uc, high1_uc, low2_uc, high2_uc);
return 0;
}
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
#include <cni.h>
#include <gnu/gcj/convert/Input_EUCJIS.h>
#define ERROR_CHAR 0xFFFD
extern unsigned short JIS0208_to_Unicode[84][94];
extern unsigned short JIS0212_to_Unicode[76][94];
jint
gnu::gcj::convert::Input_EUCJIS::read(jcharArray outbuffer, jint outpos,
jint outlength)
{
jint start_outpos = outpos;
for (;;)
{
if (outpos >= outlength)
break;
if (inpos >= inlength)
break;
int b = ((unsigned char*) elements(inbuffer))[inpos++];
if (codeset == 0) // ASCII or JIS-Roman
{
if (b < 128)
{
#if 0
// Technically, we should translate 0x5c to Yen symbol;
// in practice, it is not clear.
if (b == 0x5c)
b = 0x00A5; // Yen sign.
#endif
elements(outbuffer)[outpos++] = (char) b;
}
else
{
if (b == 0x8E) // SS2
codeset = 2;
else if (b == 0x8F) // SS3
codeset = 3;
else
{
codeset = 1;
first_byte = b;
}
}
}
else if (codeset == 1) // JIS X 0208:1997
{
first_byte -= 0x80 + 33;
b -= 0x80 + 33;
if ((unsigned) first_byte >= 84 || (unsigned) b >= 94)
b = ERROR_CHAR;
else
{
b = JIS0208_to_Unicode[first_byte][b];
if (b == 0)
b = ERROR_CHAR;
}
elements(outbuffer)[outpos++] = b;
codeset = 0;
}
else if (codeset == 2) // Half-width katakana
{
if (b >= 0xA1 && b <= 0xDF)
b += 0xFF61 - 0xA1;
else
b = ERROR_CHAR;
elements(outbuffer)[outpos++] = b;
codeset = 0;
}
else if (codeset == 3) // second byte of JIS X 0212-1990
{
first_byte = b;
codeset = 4;
}
else // codeset == 4 // third byte of JIS X 0212-1990
{
first_byte -= 0x80 + 34;
b -= 0x80 + 33;
if ((unsigned) first_byte >= 76 || (unsigned) b >= 94)
b = ERROR_CHAR;
else
{
b = JIS0208_to_Unicode[first_byte][b];
if (b == 0)
b = ERROR_CHAR;
}
elements(outbuffer)[outpos++] = b;
codeset = 0;
}
}
return outpos - start_outpos;
}
// Connection.java - Implementation of HttpURLConnection for http protocol.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.protocol.http;
import java.net.*;
import java.io.*;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date March 29, 1999.
*/
/**
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Minimal subset of functionality. Proxies and Redirects
* not yet handled. FileNameMap handling needs to be considered.
* useCaches, ifModifiedSince, and allowUserInteraction need
* consideration as well as doInput and doOutput.
*/
class Connection extends HttpURLConnection
{
protected Socket sock = null;
private static Hashtable defRequestProperties = new Hashtable();
private Hashtable requestProperties;
private Hashtable hdrHash = new Hashtable();
private Vector hdrVec = new Vector();
private boolean gotHeaders = false;
private BufferedInputStream bufferedIn;
public Connection(URL url)
{
super(url);
requestProperties = (Hashtable) defRequestProperties.clone();
}
// Override method in URLConnection.
public static void setDefaultRequestProperty(String key, String value)
{
defRequestProperties.put(key, value);
}
// Override method in URLConnection.
public static String getDefaultRequestProperty(String key)
{
return (String) defRequestProperties.get(key);
}
// Override method in URLConnection.
public void setRequestProperty(String key, String value)
{
if (connected)
throw new IllegalAccessError("Connection already established.");
requestProperties.put(key, value);
}
// Override method in URLConnection.
public String getRequestProperty(String key)
{
if (connected)
throw new IllegalAccessError("Connection already established.");
return (String) requestProperties.get(key);
}
// Implementation of abstract method.
public void connect() throws IOException
{
// Call is ignored if already connected.
if (connected)
return;
// Get address and port number.
int port;
InetAddress destAddr = InetAddress.getByName(url.getHost());
if ((port = url.getPort()) == -1)
port = 80;
// Open socket and output stream.
sock = new Socket(destAddr, port);
PrintWriter out = new PrintWriter(sock.getOutputStream());
// Send request including any request properties that were set.
out.print(getRequestMethod() + " " + url.getFile() + " HTTP/1.1\n");
out.print("Host: " + url.getHost() + ":" + port + "\n");
Enumeration reqKeys = requestProperties.keys();
Enumeration reqVals = requestProperties.elements();
while (reqKeys.hasMoreElements())
out.print(reqKeys.nextElement() + ": " + reqVals.nextElement() + "\n");
out.print("\n");
out.flush();
connected = true;
}
// Implementation of abstract method.
public void disconnect()
{
if (sock != null)
{
try
{
sock.close();
}
catch (IOException ex)
{
; // Ignore errors in closing socket.
}
sock = null;
}
connected = false;
}
// TODO: public boolean usingProxy()
public boolean usingProxy()
{
throw new InternalError("HttpURLConnection.usingProxy not implemented");
}
// Override default method in URLConnection.
public InputStream getInputStream() throws IOException
{
if (!connected)
connect();
if (bufferedIn == null)
bufferedIn = new BufferedInputStream(sock.getInputStream());
return bufferedIn;
}
// Override default method in URLConnection.
public OutputStream getOutputStream() throws IOException
{
if (!connected)
connect();
return sock.getOutputStream();
}
// Override default method in URLConnection.
public String getHeaderField(String name)
{
try
{
getHttpHeaders();
}
catch (IOException x)
{
return null;
}
return (String) hdrHash.get(name.toLowerCase());
}
// Override default method in URLConnection.
public String getHeaderField(int n)
{
try
{
getHttpHeaders();
}
catch (IOException x)
{
return null;
}
if (n < hdrVec.size())
return getField((String) hdrVec.elementAt(n));
return null;
}
// Override default method in URLConnection.
public String getHeaderFieldKey(int n)
{
try
{
getHttpHeaders();
}
catch (IOException x)
{
return null;
}
if (n < hdrVec.size())
return getKey((String) hdrVec.elementAt(n));
return null;
}
private String getKey(String str)
{
if (str == null)
return null;
int index = str.indexOf(':');
if (index >= 0)
return str.substring(0, index);
else
return null;
}
private String getField(String str)
{
if (str == null)
return null;
int index = str.indexOf(':');
if (index >= 0)
return str.substring(index + 1).trim();
else
return str;
}
private void getHttpHeaders() throws IOException
{
if (gotHeaders)
return;
gotHeaders = true;
connect();
// Originally tried using a BufferedReader here to take advantage of
// the readLine method and avoid the following, but the buffer read
// past the end of the headers so the first part of the content was lost.
// It is probably more robust than it needs to be, e.g. the byte[]
// is unlikely to overflow and a '\r' should always be followed by a '\n',
// but it is better to be safe just in case.
if (bufferedIn == null)
bufferedIn = new BufferedInputStream(sock.getInputStream());
int buflen = 100;
byte[] buf = new byte[buflen];
String line = "";
boolean gotnl = false;
byte[] ch = new byte[1];
ch[0] = (byte) '\n';
while (true)
{
// Check for leftover byte from non-'\n' after a '\r'.
if (ch[0] != '\n')
line = line + '\r' + new String(ch, 0, 1);
int i;
for (i = 0; i < buflen; i++)
{
bufferedIn.read(buf, i, 1);
if (buf[i] == '\r')
{
bufferedIn.read(ch, 0, 1);
if (ch[0] == '\n')
gotnl = true;
break;
}
}
line = line + new String(buf, 0, i);
// A '\r' '\n' combo indicates the end of the header entry.
// If it wasn't found, cycle back through the loop and append
// to 'line' until one is found.
if (gotnl)
{
// A zero length entry signals the end of the headers.
if (line.length() == 0)
break;
// Store the header and reinitialize for next cycle.
hdrVec.addElement(line);
String key = getKey(line);
if (key != null)
hdrHash.put(key.toLowerCase(), getField(line));
line = "";
ch[0] = (byte) '\n';
gotnl = false;
}
}
}
}
// Handler.java - URLStreamHandler for http protocol.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.protocol.http;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.io.IOException;
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date March 26, 1999.
*/
/**
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Minimal functionality.
*/
public class Handler extends URLStreamHandler
{
protected URLConnection openConnection(URL url) throws IOException
{
return new Connection(url);
}
}
// Base class for default BreakIterators.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.text;
import java.text.BreakIterator;
import java.text.CharacterIterator;
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date March 22, 1999
*/
public abstract class BaseBreakIterator extends BreakIterator
{
public int current ()
{
return iter.getIndex();
}
public int first ()
{
iter.first();
return iter.getBeginIndex();
}
public int following (int pos)
{
int save = iter.getIndex();
iter.setIndex(pos);
int r = next ();
iter.setIndex(save);
return r;
}
public CharacterIterator getText ()
{
return iter;
}
public int last ()
{
iter.last();
return iter.getEndIndex();
}
public int next (int n)
{
int r = iter.getIndex ();
if (n > 0)
{
while (n > 0 && r != DONE)
{
r = next ();
--n;
}
}
else if (n < 0)
{
while (n < 0 && r != DONE)
{
r = previous ();
++n;
}
}
return r;
}
public void setText (CharacterIterator newText)
{
iter = newText;
}
protected CharacterIterator iter;
}
// Default character BreakIterator.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.text;
import java.text.BreakIterator;
import java.text.CharacterIterator;
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date March 19, 1999
* Written using The Unicode Standard, Version 2.0.
*/
public class CharacterBreakIterator extends BaseBreakIterator
{
// Hangul Jamo constants from Unicode book.
private static final int LBase = 0x1100;
private static final int VBase = 0x1161;
private static final int TBase = 0x11a7;
private static final int LCount = 19;
private static final int VCount = 21;
private static final int TCount = 28;
// Information about surrogates.
private static final int highSurrogateStart = 0xD800;
private static final int highSurrogateEnd = 0xDBFF;
private static final int lowSurrogateStart = 0xDC00;
private static final int lowSurrogateEnd = 0xDFFF;
public Object clone ()
{
return new CharacterBreakIterator (this);
}
public CharacterBreakIterator ()
{
iter = null; // FIXME?
}
private CharacterBreakIterator (CharacterBreakIterator other)
{
iter = (CharacterIterator) other.iter.clone();
}
// Some methods to tell us different properties of characters.
private final boolean isL (char c)
{
return c >= LBase && c <= LBase + LCount;
}
private final boolean isV (char c)
{
return c >= VBase && c <= VBase + VCount;
}
private final boolean isT (char c)
{
return c >= TBase && c <= TBase + TCount;
}
private final boolean isLVT (char c)
{
return isL (c) || isV (c) || isT (c);
}
private final boolean isHighSurrogate (char c)
{
return c >= highSurrogateStart && c <= highSurrogateEnd;
}
private final boolean isLowSurrogate (char c)
{
return c >= lowSurrogateStart && c <= lowSurrogateEnd;
}
public int next ()
{
int end = iter.getEndIndex();
if (iter.getIndex() == end)
return DONE;
char c;
for (char prev = CharacterIterator.DONE; iter.getIndex() < end; prev = c)
{
c = iter.next();
if (c == CharacterIterator.DONE)
break;
int type = Character.getType(c);
// Break after paragraph separators.
if (type == Character.PARAGRAPH_SEPARATOR)
break;
// Now we need some lookahead.
char ahead = iter.next();
iter.previous();
if (ahead == CharacterIterator.DONE)
break;
int aheadType = Character.getType(ahead);
if (aheadType != Character.NON_SPACING_MARK
&& ! isLowSurrogate (ahead)
&& ! isLVT (ahead))
break;
if (! isLVT (c) && isLVT (ahead))
break;
if (isL (c) && ! isLVT (ahead)
&& aheadType != Character.NON_SPACING_MARK)
break;
if (isV (c) && ! isV (ahead) && !isT (ahead)
&& aheadType != Character.NON_SPACING_MARK)
break;
if (isT (c) && ! isT (ahead)
&& aheadType != Character.NON_SPACING_MARK)
break;
if (! isHighSurrogate (c) && isLowSurrogate (ahead))
break;
if (isHighSurrogate (c) && ! isLowSurrogate (ahead))
break;
if (! isHighSurrogate (prev) && isLowSurrogate (c))
break;
}
return iter.getIndex();
}
public int previous ()
{
if (iter.getIndex() == iter.getBeginIndex())
return DONE;
int start = iter.getBeginIndex();
while (iter.getIndex() >= iter.getBeginIndex())
{
char c = iter.previous();
if (c == CharacterIterator.DONE)
break;
int type = Character.getType(c);
if (type != Character.NON_SPACING_MARK
&& ! isLowSurrogate (c)
&& ! isLVT (c))
break;
// Now we need some lookahead.
char ahead = iter.previous();
if (ahead == CharacterIterator.DONE)
{
iter.next();
break;
}
char ahead2 = iter.previous();
iter.next();
iter.next();
if (ahead2 == CharacterIterator.DONE)
break;
int aheadType = Character.getType(ahead);
if (aheadType == Character.PARAGRAPH_SEPARATOR)
break;
if (isLVT (c) && ! isLVT (ahead))
break;
if (! isLVT (c) && type != Character.NON_SPACING_MARK
&& isL (ahead))
break;
if (! isV (c) && ! isT (c) && type != Character.NON_SPACING_MARK
&& isV (ahead))
break;
if (! isT (c) && type != Character.NON_SPACING_MARK
&& isT (ahead))
break;
if (isLowSurrogate (c) && ! isHighSurrogate (ahead))
break;
if (! isLowSurrogate (c) && isHighSurrogate (ahead))
break;
if (isLowSurrogate (ahead) && ! isHighSurrogate (ahead2))
break;
}
return iter.getIndex();
}
}
// Default word BreakIterator.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.text;
import java.text.BreakIterator;
import java.text.CharacterIterator;
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date March 22, 1999
* Written using The Unicode Standard, Version 2.0.
*/
public class LineBreakIterator extends BaseBreakIterator
{
public Object clone ()
{
return new LineBreakIterator (this);
}
public LineBreakIterator ()
{
iter = null;
}
private LineBreakIterator (LineBreakIterator other)
{
iter = (CharacterIterator) other.iter.clone();
}
// Some methods to tell us different properties of characters.
private final boolean isNb (char c)
{
return (c == 0x00a0 // NO-BREAK SPACE
|| c == 0x2011 // NON-BREAKING HYPHEN
|| c == 0xfeff); // ZERO WITH NO-BREAK SPACE
}
private final boolean isClose (int type)
{
return (type == Character.END_PUNCTUATION
// Unicode book says "comma, period, ...", which I take to
// mean "Po" class.
|| type == Character.OTHER_PUNCTUATION);
}
private final boolean isIdeo (char c)
{
return (c >= 0x3040 && c <= 0x309f // Hiragana
|| c >= 0x30a0 && c <= 0x30ff // Katakana
|| c >= 0x4e00 && c <= 0x9fff // Han
|| c >= 0x3100 && c <= 0x312f); // Bopomofo
}
public int next ()
{
int end = iter.getEndIndex();
if (iter.getIndex() == end)
return DONE;
while (iter.getIndex() < end)
{
char c = iter.current();
int type = Character.getType(c);
char n = iter.next();
if (n == CharacterIterator.DONE
|| type == Character.PARAGRAPH_SEPARATOR
|| type == Character.LINE_SEPARATOR)
break;
// Handle two cases where we must scan for non-spacing marks.
int start = iter.getIndex();
if (type == Character.SPACE_SEPARATOR
|| type == Character.START_PUNCTUATION
|| isIdeo (c))
{
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.NON_SPACING_MARK)
n = iter.next();
if (n == CharacterIterator.DONE)
break;
if (type == Character.SPACE_SEPARATOR)
{
int nt = Character.getType(n);
if (nt != Character.NON_SPACING_MARK
&& nt != Character.SPACE_SEPARATOR
&& ! isNb (n))
break;
}
else if (type == Character.START_PUNCTUATION)
{
if (isIdeo (n))
{
// Open punctuation followed by non spacing marks
// and then ideograph does not have a break in
// it. So skip all this.
start = iter.getIndex();
}
}
else
{
// Ideograph preceded this character.
if (isClose (Character.getType(n)))
break;
}
}
iter.setIndex(start);
}
return iter.getIndex();
}
public int previous ()
{
int start = iter.getBeginIndex();
if (iter.getIndex() == start)
return DONE;
while (iter.getIndex() >= start)
{
char c = iter.previous();
if (c == CharacterIterator.DONE)
break;
int type = Character.getType(c);
char n = iter.previous();
if (n == CharacterIterator.DONE)
break;
iter.next();
int nt = Character.getType(n);
// Break after paragraph separators.
if (nt == Character.PARAGRAPH_SEPARATOR
|| nt == Character.LINE_SEPARATOR)
break;
// Skip non-spacing marks.
int init = iter.getIndex();
while (n != CharacterIterator.DONE && nt == Character.NON_SPACING_MARK)
{
n = iter.previous();
nt = Character.getType(n);
}
if (nt == Character.SPACE_SEPARATOR
&& type != Character.SPACE_SEPARATOR
&& type != Character.NON_SPACING_MARK
&& ! isNb (c))
break;
if (! isClose (type) && isIdeo (n))
break;
if (isIdeo (c) && nt != Character.START_PUNCTUATION)
break;
iter.setIndex(init);
}
return iter.getIndex();
}
}
// Generic English locale data for java.text.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.text;
import java.util.ListResourceBundle;
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date March 4, 1999
*/
public final class LocaleData_en extends ListResourceBundle
{
// These are for DateFormatSymbols.
static final String[] ampmsDefault = {"AM", "PM" };
static final String[] erasDefault = {"BC", "AD" };
static final String localPatternCharsDefault = "GyMdkHmsSEDFwWahKz";
static final String[] monthsDefault = {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December", ""
};
static final String[] shortMonthsDefault = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""
};
static final String[] shortWeekdaysDefault = {
"", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
static final String[] weekdaysDefault = {
"", "Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday"
};
private static final Object[][] contents =
{
// These are for DecimalFormatSymbols.
{ "decimalSeparator", "." },
{ "digit", "#" },
{ "exponential", "E" },
{ "groupingSeparator", "," },
{ "infinity", "\u221e" },
{ "minusSign", "-" },
{ "NaN", "\ufffd" },
{ "patternSeparator", ";" },
{ "percent", "%" },
{ "perMill", "\u2030" },
{ "zeroDigit", "0" },
// These are for NumberFormat.
{ "numberFormat", "#,##0.###" },
{ "percentFormat", "#,##0%" },
// These are for DateFormatSymbols.
{ "ampm", ampmsDefault },
{ "eras", erasDefault },
{ "datePatternChars", localPatternCharsDefault },
{ "months", monthsDefault },
{ "shortMonths", shortMonthsDefault },
{ "shortWeekdays", shortWeekdaysDefault },
{ "weekdays", weekdaysDefault }
};
protected Object[][] getContents ()
{
return contents;
}
}
// US English locale data for java.text.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.text;
import java.util.ListResourceBundle;
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date March 4, 1999
*/
public final class LocaleData_en_US extends ListResourceBundle
{
// These are for DateFormatSymbols.
static String[][] zoneStringsDefault = {
{ "PST", "Pacific Standard Time", "PST",
/**/ "Pacific Daylight Time", "PDT", "San Francisco" },
{ "MST", "Mountain Standard Time", "MST",
/**/ "Mountain Daylight Time", "MDT", "Denver" },
{ "PNT", "Mountain Standard Time", "MST",
/**/ "Mountain Standard Time", "MST", "Phoenix" },
{ "CST", "Central Standard Time", "CST",
/**/ "Central Daylight Time", "CDT", "Chicago" },
{ "EST", "Eastern Standard Time", "EST",
/**/ "Eastern Daylight Time", "EDT", "Boston" },
{ "IET", "Eastern Standard Time", "EST",
/**/ "Eastern Standard Time", "EST", "Indianapolis" },
{ "PRT", "Atlantic Standard Time", "AST",
/**/ "Atlantic Daylight Time", "ADT", "Halifax" },
{ "HST", "Hawaii Standard Time", "HST",
/**/ "Hawaii Daylight Time", "HDT", "Honolulu" },
{ "AST", "Alaska Standard Time", "AST",
/**/ "Alaska Daylight Time", "ADT", "Anchorage" }
};
private static final Object[][] contents =
{
// These are for DecimalFormatSymbols.
{ "currency", "$" },
{ "intlCurrencySymbol", "$" }, // FIXME?
// These are for NumberFormat.
{ "currencyFormat", "$#,##0.00;($#,##0.00)" },
// These are for DateFormatSymbols.
{ "zoneStrings", zoneStringsDefault },
// These are for DateFormat.
{ "shortDateFormat", "M/d/yy" }, // Java's Y2K bug.
{ "mediumDateFormat", "d-MMM-yy" },
{ "longDateFormat", "MMMM d, yyyy" },
{ "fullDateFormat", "EEEE MMMM d, yyyy G" },
{ "shortTimeFormat", "h:mm a" },
{ "mediumTimeFormat", "h:mm:ss a" },
{ "longTimeFormat", "h:mm:ss a z" },
{ "fullTimeFormat", "h:mm:ss;S 'o''clock' a z" }
};
protected Object[][] getContents ()
{
return contents;
}
}
// Default sentence BreakIterator.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.text;
import java.text.BreakIterator;
import java.text.CharacterIterator;
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date March 23, 1999
* Written using The Unicode Standard, Version 2.0.
*/
public class SentenceBreakIterator extends BaseBreakIterator
{
public Object clone ()
{
return new SentenceBreakIterator (this);
}
public SentenceBreakIterator ()
{
iter = null;
}
private SentenceBreakIterator (SentenceBreakIterator other)
{
iter = (CharacterIterator) other.iter.clone();
}
public int next ()
{
int end = iter.getEndIndex();
if (iter.getIndex() == end)
return DONE;
while (iter.getIndex() < end)
{
char c = iter.current();
if (c == CharacterIterator.DONE)
break;
int type = Character.getType(c);
char n = iter.next();
if (n == CharacterIterator.DONE)
break;
// Always break after paragraph separator.
if (type == Character.PARAGRAPH_SEPARATOR)
break;
if (c == '!' || c == '?')
{
// Skip close punctuation.
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.END_PUNCTUATION)
n = iter.next();
// Skip spaces.
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.SPACE_SEPARATOR)
n = iter.next();
// Skip optional paragraph separator.
if (n != CharacterIterator.DONE
&& Character.getType(n) == Character.PARAGRAPH_SEPARATOR)
n = iter.next();
// There's always a break somewhere after `!' or `?'.
break;
}
if (c == '.')
{
int save = iter.getIndex();
// Skip close punctuation.
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.END_PUNCTUATION)
n = iter.next();
// Skip spaces. We keep count because we need at least
// one for this period to represent a terminator.
int spcount = 0;
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.SPACE_SEPARATOR)
{
n = iter.next();
++spcount;
}
if (spcount > 0)
{
int save2 = iter.getIndex();
// Skip over open puncutation.
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.START_PUNCTUATION)
n = iter.next();
// Next character must not be lower case.
if (n == CharacterIterator.DONE
|| ! Character.isLowerCase(n))
{
iter.setIndex(save2);
break;
}
}
iter.setIndex(save);
}
}
return iter.getIndex();
}
private final int previous_internal ()
{
int start = iter.getBeginIndex();
if (iter.getIndex() == start)
return DONE;
while (iter.getIndex() >= start)
{
char c = iter.previous();
if (c == CharacterIterator.DONE)
break;
char n = iter.previous();
if (n == CharacterIterator.DONE)
break;
iter.next();
int nt = Character.getType(n);
if (! Character.isLowerCase(c)
&& (nt == Character.START_PUNCTUATION
|| nt == Character.SPACE_SEPARATOR))
{
int save = iter.getIndex();
int save_nt = nt;
char save_n = n;
// Skip open punctuation.
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.START_PUNCTUATION)
n = iter.previous();
if (n == CharacterIterator.DONE)
break;
if (Character.getType(n) == Character.SPACE_SEPARATOR)
{
// Must have at least once space after the `.'.
int save2 = iter.getIndex();
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.SPACE_SEPARATOR)
n = iter.previous();
// Skip close punctuation.
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.END_PUNCTUATION)
n = iter.previous();
if (n == CharacterIterator.DONE || n == '.')
{
// Communicate location of actual end.
period = iter.getIndex();
iter.setIndex(save2);
break;
}
}
iter.setIndex(save);
nt = save_nt;
n = save_n;
}
if (nt == Character.PARAGRAPH_SEPARATOR)
{
// Communicate location of actual end.
period = iter.getIndex();
break;
}
else if (nt == Character.SPACE_SEPARATOR
|| nt == Character.END_PUNCTUATION)
{
int save = iter.getIndex();
// Skip spaces.
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.SPACE_SEPARATOR)
n = iter.previous();
// Skip close punctuation.
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.END_PUNCTUATION)
n = iter.previous();
int here = iter.getIndex();
iter.setIndex(save);
if (n == CharacterIterator.DONE || n == '!' || n == '?')
{
// Communicate location of actual end.
period = here;
break;
}
}
else if (n == '!' || n == '?')
{
// Communicate location of actual end.
period = iter.getIndex();
break;
}
}
return iter.getIndex();
}
public int previous ()
{
// We want to skip over the first sentence end to the second one.
// However, at the end of the string we want the first end.
int here = iter.getIndex();
period = here;
int first = previous_internal ();
if (here == iter.getEndIndex() || first == DONE)
return first;
iter.setIndex(period);
return previous_internal ();
}
// This is used for communication between previous and
// previous_internal.
private int period;
}
// Default word BreakIterator.
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.text;
import java.text.BreakIterator;
import java.text.CharacterIterator;
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date March 22, 1999
* Written using The Unicode Standard, Version 2.0.
*/
public class WordBreakIterator extends BaseBreakIterator
{
public Object clone ()
{
return new WordBreakIterator (this);
}
public WordBreakIterator ()
{
iter = null;
}
private WordBreakIterator (WordBreakIterator other)
{
iter = (CharacterIterator) other.iter.clone();
}
// Some methods to tell us different properties of characters.
private final boolean isHira (char c)
{
return c >= 0x3040 && c <= 0x309f;
}
private final boolean isKata (char c)
{
return c >= 0x30a0 && c <= 0x30ff;
}
private final boolean isHan (char c)
{
return c >= 0x4e00 && c <= 0x9fff;
}
public int next ()
{
int end = iter.getEndIndex();
if (iter.getIndex() == end)
return DONE;
while (iter.getIndex() < end)
{
char c = iter.current();
if (c == CharacterIterator.DONE)
break;
int type = Character.getType(c);
char n = iter.next();
if (n == CharacterIterator.DONE)
break;
// Break after paragraph separators.
if (type == Character.PARAGRAPH_SEPARATOR
|| type == Character.LINE_SEPARATOR)
break;
// Break between letters and non-letters.
// FIXME: we treat apostrophe as part of a word. This
// is an English-ism.
boolean is_letter = Character.isLetter(c);
if (c != '\'' && ! is_letter && type != Character.NON_SPACING_MARK
&& Character.isLetter(n))
break;
// Always break after certain symbols, such as punctuation.
// This heuristic is derived from hints in the JCL book and is
// not part of Unicode. It seems to be right, however.
// FIXME: we treat apostrophe as part of a word. This
// is an English-ism.
if (c != '\''
&& (type == Character.DASH_PUNCTUATION
|| type == Character.START_PUNCTUATION
|| type == Character.END_PUNCTUATION
|| type == Character.CONNECTOR_PUNCTUATION
|| type == Character.OTHER_PUNCTUATION
|| type == Character.MATH_SYMBOL
|| type == Character.CURRENCY_SYMBOL
|| type == Character.MODIFIER_SYMBOL
|| type == Character.OTHER_SYMBOL
|| type == Character.FORMAT
|| type == Character.CONTROL))
break;
boolean is_hira = isHira (c);
boolean is_kata = isKata (c);
boolean is_han = isHan (c);
// Special case Japanese.
if (! is_hira && ! is_kata && ! is_han
&& type != Character.NON_SPACING_MARK
&& (isHira (n) || isKata (n) || isHan (n)))
break;
if (is_hira || is_kata || is_han || is_letter)
{
// Now we need to do some lookahead. We might need to do
// quite a bit of lookahead, so we save our position and
// restore it later.
int save = iter.getIndex();
// Skip string of non spacing marks.
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.NON_SPACING_MARK)
n = iter.next();
if (n == CharacterIterator.DONE)
break;
if ((is_hira && ! isHira (n))
|| (is_kata && ! isHira (n) && ! isKata (n))
|| (is_han && ! isHira (n) && ! isHan (n))
// FIXME: we treat apostrophe as part of a word. This
// is an English-ism.
|| (is_letter && ! Character.isLetter(n) && n != '\''))
break;
iter.setIndex(save);
}
}
return iter.getIndex();
}
public int previous ()
{
int start = iter.getBeginIndex();
if (iter.getIndex() == start)
return DONE;
while (iter.getIndex() >= start)
{
char c = iter.previous();
if (c == CharacterIterator.DONE)
break;
boolean is_hira = isHira (c);
boolean is_kata = isKata (c);
boolean is_han = isHan (c);
boolean is_letter = Character.isLetter(c);
char n = iter.previous();
if (n == CharacterIterator.DONE)
break;
iter.next();
int type = Character.getType(n);
// Break after paragraph separators.
if (type == Character.PARAGRAPH_SEPARATOR
|| type == Character.LINE_SEPARATOR)
break;
// Break between letters and non-letters.
// FIXME: we treat apostrophe as part of a word. This
// is an English-ism.
if (n != '\'' && ! Character.isLetter(n)
&& type != Character.NON_SPACING_MARK
&& is_letter)
break;
// Always break after certain symbols, such as punctuation.
// This heuristic is derived from hints in the JCL book and is
// not part of Unicode. It seems to be right, however.
// FIXME: we treat apostrophe as part of a word. This
// is an English-ism.
if (n != '\''
&& (type == Character.DASH_PUNCTUATION
|| type == Character.START_PUNCTUATION
|| type == Character.END_PUNCTUATION
|| type == Character.CONNECTOR_PUNCTUATION
|| type == Character.OTHER_PUNCTUATION
|| type == Character.MATH_SYMBOL
|| type == Character.CURRENCY_SYMBOL
|| type == Character.MODIFIER_SYMBOL
|| type == Character.OTHER_SYMBOL
|| type == Character.FORMAT
|| type == Character.CONTROL))
break;
// Special case Japanese.
if ((is_hira || is_kata || is_han)
&& ! isHira (n) && ! isKata (n) && ! isHan (n)
&& type != Character.NON_SPACING_MARK)
break;
// We might have to skip over non spacing marks to see what's
// on the other side.
if (! is_hira || (! is_letter && c != '\''))
{
int save = iter.getIndex();
while (n != CharacterIterator.DONE
&& Character.getType(n) == Character.NON_SPACING_MARK)
n = iter.previous();
iter.setIndex(save);
// This is a strange case: a bunch of non-spacing marks at
// the beginning. We treat the current location as a word
// break.
if (n == CharacterIterator.DONE)
break;
if ((isHira (n) && ! is_hira)
|| (isKata (n) && ! is_hira && ! is_kata)
|| (isHan (n) && ! is_hira && ! is_han)
// FIXME: we treat apostrophe as part of a word. This
// is an English-ism.
|| (! is_letter && c != '\'' && Character.isLetter(n)))
break;
}
}
return iter.getIndex();
}
}
// -*- c++ -*-
// boehm-gc.h - Defines for Boehm collector.
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JV_BOEHM_GC__
#define __JV_BOEHM_GC__
#define JV_MARKOBJ_DECL void *_Jv_MarkObj (void *, void *, void *, void *)
#define JV_MARKARRAY_DECL void *_Jv_MarkArray (void *, void *, void *, void *)
extern "C"
{
JV_MARKOBJ_DECL;
JV_MARKARRAY_DECL;
};
#endif /* __JV_BOEHM_GC__ */
// cni.h -*- c++ -*-
// This file describes the Cygnus Native Interface, CNI.
// It provides a nicer interface to many of the things in javaprims.h.
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JAVA_CNI_H__
#define __JAVA_CNI_H__
#include <java/lang/Object.h>
#include <java/lang/Class.h>
#include <java-threads.h>
#include <java-array.h>
extern inline jobject
JvAllocObject (jclass cls)
{
return _Jv_AllocObject (cls, cls->size());
}
extern inline jobject
JvAllocObject (jclass cls, jsize sz)
{
return _Jv_AllocObject (cls, sz);
}
extern "C" jstring _Jv_NewStringUTF (const char *bytes);
extern "C" void _Jv_InitClass (jclass);
extern inline void
JvInitClass (jclass cls)
{
return _Jv_InitClass (cls);
}
extern inline jstring
JvAllocString (jsize sz)
{
return _Jv_AllocString (sz);
}
extern inline jstring
JvNewString (const jchar *chars, jsize len)
{
return _Jv_NewString (chars, len);
}
extern inline jstring
JvNewStringLatin1 (const char *bytes, jsize len)
{
return _Jv_NewStringLatin1 (bytes, len);
}
extern inline jstring
JvNewStringLatin1 (const char *bytes)
{
return _Jv_NewStringLatin1 (bytes, strlen (bytes));
}
extern inline jchar *
_Jv_GetStringChars (jstring str)
{
return (jchar*)((char*) str->data + str->boffset);
}
extern inline jchar*
JvGetStringChars (jstring str)
{
return _Jv_GetStringChars (str);
}
extern inline jsize
JvGetStringUTFLength (jstring string)
{
return _Jv_GetStringUTFLength (string);
}
extern inline jsize
JvGetStringUTFRegion (jstring str, jsize start, jsize len, char *buf)
{
return _Jv_GetStringUTFRegion (str, start, len, buf);
}
extern inline jstring
JvNewStringUTF (const char *bytes)
{
return _Jv_NewStringUTF (bytes);
}
extern class _Jv_PrimClass _Jv_byteClass, _Jv_shortClass, _Jv_intClass,
_Jv_longClass, _Jv_booleanClass, _Jv_charClass, _Jv_floatClass,
_Jv_doubleClass, _Jv_voidClass;
#define JvPrimClass(TYPE) ((jclass) & _Jv_##TYPE##Class)
class JvSynchronize
{
private:
jobject obj;
public:
JvSynchronize (const jobject &o) : obj (o)
{ _Jv_MonitorEnter (obj); }
~JvSynchronize ()
{ _Jv_MonitorExit (obj); }
};
// Throw some exception.
extern void JvThrow (jobject obj) __attribute__ ((__noreturn__));
extern inline void
JvThrow (jobject obj)
{
_Jv_Throw ((void *) obj);
}
/* Call malloc, but throw exception if insufficient memory. */
extern inline void *
JvMalloc (jsize size)
{
return _Jv_Malloc (size);
}
extern inline void
JvFree (void *ptr)
{
return _Jv_Free (ptr);
}
#endif /* __JAVA_CNI_H__ */
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define this if you want runtime debugging enabled. */
#undef DEBUG
/* Define if using POSIX threads that have the mutexattr functions. */
#undef HAVE_PTHREAD_MUTEXATTR_INIT
/* Define this if you prefer size over speed for java.lang.Character. */
#undef COMPACT_CHARACTER
/* Define if you have memcpy. */
#undef HAVE_MEMCPY
/* Define if you have memmove. */
#undef HAVE_MEMMOVE
/* Define if you have strerror. */
#undef HAVE_STRERROR
/* Define if you have __int32_t and __uint32_t. */
#undef HAVE_INT32_DEFINED
/* Define if you're running eCos. */
#undef ECOS
/* */
#undef HAVE_LOCALTIME
/* */
#undef HAVE_MKTIME
/* Define if using POSIX threads on Linux. */
#undef LINUX_THREADS
/* Define if you have the `ctime_r' function. */
#undef HAVE_CTIME_R
/* Define if you have the `gmtime_r' function. */
#undef HAVE_GMTIME_R
/* Define if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
/* Define if inet6 structures are defined in netinet/in.h. */
#undef HAVE_INET6
/* Define it socklen_t typedef is in sys/socket.h. */
#undef HAVE_SOCKLEN_T
/* Define if Boehm GC in use. */
#undef HAVE_BOEHM_GC
/* Define if gethostname is declared in <unistd.h>. */
#undef HAVE_GETHOSTNAME_DECL
/* Define if gethostbyname_r returns `int'. */
#undef GETHOSTBYNAME_R_RETURNS_INT
/* Define if gethostbyaddr_r returns `int'. */
#undef GETHOSTBYADDR_R_RETURNS_INT
/* Define if struct tm has tm_gmtoff field. */
#undef STRUCT_TM_HAS_GMTOFF
/* Define if global `timezone' exists. */
#undef HAVE_TIMEZONE
/* Define if you have the appropriate function. */
#undef HAVE_ACCESS
#undef HAVE_STAT
#undef HAVE_MKDIR
#undef HAVE_RENAME
#undef HAVE_RMDIR
#undef HAVE_UNLINK
#undef HAVE_REALPATH
#undef HAVE_READDIR_R
#undef HAVE_GETHOSTBYNAME_R
#undef HAVE_GETHOSTBYADDR_R
/* Define if you have the access function. */
#undef HAVE_ACCESS
/* Define if you have the ctime function. */
#undef HAVE_CTIME
/* Define if you have the ctime_r function. */
#undef HAVE_CTIME_R
/* Define if you have the fsync function. */
#undef HAVE_FSYNC
/* Define if you have the ftime function. */
#undef HAVE_FTIME
/* Define if you have the gethostbyaddr_r function. */
#undef HAVE_GETHOSTBYADDR_R
/* Define if you have the gethostbyname_r function. */
#undef HAVE_GETHOSTBYNAME_R
/* Define if you have the gethostname function. */
#undef HAVE_GETHOSTNAME
/* Define if you have the getpwuid_r function. */
#undef HAVE_GETPWUID_R
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the gmtime_r function. */
#undef HAVE_GMTIME_R
/* Define if you have the inet_addr function. */
#undef HAVE_INET_ADDR
/* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON
/* Define if you have the inet_pton function. */
#undef HAVE_INET_PTON
/* Define if you have the ioctl function. */
#undef HAVE_IOCTL
/* Define if you have the localtime_r function. */
#undef HAVE_LOCALTIME_R
/* Define if you have the memcpy function. */
#undef HAVE_MEMCPY
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the mkdir function. */
#undef HAVE_MKDIR
/* Define if you have the open function. */
#undef HAVE_OPEN
/* Define if you have the pthread_mutexattr_setkind_np function. */
#undef HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
/* Define if you have the pthread_mutexattr_settype function. */
#undef HAVE_PTHREAD_MUTEXATTR_SETTYPE
/* Define if you have the readdir_r function. */
#undef HAVE_READDIR_R
/* Define if you have the realpath function. */
#undef HAVE_REALPATH
/* Define if you have the rename function. */
#undef HAVE_RENAME
/* Define if you have the rmdir function. */
#undef HAVE_RMDIR
/* Define if you have the sched_yield function. */
#undef HAVE_SCHED_YIELD
/* Define if you have the select function. */
#undef HAVE_SELECT
/* Define if you have the sleep function. */
#undef HAVE_SLEEP
/* Define if you have the stat function. */
#undef HAVE_STAT
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the time function. */
#undef HAVE_TIME
/* Define if you have the uname function. */
#undef HAVE_UNAME
/* Define if you have the unlink function. */
#undef HAVE_UNLINK
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
// java-array.h - Header file for CNI arrays. -*- c++ -*-
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JAVA_ARRAY_H__
#define __JAVA_ARRAY_H__
#pragma interface
#include <java/lang/Object.h>
extern "Java" {
class __JArray : public java::lang::Object
{
public:
int length;
friend jsize JvGetArrayLength (__JArray*);
};
template<class T>
class JArray : public __JArray
{
T data[0];
public:
friend T* elements<>(JArray<T>& x);
friend T* elements<>(JArray<T>* x);
// T* getData() { return data; }
// T& operator[](jint i) { return data[i]; }
};
template<class T>
T* elements(JArray<T>& x) { return x.data; }
template<class T>
T* elements(JArray<T>* x) { return x->data; }
}; // end extern "Java"
/* These typesdefs match those in JNI. */
typedef __JArray *jarray;
typedef JArray<jobject> *jobjectArray;
typedef JArray<jboolean> *jbooleanArray;
typedef JArray<jbyte> *jbyteArray;
typedef JArray<jchar> *jcharArray;
typedef JArray<jshort> *jshortArray;
typedef JArray<jint> *jintArray;
typedef JArray<jlong> *jlongArray;
typedef JArray<jfloat> *jfloatArray;
typedef JArray<jdouble> *jdoubleArray;
typedef JArray<jstring> *jstringArray;
// Temporary work-around for gcjh bug. FIXME
typedef JArray<jcharArray> *jobjectArrayjchar;
extern "C" jbooleanArray JvNewBooleanArray (jint length);
extern "C" jbyteArray JvNewByteArray (jint length);
extern "C" jcharArray JvNewCharArray (jint length);
extern "C" jshortArray JvNewShortArray (jint length);
extern "C" jintArray JvNewIntArray (jint length);
extern "C" jlongArray JvNewLongArray (jint length);
extern "C" jfloatArray JvNewFloatArray (jint length);
extern "C" jdoubleArray JvNewDoubleArray (jint length);
extern "C" jobjectArray _Jv_NewObjectArray(jsize length, jclass, jobject init);
inline jobjectArray JvNewObjectArray (jsize length, jclass cls, jobject init)
{ return _Jv_NewObjectArray (length, cls, init); }
extern "C" jstringArray JvConvertArgv(int argc, const char **argv);
extern "C" void JvRunMain (jclass klass, int argc, const char **argv);
inline jsize JvGetArrayLength (jarray array) { return array->length; }
#endif /* __JAVA_ARRAY_H__ */
// java-assert.h - Header file holding assertion definitions. -*- c++ -*-
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JAVA_ASSERT_H__
#define __JAVA_ASSERT_H__
// This is a libgcj implementation header.
void _Jv_Abort (const char *, const char *, int, const char *)
__attribute__ ((__noreturn__));
#ifdef DEBUG
#define _Jv_AssertDoCall(Message) _Jv_Abort (__FUNCTION__, __FILE__, __LINE__, Message)
#define JvAssertMessage(Expr, Message) \
do { if (! (Expr)) _Jv_AssertDoCall (Message); } while (0)
#define JvAssert(Expr) \
do { if (! (Expr)) _Jv_AssertDoCall (# Expr); } while (0)
#define JvFail(Message) _Jv_AssertDoCall (Message)
#else /* DEBUG */
#define _Jv_AssertDoCall(Message)
#define JvAssertMessage(Expr, Message)
#define JvAssert(Expr)
#define JvFail(Message) _Jv_Abort (0, 0, 0, Message)
#endif /* not DEBUG */
#endif /* __JAVA_ASSERT_H__ */
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// java-field.h - Header file for fieldID instances. -*- c++ -*-
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JAVA_FIELD_H__
#define __JAVA_FIELD_H__
#include <java/lang/Class.h>
#include <java/lang/reflect/Field.h>
#define _Jv_FIELD_UNRESOLVED_FLAG 0x8000
#define _Jv_FIELD_CONSTANT_VALUE 0x4000
struct _Jv_Field
{
#ifndef COMPACT_FIELDS
struct _Jv_Utf8Const* name;
#endif
/* The type of the field, if isResolved().
If !isResolved(): The fields's signature as a (Utf8Const*). */
jclass type;
_Jv_ushort flags;
#ifdef COMPACT_FIELDS
short nameIndex; /* ofsfet in class's name table */
#else
_Jv_ushort bsize; /* not really needed ... */
#endif
union {
int boffset; /* offset in bytes for instance field */
void* addr; /* address of static field */
} u;
#ifdef __cplusplus
jboolean isResolved ()
{ return ! (flags & _Jv_FIELD_UNRESOLVED_FLAG); }
public:
int getOffset () { return u.boffset; }
jobject getObjectField (jobject obj)
{ return *(jobject *)((char *)obj + getOffset ()); }
jfieldID getNextInstanceField () { return this + 1; }
jboolean isRef () { return ! isResolved () || ! type->isPrimitive (); }
// FIXME - may need to mask off internal flags.
int getModifiers() { return flags; }
#ifdef COMPACT_FIELDS
_Jv_Utf8Const * getNameUtf8Const (jclass cls)
{ return clas->fieldNames + nameIndex; }
#else
_Jv_Utf8Const * getNameUtf8Const (jclass) { return name; }
#endif
#endif
};
#ifdef __cplusplus
inline jbyte
_Jv_GetStaticByteField (jclass, _Jv_Field* field)
{
return * (jbyte *) field->u.addr;
}
inline jshort
_Jv_GetStaticShortField (jclass, _Jv_Field* field)
{
return * (jshort *) field->u.addr;
}
inline jint
_Jv_GetStaticIntField (jclass, _Jv_Field* field)
{
return * (jint *) field->u.addr;
}
inline jlong
_Jv_GetStaticLongField (jclass, _Jv_Field* field)
{
return * (jlong *) field->u.addr;
}
inline jobject
_Jv_GetObjectField (jobject obj, _Jv_Field* field)
{
return field->getObjectField (obj);
}
inline jbyte
_Jv_GetByteField (jobject obj, _Jv_Field* field)
{
return * (jbyte *) ((char*) obj + field->getOffset ());
}
inline jshort
_Jv_GetShortField (jobject obj, _Jv_Field* field)
{
return * (jshort *) ((char*) obj + field->getOffset ());
}
inline jint
_Jv_GetIntField (jobject obj, _Jv_Field* field)
{
return * (jint *) ((char*) obj + field->getOffset ());
}
inline jlong
_Jv_GetLongField (jobject obj, _Jv_Field* field)
{
return * (jlong *) ((char*) obj + field->getOffset ());
}
extern inline jfieldID
_Jv_FromReflectedField (java::lang::reflect::Field *field)
{
return (jfieldID) ((char *) field->declaringClass->fields + field->offset);
}
#ifdef __JAVA_CNI_H__
extern inline jfieldID
JvGetFirstInstanceField (jclass klass)
{
return &(klass->fields[klass->static_field_count]);
}
extern inline jint
JvNumInstanceFields (jclass klass)
{
return klass->field_count - klass->static_field_count;
}
extern inline jboolean
JvFieldIsRef (jfieldID field)
{
return field->isRef ();
}
extern inline jobject
JvGetObjectField (jobject obj, _Jv_Field* field)
{
return _Jv_GetObjectField (obj, field);
}
#endif /* defined (__JAVA_CNI_H__) */
#endif
#endif /* __JAVA_FIELD_H */
// java-method.h - Header file for methodID instances. -*- c++ -*-
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
extern inline jmethodID
_Jv_FromReflectedMethod(java::lang::reflect::Method *method)
{
return (jmethodID)
((char *) method->declaringClass->methods + method->offset);
}
// javaprims.h - Main external header file for libgcj. -*- c++ -*-
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JAVAPRIMS_H__
#define __JAVAPRIMS_H__
// To force selection of correct types that will mangle consistently
// across platforms.
extern "Java"
{
typedef __java_byte jbyte;
typedef __java_short jshort;
typedef __java_int jint;
typedef __java_long jlong;
typedef __java_float jfloat;
typedef __java_double jdouble;
typedef __java_char jchar;
typedef __java_boolean jboolean;
typedef jint jsize;
// The following class declarations are automatically generated by
// the `classes.pl' script.
namespace java
{
namespace io
{
class BufferedInputStream;
class BufferedOutputStream;
class BufferedReader;
class BufferedWriter;
class ByteArrayInputStream;
class ByteArrayOutputStream;
class CharArrayReader;
class CharArrayWriter;
class CharConversionException;
class DataInput;
class DataInputStream;
class DataOutput;
class DataOutputStream;
class EOFException;
class File;
class FileDescriptor;
class FileInputStream;
class FileNotFoundException;
class FileOutputStream;
class FileReader;
class FileWriter;
class FilenameFilter;
class FilterInputStream;
class FilterOutputStream;
class FilterReader;
class FilterWriter;
class IOException;
class InputStream;
class InputStreamReader;
class InterruptedIOException;
class LineNumberInputStream;
class LineNumberReader;
class OutputStream;
class OutputStreamWriter;
class PipedInputStream;
class PipedOutputStream;
class PipedReader;
class PipedWriter;
class PrintStream;
class PrintWriter;
class PushbackInputStream;
class PushbackReader;
class RandomAccessFile;
class Reader;
class SequenceInputStream;
class Serializable;
class StreamTokenizer;
class StringBufferInputStream;
class StringReader;
class StringWriter;
class SyncFailedException;
class UTFDataFormatException;
class UnsupportedEncodingException;
class Writer;
};
namespace lang
{
class AbstractMethodError;
class ArithmeticException;
class ArrayIndexOutOfBoundsException;
class ArrayStoreException;
class Boolean;
class Byte;
class Character;
class Class;
class ClassCastException;
class ClassCircularityError;
class ClassFormatError;
class ClassLoader;
class ClassNotFoundException;
class CloneNotSupportedException;
class Cloneable;
class Comparable;
class Compiler;
class Double;
class Error;
class Exception;
class ExceptionInInitializerError;
class FirstThread;
class Float;
class IllegalAccessError;
class IllegalAccessException;
class IllegalArgumentException;
class IllegalMonitorStateException;
class IllegalStateException;
class IllegalThreadStateException;
class IncompatibleClassChangeError;
class IndexOutOfBoundsException;
class InstantiationError;
class InstantiationException;
class Integer;
class InternalError;
class InterruptedException;
class LinkageError;
class Long;
class Math;
class NegativeArraySizeException;
class NoClassDefFoundError;
class NoSuchFieldError;
class NoSuchFieldException;
class NoSuchMethodError;
class NoSuchMethodException;
class NullPointerException;
class Number;
class NumberFormatException;
class Object;
class OutOfMemoryError;
class Process;
class Runnable;
class Runtime;
class RuntimeException;
class SecurityException;
class SecurityManager;
class Short;
class StackOverflowError;
class String;
class StringBuffer;
class StringIndexOutOfBoundsException;
class System;
class Thread;
class ThreadDeath;
class ThreadGroup;
class Throwable;
class UnknownError;
class UnsatisfiedLinkError;
class UnsupportedOperationException;
class VerifyError;
class VirtualMachineError;
class Void;
namespace reflect
{
class AccessibleObject;
class Array;
class Constructor;
class Field;
class InvocationTargetException;
class Member;
class Method;
class Modifier;
};
};
namespace util
{
class BitSet;
class Calendar;
class ConcurrentModificationException;
class Date;
class Dictionary;
class EmptyStackException;
class Enumeration;
class EventListener;
class EventObject;
class GregorianCalendar;
class Hashtable;
class HashtableEntry;
class HashtableEnumeration;
class ListResourceBundle;
class Locale;
class MissingResourceException;
class NoSuchElementException;
class Observable;
class Observer;
class Properties;
class Random;
class ResourceBundle;
class SimpleTimeZone;
class Stack;
class StringTokenizer;
class TimeZone;
class TooManyListenersException;
class Vector;
class VectorEnumeration;
namespace zip
{
class Adler32;
class CRC32;
class Checksum;
class Deflater;
class DeflaterOutputStream;
class ZipConstants;
class ZipEntry;
class ZipEnumeration;
class ZipException;
class ZipFile;
class ZipOutputStream;
};
};
};
};
typedef struct java::lang::Object* jobject;
typedef class java::lang::Class* jclass;
typedef class java::lang::Throwable* jthrowable;
typedef class java::lang::String* jstring;
struct _Jv_JNIEnv;
typedef struct _Jv_Field *jfieldID;
typedef struct _Jv_Method *jmethodID;
extern "C" jobject _Jv_AllocObject (jclass, jint);
extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
extern "C" jstring _Jv_AllocString(jsize);
extern "C" jstring _Jv_NewString (const jchar*, jsize);
extern "C" jchar* _Jv_GetStringChars (jstring str);
extern "C" jint _Jv_MonitorEnter (jobject);
extern "C" jint _Jv_MonitorExit (jobject);
extern "C" jstring _Jv_NewStringLatin1(const char*, jsize);
extern "C" jsize _Jv_GetStringUTFLength (jstring);
extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
extern "C" void _Jv_Throw (void *) __attribute__ ((__noreturn__));
extern "C" void* _Jv_Malloc (jsize);
extern "C" void _Jv_Free (void*);
typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
struct _Jv_Utf8Const
{
_Jv_ushort hash;
_Jv_ushort length; /* In bytes, of data portion, without final '\0'. */
char data[1]; /* In Utf8 format, with final '\0'. */
};
#endif /* __JAVAPRIMS_H__ */
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JAVA_JNI_H__
#define __JAVA_JNI_H__
#ifdef __GNUC__
# define __need___va_list
# include <stdarg.h>
# define _Jv_va_list __gnuc_va_list
#else
# include <stdarg.h>
# define _Jv_va_list va_list
#endif
#ifdef __cplusplus
// This is wrong, because it pollutes the name-space too much!
#include <javaprims.h>
typedef struct _Jv_JNIEnv JNIEnv;
#else
typedef int jbyte __attribute__((__mode__(__QI__)));
typedef int jshort __attribute__((__mode__(__HI__)));
typedef int jint __attribute__((__mode__(__SI__)));
typedef int jlong __attribute__((__mode__(__DI__)));
typedef bool jboolean __attribute__((__mode__(__QI__)));
typedef unsigned short jchar __attribute__((__mode__(__HI__)));
typedef float jfloat;
typedef double jdouble;
typedef jint jsize;
typedef const struct JNINativeInterface *JNIEnv;
#endif
typedef union jvalue
{
jboolean z;
jbyte b;
jchar c;
jshort s;
jint i;
jlong j;
jfloat f;
jdouble d;
jobject l;
} jvalue;
typedef void * (*_Jv_func)(...);
struct JNINativeInterface
{
_Jv_func reserved0;
_Jv_func reserved1;
_Jv_func reserved2;
_Jv_func reserved3;
_Jv_func GetVersion;
_Jv_func DefineClass;
_Jv_func FindClass;
_Jv_func reserved4;
_Jv_func reserved5;
_Jv_func reserved6;
jclass (*GetSuperclass) (JNIEnv*, jclass);
jboolean (*IsAssignableFrom) (JNIEnv*, jclass, jclass);
_Jv_func reserved7;
jint (*Throw) (JNIEnv*, jthrowable);
_Jv_func ThrowNew;
_Jv_func ExceptionOccurred;
_Jv_func ExceptionDescribe;
_Jv_func ExceptionClear;
_Jv_func FatalError;
_Jv_func reserved8;
_Jv_func reserved9;
_Jv_func NewGlobalRef;
_Jv_func DeleteGlobalRef;
_Jv_func DeleteLocalRef;
_Jv_func IsSameObject;
_Jv_func reserved10;
_Jv_func reserved11;
_Jv_func AllocObject;
_Jv_func NewObject;
_Jv_func NewObjectV;
_Jv_func NewObjectA;
_Jv_func GetObjectClass;
_Jv_func IsInstanceOf;
_Jv_func GetMethodID;
_Jv_func CallObjectMethod;
_Jv_func CallObjectMethodV;
_Jv_func CallObjectMethodA;
_Jv_func CallBooleanMethod;
_Jv_func CallBooleanMethodV;
_Jv_func CallBooleanMethodA;
_Jv_func CallByteMethod;
_Jv_func CallByteMethodV;
_Jv_func CallByteMethodA;
_Jv_func CallCharMethod;
_Jv_func CallCharMethodV;
_Jv_func CallCharMethodA;
_Jv_func CallShortMethod;
_Jv_func CallShortMethodV;
_Jv_func CallShortMethodA;
_Jv_func CallIntMethod;
_Jv_func CallIntMethodV;
_Jv_func CallIntMethodA;
_Jv_func CallLongMethod;
_Jv_func CallLongMethodV;
_Jv_func CallLongMethodA;
_Jv_func CallFloatMethod;
_Jv_func CallFloatMethodV;
_Jv_func CallFloatMethodA;
_Jv_func CallDoubleMethod;
_Jv_func CallDoubleMethodV;
_Jv_func CallDoubleMethodA;
_Jv_func CallVoidMethod;
_Jv_func CallVoidMethodV;
_Jv_func CallVoidMethodA;
_Jv_func CallNonvirtualObjectMethod;
_Jv_func CallNonvirtualObjectMethodV;
_Jv_func CallNonvirtualObjectMethodA;
jboolean (*CallNonvirtualBooleanMethod) (JNIEnv*, jobject, jclass, jmethodID, ...);
jboolean (*CallNonvirtualBooleanMethodV) (JNIEnv*, jobject, jclass, jmethodID, _Jv_va_list);
jboolean (*CallNonvirtualBooleanMethodA) (JNIEnv*, jobject, jclass, jmethodID, jvalue*);
_Jv_func CallNonvirtualByteMethod;
_Jv_func CallNonvirtualByteMethodV;
_Jv_func CallNonvirtualByteMethodA;
_Jv_func CallNonvirtualCharMethod;
_Jv_func CallNonvirtualCharMethodV;
_Jv_func CallNonvirtualCharMethodA;
_Jv_func CallNonvirtualShortMethod;
_Jv_func CallNonvirtualShortMethodV;
_Jv_func CallNonvirtualShortMethodA;
_Jv_func CallNonvirtualIntMethod;
_Jv_func CallNonvirtualIntMethodV;
_Jv_func CallNonvirtualIntMethodA;
_Jv_func CallNonvirtualLongMethod;
_Jv_func CallNonvirtualLongMethodV;
_Jv_func CallNonvirtualLongMethodA;
_Jv_func CallNonvirtualFloatMethod;
_Jv_func CallNonvirtualFloatMethodV;
_Jv_func CallNonvirtualFloatMethodA;
_Jv_func CallNonvirtualDoubleMethod;
jdouble (*CallNonvirtualDoubleMethodV) (JNIEnv*, jobject, jclass, jmethodID, _Jv_va_list);
_Jv_func CallNonvirtualDoubleMethodA;
_Jv_func CallNonvirtualVoidMethod;
_Jv_func CallNonvirtualVoidMethodV;
_Jv_func CallNonvirtualVoidMethodA;
_Jv_func GetFieldID;
jobject (*GetObjectField) (JNIEnv*, jobject, jfieldID);
jboolean (*GetBooleanField) (JNIEnv*, jobject, jfieldID);
jbyte (*GetByteField) (JNIEnv*, jobject, jfieldID);
jchar (*GetCharField) (JNIEnv*, jobject, jfieldID);
jshort (*GetShortField) (JNIEnv*, jobject, jfieldID);
jint (*GetIntField) (JNIEnv*, jobject, jfieldID);
jlong (*GetLongField) (JNIEnv*, jobject, jfieldID);
jfloat (*GetFloatField) (JNIEnv*, jobject, jfieldID);
jdouble (*GetDoubleField) (JNIEnv*, jobject, jfieldID);
_Jv_func SetObjectField;
_Jv_func SetBooleanField;
_Jv_func SetByteField;
_Jv_func SetCharField;
_Jv_func SetShortField;
_Jv_func SetIntField;
_Jv_func SetLongField;
_Jv_func SetFloatField;
_Jv_func SetDoubleField;
_Jv_func GetStaticMethodID;
_Jv_func CallStaticObjectMethod;
_Jv_func CallStaticObjectMethodV;
_Jv_func CallStaticObjectMethodA;
_Jv_func CallStaticBooleanMethod;
_Jv_func CallStaticBooleanMethodV;
_Jv_func CallStaticBooleanMethodA;
_Jv_func CallStaticByteMethod;
_Jv_func CallStaticByteMethodV;
_Jv_func CallStaticByteMethodA;
_Jv_func CallStaticCharMethod;
_Jv_func CallStaticCharMethodV;
_Jv_func CallStaticCharMethodA;
_Jv_func CallStaticShortMethod;
_Jv_func CallStaticShortMethodV;
_Jv_func CallStaticShortMethodA;
_Jv_func CallStaticIntMethod;
_Jv_func CallStaticIntMethodV;
_Jv_func CallStaticIntMethodA;
_Jv_func CallStaticLongMethod;
_Jv_func CallStaticLongMethodV;
_Jv_func CallStaticLongMethodA;
_Jv_func CallStaticFloatMethod;
_Jv_func CallStaticFloatMethodV;
_Jv_func CallStaticFloatMethodA;
_Jv_func CallStaticDoubleMethod;
_Jv_func CallStaticDoubleMethodV;
_Jv_func CallStaticDoubleMethodA;
_Jv_func CallStaticVoidMethod;
_Jv_func CallStaticVoidMethodV;
_Jv_func CallStaticVoidMethodA;
_Jv_func GetStaticFieldID;
_Jv_func GetStaticObjectField;
_Jv_func GetStaticBooleanField;
_Jv_func GetStaticByteField;
_Jv_func GetStaticCharField;
_Jv_func GetStaticShortField;
_Jv_func GetStaticIntField;
_Jv_func GetStaticLongField;
_Jv_func GetStaticFloatField;
_Jv_func GetStaticDoubleField;
_Jv_func SetStaticObjectField;
_Jv_func SetStaticBooleanField;
_Jv_func SetStaticByteField;
_Jv_func SetStaticCharField;
_Jv_func SetStaticShortField;
_Jv_func SetStaticIntField;
_Jv_func SetStaticLongField;
_Jv_func SetStaticFloatField;
_Jv_func SetStaticDoubleField;
_Jv_func NewString;
jint (*GetStringLength) (JNIEnv*, jstring);
_Jv_func GetStringChars;
_Jv_func ReleaseStringChars;
_Jv_func NewStringUTF;
_Jv_func GetStringUTFLength;
_Jv_func GetStringUTFChars;
_Jv_func ReleaseStringUTFChars;
_Jv_func GetArrayLength;
_Jv_func NewObjectArray;
_Jv_func GetObjectArrayElement;
_Jv_func SetObjectArrayElement;
_Jv_func NewBooleanArray;
_Jv_func NewByteArray;
_Jv_func NewCharArray;
_Jv_func NewShortArray;
_Jv_func NewIntArray;
_Jv_func NewLongArray;
_Jv_func NewFloatArray;
_Jv_func NewDoubleArray;
_Jv_func GetBooleanArrayElements;
_Jv_func GetByteArrayElements;
_Jv_func GetCharArrayElements;
_Jv_func GetShortArrayElements;
_Jv_func GetIntArrayElements;
_Jv_func GetLongArrayElements;
_Jv_func GetFloatArrayElements;
_Jv_func GetDoubleArrayElements;
_Jv_func ReleaseBooleanArrayElements;
_Jv_func ReleaseByteArrayElements;
_Jv_func ReleaseCharArrayElements;
_Jv_func ReleaseShortArrayElements;
_Jv_func ReleaseIntArrayElements;
_Jv_func ReleaseLongArrayElements;
_Jv_func ReleaseFloatArrayElements;
_Jv_func ReleaseDoubleArrayElements;
_Jv_func GetBooleanArrayRegion;
_Jv_func GetByteArrayRegion;
_Jv_func GetCharArrayRegion;
_Jv_func GetShortArrayRegion;
_Jv_func GetIntArrayRegion;
_Jv_func GetLongArrayRegion;
_Jv_func GetFloatArrayRegion;
_Jv_func GetDoubleArrayRegion;
_Jv_func SetBooleanArrayRegion;
_Jv_func SetByteArrayRegion;
_Jv_func SetCharArrayRegion;
_Jv_func SetShortArrayRegion;
_Jv_func SetIntArrayRegion;
_Jv_func SetLongArrayRegion;
_Jv_func SetFloatArrayRegion;
_Jv_func SetDoubleArrayRegion;
_Jv_func RegisterNatives;
_Jv_func UnregisterNatives;
_Jv_func MonitorEnter;
_Jv_func MonitorExit;
_Jv_func GetJavaVM;
};
#ifdef __cplusplus
struct _Jv_JNIEnv
{
struct JNINativeInterface *p;
jclass GetSuperclass (jclass cl);
jsize GetStringLength (jstring str);
};
extern inline jclass
_Jv_JNIEnv::GetSuperclass (jclass cl)
{ return p->GetSuperclass (this, cl); }
extern inline jsize
_Jv_JNIEnv::GetStringLength (jstring str)
{ return p->GetStringLength (this, str); }
#endif
#endif /* __JAVA_JNI_H__ */
// jvm.h - Header file for private implementation information. -*- c++ -*-
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JAVA_JVM_H__
#define __JAVA_JVM_H__
#include <java-assert.h>
#include <java-field.h>
/* Structure of the virtual table. */
struct _Jv_VTable
{
jclass clas;
void *method[1];
};
/* Extract a character from a Java-style Utf8 string.
* PTR points to the current character.
* LIMIT points to the end of the Utf8 string.
* PTR is incremented to point after the character thta gets returns.
* On an error, -1 is returned. */
#define UTF8_GET(PTR, LIMIT) \
((PTR) >= (LIMIT) ? -1 \
: *(PTR) < 128 ? *(PTR)++ \
: (*(PTR)&0xE0) == 0xC0 && ((PTR)+=2)<=(LIMIT) && ((PTR)[-1]&0xC0) == 0x80 \
? (((PTR)[-2] & 0x1F) << 6) + ((PTR)[-1] & 0x3F) \
: (*(PTR) & 0xF0) == 0xE0 && ((PTR) += 3) <= (LIMIT) \
&& ((PTR)[-2] & 0xC0) == 0x80 && ((PTR)[-1] & 0xC0) == 0x80 \
? (((PTR)[-3]&0x0F) << 12) + (((PTR)[-2]&0x3F) << 6) + ((PTR)[-1]&0x3F) \
: ((PTR)++, -1))
extern int _Jv_strLengthUtf8(char* str, int len);
typedef struct _Jv_Utf8Const Utf8Const;
_Jv_Utf8Const *_Jv_makeUtf8Const (char *s, int len);
extern jboolean _Jv_equalUtf8Consts (_Jv_Utf8Const *, _Jv_Utf8Const *);
extern jboolean _Jv_equal (_Jv_Utf8Const *, jstring, jint);
#define StringClass _CL_Q34java4lang6String
extern java::lang::Class StringClass;
/* Type of pointer used as finalizer. */
typedef void _Jv_FinalizerFunc (jobject);
/* Allocate space for a new Java object. */
void *_Jv_AllocObj (jsize size);
/* Allocate space for an array of Java objects. */
void *_Jv_AllocArray (jsize size);
/* Allocate space that is known to be pointer-free. */
void *_Jv_AllocBytes (jsize size);
/* Initialize the GC. */
void _Jv_InitGC (void);
/* Register a finalizer. */
void _Jv_RegisterFinalizer (void *object, _Jv_FinalizerFunc *method);
/* Run finalizers for objects ready to be finalized.. */
void _Jv_RunFinalizers (void);
/* Run all finalizers. Should be called only before exit. */
void _Jv_RunAllFinalizers (void);
/* Perform a GC. */
void _Jv_RunGC (void);
/* Return approximation of total size of heap. */
long _Jv_GCTotalMemory (void);
/* Return approximation of total free memory. */
long _Jv_GCFreeMemory (void);
/* Allocate some unscanned bytes. Throw exception if out of memory. */
void *_Jv_AllocBytesChecked (jsize size);
// This function is used to determine the hash code of an object.
inline jint
_Jv_HashCode (jobject obj)
{
return (jint) obj;
}
extern "C" void _Jv_ThrowBadArrayIndex (jint bad_index);
extern "C" jobject _Jv_NewArray (jint type, jint size);
extern "C" jobject _Jv_NewMultiArray (jclass klass, jint dims, ...);
extern "C" void *_Jv_CheckCast (jclass klass, jobject obj);
extern "C" void *_Jv_LookupInterfaceMethod (jclass klass, Utf8Const *name,
Utf8Const *signature);
extern "C" void _Jv_CheckArrayStore (jobject array, jobject obj);
extern "C" void _Jv_RegisterClass (jclass klass);
extern "C" void _Jv_RegisterClasses (jclass *classes);
extern jclass _Jv_FindClass (_Jv_Utf8Const *name,
java::lang::ClassLoader *loader);
extern jclass _Jv_FindClassFromSignature (char *,
java::lang::ClassLoader *loader);
extern jobject _Jv_NewMultiArray (jclass, jint ndims, jint* dims);
#endif /* __JAVA_JVM_H__ */
// -*- c++ -*-
// no-gc.h - Defines for no garbage collector.
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JV_NO_GC__
#define __JV_NO_GC__
// Nothing.
#endif /* __JV_NO_GC__ */
// -*- c++ -*-
// no-threads.h - Defines for using no threads.
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JV_NO_THREADS__
#define __JV_NO_THREADS__
#include "config.h"
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
//
// Typedefs.
//
typedef int _Jv_ConditionVariable_t;
typedef int _Jv_Mutex_t;
typedef int _Jv_Thread_t;
typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
//
// Condition variables.
//
inline void
_Jv_CondInit (_Jv_ConditionVariable_t *)
{
}
// Waiting is ok provided there is a timeout. Otherwise we will just
// wait forever.
inline int
_Jv_CondWait (_Jv_ConditionVariable_t *, _Jv_Mutex_t *,
jlong millis, jint nanos)
{
if (millis == 0 && nanos == 0)
JvFail ("_Jv_CondWait without timeout");
#ifdef HAVE_SLEEP
int seconds = millis / 1000;
if (seconds > 0)
sleep (seconds);
#endif
return 0;
}
inline int
_Jv_CondNotify (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
{
// It is ok to notify -- it just has no effect.
return 0;
}
inline int
_Jv_CondNotifyAll (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
{
// It is ok to notify -- it just has no effect.
return 0;
}
//
// Mutexes.
//
inline void
_Jv_MutexInit (_Jv_Mutex_t *)
{
}
inline int
_Jv_MutexLock (_Jv_Mutex_t *)
{
return 0;
}
inline int
_Jv_MutexUnlock (_Jv_Mutex_t *)
{
return 0;
}
//
// Thread creation and manipulation.
//
inline void
_Jv_InitThreads (void)
{
}
inline void
_Jv_ThreadInitData (_Jv_Thread_t **data, java::lang::Thread *)
{
*data = NULL;
}
inline java::lang::Thread *
_Jv_ThreadCurrent (void)
{
extern java::lang::Thread *_Jv_OnlyThread;
return _Jv_OnlyThread;
}
inline void
_Jv_ThreadYield (void)
{
}
inline void
_Jv_ThreadSetPriority (_Jv_Thread_t *, jint)
{
}
inline void
_Jv_ThreadCancel (_Jv_Thread_t *, void *)
{
JvFail ("_Jv_ThreadCancel");
}
// Like Cancel, but doesn't run cleanups.
inline void
_Jv_ThreadDestroy (_Jv_Thread_t *)
{
JvFail ("_Jv_ThreadDestroy");
}
void _Jv_ThreadStart (java::lang::Thread *, _Jv_Thread_t *,
_Jv_ThreadStartFunc *meth);
inline void
_Jv_ThreadWait (void)
{
}
inline void
_Jv_ThreadInterrupt (_Jv_Thread_t *)
{
}
#endif /* __JV_NO_THREADS__ */
// -*- c++ -*-
// posix-threads.h - Defines for using POSIX threads.
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JV_POSIX_THREADS__
#define __JV_POSIX_THREADS__
// NOTE: This file may only reference those pthread functions which
// are known not to be overridden by the Boehm GC. If in doubt, scan
// boehm-gc/gc.h. This is yucky but lets us avoid including gc.h
// everywhere (which would be truly yucky).
#include <pthread.h>
#include <sched.h>
#if defined (HAVE_PTHREAD_MUTEXATTR_SETTYPE) || defined (HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
# define HAVE_RECURSIVE_MUTEX 1
#endif
//
// Typedefs.
//
typedef pthread_cond_t _Jv_ConditionVariable_t;
#ifdef HAVE_RECURSIVE_MUTEX
typedef pthread_mutex_t _Jv_Mutex_t;
#else
// Some systems do not have recursive mutexes, so we must simulate
// them. Solaris is one such system.
typedef struct
{
// Mutex used when locking this structure transiently.
pthread_mutex_t mutex;
// Mutex the thread holds the entire time this mutex is held. This
// is used to make condition variables work properly.
pthread_mutex_t mutex2;
// Condition variable used when waiting for this lock.
pthread_cond_t cond;
// Thread holding this mutex. If COUNT is 0, no thread is holding.
pthread_t thread;
// Number of times mutex is held. If 0, the lock is not held.
int count;
} _Jv_Mutex_t;
#endif /* HAVE_RECURSIVE_MUTEX */
typedef struct
{
// Flag values are defined in implementation.
int flags;
// Actual thread id.
pthread_t thread;
// Exception we want to throw when cancelled.
void *exception;
} _Jv_Thread_t;
typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
//
// Condition variables.
//
inline void
_Jv_CondInit (_Jv_ConditionVariable_t *cv)
{
pthread_cond_init (cv, 0);
}
#ifndef LINUX_THREADS
// pthread_cond_destroy does nothing on Linux and it is a win to avoid
// defining this macro.
#define _Jv_HaveCondDestroy
inline void
_Jv_CondDestroy (_Jv_ConditionVariable_t *cv)
{
pthread_cond_destroy (cv);
}
#endif /* LINUX_THREADS */
int _Jv_CondWait (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu,
jlong millis, jint nanos);
inline int
_Jv_CondNotify (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *)
{
// FIXME: check to see if mutex is held by current thread.
return pthread_cond_signal (cv);
}
inline int
_Jv_CondNotifyAll (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *)
{
// FIXME: check to see if mutex is held by current thread.
return pthread_cond_broadcast (cv);
}
//
// Mutexes.
//
#ifdef RECURSIVE_MUTEX_IS_DEFAULT
inline void
_Jv_MutexInit (_Jv_Mutex_t *mu)
{
pthread_mutex_init (mu, NULL);
}
#else
void _Jv_MutexInit (_Jv_Mutex_t *mu);
#endif
#ifndef LINUX_THREADS
// pthread_mutex_destroy does nothing on Linux and it is a win to avoid
// defining this macro.
#define _Jv_HaveMutexDestroy
#ifdef HAVE_RECURSIVE_MUTEX
inline void
_Jv_MutexDestroy (_Jv_Mutex_t *mu)
{
pthread_mutex_destroy (mu);
}
#else /* HAVE_RECURSIVE_MUTEX */
extern void _Jv_MutexDestroy (_Jv_Mutex_t *mu);
#endif /* HAVE_RECURSIVE_MUTEX */
#endif /* LINUX_THREADS */
#ifdef HAVE_RECURSIVE_MUTEX
inline int
_Jv_MutexLock (_Jv_Mutex_t *mu)
{
return pthread_mutex_lock (mu);
}
inline int
_Jv_MutexUnlock (_Jv_Mutex_t *mu)
{
return pthread_mutex_unlock (mu);
}
#else /* HAVE_RECURSIVE_MUTEX */
extern int _Jv_MutexLock (_Jv_Mutex_t *mu);
extern int _Jv_MutexUnlock (_Jv_Mutex_t *mu);
#endif /* HAVE_RECURSIVE_MUTEX */
//
// Thread creation and manipulation.
//
void _Jv_InitThreads (void);
void _Jv_ThreadInitData (_Jv_Thread_t **data, java::lang::Thread *thread);
inline java::lang::Thread *
_Jv_ThreadCurrent (void)
{
extern pthread_key_t _Jv_ThreadKey;
return (java::lang::Thread *) pthread_getspecific (_Jv_ThreadKey);
}
inline void
_Jv_ThreadYield (void)
{
#ifdef HAVE_SCHED_YIELD
sched_yield ();
#endif /* HAVE_SCHED_YIELD */
}
void _Jv_ThreadSetPriority (_Jv_Thread_t *data, jint prio);
void _Jv_ThreadCancel (_Jv_Thread_t *data, void *error);
// Like Cancel, but doesn't run cleanups.
inline void
_Jv_ThreadDestroy (_Jv_Thread_t *)
{
JvFail ("_Jv_ThreadDestroy");
}
void _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data,
_Jv_ThreadStartFunc *meth);
void _Jv_ThreadWait (void);
void _Jv_ThreadInterrupt (_Jv_Thread_t *data);
#endif /* __JV_POSIX_THREADS__ */
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment