java.net implemented.
authorschani <none@none>
Tue, 9 Nov 1999 11:33:46 +0000 (11:33 +0000)
committerschani <none@none>
Tue, 9 Nov 1999 11:33:46 +0000 (11:33 +0000)
Dynamic classloader implemented (buggy).
Thread.sleep implemented.

75 files changed:
Makefile.am
Makefile.in
aclocal.m4
alpha/Makefile.in
alpha/ngen.c
builtin.c
comp/Makefile.in
config.h.in
configure
headers.c
jit/Makefile.in
jit/parse.c
jni.c
loader.c
main.c
mips/Makefile.in
mm/Makefile.in
mm/heap2.c
nat/Class.c
nat/ClassLoader.c
nat/DatagramPacket.c [new file with mode: 0644]
nat/DatagramPacket.h [new file with mode: 0644]
nat/Field.c
nat/InetAddress.c
nat/InetAddressImpl.c
nat/Integer.h [new file with mode: 0644]
nat/Makefile.in
nat/Object.c
nat/PlainDatagramSocketImpl.c [new file with mode: 0644]
nat/PlainDatagramSocketImpl.h [new file with mode: 0644]
nat/PlainSocketImpl.c [new file with mode: 0644]
nat/PlainSocketImpl.h [new file with mode: 0644]
nat/SocketImpl.h [new file with mode: 0644]
nat/SocketInputStream.c [new file with mode: 0644]
nat/SocketInputStream.h [new file with mode: 0644]
nat/SocketOutputStream.c [new file with mode: 0644]
nat/SocketOutputStream.h [new file with mode: 0644]
nat/System.c
nat/Thread.c
native.c
src/cacao/cacao.c
src/cacaoh/headers.c
src/native/jni.c
src/native/native.c
src/native/vm/Field.c
src/native/vm/VMThread.c
src/threads/green/threadio.c
src/threads/green/threadio.h
src/threads/green/threads.c
src/threads/green/threads.h
src/vm/builtin.c
src/vm/jit/parse.c
src/vm/loader.c
tests/Makefile.in
tests/network/DemoClient.java [new file with mode: 0644]
tests/network/DemoServer.java [new file with mode: 0644]
tests/network/FILE.HTM [new file with mode: 0644]
tests/network/GenericServer.java [new file with mode: 0644]
tests/network/classloader.java [new file with mode: 0644]
tests/network/httpd/httpd.java [new file with mode: 0644]
tests/network/socktest.java [new file with mode: 0644]
tests/network/udp/QuoteClient.java [new file with mode: 0644]
tests/network/udp/QuoteServer.java [new file with mode: 0644]
tests/network/udp/QuoteServerThread.java [new file with mode: 0644]
tests/network/udp/one-liners.txt [new file with mode: 0644]
tests/network/urltest.java [new file with mode: 0644]
tests/network/whatip2.java [new file with mode: 0644]
tests/sleep.java [new file with mode: 0644]
threads/Makefile.in
threads/notyet.c
threads/thread.c
threads/thread.h
threads/threadio.c
threads/threadio.h
toolbox/Makefile.in

index 26c443eae0aa5de137c5c30bba6dd3f7f5183d17..abad2ef1e480001f83aab5b1e8f72fb05883d7a3 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-# $Id: Makefile.am 135 1999-10-04 10:35:09Z roman $
+# $Id: Makefile.am 136 1999-11-09 11:33:46Z schani $
 
 MAINTAINERCLEANFILES = Makefile.in configure
 SUBDIRS = toolbox mm alpha jit comp nat threads mips tst doc narray
@@ -66,6 +66,7 @@ nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh: cacaoh
                java.lang.ClassLoader \
                java.lang.Class \
                java.lang.Compiler \
+               java.lang.Integer \
                java.lang.Double \
                java.lang.Float \
                java.lang.Math \
@@ -104,6 +105,12 @@ nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh: cacaoh
                java.math.BigInteger \
                java.net.InetAddress \
                java.net.InetAddressImpl \
+               java.net.DatagramPacket \
+               java.net.PlainDatagramSocketImpl \
+               java.net.SocketImpl \
+               java.net.PlainSocketImpl \
+               java.net.SocketInputStream \
+               java.net.SocketOutputStream \
                java.security.PrivilegedActionException \
                java.security.PrivilegedAction \
                java.security.PrivilegedExceptionAction \
index 4f142f20c5c046b1d2a5c6e52c650a5a41df6f05..4e7d48447f2bb60ff38102944ec419d651018212 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-# $Id: Makefile.in 135 1999-10-04 10:35:09Z roman $
+# $Id: Makefile.in 136 1999-11-09 11:33:46Z schani $
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -34,7 +34,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -51,6 +51,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -78,51 +79,25 @@ SUBDIRS = toolbox mm alpha jit comp nat threads mips tst doc narray
 
 EXTRA_DIST = html/cacaoinstall.html html/cacaoman.html html/index.html
 
-CLEANFILES = @SYSDEP_DIR@/asmpart.o \
-                        @SYSDEP_DIR@/asmpart.s \
-             @SYSDEP_DIR@/offsets.h \
-                nativetable.hh \
-                nativetypes.hh
+CLEANFILES = @SYSDEP_DIR@/asmpart.o                     @SYSDEP_DIR@/asmpart.s              @SYSDEP_DIR@/offsets.h              nativetable.hh                  nativetypes.hh
+
 
 bin_PROGRAMS = cacao
 noinst_PROGRAMS = cacaoh
 
-INCLUDES=-I/usr/include -I$(top_srcdir)/@SYSDEP_DIR@ -I$(top_srcdir)/jit -I@SYSDEP_DIR@ -I$(top_srcdir)
-
-cacao_SOURCES = \
-       asmpart.h \
-       builtin.c \
-       builtin.h \
-       callargs.h \
-       @COMPILER_SOURCES@ \
-       global.h \
-       jit.c \
-       jit.h \
-       loader.c \
-       loader.h \
-       main.c \
-       native.c \
-       native.h \
-       tables.c \
-       tables.h 
-
-EXTRA_cacao_SOURCES = \
-       compiler.c \
-       compiler.h 
-
-cacao_LDADD = \
-       @SYSDEP_DIR@/asmpart.o \
-       @COMPILER_OBJECTS@ \
-       toolbox/libtoolbox.a \
-       @GC_OBJ@ \
-    @THREAD_OBJ@
-
-cacao_DEPENDENCIES = \
-       @SYSDEP_DIR@/asmpart.o \
-       @COMPILER_OBJECTS@ \
-       toolbox/libtoolbox.a \
-       @GC_OBJ@ \
-       @THREAD_OBJ@
+INCLUDES = -I/usr/include -I$(top_srcdir)/@SYSDEP_DIR@ -I$(top_srcdir)/jit -I@SYSDEP_DIR@ -I$(top_srcdir)
+
+cacao_SOURCES =        asmpart.h       builtin.c       builtin.h       callargs.h      @COMPILER_SOURCES@      global.h        jit.c   jit.h   loader.c        loader.h        main.c  native.c        native.h        tables.c        tables.h 
+
+
+EXTRA_cacao_SOURCES =          compiler.c      compiler.h 
+
+
+cacao_LDADD =          @SYSDEP_DIR@/asmpart.o  @COMPILER_OBJECTS@      toolbox/libtoolbox.a    @GC_OBJ@     @THREAD_OBJ@
+
+
+cacao_DEPENDENCIES =   @SYSDEP_DIR@/asmpart.o  @COMPILER_OBJECTS@      toolbox/libtoolbox.a    @GC_OBJ@        @THREAD_OBJ@
+
 
 cacaoh_SOURCES = headers.c tables.c loader.c builtin.c
 cacaoh_LDADD = toolbox/libtoolbox.a @GC_OBJ@ @THREAD_OBJ@
@@ -143,28 +118,28 @@ cacao_LDFLAGS =
 cacaoh_OBJECTS =  headers.o tables.o loader.o builtin.o
 cacaoh_LDFLAGS = 
 CFLAGS = @CFLAGS@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
-DIST_COMMON =  README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
-Makefile.in NEWS acconfig.h aclocal.m4 config.guess config.h.in \
-config.sub configure configure.in install-sh missing mkinstalldirs \
-stamp-h.in
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON =  README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
+Makefile.am Makefile.in NEWS acconfig.h aclocal.m4 config.guess \
+config.h.in config.sub configure configure.in install-sh missing \
+mkinstalldirs
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
+TAR = gtar
+GZIP_ENV = --best
 DEP_FILES =  .deps/builtin.P .deps/compiler.P .deps/headers.P \
 .deps/jit.P .deps/loader.P .deps/main.P .deps/native.P .deps/tables.P
 SOURCES = $(cacao_SOURCES) $(EXTRA_cacao_SOURCES) $(cacaoh_SOURCES)
 OBJECTS = $(cacao_OBJECTS) $(cacaoh_OBJECTS)
 
-all: all-recursive-am all-am
-
+all: all-redirect
 .SUFFIXES:
 .SUFFIXES: .S .c .o .s
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -174,22 +149,29 @@ Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
 $(ACLOCAL_M4):  configure.in 
        cd $(srcdir) && $(ACLOCAL)
 
-config.status: $(srcdir)/configure
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
        $(SHELL) ./config.status --recheck
 $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
        cd $(srcdir) && $(AUTOCONF)
 
 config.h: stamp-h
-       @:
+       @if test ! -f $@; then \
+               rm -f stamp-h; \
+               $(MAKE) stamp-h; \
+       else :; fi
 stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
        cd $(top_builddir) \
          && CONFIG_FILES= CONFIG_HEADERS=config.h \
             $(SHELL) ./config.status
-       @echo timestamp > stamp-h
+       @echo timestamp > stamp-h 2> /dev/null
 $(srcdir)/config.h.in: $(srcdir)/stamp-h.in
+       @if test ! -f $@; then \
+               rm -f $(srcdir)/stamp-h.in; \
+               $(MAKE) $(srcdir)/stamp-h.in; \
+       else :; fi
 $(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
        cd $(top_srcdir) && $(AUTOHEADER)
-       @echo timestamp > $(srcdir)/stamp-h.in
+       @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
 
 mostlyclean-hdr:
 
@@ -214,15 +196,15 @@ install-binPROGRAMS: $(bin_PROGRAMS)
        $(mkinstalldirs) $(DESTDIR)$(bindir)
        @list='$(bin_PROGRAMS)'; for p in $$list; do \
          if test -f $$p; then \
-           echo "  $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
-            $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
+           echo "  $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+            $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
          else :; fi; \
        done
 
 uninstall-binPROGRAMS:
        @$(NORMAL_UNINSTALL)
        list='$(bin_PROGRAMS)'; for p in $$list; do \
-         rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
+         rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
        done
 
 mostlyclean-noinstPROGRAMS:
@@ -271,41 +253,65 @@ all-recursive install-data-recursive install-exec-recursive \
 installdirs-recursive install-recursive uninstall-recursive  \
 check-recursive installcheck-recursive info-recursive dvi-recursive:
        @set fnord $(MAKEFLAGS); amf=$$2; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
        list='$(SUBDIRS)'; for subdir in $$list; do \
-         target=`echo $@ | sed s/-recursive//`; \
          echo "Making $$target in $$subdir"; \
-         (cd $$subdir && $(MAKE) $$target) \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
           || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
-       done && test -z "$$fail"
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
        @set fnord $(MAKEFLAGS); amf=$$2; \
+       dot_seen=no; \
        rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
          rev="$$subdir $$rev"; \
+         test "$$subdir" = "." && dot_seen=yes; \
        done; \
+       test "$$dot_seen" = "no" && rev=". $$rev"; \
+       target=`echo $@ | sed s/-recursive//`; \
        for subdir in $$rev; do \
-         target=`echo $@ | sed s/-recursive//`; \
          echo "Making $$target in $$subdir"; \
-         (cd $$subdir && $(MAKE) $$target) \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
           || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
        done && test -z "$$fail"
 tags-recursive:
        list='$(SUBDIRS)'; for subdir in $$list; do \
-         (cd $$subdir && $(MAKE) tags); \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
        done
 
 tags: TAGS
 
 ID: $(HEADERS) $(SOURCES) $(LISP)
+       list='$(SOURCES) $(HEADERS)'; \
+       unique=`for i in $$list; do echo $$i; done | \
+         awk '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
        here=`pwd` && cd $(srcdir) \
-         && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
+         && mkid -f$$here/ID $$unique $(LISP)
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
        tags=; \
        here=`pwd`; \
        list='$(SUBDIRS)'; for subdir in $$list; do \
-         test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+   if test "$$subdir" = .; then :; else \
+           test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+   fi; \
        done; \
        list='$(SOURCES) $(HEADERS)'; \
        unique=`for i in $$list; do echo $$i; done | \
@@ -331,29 +337,31 @@ top_distdir = $(distdir)
 # tarfile.
 distcheck: dist
        -rm -rf $(distdir)
-       GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
+       GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
        mkdir $(distdir)/=build
        mkdir $(distdir)/=inst
        dc_install_base=`cd $(distdir)/=inst && pwd`; \
        cd $(distdir)/=build \
          && ../configure --srcdir=.. --prefix=$$dc_install_base \
-         && $(MAKE) \
-         && $(MAKE) dvi \
-         && $(MAKE) check \
-         && $(MAKE) install \
-         && $(MAKE) installcheck \
-         && $(MAKE) dist
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) dist
        -rm -rf $(distdir)
-       @echo "========================"; \
-       echo "$(distdir).tar.gz is ready for distribution"; \
-       echo "========================"
+       @banner="$(distdir).tar.gz is ready for distribution"; \
+       dashes=`echo "$$banner" | sed s/./=/g`; \
+       echo "$$dashes"; \
+       echo "$$banner"; \
+       echo "$$dashes"
 dist: distdir
        -chmod -R a+r $(distdir)
-       GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
+       GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
        -rm -rf $(distdir)
 dist-all: distdir
        -chmod -R a+r $(distdir)
-       GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
+       GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
        -rm -rf $(distdir)
 distdir: $(DISTFILES)
        -rm -rf $(distdir)
@@ -367,17 +375,23 @@ distdir: $(DISTFILES)
        $(mkinstalldirs) $(distdir)/html
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
        for subdir in $(SUBDIRS); do \
-         test -d $(distdir)/$$subdir \
-         || mkdir $(distdir)/$$subdir \
-         || exit 1; \
-         chmod 777 $(distdir)/$$subdir; \
-         (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+         if test "$$subdir" = .; then :; else \
+           test -d $(distdir)/$$subdir \
+           || mkdir $(distdir)/$$subdir \
            || exit 1; \
+           chmod 777 $(distdir)/$$subdir; \
+           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+             || exit 1; \
+         fi; \
        done
 
 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
@@ -389,94 +403,99 @@ mostlyclean-depend:
 clean-depend:
 
 distclean-depend:
+       -rm -rf .deps
 
 maintainer-clean-depend:
-       -rm -rf .deps
 
 %.o: %.c
        @echo '$(COMPILE) -c $<'; \
-       $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
+       $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-cp .deps/$(*F).pp .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm .deps/$(*F).pp
 
 %.lo: %.c
        @echo '$(LTCOMPILE) -c $<'; \
-       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
-       @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
-         < .deps/$(*F).p > .deps/$(*F).P
-       @-rm -f .deps/$(*F).p
+       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
+         < .deps/$(*F).pp > .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm -f .deps/$(*F).pp
+info-am:
 info: info-recursive
+dvi-am:
 dvi: dvi-recursive
-check: all-am
-       $(MAKE) check-recursive
+check-am: all-am
+check: check-recursive
+installcheck-am:
 installcheck: installcheck-recursive
 all-recursive-am: config.h
-       $(MAKE) all-recursive
-
-all-am: Makefile $(PROGRAMS) config.h
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 install-exec-am: install-binPROGRAMS
+install-exec: install-exec-recursive
 
-uninstall-am: uninstall-binPROGRAMS
-
-install-exec: install-exec-recursive install-exec-am
-       @$(NORMAL_INSTALL)
-
+install-data-am:
 install-data: install-data-recursive
-       @$(NORMAL_INSTALL)
-
-install: install-recursive install-exec-am
-       @:
-
-uninstall: uninstall-recursive uninstall-am
 
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am: uninstall-binPROGRAMS
+uninstall: uninstall-recursive
+all-am: Makefile $(PROGRAMS) config.h
+all-redirect: all-recursive-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs: installdirs-recursive
-       $(mkinstalldirs)  $(DATADIR)$(bindir)
+installdirs-am:
+       $(mkinstalldirs)  $(DESTDIR)$(bindir)
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
        -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
        -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 mostlyclean-am:  mostlyclean-hdr mostlyclean-binPROGRAMS \
                mostlyclean-noinstPROGRAMS mostlyclean-compile \
                mostlyclean-tags mostlyclean-depend mostlyclean-generic
 
+mostlyclean: mostlyclean-recursive
+
 clean-am:  clean-hdr clean-binPROGRAMS clean-noinstPROGRAMS \
                clean-compile clean-tags clean-depend clean-generic \
                mostlyclean-am
 
+clean: clean-recursive
+
 distclean-am:  distclean-hdr distclean-binPROGRAMS \
                distclean-noinstPROGRAMS distclean-compile \
                distclean-tags distclean-depend distclean-generic \
                clean-am
 
+distclean: distclean-recursive
+       -rm -f config.status
+
 maintainer-clean-am:  maintainer-clean-hdr maintainer-clean-binPROGRAMS \
                maintainer-clean-noinstPROGRAMS \
                maintainer-clean-compile maintainer-clean-tags \
                maintainer-clean-depend maintainer-clean-generic \
                distclean-am
-
-mostlyclean:  mostlyclean-recursive mostlyclean-am
-
-clean:  clean-recursive clean-am
-
-distclean:  distclean-recursive distclean-am
-       -rm -f config.status
-
-maintainer-clean:  maintainer-clean-recursive maintainer-clean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
        -rm -f config.status
 
 .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
@@ -493,11 +512,12 @@ dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
 maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
 distclean-tags clean-tags maintainer-clean-tags distdir \
 mostlyclean-depend distclean-depend clean-depend \
-maintainer-clean-depend info dvi installcheck all-recursive-am all-am \
-install-exec-am uninstall-am install-exec install-data install \
-uninstall all installdirs mostlyclean-generic distclean-generic \
-clean-generic maintainer-clean-generic clean mostlyclean distclean \
-maintainer-clean
+maintainer-clean-depend info-am info dvi-am dvi check check-am \
+installcheck-am installcheck all-recursive-am install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs-am \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
 native.c: nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh
@@ -509,6 +529,7 @@ nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh: cacaoh
                java.lang.ClassLoader \
                java.lang.Class \
                java.lang.Compiler \
+               java.lang.Integer \
                java.lang.Double \
                java.lang.Float \
                java.lang.Math \
@@ -547,6 +568,12 @@ nativetypes.hh @SYSDEP_DIR@/offsets.h nativetable.hh: cacaoh
                java.math.BigInteger \
                java.net.InetAddress \
                java.net.InetAddressImpl \
+               java.net.DatagramPacket \
+               java.net.PlainDatagramSocketImpl \
+               java.net.SocketImpl \
+               java.net.PlainSocketImpl \
+               java.net.SocketInputStream \
+               java.net.SocketOutputStream \
                java.security.PrivilegedActionException \
                java.security.PrivilegedAction \
                java.security.PrivilegedExceptionAction \
index 0520b196d725e0209fcf56c4a787f11fd8cd9986..a2143ce4ad772616bc48112e6da42e21b3cac3ed 100644 (file)
@@ -1,7 +1,7 @@
-dnl aclocal.m4 generated automatically by aclocal 1.3
+dnl aclocal.m4 generated automatically by aclocal 1.4a
 
-dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
-dnl This Makefile.in is free software; the Free Software Foundation
+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.
 
@@ -20,7 +20,9 @@ dnl Usage:
 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
 
 AC_DEFUN(AM_INIT_AUTOMAKE,
-[AC_REQUIRE([AM_PROG_INSTALL])
+[AC_REQUIRE([AC_PROG_INSTALL])
+dnl We require 2.13 because we rely on SHELL being computed by configure.
+AC_PREREQ([2.13])
 PACKAGE=[$1]
 AC_SUBST(PACKAGE)
 VERSION=[$2]
@@ -30,8 +32,8 @@ 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")
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
+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.
@@ -43,15 +45,6 @@ AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
 AC_REQUIRE([AC_PROG_MAKE_SET])])
 
-
-# serial 1
-
-AC_DEFUN(AM_PROG_INSTALL,
-[AC_REQUIRE([AC_PROG_INSTALL])
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-AC_SUBST(INSTALL_SCRIPT)dnl
-])
-
 #
 # Check to make sure that the build environment is sane.
 #
index d9d7b72dce4fad8b6bcc0cc7ce5e5d2567708d48..cae23bf26407dbec9f7b8588bedd531edf55e028 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,6 +49,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -71,9 +72,8 @@ SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
-EXTRA_DIST = asmpart.c disass.c cray.c gen.c ngen.c \
-            defines.h native-math.h ngen.h sigcontext.h \
-            types.h threads.h 
+EXTRA_DIST = asmpart.c disass.c cray.c gen.c ngen.c         defines.h native-math.h ngen.h sigcontext.h             types.h threads.h 
+
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -82,12 +82,11 @@ DIST_COMMON =  Makefile.am Makefile.in
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
-all: Makefile
-
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
 .SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu alpha/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -110,60 +109,73 @@ distdir: $(DISTFILES)
          && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu alpha/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
-info:
-dvi:
-check: all
-       $(MAKE)
-installcheck:
-install-exec: 
-       @$(NORMAL_INSTALL)
-
-install-data: 
-       @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-       @:
-
-uninstall: 
-
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile
+all-redirect: all-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-generic
+mostlyclean-am:  mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-generic mostlyclean-am
 
-clean:  clean-generic mostlyclean
+clean: clean-am
 
-distclean:  distclean-generic clean
-       -rm -f config.status
+distclean-am:  distclean-generic clean-am
 
-maintainer-clean:  maintainer-clean-generic distclean
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-generic distclean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
-.PHONY: tags distdir info dvi installcheck install-exec install-data \
-install uninstall all installdirs mostlyclean-generic distclean-generic \
-clean-generic maintainer-clean-generic clean mostlyclean distclean \
-maintainer-clean
+maintainer-clean: maintainer-clean-am
+
+.PHONY: tags distdir info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
index 9fe14cea00ddcd1941b1251c37b81346335b0ddf..f0107dee0b87c683067f45422c0dd83b1ba9e6c2 100644 (file)
@@ -11,7 +11,7 @@
        Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
                 Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
 
-       Last Change: $Id: ngen.c 135 1999-10-04 10:35:09Z roman $
+       Last Change: $Id: ngen.c 136 1999-11-09 11:33:46Z schani $
 
 *******************************************************************************/
 
@@ -3308,6 +3308,7 @@ makeactualcall:
                                        M_CMPULT(REG_ZERO, REG_ITMP1, d);      /* REG_ITMP1 != 0  */
                                        }
                                else {                                     /* class           */
+/*
                                        s2 = super->vftbl->diffval;
                                        M_BEQZ(s1, 4 + (s2 > 255));
                                        M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
@@ -3319,6 +3320,16 @@ makeactualcall:
                                                M_LDA(REG_ITMP2, REG_ZERO, s2);
                                                M_CMPULE(REG_ITMP1, REG_ITMP2, d);
                                                }
+*/
+                                       M_BEQZ(s1, 7);
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       a = dseg_addaddress ((void*) super->vftbl);
+                                       M_ALD(REG_ITMP2, REG_PV, a);
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
+                                       M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
+                                       M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
+                                       M_CMPULE(REG_ITMP1, REG_ITMP2, d);
                                        }
                                }
                        else
@@ -3365,6 +3376,7 @@ makeactualcall:
                                        mcode_addxcastrefs(mcodeptr);
                                        }
                                else {                                     /* class           */
+/*
                                        s2 = super->vftbl->diffval;
                                        M_BEQZ(s1, 4 + (s2 != 0) + (s2 > 255));
                                        M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
@@ -3382,6 +3394,25 @@ makeactualcall:
                                                M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
                                                M_BEQZ(REG_ITMP2, 0);
                                                }
+*/
+                                       M_BEQZ(s1, 8 + (d == REG_ITMP3));
+                                       M_ALD(REG_ITMP1, s1, OFFSET(java_objectheader, vftbl));
+                                       a = dseg_addaddress ((void*) super->vftbl);
+                                       M_ALD(REG_ITMP2, REG_PV, a);
+                                       M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl, baseval));
+                                       if (d != REG_ITMP3) {
+                                               M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl, baseval));
+                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
+                                               M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1);
+                                               }
+                                       else {
+                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, baseval));
+                                               M_ISUB(REG_ITMP1, REG_ITMP2, REG_ITMP1);
+                                               M_ALD(REG_ITMP2, REG_PV, a);
+                                               M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl, diffval));
+                                               }
+                                       M_CMPULE(REG_ITMP1, REG_ITMP2, REG_ITMP2);
+                                       M_BEQZ(REG_ITMP2, 0);
                                        mcode_addxcastrefs(mcodeptr);
                                        }
                                }
index ab89cc25eb7344df25b6d24a22bd487a634ffeb8..f3004a1b8ac235579ff634b797ce5beacf2ed3c2 100644 (file)
--- a/builtin.c
+++ b/builtin.c
@@ -128,18 +128,18 @@ s4 builtin_isanysubclass (classinfo *sub, classinfo *super)
                return (sub->vftbl->interfacetablelength > super->index) &&
                       (sub->vftbl->interfacetable[-super->index] != NULL);
 
+       /*
     while (sub != 0)
                if (sub == super)
                        return 1;
                else
                        sub = sub->super;
-       
+
        return 0;
+       */
 
-       /*
        return (unsigned) (sub->vftbl->baseval - super->vftbl->baseval) <=
               (unsigned) (super->vftbl->diffval);
-       */
 }
 
 
@@ -177,22 +177,22 @@ s4 builtin_instanceof(java_objectheader *obj, classinfo *class)
 
 s4 builtin_checkcast(java_objectheader *obj, classinfo *class)
 {
-       #ifdef DEBUG
+#ifdef DEBUG
        log_text ("builtin_checkcast called");
-       #endif
+#endif
 
        if (obj == NULL)
                return 1;
        if (builtin_isanysubclass (obj->vftbl->class, class))
                return 1;
 
-       #if DEBUG
+       /* #if DEBUG */
        printf ("#### checkcast failed ");
        utf_display (obj->vftbl->class->name);
        printf (" -> ");
        utf_display (class->name);
        printf ("\n");
-       #endif
+       /* #endif */
 
        return 0;
 }
@@ -251,22 +251,40 @@ s4 builtin_checkarraycast(java_objectheader *o, constant_arraydescriptor *desc)
 
        if (!o) return 1;
        if (o->vftbl->class != class_array) {
+#ifdef DEBUG
+               printf ("#### checkarraycast failed 1\n");
+#endif
                return 0;
                }
                
        if (a->arraytype != desc->arraytype) {
+#ifdef DEBUG
+               printf ("#### checkarraycast failed 2\n");
+#endif
                return 0;
                }
        
        switch (a->arraytype) {
                case ARRAYTYPE_OBJECT: {
                        java_objectarray *oa = (java_objectarray*) o;
-                       return builtin_isanysubclass (oa->elementtype, desc->objectclass);
+                       int result = builtin_isanysubclass (oa->elementtype, desc->objectclass);
+
+#ifdef DEBUG
+                       if (!result)
+                               printf ("#### checkarraycast failed 3\n");
+#endif
+                       return result;
                        }
                case ARRAYTYPE_ARRAY: {
                        java_arrayarray *aa = (java_arrayarray*) o;
-                       return builtin_descriptorscompatible
-                          (aa->elementdescriptor, desc->elementdescriptor);
+                       int result = builtin_descriptorscompatible
+                               (aa->elementdescriptor, desc->elementdescriptor);
+
+#ifdef DEBUG
+                       if (!result)
+                               printf ("#### checkarraycast failed 4\n");
+#endif
+                       return result;
                        }
                default:   
                        return 1;
@@ -354,6 +372,8 @@ java_objectheader *builtin_new (classinfo *c)
 {
        java_objectheader *o;
 
+       class_init(c);
+
 #ifdef SIZE_FROM_CLASSINFO
        c->alignedsize = align_size(c->instancesize);
        o = heap_allocate ( c->alignedsize, true, c->finalizer );
index f238e75dda8531bdde0ea9c5fad21a0ace8deb31..a5749f447c0aafd6a466d1496fd7d96993d56a40 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,6 +49,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -71,8 +72,8 @@ SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
-EXTRA_DIST = block.c local.c parse.c reg.c stack.c var.c \
-            defines.c mcode.c pcmd.c regalloc.c tools.c
+EXTRA_DIST = block.c local.c parse.c reg.c stack.c var.c            defines.c mcode.c pcmd.c regalloc.c tools.c
+
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -81,12 +82,11 @@ DIST_COMMON =  Makefile.am Makefile.in
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
-all: Makefile
-
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
 .SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu comp/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -109,60 +109,73 @@ distdir: $(DISTFILES)
          && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu comp/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
-info:
-dvi:
-check: all
-       $(MAKE)
-installcheck:
-install-exec: 
-       @$(NORMAL_INSTALL)
-
-install-data: 
-       @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-       @:
-
-uninstall: 
-
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile
+all-redirect: all-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-generic
+mostlyclean-am:  mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-generic mostlyclean-am
 
-clean:  clean-generic mostlyclean
+clean: clean-am
 
-distclean:  distclean-generic clean
-       -rm -f config.status
+distclean-am:  distclean-generic clean-am
 
-maintainer-clean:  maintainer-clean-generic distclean
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-generic distclean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
-.PHONY: tags distdir info dvi installcheck install-exec install-data \
-install uninstall all installdirs mostlyclean-generic distclean-generic \
-clean-generic maintainer-clean-generic clean mostlyclean distclean \
-maintainer-clean
+maintainer-clean: maintainer-clean-am
+
+.PHONY: tags distdir info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
index f7f22830488e2c883fc384a345bf9595b8fb6eb4..448cad78b077ec2efb1c036526a172d9ce61cda0 100644 (file)
 #undef EXTERNAL_OVERFLOW
 #undef DONT_FREE_FIRST
 
-/* Make automake happy */
-#undef PACKAGE
-#undef VERSION
-
 /* sysdep */
 #undef SYSDEP_DIR
 
 
 /* Define if you have the m library (-lm).  */
 #undef HAVE_LIBM
+
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
index 5427420225ebb8abe98acc3bc1ef500731da8fdf..2de24052d611b005bb7edd31b15dd476f5644ceb 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12 
+# Generated automatically using autoconf version 2.13 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -54,6 +54,7 @@ mandir='${prefix}/man'
 # Initialize some other variables.
 subdirs=
 MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
 # Maximum number of lines to put in a shell here document.
 ac_max_here_lines=12
 
@@ -337,7 +338,7 @@ EOF
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12"
+    echo "configure generated by autoconf version 2.13"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -507,9 +508,11 @@ ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
+ac_exeext=
+ac_objext=o
 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -544,26 +547,26 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 
 
 # Make sure we can run config.sub.
-if $ac_config_sub sun4 >/dev/null 2>&1; then :
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
 else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:553: checking host system type" >&5
+echo "configure:556: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
 NONE)
   case $nonopt in
   NONE)
-    if host_alias=`$ac_config_guess`; then :
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
     else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
     fi ;;
   *) host_alias=$nonopt ;;
   esac ;;
 esac
 
-host=`$ac_config_sub $host_alias`
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
 host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
@@ -577,28 +580,30 @@ echo "$ac_t""$host" 1>&6
 # SunOS /usr/etc/install
 # IRIX /sbin/install
 # AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:585: checking for a BSD compatible install" >&5
+echo "configure:589: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS=":"
   for ac_dir in $PATH; do
     # Account for people who put trailing slashes in PATH elements.
     case "$ac_dir/" in
     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
     *)
       # OSF1 and SCO ODT 3.0 have their own names for install.
-      for ac_prog in ginstall installbsd scoinst install; do
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
         if test -f $ac_dir/$ac_prog; then
          if test $ac_prog = install &&
             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
            # AIX install.  It has an incompatible calling convention.
-           # OSF/1 installbsd also uses dspmsg, but is usable.
            :
          else
            ac_cv_path_install="$ac_dir/$ac_prog -c"
@@ -628,13 +633,12 @@ echo "$ac_t""$INSTALL" 1>&6
 # It thinks the first close brace ends the variable substitution.
 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:638: checking whether build environment is sane" >&5
+echo "configure:642: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -691,7 +695,7 @@ test "$program_suffix" != NONE &&
 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:695: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:699: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -718,6 +722,7 @@ else
 fi
 
 
+
 PACKAGE=cacao
 
 VERSION=0.40
@@ -737,7 +742,7 @@ EOF
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:741: checking for working aclocal" >&5
+echo "configure:746: checking for working aclocal" >&5
 # 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.
@@ -750,7 +755,7 @@ else
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:754: checking for working autoconf" >&5
+echo "configure:759: checking for working autoconf" >&5
 # 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.
@@ -763,7 +768,7 @@ else
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:767: checking for working automake" >&5
+echo "configure:772: checking for working automake" >&5
 # 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.
@@ -776,7 +781,7 @@ else
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:780: checking for working autoheader" >&5
+echo "configure:785: checking for working autoheader" >&5
 # 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.
@@ -789,7 +794,7 @@ else
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:793: checking for working makeinfo" >&5
+echo "configure:798: checking for working makeinfo" >&5
 # 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.
@@ -846,15 +851,16 @@ EOF
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:850: checking for $ac_word" >&5
+echo "configure:855: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_prog_CC="gcc"
@@ -875,16 +881,17 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:879: checking for $ac_word" >&5
+echo "configure:885: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_prog_rejected=no
-  for ac_dir in $PATH; do
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
@@ -919,25 +926,61 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:936: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:927: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:968: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
-cat > conftest.$ac_ext <<EOF
-#line 937 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 979 "configure"
 #include "confdefs.h"
+
 main(){return(0);}
 EOF
-if { (eval echo configure:941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -951,18 +994,24 @@ else
   ac_cv_prog_cc_works=no
 fi
 rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
 if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:961: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1010: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:966: checking whether we are using GNU C" >&5
+echo "configure:1015: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -971,7 +1020,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:975: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -982,11 +1031,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
 if test $ac_cv_prog_gcc = yes; then
   GCC=yes
-  ac_test_CFLAGS="${CFLAGS+set}"
-  ac_save_CFLAGS="$CFLAGS"
-  CFLAGS=
-  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:990: checking whether ${CC-cc} accepts -g" >&5
+else
+  GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1043: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1001,30 +1054,35 @@ rm -f conftest*
 fi
 
 echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-  if test "$ac_test_CFLAGS" = set; then
-    CFLAGS="$ac_save_CFLAGS"
-  elif test $ac_cv_prog_cc_g = yes; then
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
     CFLAGS="-g -O2"
   else
-    CFLAGS="-O2"
+    CFLAGS="-g"
   fi
 else
-  GCC=
-  test "${CFLAGS+set}" = set || CFLAGS="-g"
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
 fi
 
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1020: checking for $ac_word" >&5
+echo "configure:1077: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_prog_RANLIB="ranlib"
@@ -1044,7 +1102,7 @@ fi
 
 
 echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
-echo "configure:1048: checking for sin in -lm" >&5
+echo "configure:1106: checking for sin in -lm" >&5
 ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1052,7 +1110,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1056 "configure"
+#line 1114 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1063,7 +1121,7 @@ int main() {
 sin()
 ; return 0; }
 EOF
-if { (eval echo configure:1067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1096,12 +1154,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:1100: checking for $ac_hdr that defines DIR" >&5
+echo "configure:1158: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1105 "configure"
+#line 1163 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -1109,7 +1167,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:1113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -1134,7 +1192,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:1138: checking for opendir in -ldir" >&5
+echo "configure:1196: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1142,7 +1200,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1146 "configure"
+#line 1204 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1153,7 +1211,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:1157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1175,7 +1233,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:1179: checking for opendir in -lx" >&5
+echo "configure:1237: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1183,7 +1241,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1187 "configure"
+#line 1245 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1194,7 +1252,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:1198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1217,7 +1275,7 @@ fi
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1221: checking how to run the C preprocessor" >&5
+echo "configure:1279: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1232,14 +1290,14 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1236 "configure"
+#line 1294 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1300: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
@@ -1249,14 +1307,31 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1253 "configure"
+#line 1311 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1328 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1259: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
@@ -1268,6 +1343,8 @@ else
 fi
 rm -f conftest*
 fi
+rm -f conftest*
+fi
 rm -f conftest*
   ac_cv_prog_CPP="$CPP"
 fi
@@ -1278,12 +1355,12 @@ fi
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1282: checking for ANSI C header files" >&5
+echo "configure:1359: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1287 "configure"
+#line 1364 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1291,8 +1368,8 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   ac_cv_header_stdc=yes
@@ -1308,7 +1385,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1312 "configure"
+#line 1389 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1326,7 +1403,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1330 "configure"
+#line 1407 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1347,7 +1424,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1351 "configure"
+#line 1428 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1358,7 +1435,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:1362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1385,18 +1462,18 @@ for ac_hdr in fcntl.h sys/time.h unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1389: checking for $ac_hdr" >&5
+echo "configure:1466: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1394 "configure"
+#line 1471 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1399: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1476: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -1423,12 +1500,12 @@ done
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1427: checking for working const" >&5
+echo "configure:1504: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1432 "configure"
+#line 1509 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1477,7 +1554,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:1481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1558: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1498,21 +1575,21 @@ EOF
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1502: checking for inline" >&5
+echo "configure:1579: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 1509 "configure"
+#line 1586 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:1516: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -1538,12 +1615,12 @@ EOF
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1542: checking for off_t" >&5
+echo "configure:1619: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1547 "configure"
+#line 1624 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1552,7 +1629,7 @@ else
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_off_t=yes
 else
@@ -1571,12 +1648,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1575: checking for size_t" >&5
+echo "configure:1652: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1580 "configure"
+#line 1657 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1585,7 +1662,7 @@ else
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_size_t=yes
 else
@@ -1604,12 +1681,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1608: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:1685: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1613 "configure"
+#line 1690 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -1618,7 +1695,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:1622: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -1639,12 +1716,12 @@ EOF
 fi
 
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:1643: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:1720: checking whether struct tm is in sys/time.h or time.h" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1648 "configure"
+#line 1725 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -1652,7 +1729,7 @@ int main() {
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:1656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -1675,13 +1752,13 @@ fi
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1679: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:1756: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 1685 "configure"
+#line 1762 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -1699,7 +1776,7 @@ rm -f conftest*
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 1703 "configure"
+#line 1780 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -1721,7 +1798,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
 fi
 
 echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:1725: checking for 8-bit clean memcmp" >&5
+echo "configure:1802: checking for 8-bit clean memcmp" >&5
 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1729,7 +1806,7 @@ else
   ac_cv_func_memcmp_clean=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 1733 "configure"
+#line 1810 "configure"
 #include "confdefs.h"
 
 main()
@@ -1739,7 +1816,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:1743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_memcmp_clean=yes
 else
@@ -1754,24 +1831,24 @@ fi
 fi
 
 echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
-test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o"
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
 
 for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1764: checking for $ac_hdr" >&5
+echo "configure:1841: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1769 "configure"
+#line 1846 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1774: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -1799,12 +1876,12 @@ done
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1803: checking for $ac_func" >&5
+echo "configure:1880: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1808 "configure"
+#line 1885 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1827,7 +1904,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1852,7 +1929,7 @@ fi
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:1856: checking for working mmap" >&5
+echo "configure:1933: checking for working mmap" >&5
 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1860,7 +1937,7 @@ else
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 1864 "configure"
+#line 1941 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -2000,7 +2077,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:2004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -2023,12 +2100,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2027: checking return type of signal handlers" >&5
+echo "configure:2104: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2032 "configure"
+#line 2109 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2045,7 +2122,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2049: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -2066,12 +2143,12 @@ EOF
 for ac_func in getcwd gettimeofday mkdir mktime select socket
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2070: checking for $ac_func" >&5
+echo "configure:2147: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2075 "configure"
+#line 2152 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2094,7 +2171,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2121,12 +2198,12 @@ done
 
 if test $ac_cv_func_mmap_fixed_mapped = yes; then
        echo $ac_n "checking whether MAP_FAILED is defined""... $ac_c" 1>&6
-echo "configure:2125: checking whether MAP_FAILED is defined" >&5
+echo "configure:2202: checking whether MAP_FAILED is defined" >&5
 if eval "test \"`echo '$''{'ac_cv_map_failed'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2130 "configure"
+#line 2207 "configure"
 #include "confdefs.h"
 #include <sys/mman.h>
                                     #ifdef MAP_FAILED
@@ -2148,12 +2225,12 @@ fi
 echo "$ac_t""$ac_cv_map_failed" 1>&6
 
        echo $ac_n "checking whether MAP_ANONYMOUS is defined""... $ac_c" 1>&6
-echo "configure:2152: checking whether MAP_ANONYMOUS is defined" >&5
+echo "configure:2229: checking whether MAP_ANONYMOUS is defined" >&5
 if eval "test \"`echo '$''{'ac_cv_map_anonymous'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2157 "configure"
+#line 2234 "configure"
 #include "confdefs.h"
 #include <sys/mman.h>
                                     #ifdef MAP_ANONYMOUS
@@ -2205,7 +2282,7 @@ fi
 
 
 echo $ac_n "checking whether to include threads support""... $ac_c" 1>&6
-echo "configure:2209: checking whether to include threads support" >&5
+echo "configure:2286: checking whether to include threads support" >&5
 if test x"$enable_threads" = "xno"; then
        echo "$ac_t""no" 1>&6
 else
@@ -2231,7 +2308,7 @@ EOF
 fi
 
 echo $ac_n "checking which garbage collector to use""... $ac_c" 1>&6
-echo "configure:2235: checking which garbage collector to use" >&5
+echo "configure:2312: checking which garbage collector to use" >&5
 if test x"$enable_gc2" = "xno"; then
        echo "$ac_t""old garbage collector" 1>&6
        GC_OBJ="mm/libmm_old.a"
@@ -2265,7 +2342,7 @@ EOF
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
 (set) 2>&1 |
-  case `(ac_space=' '; set) 2>&1` in
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
   *ac_space=\ *)
     # `set' does not quote correctly, so add quotes (double-quote substitution
     # turns \\\\ into \\, and sed turns \\ into \).
@@ -2332,7 +2409,7 @@ do
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.12"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -2363,9 +2440,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
 $ac_vpsub
 $extrasub
+s%@SHELL@%$SHELL%g
 s%@CFLAGS@%$CFLAGS%g
 s%@CPPFLAGS@%$CPPFLAGS%g
 s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
 s%@DEFS@%$DEFS%g
 s%@LDFLAGS@%$LDFLAGS%g
 s%@LIBS@%$LIBS%g
@@ -2390,8 +2469,8 @@ s%@host_cpu@%$host_cpu%g
 s%@host_vendor@%$host_vendor%g
 s%@host_os@%$host_os%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@PACKAGE@%$PACKAGE%g
 s%@VERSION@%$VERSION%g
 s%@ACLOCAL@%$ACLOCAL%g
index 134276556ab9f90eb2b9725a1210d3b443b0af32..5e3f4b731c9f7688dfae430cc3a7050a51711222 100644 (file)
--- a/headers.c
+++ b/headers.c
        Changes: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
                 Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
 
-       Last Change: $Id: headers.c 135 1999-10-04 10:35:09Z roman $
+       Last Change: $Id: headers.c 136 1999-11-09 11:33:46Z schani $
 
 *******************************************************************************/
 
+#define CACAOH
+
 #include "config.h" /* phil */
 #include "global.h"
 #include "tables.h"
index 72b1e79485fab0afe47ba7fc72a2ecb2f05add20..a33905e57ff0711ca2ac29132be3b951a4e88ef9 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,6 +49,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -80,12 +81,11 @@ DIST_COMMON =  Makefile.am Makefile.in
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
-all: Makefile
-
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
 .SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu jit/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -108,60 +108,73 @@ distdir: $(DISTFILES)
          && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu jit/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
-info:
-dvi:
-check: all
-       $(MAKE)
-installcheck:
-install-exec: 
-       @$(NORMAL_INSTALL)
-
-install-data: 
-       @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-       @:
-
-uninstall: 
-
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile
+all-redirect: all-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-generic
+mostlyclean-am:  mostlyclean-generic
 
-clean:  clean-generic mostlyclean
+mostlyclean: mostlyclean-am
 
-distclean:  distclean-generic clean
-       -rm -f config.status
+clean-am:  clean-generic mostlyclean-am
 
-maintainer-clean:  maintainer-clean-generic distclean
+clean: clean-am
+
+distclean-am:  distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-generic distclean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
-.PHONY: tags distdir info dvi installcheck install-exec install-data \
-install uninstall all installdirs mostlyclean-generic distclean-generic \
-clean-generic maintainer-clean-generic clean mostlyclean distclean \
-maintainer-clean
+maintainer-clean: maintainer-clean-am
+
+.PHONY: tags distdir info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
index eb7a9f31d7692d7e53af4e2806c1a4e80959815b..bbb66fb8898839e2a3437f1ca8d5629a10df1229 100644 (file)
@@ -8,7 +8,7 @@
        
        Author: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
 
-       Last Change: $Id: parse.c 135 1999-10-04 10:35:09Z roman $
+       Last Change: $Id: parse.c 136 1999-11-09 11:33:46Z schani $
 
 *******************************************************************************/
 
@@ -871,6 +871,10 @@ static void parse()
                                        BUILTIN2((functionptr) asm_builtin_checkarraycast, TYPE_ADR);
                                        }
                                else { /* object type cast-check */
+                                       /*
+                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                                       BUILTIN2((functionptr) asm_builtin_checkcast, TYPE_ADR);
+                                       */
                                        OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
                                        }
                                break;
@@ -884,7 +888,11 @@ static void parse()
                                        BUILTIN2((functionptr) builtin_arrayinstanceof, TYPE_INT);
                                        }
                                else { /* object type cast-check */
-                                       OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
+                                       /*
+                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                                       BUILTIN2((functionptr) builtin_instanceof, TYPE_INT);
+                                       */
+                                       OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
                                        }
                                break;
 
diff --git a/jni.c b/jni.c
index d7432726b4b0908dd93e7ad38e1287b09be1ba58..bedd4b8f88a3f19577dcbc72a97a01c23351c32d 100644 (file)
--- a/jni.c
+++ b/jni.c
@@ -1233,54 +1233,63 @@ jfieldID GetStaticFieldID (JNIEnv *env, jclass clazz, const char *name, const ch
 
 jobject GetStaticObjectField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.a;       
 }
 
 
 jboolean GetStaticBooleanField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jbyte GetStaticByteField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jchar GetStaticCharField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jshort GetStaticShortField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jint GetStaticIntField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jlong GetStaticLongField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.l;
 }
 
 
 jfloat GetStaticFloatField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.f;
 }
 
 
 jdouble GetStaticDoubleField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.d;
 }
 
@@ -1288,54 +1297,63 @@ jdouble GetStaticDoubleField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 
 void SetStaticObjectField (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value)
 {
+       class_init(clazz);
        fieldID->value.a = value;
 }
 
 
 void SetStaticBooleanField (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticByteField (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticCharField (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticShortField (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticIntField (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticLongField (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value)
 {
+       class_init(clazz);
        fieldID->value.l = value;
 }
 
 
 void SetStaticFloatField (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value)
 {
+       class_init(clazz);
        fieldID->value.f = value;
 }
 
 
 void SetStaticDoubleField (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value)
 {
+       class_init(clazz);
        fieldID->value.d = value;
 }
 
@@ -2154,3 +2172,16 @@ JNIEnv env =
     &DeleteWeakGlobalRef,
     &ExceptionCheck
     };
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index d40b095cd0e197322426dc892b83c69904a5293f..058609e41eabae571b17ebffe8b24d85eddb09fc 100644 (file)
--- a/loader.c
+++ b/loader.c
@@ -289,7 +289,7 @@ bool suck_start (utf *classname)
        }
 
        sprintf (logtext,"Can not open class file '%s'", filename);
-       error();
+       dolog();
 
        return false;
 }
@@ -2254,6 +2254,7 @@ void class_showmethods (classinfo *c)
 /******************* Funktionen fuer den Class-loader generell ****************/
 /******************************************************************************/
 
+static int loader_inited = 0;
 
 /********************* Funktion: loader_load ***********************************
 
@@ -2294,6 +2295,9 @@ classinfo *loader_load (utf *topname)
                loadingtime += (stoptime-starttime);
                }
 
+       if (loader_inited)
+               loader_compute_subclasses();
+
        intsRestore();                          /* schani */
 
        return top; 
@@ -2451,6 +2455,8 @@ void loader_init ()
        proto_java_lang_ThreadDeath =                             /* schani */
                builtin_new(class_java_lang_ThreadDeath);
        heap_addreference ( (void**) &proto_java_lang_ThreadDeath);
+
+       loader_inited = 1;
 }
 
 
@@ -2479,7 +2485,7 @@ void loader_initclasses ()
        intsRestore();                      /* schani */
 }
 
-static s4 classvalue = 0;
+static s4 classvalue;
 
 static void loader_compute_class_values (classinfo *c)
 {
@@ -2511,6 +2517,15 @@ void loader_compute_subclasses ()
        
        intsDisable();                     /* schani */
 
+       c = list_first (&linkedclasses);
+       while (c) {
+               if (!(c->flags & ACC_INTERFACE)) {
+                       c->nextsub = 0;
+                       c->sub = 0;
+                       }
+               c = list_next (&linkedclasses, c);
+               }
+
        c = list_first (&linkedclasses);
        while (c) {
                if (!(c->flags & ACC_INTERFACE) && (c->super != NULL)) {
@@ -2520,6 +2535,7 @@ void loader_compute_subclasses ()
                c = list_next (&linkedclasses, c);
                }
 
+       classvalue = 0;
        loader_compute_class_values(class_java_lang_Object);
 
        intsRestore();                      /* schani */
diff --git a/main.c b/main.c
index b1b3bad7f502ab0d1592e5a527ce9cbeb8929bae..ff70eee492902280030d99e91d3190b1b30db230 100644 (file)
--- a/main.c
+++ b/main.c
@@ -17,7 +17,7 @@
                 Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
                         Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
 
-       Last Change: $Id: main.c 135 1999-10-04 10:35:09Z roman $
+       Last Change: $Id: main.c 136 1999-11-09 11:33:46Z schani $
 
 *******************************************************************************/
 
@@ -733,8 +733,6 @@ int main(int argc, char **argv)
 
        topclass = loader_load ( utf_new_char (cp) );
 
-       loader_compute_subclasses();
-
        gc_init();
 
 #ifdef USE_THREADS
index 6a49b83e425d10c0366485df9c09f00791034dda..a36fde125fc2f5d3ccbba5f36ef2f57735469e44 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,6 +49,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -71,8 +72,8 @@ SYSDEP_DIR = @SYSDEP_DIR@
 THREAD_OBJ = @THREAD_OBJ@
 VERSION = @VERSION@
 
-EXTRA_DIST = asmpart.c calling.doc defines.h disass.c \
-            native-math.h ngen.c ngen.h threads.h types.h
+EXTRA_DIST = asmpart.c calling.doc defines.h disass.c       native-math.h ngen.c ngen.h threads.h types.h
+
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -81,12 +82,11 @@ DIST_COMMON =  Makefile.am Makefile.in
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
-all: Makefile
-
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
 .SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu mips/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -109,60 +109,73 @@ distdir: $(DISTFILES)
          && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu mips/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
-info:
-dvi:
-check: all
-       $(MAKE)
-installcheck:
-install-exec: 
-       @$(NORMAL_INSTALL)
-
-install-data: 
-       @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-       @:
-
-uninstall: 
-
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile
+all-redirect: all-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-generic
+mostlyclean-am:  mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-generic mostlyclean-am
 
-clean:  clean-generic mostlyclean
+clean: clean-am
 
-distclean:  distclean-generic clean
-       -rm -f config.status
+distclean-am:  distclean-generic clean-am
 
-maintainer-clean:  maintainer-clean-generic distclean
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-generic distclean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
-.PHONY: tags distdir info dvi installcheck install-exec install-data \
-install uninstall all installdirs mostlyclean-generic distclean-generic \
-clean-generic maintainer-clean-generic clean mostlyclean distclean \
-maintainer-clean
+maintainer-clean: maintainer-clean-am
+
+.PHONY: tags distdir info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
index e6422d65310d295fa9c66b6a075551e008a76740..9abb0bd2a3bb7389794a3b593f99d43cd21213e3 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,6 +49,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -73,14 +74,11 @@ VERSION = @VERSION@
 
 noinst_LIBRARIES = libmm_new.a libmm_old.a
 
-libmm_new_a_SOURCES = allocator2.c allocator.h \
-                     bitmap2.c bitmap2.h \
-                     heap2.c \
-                     lifespan.c lifespan.h \
-                     mm.h
+libmm_new_a_SOURCES = allocator2.c allocator.h                       bitmap2.c bitmap2.h                     heap2.c                 lifespan.c lifespan.h                   mm.h
+
 libmm_old_a_SOURCES = heap.old.c
 
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -97,25 +95,25 @@ libmm_old_a_LIBADD =
 libmm_old_a_OBJECTS =  heap.old.o
 AR = ar
 CFLAGS = @CFLAGS@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
 DIST_COMMON =  Makefile.am Makefile.in
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
+TAR = gtar
+GZIP_ENV = --best
 DEP_FILES =  .deps/allocator2.P .deps/bitmap2.P .deps/heap.old.P \
 .deps/heap2.P .deps/lifespan.P
 SOURCES = $(libmm_new_a_SOURCES) $(libmm_old_a_SOURCES)
 OBJECTS = $(libmm_new_a_OBJECTS) $(libmm_old_a_OBJECTS)
 
-all: Makefile $(LIBRARIES)
-
+all: all-redirect
 .SUFFIXES:
 .SUFFIXES: .S .c .o .s
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu mm/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -161,8 +159,12 @@ libmm_old.a: $(libmm_old_a_OBJECTS) $(libmm_old_a_DEPENDENCIES)
 tags: TAGS
 
 ID: $(HEADERS) $(SOURCES) $(LISP)
+       list='$(SOURCES) $(HEADERS)'; \
+       unique=`for i in $$list; do echo $$i; done | \
+         awk '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
        here=`pwd` && cd $(srcdir) \
-         && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
+         && mkid -f$$here/ID $$unique $(LISP)
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
        tags=; \
@@ -195,9 +197,13 @@ distdir: $(DISTFILES)
          && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu mm/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
 
 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
@@ -209,80 +215,98 @@ mostlyclean-depend:
 clean-depend:
 
 distclean-depend:
+       -rm -rf .deps
 
 maintainer-clean-depend:
-       -rm -rf .deps
 
 %.o: %.c
        @echo '$(COMPILE) -c $<'; \
-       $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
+       $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-cp .deps/$(*F).pp .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm .deps/$(*F).pp
 
 %.lo: %.c
        @echo '$(LTCOMPILE) -c $<'; \
-       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
-       @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
-         < .deps/$(*F).p > .deps/$(*F).P
-       @-rm -f .deps/$(*F).p
-info:
-dvi:
-check: all
-       $(MAKE)
-installcheck:
-install-exec: 
-       @$(NORMAL_INSTALL)
-
-install-data: 
-       @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-       @:
-
-uninstall: 
-
+       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
+         < .deps/$(*F).pp > .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(LIBRARIES)
+all-redirect: all-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
+mostlyclean-am:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
                mostlyclean-tags mostlyclean-depend mostlyclean-generic
 
-clean:  clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
-               clean-generic mostlyclean
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
+               clean-generic mostlyclean-am
 
-distclean:  distclean-noinstLIBRARIES distclean-compile distclean-tags \
-               distclean-depend distclean-generic clean
-       -rm -f config.status
+clean: clean-am
 
-maintainer-clean:  maintainer-clean-noinstLIBRARIES \
+distclean-am:  distclean-noinstLIBRARIES distclean-compile \
+               distclean-tags distclean-depend distclean-generic \
+               clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-noinstLIBRARIES \
                maintainer-clean-compile maintainer-clean-tags \
                maintainer-clean-depend maintainer-clean-generic \
-               distclean
+               distclean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
+maintainer-clean: maintainer-clean-am
+
 .PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
 clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
 mostlyclean-compile distclean-compile clean-compile \
 maintainer-clean-compile tags mostlyclean-tags distclean-tags \
 clean-tags maintainer-clean-tags distdir mostlyclean-depend \
-distclean-depend clean-depend maintainer-clean-depend info dvi \
-installcheck install-exec install-data install uninstall all \
-installdirs mostlyclean-generic distclean-generic clean-generic \
+distclean-depend clean-depend maintainer-clean-depend info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
index 97a5158682dd306a818f1e8ab2e6fbd0839101db..be256073c7423282549a44988c0c9b1e22244e90 100644 (file)
@@ -509,12 +509,16 @@ void gc_finalize (void)
        while (curr) {
                if (curr->address) {
                        if (!bitmap_testbit(mark_bits, curr->address)) {
+                               int b;
 
 #ifdef FINALIZER_COUNTING
                                ++gc_finalizers_executed;
 #endif
+                               b = blockInts;
+                               blockInts = 0;
                                asm_calljavamethod(((java_objectheader*)curr->address)->vftbl->class->finalizer, 
                                                                   curr->address, NULL, NULL, NULL);
+                               blockInts = b;
                                curr->address = 0;
                        }
                }
index 3640598cd982bff4fd44c40053e63e354897aa87..08128c48ca5657753f70c2374c990dba2cc53907 100644 (file)
@@ -238,12 +238,18 @@ classinfo *get_returntype(methodinfo *m)
  * Method:    forName0
  * Signature: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;
  */
-JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_Class_forName0 ( JNIEnv *env ,  struct java_lang_String* s, s4 initialize, struct java_lang_ClassLoader* par3)
+JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_Class_forName0 ( JNIEnv *env ,  struct java_lang_String* s, s4 initialize, struct java_lang_ClassLoader* loader)
 {
        classinfo *c;
        utf *u;
        u4 i;
 
+       if (runverbose)
+       {
+           log_text("Java_java_lang_Class_forName0 called");
+           log_text(javastring_tochar((java_objectheader*)s));
+       }
+
        /* illegal argument */
        if (!s) return NULL;
        
@@ -251,6 +257,7 @@ JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_Class_forName0 ( JNIEnv
 
          /*  arrayclasses, e.g. [Ljava.lang.String; */   
          c = create_array_class(javastring_toutf(s, true));
+         assert(c != 0);
 
        } else
        {
@@ -259,12 +266,29 @@ JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_Class_forName0 ( JNIEnv
          u = javastring_toutf(s, true);
 
          if ( !(c = class_get(u)) ) {
-
-           /* class was not found, raise exception */
-           exceptionptr = 
-             native_new_and_init (class_java_lang_ClassNotFoundException);
-
-           return NULL;
+             methodinfo *method;
+             java_lang_Class *class;
+
+             /* class was not found. first check whether we can load it */
+             method = class_findmethod(loader->header.vftbl->class,
+                                       utf_new_char("loadClass"),
+                                       utf_new_char("(Ljava/lang/String;)Ljava/lang/Class;"));
+             if (method == NULL)
+             {
+                 log_text("could not find method");
+                 exceptionptr = native_new_and_init (class_java_lang_ClassNotFoundException);
+                 return NULL;
+             }
+
+             c = (classinfo*)asm_calljavafunction(method, loader, s, NULL, NULL);
+
+             if (c == NULL)
+             {
+                 /* class was not loaded. raise exception */
+                 exceptionptr = 
+                     native_new_and_init (class_java_lang_ClassNotFoundException);
+                 return NULL;
+             }
          }
         }
 
@@ -487,7 +511,7 @@ JNIEXPORT struct java_lang_reflect_Field* JNICALL Java_java_lang_Class_getField0
       /* save type in slot-field for faster processing */
       setfield_critical(c,o,"slot",           "I",                 jint,    (jint) f->descriptor->text[0]);  
       setfield_critical(c,o,"name",           "Ljava/lang/String;", jstring, (jstring) name);
-      setfield_critical(c,o,"type",           "Ljava/lang/Class;",  jclass,  c);
+      setfield_critical(c,o,"type",           "Ljava/lang/Class;",  jclass,  fieldtype);
 
       return o;
     }
index 4ce3498c809de64efc495e635773b2de0a2a16c6..6009bd897744be6f0d26b30b1469bc688efbdfec 100644 (file)
@@ -9,6 +9,8 @@ JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_ClassLoader_defineClass
 {
     classinfo *c;
 
+    log_text("Java_java_lang_ClassLoader_defineClass0 called");
+
     /* call JNI-function to load the class */
     c = env->DefineClass(env, javastring_tochar((java_objectheader*) name), (jobject) this, (const jbyte *) &buf[off], len);
     use_class_as_object (c);    
@@ -22,8 +24,41 @@ JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_ClassLoader_defineClass
  */
 JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_ClassLoader_findBootstrapClass ( JNIEnv *env ,  struct java_lang_ClassLoader* this, struct java_lang_String* name)
 {
-  /* load the class */
-  return Java_java_lang_Class_forName0(env,name,0,this);
+    classinfo *c;
+    bool result;
+    utf *transformed_name;
+
+    if (runverbose)
+    {
+       log_text("Java_java_lang_ClassLoader_findBootstrapClass called");
+       log_text(javastring_tochar((java_objectheader*)name));
+    }
+
+    /* check whether the class exists */
+    transformed_name = javastring_toutf(name, true);
+    result = suck_start(transformed_name);
+    /* suck_stop(); */
+
+    if (!result)
+    {
+       log_text("could not find class");
+       exceptionptr = native_new_and_init(class_java_lang_ClassNotFoundException);
+       return NULL;
+    }
+
+    /* load the class */
+    c = loader_load(transformed_name);
+
+    if (c == NULL)
+    {
+       log_text("could not load class");
+       exceptionptr = native_new_and_init(class_java_lang_ClassNotFoundException);
+       return NULL;
+    }
+
+    use_class_as_object(c);
+
+    return (java_lang_Class*)c;
 }
 
 /*
@@ -33,7 +68,18 @@ JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_ClassLoader_findBootstr
  */
 JNIEXPORT struct java_lang_Class* JNICALL Java_java_lang_ClassLoader_findLoadedClass ( JNIEnv *env ,  struct java_lang_ClassLoader* this, struct java_lang_String* name)
 {  
-  return Java_java_lang_Class_forName0(env,name,0,this);
+    classinfo *class;
+
+    if (runverbose)
+       log_text("Java_java_lang_ClassLoader_findLoadedClass called");
+
+    class = class_get(javastring_toutf(name, true));
+    if (class == NULL)
+       return NULL;
+
+    use_class_as_object(class);
+
+    return (java_lang_Class*)class;
 }
 
 /*
diff --git a/nat/DatagramPacket.c b/nat/DatagramPacket.c
new file mode 100644 (file)
index 0000000..41f09cc
--- /dev/null
@@ -0,0 +1,12 @@
+/* class: java/net/DatagramPacket */
+
+/*
+ * Class:     java/net/DatagramPacket
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_net_DatagramPacket_init (JNIEnv *env )
+{
+    if (runverbose)
+       log_text("Java_java_net_DatagramPacket_init called");
+}
diff --git a/nat/DatagramPacket.h b/nat/DatagramPacket.h
new file mode 100644 (file)
index 0000000..98a9394
--- /dev/null
@@ -0,0 +1,19 @@
+/* This file is machine generated, don't edit it !*/
+
+/* Structure information for class: java/net/DatagramPacket */
+
+typedef struct java_net_DatagramPacket {
+   java_objectheader header;
+   java_bytearray* buf;
+   s4 offset;
+   s4 length;
+   struct java_net_InetAddress* address;
+   s4 port;
+} java_net_DatagramPacket;
+
+/*
+ * Class:     java/net/DatagramPacket
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_net_DatagramPacket_init (JNIEnv *env );
index d93aac96016546053e779321d61be998f7ab5fda..5e97c9763493d88f6074f303dc844855959ed5b4 100644 (file)
@@ -19,7 +19,7 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Field_get ( JN
 
   /* The fieldid is used to retrieve the value, for primitive types a new 
      object for wrapping the primitive type is created.  */
-  if (st || obj)   
+  if (st || obj)
     switch (this->slot) {
       case 'I' : {
                   /* create wrapping class */
index 0cb16900c2b0a173ce01d8628a44afa671f10e42..f6a38a73a850711f20bc2ff9d8961cbd21ad2105 100644 (file)
@@ -7,8 +7,8 @@
  */
 JNIEXPORT void JNICALL Java_java_net_InetAddress_init (JNIEnv *env )
 {
-  log_text("Java_java_net_InetAddress_init called");
-
+    if (runverbose)
+       log_text("Java_java_net_InetAddress_init called");
 }
 
 
index 05614b61c0306955078da99885590c9670ba4598..93521c9c192e32d29e80acc487b3db53e134503f 100644 (file)
@@ -1,13 +1,30 @@
 /* class: java/net/InetAddressImpl */
 
+#include <netinet/in.h>
+#include <netdb.h>
+
+#define HOSTNMSZ 80
+
 /*
  * Class:     java/net/InetAddressImpl
  * Method:    getHostByAddr
  * Signature: (I)Ljava/lang/String;
  */
-JNIEXPORT struct java_lang_String* JNICALL Java_java_net_InetAddressImpl_getHostByAddr (JNIEnv *env ,  struct java_net_InetAddressImpl* this , s4 par1)
+JNIEXPORT struct java_lang_String* JNICALL Java_java_net_InetAddressImpl_getHostByAddr (JNIEnv *env ,  struct java_net_InetAddressImpl* this , s4 addr)
 {
-  log_text("Java_java_net_InetAddressImpl_getHostByAddr called");
+    struct hostent* ent;
+
+    if (runverbose)
+       log_text("Java_java_net_InetAddressImpl_getHostByAddr called");
+
+    addr = htonl(addr);
+    ent = gethostbyaddr((char*)&addr, sizeof(s4), AF_INET);
+    if (ent == 0) {
+       exceptionptr = native_new_and_init (class_java_net_UnknownHostException);
+       return 0;
+    }
+
+    return (java_lang_String*)javastring_new_char((char*)ent->h_name);
 }
 
 /*
@@ -17,7 +34,10 @@ JNIEXPORT struct java_lang_String* JNICALL Java_java_net_InetAddressImpl_getHost
  */
 JNIEXPORT s4 JNICALL Java_java_net_InetAddressImpl_getInetFamily (JNIEnv *env ,  struct java_net_InetAddressImpl* this )
 {
-  log_text("Java_java_net_InetAddressImpl_getInetFamily called");
+    if (runverbose)
+       log_text("Java_java_net_InetAddressImpl_getInetFamily called");
+
+    return (AF_INET);
 }
 
 /*
@@ -27,7 +47,15 @@ JNIEXPORT s4 JNICALL Java_java_net_InetAddressImpl_getInetFamily (JNIEnv *env ,
  */
 JNIEXPORT struct java_lang_String* JNICALL Java_java_net_InetAddressImpl_getLocalHostName (JNIEnv *env ,  struct java_net_InetAddressImpl* this )
 {
-  log_text("Java_java_net_InetAddressImpl_getLocalHostName called");
+    char hostname[HOSTNMSZ];
+
+    if (runverbose)
+       log_text("Java_java_net_InetAddressImpl_getLocalHostName called");
+
+    if (gethostname(hostname, HOSTNMSZ-1) < 0) {
+       return (java_lang_String*)javastring_new_char("localhost");
+    }
+    return (java_lang_String*)javastring_new_char(hostname);
 }
 
 /*
@@ -35,9 +63,44 @@ JNIEXPORT struct java_lang_String* JNICALL Java_java_net_InetAddressImpl_getLoca
  * Method:    lookupAllHostAddr
  * Signature: (Ljava/lang/String;)[[B
  */
-JNIEXPORT java_arrayarray* JNICALL Java_java_net_InetAddressImpl_lookupAllHostAddr (JNIEnv *env ,  struct java_net_InetAddressImpl* this , struct java_lang_String* par1)
+JNIEXPORT java_arrayarray* JNICALL Java_java_net_InetAddressImpl_lookupAllHostAddr (JNIEnv *env ,  struct java_net_InetAddressImpl* this , struct java_lang_String* str)
 {
-  log_text("Java_java_net_InetAddressImpl_lookupAllHostAddr called");
+    char *name;
+    struct hostent* ent;
+    java_arrayarray *array;
+    int i;
+    int alength;
+    constant_arraydescriptor arraydesc;
+
+    if (runverbose)
+       log_text("Java_java_net_InetAddressImpl_lookupAllHostAddr called");
+
+    name = javastring_tochar((java_objectheader*)str);
+
+    ent = gethostbyname(name);
+    if (ent == 0) {
+       exceptionptr = native_new_and_init (class_java_net_UnknownHostException);
+       return 0;
+    }
+
+    for (alength = 0; ent->h_addr_list[alength]; alength++)
+       ;
+
+    arraydesc.arraytype = ARRAYTYPE_BYTE;
+    array = builtin_newarray_array(alength, &arraydesc);
+    assert(array != 0);
+
+    for (i = 0; i < alength; i++) {
+       java_bytearray *obj;
+
+       /* Copy in the network address */
+       obj = builtin_newarray_byte(sizeof(s4));
+       assert(obj != 0);
+       *(s4*)obj->data = *(s4*)ent->h_addr_list[i];
+       array->data[i] = (java_arrayheader*)obj;
+    }
+
+    return array;
 }
 
 /*
@@ -47,6 +110,10 @@ JNIEXPORT java_arrayarray* JNICALL Java_java_net_InetAddressImpl_lookupAllHostAd
  */
 JNIEXPORT void JNICALL Java_java_net_InetAddressImpl_makeAnyLocalAddress (JNIEnv *env ,  struct java_net_InetAddressImpl* this , struct java_net_InetAddress* par1)
 {
-  log_text("Java_java_net_InetAddressImpl_makeAnyLocalAddress called");
-}
+    if (runverbose)
+       log_text("Java_java_net_InetAddressImpl_makeAnyLocalAddress called");
 
+    /* par1->hostName = 0; */
+    par1->address = htonl(INADDR_ANY);
+    par1->family = AF_INET;
+}
diff --git a/nat/Integer.h b/nat/Integer.h
new file mode 100644 (file)
index 0000000..b8ab627
--- /dev/null
@@ -0,0 +1,9 @@
+/* This file is machine generated, don't edit it !*/
+
+/* Structure information for class: java/lang/Integer */
+
+typedef struct java_lang_Integer {
+   java_objectheader header;
+   s4 value;
+} java_lang_Integer;
+
index 10f318f6f0e541936649fa1f05b45d4c362e9627..d97eab42da8614e7183eef17b9d43397f31028a9 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,6 +49,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -78,12 +79,11 @@ DIST_COMMON =  Makefile.am Makefile.in
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
-all: Makefile
-
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
 .SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu nat/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -106,60 +106,73 @@ distdir: $(DISTFILES)
          && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu nat/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
-info:
-dvi:
-check: all
-       $(MAKE)
-installcheck:
-install-exec: 
-       @$(NORMAL_INSTALL)
-
-install-data: 
-       @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-       @:
-
-uninstall: 
-
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile
+all-redirect: all-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-generic
+mostlyclean-am:  mostlyclean-generic
 
-clean:  clean-generic mostlyclean
+mostlyclean: mostlyclean-am
 
-distclean:  distclean-generic clean
-       -rm -f config.status
+clean-am:  clean-generic mostlyclean-am
 
-maintainer-clean:  maintainer-clean-generic distclean
+clean: clean-am
+
+distclean-am:  distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-generic distclean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
-.PHONY: tags distdir info dvi installcheck install-exec install-data \
-install uninstall all installdirs mostlyclean-generic distclean-generic \
-clean-generic maintainer-clean-generic clean mostlyclean distclean \
-maintainer-clean
+maintainer-clean: maintainer-clean-am
+
+.PHONY: tags distdir info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
index 78a46d1ee8e01218813e9417f5b87fb31833ae17..5b3fa469d801e55288be78b813f1e2e265dfc72d 100644 (file)
@@ -35,6 +35,9 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_Object_clone ( JNIEnv
 
            size = sizeof(java_arrayheader)
              + array->size * multiplicator[array->arraytype];
+           if (array->arraytype == ARRAYTYPE_OBJECT /* elementtype */
+               || array->arraytype == ARRAYTYPE_ARRAY) /* elementdescriptor */
+               size += sizeof(void*);
 
            if (array->arraytype==ARRAYTYPE_OBJECT || array->arraytype==ARRAYTYPE_OBJECT)
                size+=sizeof(void*);
diff --git a/nat/PlainDatagramSocketImpl.c b/nat/PlainDatagramSocketImpl.c
new file mode 100644 (file)
index 0000000..ccfd807
--- /dev/null
@@ -0,0 +1,406 @@
+/* class: java/net/PlainDatagramSocketImpl */
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    bind
+ * Signature: (ILjava/net/InetAddress;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_bind (JNIEnv *env, 
+                                           struct java_net_PlainDatagramSocketImpl* this,
+                                           s4 port, struct java_net_InetAddress* laddr)
+{
+    int r;
+    struct sockaddr_in addr;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_bind called");
+
+#if defined(BSD44)
+    addr.sin_len = sizeof(addr);
+#endif
+    addr.sin_family = AF_INET;
+    addr.sin_port = htons(port);
+    addr.sin_addr.s_addr = htonl(laddr->address);
+
+    r = bind(this->fd->fd, (struct sockaddr*)&addr, sizeof(addr));
+    if (r < 0) {
+       exceptionptr = native_new_and_init (class_java_net_SocketException);
+       return;
+    }
+
+    this->localPort = addr.sin_port; /* is this correct? */
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    datagramSocketClose
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_datagramSocketClose (JNIEnv *env,  struct java_net_PlainDatagramSocketImpl* this)
+{
+    int r;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_datagramSocketClose called");
+
+    if (this->fd->fd != -1) {
+       r = close(this->fd->fd);
+       this->fd->fd = -1;
+       if (r < 0) {
+           exceptionptr = native_new_and_init (class_java_net_SocketException);
+           return;
+       }
+    }
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    datagramSocketCreate
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this)
+{
+    int fd;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate called");
+
+    fd = threadedSocket(AF_INET, SOCK_DGRAM, 0);
+    this->fd->fd = fd;
+    if (fd < 0) {
+       exceptionptr = native_new_and_init (class_java_net_SocketException);
+       return;
+    }
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    getTTL
+ * Signature: ()B
+ */
+JNIEXPORT s4 JNICALL
+Java_java_net_PlainDatagramSocketImpl_getTTL (JNIEnv *env, struct java_net_PlainDatagramSocketImpl* this)
+{
+    return Java_java_net_PlainDatagramSocketImpl_getTimeToLive(env, this);
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    getTimeToLive
+ * Signature: ()I
+ */
+JNIEXPORT s4 JNICALL
+Java_java_net_PlainDatagramSocketImpl_getTimeToLive (JNIEnv *env, struct java_net_PlainDatagramSocketImpl* this)
+{
+    int ttl;
+    int size = sizeof(int);
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_getTimeToLive called");
+
+    if (getsockopt(this->fd->fd, IPPROTO_IP, IP_TTL, &ttl, &size) == -1)
+    {
+       exceptionptr = native_new_and_init(class_java_io_IOException);
+       return 0;
+    }
+
+    return ttl;
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_init (JNIEnv *env )
+{
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_init called");
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    join
+ * Signature: (Ljava/net/InetAddress;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_join (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , struct java_net_InetAddress* addr)
+{
+    struct ip_mreq mreq;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_join called");
+
+    mreq.imr_multiaddr.s_addr = htonl(addr->address);
+    mreq.imr_interface.s_addr = INADDR_ANY;
+
+    if (setsockopt(this->fd->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(struct ip_mreq)) == -1)
+       exceptionptr = native_new_and_init(class_java_io_IOException);
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    leave
+ * Signature: (Ljava/net/InetAddress;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_leave (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , struct java_net_InetAddress* addr)
+{
+    struct ip_mreq mreq;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_leave called");
+
+    mreq.imr_multiaddr.s_addr = htonl(addr->address);
+    mreq.imr_interface.s_addr = INADDR_ANY;
+
+    if (setsockopt(this->fd->fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(struct ip_mreq)) == -1)
+       exceptionptr = native_new_and_init(class_java_io_IOException);
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    peek
+ * Signature: (Ljava/net/InetAddress;)I
+ */
+JNIEXPORT s4 JNICALL
+Java_java_net_PlainDatagramSocketImpl_peek (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , struct java_net_InetAddress* addr)
+{
+    int r;
+    struct sockaddr_in saddr;
+    int alen = sizeof(saddr);
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_peek called");
+
+    r = threadedRecvfrom(this->fd->fd, 0, 0, MSG_PEEK, (struct sockaddr*)&saddr, &alen);
+    if (r < 0) {
+       exceptionptr = native_new_and_init (class_java_net_SocketException);
+       return;
+    }
+
+    addr->address = ntohl(saddr.sin_addr.s_addr);
+
+    return (r);
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    receive
+ * Signature: (Ljava/net/DatagramPacket;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_receive (JNIEnv *env, struct java_net_PlainDatagramSocketImpl* this, struct java_net_DatagramPacket* pkt)
+{
+    int r;
+    struct sockaddr_in addr;
+    int alen = sizeof(addr);
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_receive called");
+
+    r = threadedRecvfrom(this->fd->fd, pkt->buf->data, pkt->length, 0, (struct sockaddr*)&addr, &alen);
+    if (r < 0) {
+       exceptionptr = native_new_and_init (class_java_net_SocketException);
+       return;
+    }
+
+    pkt->length = r;
+    pkt->port = ntohs(addr.sin_port);
+    if (pkt->address == 0)
+       pkt->address = (java_net_InetAddress*)native_new_and_init(loader_load(utf_new_char("java/net/InetAddress")));
+    pkt->address->address = ntohl(addr.sin_addr.s_addr);
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    send
+ * Signature: (Ljava/net/DatagramPacket;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_send (JNIEnv *env, struct java_net_PlainDatagramSocketImpl* this, struct java_net_DatagramPacket* pkt)
+{
+    int r;
+    struct sockaddr_in addr;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_send called");
+
+#if defined(BSD44)
+    addr.sin_len = sizeof(addr);
+#endif
+    addr.sin_family = AF_INET;
+    addr.sin_port = htons(pkt->port);
+    addr.sin_addr.s_addr = htonl(pkt->address->address);
+
+    r = threadedSendto(this->fd->fd, pkt->buf->data, pkt->length, 0, (struct sockaddr*)&addr, sizeof(addr));
+    if (r < 0) {
+       exceptionptr = native_new_and_init (class_java_net_SocketException);
+       return;
+    }
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    setTTL
+ * Signature: (B)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_setTTL (JNIEnv *env, struct java_net_PlainDatagramSocketImpl* this, s4 ttl)
+{
+    Java_java_net_PlainDatagramSocketImpl_setTimeToLive(env, this, ttl);
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    setTimeToLive
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_setTimeToLive (JNIEnv *env, struct java_net_PlainDatagramSocketImpl* this, s4 ttl)
+{
+    int optval = ttl;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_setTimeToLive called");
+
+    if (setsockopt(this->fd->fd, IPPROTO_IP, IP_TTL, &optval, sizeof(int)) == -1)
+       exceptionptr = native_new_and_init(class_java_io_IOException);
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    socketGetOption
+ * Signature: (I)I
+ */
+JNIEXPORT s4 JNICALL
+Java_java_net_PlainDatagramSocketImpl_socketGetOption (JNIEnv *env, 
+                                                      struct java_net_PlainDatagramSocketImpl* this, s4 opt)
+{
+    int level;
+    int optname;
+    void *optval;
+    int optlen;
+
+    int intopt;
+    struct in_addr in_addr;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_bind called");
+
+    switch (opt)
+    {
+       case /* SO_SNDBUF */ 0x1001 :
+       case /* SO_RCVBUF */ 0x1002 :
+           level = SOL_SOCKET;
+           optname = (opt == 0x1001) ? SO_SNDBUF : SO_RCVBUF;
+           optval = &intopt;
+           optlen = sizeof(int);
+           break;
+
+       case /* IP_MULTICAST_IF */ 0x10 :
+           level = IPPROTO_IP;
+           optname = IP_MULTICAST_IF;
+           optval = &in_addr;
+           optlen = sizeof(struct in_addr);
+           break;
+           
+       case /* SO_BINDADDR */ 0x000f :
+           {
+               struct sockaddr_in sockaddr;
+               int size = sizeof(struct sockaddr_in);
+
+               if (getsockname(this->fd->fd, &sockaddr, &size) == -1)
+               {
+                   exceptionptr = native_new_and_init(class_java_net_SocketException);
+                   return 0;
+               }
+
+               return ntohl(sockaddr.sin_addr.s_addr);
+           }
+           break;
+
+       default :
+           assert(0);
+    }
+
+    if (getsockopt(this->fd->fd, level, optname, optval, &optlen) == -1)
+       exceptionptr = native_new_and_init(class_java_net_SocketException);
+
+    switch (optname)
+    {
+       case SO_SNDBUF :
+       case SO_RCVBUF :
+           return intopt;
+
+       case IP_MULTICAST_IF :
+           return in_addr.s_addr;
+    }
+
+    assert(0);
+
+    return 0;
+}
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    socketSetOption
+ * Signature: (ILjava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainDatagramSocketImpl_socketSetOption (JNIEnv *env, 
+                                                      struct java_net_PlainDatagramSocketImpl* this, s4 opt, struct java_lang_Object* obj)
+{
+    int level;
+    int optname;
+    void *optval;
+    int optlen;
+
+    int flag;
+    int bufsize;
+    struct in_addr in_addr;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainDatagramSocketImpl_socketSetOption called");
+
+    switch (opt)
+    {
+       case /* SO_REUSEADDR */ 0x04 :
+           flag = ((java_lang_Integer*)obj)->value;
+
+           level = SOL_SOCKET;
+           optname = SO_REUSEADDR;
+           optval = &flag;
+           optlen = sizeof(int);
+           break;
+
+       case /* SO_SNDBUF */ 0x1001 :
+       case /* SO_RCVBUF */ 0x1002 :
+           bufsize = ((java_lang_Integer*)obj)->value;
+
+           level = SOL_SOCKET;
+           optname = (opt == 0x1001) ? SO_SNDBUF : SO_RCVBUF;
+           optval = &level;
+           optlen = sizeof(int);
+           break;
+
+       case /* IP_MULTICAST_IF */ 0x10 :
+           in_addr.s_addr = ((java_net_InetAddress*)obj)->address;
+
+           level = IPPROTO_IP;
+           optname = IP_MULTICAST_IF;
+           optval = &in_addr;
+           optlen = sizeof(struct in_addr);
+           break;
+
+       default :
+           assert(0);
+    }
+
+    if (setsockopt(this->fd->fd, level, optname, optval, optlen) == -1)
+       exceptionptr = native_new_and_init(class_java_net_SocketException);
+}
diff --git a/nat/PlainDatagramSocketImpl.h b/nat/PlainDatagramSocketImpl.h
new file mode 100644 (file)
index 0000000..ff81ce9
--- /dev/null
@@ -0,0 +1,101 @@
+/* This file is machine generated, don't edit it !*/
+
+/* Structure information for class: java/net/PlainDatagramSocketImpl */
+
+typedef struct java_net_PlainDatagramSocketImpl {
+   java_objectheader header;
+   s4 localPort;
+   struct java_io_FileDescriptor* fd;
+   s4 timeout;
+} java_net_PlainDatagramSocketImpl;
+
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    bind
+ * Signature: (ILjava/net/InetAddress;)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_bind (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , s4 par1, struct java_net_InetAddress* par2);
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    datagramSocketClose
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_datagramSocketClose (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this );
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    datagramSocketCreate
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this );
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    getTTL
+ * Signature: ()B
+ */
+JNIEXPORT s4 JNICALL Java_java_net_PlainDatagramSocketImpl_getTTL (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this );
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    getTimeToLive
+ * Signature: ()I
+ */
+JNIEXPORT s4 JNICALL Java_java_net_PlainDatagramSocketImpl_getTimeToLive (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this );
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_init (JNIEnv *env );
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    join
+ * Signature: (Ljava/net/InetAddress;)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_join (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , struct java_net_InetAddress* par1);
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    leave
+ * Signature: (Ljava/net/InetAddress;)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_leave (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , struct java_net_InetAddress* par1);
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    peek
+ * Signature: (Ljava/net/InetAddress;)I
+ */
+JNIEXPORT s4 JNICALL Java_java_net_PlainDatagramSocketImpl_peek (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , struct java_net_InetAddress* par1);
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    receive
+ * Signature: (Ljava/net/DatagramPacket;)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_receive (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , struct java_net_DatagramPacket* par1);
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    send
+ * Signature: (Ljava/net/DatagramPacket;)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_send (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , struct java_net_DatagramPacket* par1);
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    setTTL
+ * Signature: (B)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_setTTL (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , s4 par1);
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    setTimeToLive
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_setTimeToLive (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , s4 par1);
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    socketGetOption
+ * Signature: (I)I
+ */
+JNIEXPORT s4 JNICALL Java_java_net_PlainDatagramSocketImpl_socketGetOption (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , s4 par1);
+/*
+ * Class:     java/net/PlainDatagramSocketImpl
+ * Method:    socketSetOption
+ * Signature: (ILjava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainDatagramSocketImpl_socketSetOption (JNIEnv *env ,  struct java_net_PlainDatagramSocketImpl* this , s4 par1, struct java_lang_Object* par2);
diff --git a/nat/PlainSocketImpl.c b/nat/PlainSocketImpl.c
new file mode 100644 (file)
index 0000000..7dc5a56
--- /dev/null
@@ -0,0 +1,384 @@
+/* class: java/net/PlainSocketImpl */
+
+#include <sys/socket.h>
+#include <netinet/tcp.h>
+#include <asm/termios.h>               /* a little linux-centric maybe?? (should be in autoconf) */
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    initProto
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainSocketImpl_initProto (JNIEnv *env )
+{
+    if (runverbose)
+       log_text("Java_java_net_PlainSocketImpl_initProto called");
+}
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketAccept
+ * Signature: (Ljava/net/SocketImpl;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainSocketImpl_socketAccept (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , struct java_net_SocketImpl* sock)
+{
+       int r;
+       int alen;
+       struct sockaddr_in addr;
+
+       if (runverbose)
+           log_text("Java_java_net_PlainSocketImpl_socketAccept called");
+
+       alen = sizeof(addr);
+#if defined(BSD44)
+       addr.sin_len = sizeof(addr);
+#endif
+       addr.sin_family = AF_INET;
+       addr.sin_port = htons(sock->localport);
+       addr.sin_addr.s_addr = htonl(sock->address->address);
+
+       r = threadedAccept(this->fd->fd, (struct sockaddr*)&addr, &alen);
+       if (r < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return;
+       }
+       sock->fd->fd = r;
+
+       /* Enter information into socket object */
+       alen = sizeof(addr);
+       r = getpeername(r, (struct sockaddr*)&addr, &alen);
+       if (r < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return;
+       }
+
+       sock->address->address = ntohl(addr.sin_addr.s_addr);
+       sock->port = ntohs(addr.sin_port);
+}
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketAvailable
+ * Signature: ()I
+ */
+JNIEXPORT s4 JNICALL
+Java_java_net_PlainSocketImpl_socketAvailable (JNIEnv *env ,  struct java_net_PlainSocketImpl* this )
+{
+       int r;
+       int len;
+
+       if (runverbose)
+           log_text("Java_java_net_PlainSocketImpl_socketAvailable called");
+
+       r = ioctl(this->fd->fd, FIONREAD, &len);
+       if (r < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return 0;
+       }
+       return (s4)len;
+}
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketBind
+ * Signature: (Ljava/net/InetAddress;I)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainSocketImpl_socketBind (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , struct java_net_InetAddress* laddr, s4 lport)
+{
+       int r;
+       struct sockaddr_in addr;
+       int fd;
+       int on = 1;
+       int alen;
+
+       if (runverbose)
+           log_text("Java_java_net_PlainSocketImpl_socketBind called");
+
+#if defined(BSD44)
+       addr.sin_len = sizeof(addr);
+#endif
+       addr.sin_family = AF_INET;
+       addr.sin_port = htons(lport);
+       addr.sin_addr.s_addr = htonl(laddr->address);
+
+       fd = this->fd->fd;
+
+       /* Allow rebinding to socket - ignore errors */
+       (void)setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on));
+       r = bind(fd, (struct sockaddr*)&addr, sizeof(addr));
+       if (r < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return;
+       }
+
+       /* Enter information into socket object */
+       this->address = laddr;
+       if (lport == 0) {
+               alen = sizeof(addr);
+               r = getsockname(fd, (struct sockaddr*)&addr, &alen);
+               if (r < 0) {
+                       exceptionptr = native_new_and_init (class_java_io_IOException);
+                       return;
+               }
+               lport = ntohs(addr.sin_port);
+       }
+       this->localport = lport;
+}
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketClose
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainSocketImpl_socketClose (JNIEnv *env ,  struct java_net_PlainSocketImpl* this)
+{
+       int r;
+
+       if (runverbose)
+           log_text("Java_java_net_PlainSocketImpl_socketClose called");
+
+       if (this->fd->fd != -1) {
+               r = close(this->fd->fd);
+               this->fd->fd = -1;
+               if (r < 0) {
+                       exceptionptr = native_new_and_init (class_java_io_IOException);
+                       return;
+               }
+       }
+}
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketConnect
+ * Signature: (Ljava/net/InetAddress;I)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainSocketImpl_socketConnect (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , struct java_net_InetAddress* daddr, s4 dport)
+{
+       int fd;
+       int r;
+       struct sockaddr_in addr;
+       int alen;
+
+       if (runverbose)
+           log_text("Java_java_net_PlainSocketImpl_socketConnect called");
+
+#if defined(BSD44)
+       addr.sin_len = sizeof(addr);
+#endif
+       addr.sin_family = AF_INET;
+       addr.sin_port = htons(dport);
+       addr.sin_addr.s_addr = htonl(daddr->address);
+
+       fd = this->fd->fd;
+       r = threadedConnect(fd, (struct sockaddr*)&addr, sizeof(addr));
+       if (r < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return;
+       }
+
+       /* Enter information into socket object */
+       alen = sizeof(addr);
+       r = getsockname(fd, (struct sockaddr*)&addr, &alen);
+       if (r < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return;
+       }
+
+       this->address = daddr;
+       this->port = dport;
+       this->localport = ntohs(addr.sin_port);
+}
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketCreate
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainSocketImpl_socketCreate (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , s4 /* bool */ stream)
+{
+       int fd;
+       int type;
+
+       if (runverbose)
+           log_text("Java_java_net_PlainSocketImpl_socketCreate called");
+
+       if (stream == 0) {
+               type = SOCK_DGRAM;
+       }
+       else {
+               type = SOCK_STREAM;
+       }
+
+       fd = threadedSocket(AF_INET, type, 0);
+       if (fd < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return;
+       }
+       this->fd->fd = fd;
+}
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketGetOption
+ * Signature: (I)I
+ */
+JNIEXPORT s4 JNICALL
+Java_java_net_PlainSocketImpl_socketGetOption (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , s4 opt)
+{
+    int level;
+    int optname;
+    void *optval;
+    int optlen;
+
+    struct linger linger;
+    int intopt;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainSocketImpl_socketGetOption called");
+
+    switch (opt)
+    {
+       case /* SO_LINGER */ 0x0080 :
+           level = SOL_SOCKET;
+           optname = SO_LINGER;
+           optval = &linger;
+           optlen = sizeof(struct linger);
+           break;
+
+       case /* TCP_NODELAY */ 0x0001 :
+           level = IPPROTO_TCP;
+           optname = TCP_NODELAY;
+           optval = &intopt;
+           optlen = sizeof(int);
+           break;
+
+       case /* SO_SNDBUF */ 0x1001 :
+       case /* SO_RCVBUF */ 0x1002 :
+           level = SOL_SOCKET;
+           optname = (opt == 0x1001) ? SO_SNDBUF : SO_RCVBUF;
+           optval = &intopt;
+           optlen = sizeof(int);
+           break;
+
+       case /* SO_BINDADDR */ 0x000f :
+           return this->address->address;
+
+       default :
+           assert(0);
+    }
+
+    if (getsockopt(this->fd->fd, level, optname, optval, &optlen) == -1)
+       exceptionptr = native_new_and_init(class_java_net_SocketException);
+
+    switch (optname)
+    {
+       case SO_LINGER :
+           if (linger.l_onoff)
+               return linger.l_linger;
+           return -1;
+
+       case TCP_NODELAY :
+           if (intopt)
+               return 1;
+           return -1;          /* -1 == false? */
+
+       case SO_SNDBUF :
+       case SO_RCVBUF :
+           return intopt;
+    }
+
+    assert(0);
+
+    return 0;
+}
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketListen
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainSocketImpl_socketListen (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , s4 count)
+{
+       int r;
+
+       if (runverbose)
+           log_text("java_net_PlainSocketImpl_socketListen called");
+
+       r = listen(this->fd->fd, count);
+       if (r < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return;
+       }
+}
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketSetOption
+ * Signature: (IZLjava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_PlainSocketImpl_socketSetOption (JNIEnv *env,
+                                              struct java_net_PlainSocketImpl* this , s4 cmd, s4 /* bool */ on, struct java_lang_Object* value)
+{
+    int level;
+    int optname;
+    void *optval;
+    int optlen;
+
+    struct linger linger;
+    int nodelay;
+    int bufsize;
+
+    if (runverbose)
+       log_text("Java_java_net_PlainSocketImpl_socketSetOption called");
+
+    switch (cmd)
+    {
+       case /* SO_LINGER */ 0x0080 :
+           if (on)
+           {
+               linger.l_onoff = 1;
+               linger.l_linger = ((java_lang_Integer*)value)->value;
+           }
+           else
+               linger.l_onoff = 0;
+
+           level = SOL_SOCKET;
+           optname = SO_LINGER;
+           optval = &linger;
+           optlen = sizeof(struct linger);
+           break;
+
+       case /* TCP_NODELAY */ 0x0001 :
+           nodelay = on ? 1 : 0;
+
+           level = IPPROTO_TCP;
+           optname = TCP_NODELAY;
+           optval = &nodelay;
+           optlen = sizeof(int);
+           break;
+
+       case /* SO_SNDBUF */ 0x1001 :
+       case /* SO_RCVBUF */ 0x1002 :
+           bufsize = ((java_lang_Integer*)value)->value;
+
+           level = SOL_SOCKET;
+           optname = (cmd == 0x1001) ? SO_SNDBUF : SO_RCVBUF;
+           optval = &bufsize;
+           optlen = sizeof(int);
+           break;
+
+       default :
+           assert(0);
+    }
+
+    if (setsockopt(this->fd->fd, level, optname, optval, optlen) == -1)
+       exceptionptr = native_new_and_init(class_java_net_SocketException);
+}
diff --git a/nat/PlainSocketImpl.h b/nat/PlainSocketImpl.h
new file mode 100644 (file)
index 0000000..8aeb5b5
--- /dev/null
@@ -0,0 +1,73 @@
+/* This file is machine generated, don't edit it !*/
+
+/* Structure information for class: java/net/PlainSocketImpl */
+
+typedef struct java_net_PlainSocketImpl {
+   java_objectheader header;
+   struct java_io_FileDescriptor* fd;
+   struct java_net_InetAddress* address;
+   s4 port;
+   s4 localport;
+   s4 timeout;
+} java_net_PlainSocketImpl;
+
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    initProto
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_initProto (JNIEnv *env );
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketAccept
+ * Signature: (Ljava/net/SocketImpl;)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_socketAccept (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , struct java_net_SocketImpl* par1);
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketAvailable
+ * Signature: ()I
+ */
+JNIEXPORT s4 JNICALL Java_java_net_PlainSocketImpl_socketAvailable (JNIEnv *env ,  struct java_net_PlainSocketImpl* this );
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketBind
+ * Signature: (Ljava/net/InetAddress;I)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_socketBind (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , struct java_net_InetAddress* par1, s4 par2);
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketClose
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_socketClose (JNIEnv *env ,  struct java_net_PlainSocketImpl* this );
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketConnect
+ * Signature: (Ljava/net/InetAddress;I)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_socketConnect (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , struct java_net_InetAddress* par1, s4 par2);
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketCreate
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_socketCreate (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , s4 par1);
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketGetOption
+ * Signature: (I)I
+ */
+JNIEXPORT s4 JNICALL Java_java_net_PlainSocketImpl_socketGetOption (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , s4 par1);
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketListen
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_socketListen (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , s4 par1);
+/*
+ * Class:     java/net/PlainSocketImpl
+ * Method:    socketSetOption
+ * Signature: (IZLjava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL Java_java_net_PlainSocketImpl_socketSetOption (JNIEnv *env ,  struct java_net_PlainSocketImpl* this , s4 par1, s4 par2, struct java_lang_Object* par3);
diff --git a/nat/SocketImpl.h b/nat/SocketImpl.h
new file mode 100644 (file)
index 0000000..dd07338
--- /dev/null
@@ -0,0 +1,12 @@
+/* This file is machine generated, don't edit it !*/
+
+/* Structure information for class: java/net/SocketImpl */
+
+typedef struct java_net_SocketImpl {
+   java_objectheader header;
+   struct java_io_FileDescriptor* fd;
+   struct java_net_InetAddress* address;
+   s4 port;
+   s4 localport;
+} java_net_SocketImpl;
+
diff --git a/nat/SocketInputStream.c b/nat/SocketInputStream.c
new file mode 100644 (file)
index 0000000..38f1e97
--- /dev/null
@@ -0,0 +1,45 @@
+/* class: java/net/SocketInputStream */
+
+/*
+ * Class:     java/net/SocketInputStream
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_SocketInputStream_init (JNIEnv *env )
+{
+    if (runverbose)
+       log_text("Java_java_net_SocketInputStream_initProto called");
+}
+
+/*
+ * Class:     java/net/SocketInputStream
+ * Method:    socketRead
+ * Signature: ([BII)I
+ */
+JNIEXPORT s4 JNICALL
+Java_java_net_SocketInputStream_socketRead (JNIEnv *env,  struct java_net_SocketInputStream* this, java_bytearray* buf, s4 offset, s4 len)
+{
+       int r;
+
+       if (runverbose)
+           log_text("Java_java_net_SocketInputStream_socketRead called");
+    
+       assert(blockInts == 0);
+
+       r = threadedRead(this->impl->fd->fd, &buf->data[offset], len);
+       if (r < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return 0;
+       }
+       else if (r == 0) {
+               return (-1);    /* EOF */
+       }
+       else {
+               return (r);
+       }
+
+       assert(blockInts == 0);
+
+       return 0;
+}
diff --git a/nat/SocketInputStream.h b/nat/SocketInputStream.h
new file mode 100644 (file)
index 0000000..7e647a3
--- /dev/null
@@ -0,0 +1,24 @@
+/* This file is machine generated, don't edit it !*/
+
+/* Structure information for class: java/net/SocketInputStream */
+
+typedef struct java_net_SocketInputStream {
+   java_objectheader header;
+   struct java_io_FileDescriptor* fd;
+   s4 eof;
+   struct java_net_SocketImpl* impl;
+   java_bytearray* temp;
+} java_net_SocketInputStream;
+
+/*
+ * Class:     java/net/SocketInputStream
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_net_SocketInputStream_init (JNIEnv *env );
+/*
+ * Class:     java/net/SocketInputStream
+ * Method:    socketRead
+ * Signature: ([BII)I
+ */
+JNIEXPORT s4 JNICALL Java_java_net_SocketInputStream_socketRead (JNIEnv *env ,  struct java_net_SocketInputStream* this , java_bytearray* par1, s4 par2, s4 par3);
diff --git a/nat/SocketOutputStream.c b/nat/SocketOutputStream.c
new file mode 100644 (file)
index 0000000..fbdea73
--- /dev/null
@@ -0,0 +1,42 @@
+/* class: java/net/SocketOutputStream */
+
+/*
+ * Class:     java/net/SocketOutputStream
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_SocketOutputStream_init (JNIEnv *env )
+{
+    if (runverbose)
+       log_text("Java_java_net_SocketOutputStream_init called");
+}
+
+/*
+ * Class:     java/net/SocketOutputStream
+ * Method:    socketWrite
+ * Signature: ([BII)V
+ */
+JNIEXPORT void JNICALL
+Java_java_net_SocketOutputStream_socketWrite (JNIEnv *env,  struct java_net_SocketOutputStream* this, java_bytearray* buf, s4 offset, s4 len)
+{
+       int r;
+
+       if (runverbose)
+           log_text("Java_java_net_SocketOutputStream_socketWrite called");
+
+       assert(blockInts == 0);
+
+       if (this->impl->fd->fd < 0) {
+               /* exceptionptr = native_new_and_init (class_java_io_IOException); */
+               return;
+       }
+       r = threadedWrite(this->impl->fd->fd, &buf->data[offset], len);
+       if (r < 0) {
+               exceptionptr = native_new_and_init (class_java_io_IOException);
+               return;
+       }
+       assert(r == len);
+
+       assert(blockInts == 0);
+}
diff --git a/nat/SocketOutputStream.h b/nat/SocketOutputStream.h
new file mode 100644 (file)
index 0000000..028a1ab
--- /dev/null
@@ -0,0 +1,23 @@
+/* This file is machine generated, don't edit it !*/
+
+/* Structure information for class: java/net/SocketOutputStream */
+
+typedef struct java_net_SocketOutputStream {
+   java_objectheader header;
+   struct java_io_FileDescriptor* fd;
+   struct java_net_SocketImpl* impl;
+   java_bytearray* temp;
+} java_net_SocketOutputStream;
+
+/*
+ * Class:     java/net/SocketOutputStream
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_java_net_SocketOutputStream_init (JNIEnv *env );
+/*
+ * Class:     java/net/SocketOutputStream
+ * Method:    socketWrite
+ * Signature: ([BII)V
+ */
+JNIEXPORT void JNICALL Java_java_net_SocketOutputStream_socketWrite (JNIEnv *env ,  struct java_net_SocketOutputStream* this , java_bytearray* par1, s4 par2, s4 par3);
index 4cc8a8c6d9d4859fb80659b29ce636f4807db8b9..0fd018ce097cba109482648f8cf616a17c18c4e0 100644 (file)
@@ -191,7 +191,7 @@ JNIEXPORT void JNICALL Java_java_lang_System_arraycopy (JNIEnv *env, struct java
 }
 
 #define MAXPROPS 100
-static int activeprops = 16;
+static int activeprops = 15;
 
 static char *proplist[MAXPROPS][2] = {
        { "java.class.path", NULL },
@@ -199,8 +199,6 @@ static char *proplist[MAXPROPS][2] = {
        { "user.home", NULL }, 
        { "user.name", NULL }, 
        { "user.dir",  NULL }, 
-          
-       { "impl.prefix", "" },
 
        { "java.class.version", "45.3" },
        { "java.version", "cacao:0.3" },
@@ -333,6 +331,7 @@ JNIEXPORT void JNICALL Java_java_lang_System_setOut0 (JNIEnv *env , struct java_
 JNIEXPORT struct java_lang_String* JNICALL Java_java_lang_System_mapLibraryName (JNIEnv *env , struct java_lang_String* s)
 {
   char somefile[MAXSTRINGSIZE];
+  char *java_home;
 
   /* return name of any file that exists (relative to root),
      so ClassLoader believes we dynamically load the native library */ 
@@ -340,7 +339,10 @@ JNIEXPORT struct java_lang_String* JNICALL Java_java_lang_System_mapLibraryName
   if (strlen(classpath)+24>MAXSTRINGSIZE)
     panic("filename too long");
 
-  strcpy(somefile,getenv("JAVA_HOME"));
+  java_home = getenv("JAVA_HOME");
+  if (java_home == 0)
+      java_home = "/tmp";
+  strcpy(somefile,java_home);
   strcat(somefile,"/dummy");
 
   return (java_lang_String* ) javastring_new_char(&somefile[1]);
index 737034c9b51db8770b47f2db4297bb7b8589869b..6b08037941e47b5983e7a2ae7a4253a2ee4818af 100644 (file)
@@ -7,8 +7,8 @@
  */
 JNIEXPORT s4 JNICALL Java_java_lang_Thread_countStackFrames ( JNIEnv *env ,  struct java_lang_Thread* this)
 {
-  log_text ("java_lang_Thread_countStackFrames called");
-  return 0;         /* not yet implemented */
+    log_text ("java_lang_Thread_countStackFrames called");
+    return 0;         /* not yet implemented */
 }
 
 /*
@@ -54,6 +54,7 @@ JNIEXPORT struct java_lang_Thread* JNICALL Java_java_lang_Thread_currentThread (
 JNIEXPORT void JNICALL Java_java_lang_Thread_interrupt0 ( JNIEnv *env ,  struct java_lang_Thread* this)
 {
   log_text("Java_java_lang_Thread_interrupt0  called");
+  /* not yet implemented */
 }
 
 /*
@@ -63,14 +64,14 @@ JNIEXPORT void JNICALL Java_java_lang_Thread_interrupt0 ( JNIEnv *env ,  struct
  */
 JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive ( JNIEnv *env ,  struct java_lang_Thread* this)
 {
-  if (runverbose)
-    log_text ("java_lang_Thread_isAlive called");
-
-  #ifdef USE_THREADS
-       return aliveThread((thread*)this);
-  #else
-       return 0;
-  #endif
+    if (runverbose)
+       log_text ("java_lang_Thread_isAlive called");
+
+#ifdef USE_THREADS
+    return aliveThread((thread*)this);
+#else
+    return 0;
+#endif
 }
 
 /*
@@ -80,7 +81,8 @@ JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive ( JNIEnv *env ,  struct java_
  */
 JNIEXPORT s4 JNICALL Java_java_lang_Thread_isInterrupted ( JNIEnv *env ,  struct java_lang_Thread* this, s4 par1)
 {
-  log_text("Java_java_lang_Thread_isInterrupted  called");
+    log_text("Java_java_lang_Thread_isInterrupted  called");
+    return 0;                  /* not yet implemented */
 }
 
 /*
@@ -100,12 +102,12 @@ JNIEXPORT void JNICALL Java_java_lang_Thread_registerNatives ( JNIEnv *env  )
  */
 JNIEXPORT void JNICALL Java_java_lang_Thread_resume0 ( JNIEnv *env ,  struct java_lang_Thread* this)
 {
-  if (runverbose)
-    log_text ("java_lang_Thread_resume0 called");
+    if (runverbose)
+       log_text ("java_lang_Thread_resume0 called");
 
-  #ifdef USE_THREADS
-       resumeThread((thread*)this);
-  #endif
+#ifdef USE_THREADS
+    resumeThread((thread*)this);
+#endif
 }
 
 /*
@@ -115,12 +117,12 @@ JNIEXPORT void JNICALL Java_java_lang_Thread_resume0 ( JNIEnv *env ,  struct jav
  */
 JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0 ( JNIEnv *env ,  struct java_lang_Thread* this, s4 par1)
 {
-  if (runverbose) 
-    log_text ("java_lang_Thread_setPriority0 called");
+    if (runverbose) 
+       log_text ("java_lang_Thread_setPriority0 called");
 
-  #ifdef USE_THREADS
-  setPriorityThread((thread*)this, par1);
-  #endif
+#ifdef USE_THREADS
+    setPriorityThread((thread*)this, par1);
+#endif
 }
 
 /*
@@ -128,16 +130,14 @@ JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0 ( JNIEnv *env ,  struc
  * Method:    sleep
  * Signature: (J)V
  */
-JNIEXPORT void JNICALL Java_java_lang_Thread_sleep ( JNIEnv *env ,  s8 par1)
+JNIEXPORT void JNICALL Java_java_lang_Thread_sleep (JNIEnv *env, s8 millis)
 {
-  if (runverbose)
-    log_text ("java_lang_Thread_sleep called");
+    if (runverbose)
+       log_text ("java_lang_Thread_sleep called");
 
-  #ifdef USE_THREADS
-       yieldThread();
-  #endif
-       
-  /* not yet implemented */
+#ifdef USE_THREADS
+    sleepThread(millis);
+#endif
 }
 
 /*
index 51307463038fef01ef13241f48884ab14d1e736a..e87cc9334e2315dfb9ce86142de574f3188e3b4c 100644 (file)
--- a/native.c
+++ b/native.c
@@ -29,8 +29,8 @@
 #include <assert.h>
 #include <sys/time.h>
 
-#include "../threads/thread.h"                       /* schani */
-#include "../threads/locks.h"
+#include "threads/thread.h"                       /* schani */
+#include "threads/locks.h"
 
 /* INCLUDE-Files fuer IO-Funktionen */
 
@@ -69,6 +69,8 @@ static classinfo *class_java_io_SyncFailedException;
 static classinfo *class_java_io_IOException;
 static classinfo *class_java_io_UnixFileSystem;
 static classinfo *class_java_security_PrivilegedActionException;
+static classinfo *class_java_net_UnknownHostException;
+static classinfo *class_java_net_SocketException;
 static classinfo *class_java_lang_NoSuchMethodException;
 static classinfo *class_java_lang_Double;
 static classinfo *class_java_lang_Float;
@@ -136,6 +138,11 @@ static void use_class_as_object (classinfo *c)
 #include "nat/BigInteger.c"
 #include "nat/InetAddress.c"
 #include "nat/InetAddressImpl.c"
+#include "nat/DatagramPacket.c"
+#include "nat/PlainDatagramSocketImpl.c"
+#include "nat/PlainSocketImpl.c"
+#include "nat/SocketInputStream.c"
+#include "nat/SocketOutputStream.c"
 #include "nat/AccessController.c"
 #include "nat/ClassLoader_NativeLibrary.c"
 #include "nat/UnixFileSystem.c"
@@ -208,6 +215,10 @@ void native_loadclasses()
                class_new ( utf_new_char ("java/lang/ClassLoader") );   
        class_java_security_PrivilegedActionException =
                class_new( utf_new_char("java/security/PrivilegedActionException"));
+       class_java_net_UnknownHostException = 
+               loader_load( utf_new_char ("java/net/UnknownHostException") );
+       class_java_net_SocketException = 
+               loader_load( utf_new_char ("java/net/SocketException") );
        class_java_lang_IllegalArgumentException =
                class_new( utf_new_char("java/lang/IllegalArgumentException"));
        class_java_lang_ArrayIndexOutOfBoundsException =
index bfb734b3919f72ec0a91cab75fe8bff1e90cabf4..b820b0ee527f4ad3b1deb7c36cad949e8c19c01d 100644 (file)
@@ -17,7 +17,7 @@
                 Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
                         Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
 
-       Last Change: $Id: cacao.c 135 1999-10-04 10:35:09Z roman $
+       Last Change: $Id: cacao.c 136 1999-11-09 11:33:46Z schani $
 
 *******************************************************************************/
 
@@ -733,8 +733,6 @@ int main(int argc, char **argv)
 
        topclass = loader_load ( utf_new_char (cp) );
 
-       loader_compute_subclasses();
-
        gc_init();
 
 #ifdef USE_THREADS
index 134276556ab9f90eb2b9725a1210d3b443b0af32..5e3f4b731c9f7688dfae430cc3a7050a51711222 100644 (file)
        Changes: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
                 Philipp Tomsich     EMAIL: cacao@complang.tuwien.ac.at
 
-       Last Change: $Id: headers.c 135 1999-10-04 10:35:09Z roman $
+       Last Change: $Id: headers.c 136 1999-11-09 11:33:46Z schani $
 
 *******************************************************************************/
 
+#define CACAOH
+
 #include "config.h" /* phil */
 #include "global.h"
 #include "tables.h"
index d7432726b4b0908dd93e7ad38e1287b09be1ba58..bedd4b8f88a3f19577dcbc72a97a01c23351c32d 100644 (file)
@@ -1233,54 +1233,63 @@ jfieldID GetStaticFieldID (JNIEnv *env, jclass clazz, const char *name, const ch
 
 jobject GetStaticObjectField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.a;       
 }
 
 
 jboolean GetStaticBooleanField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jbyte GetStaticByteField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jchar GetStaticCharField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jshort GetStaticShortField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jint GetStaticIntField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.i;       
 }
 
 
 jlong GetStaticLongField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.l;
 }
 
 
 jfloat GetStaticFloatField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.f;
 }
 
 
 jdouble GetStaticDoubleField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 {
+       class_init(clazz);
        return fieldID->value.d;
 }
 
@@ -1288,54 +1297,63 @@ jdouble GetStaticDoubleField (JNIEnv *env, jclass clazz, jfieldID fieldID)
 
 void SetStaticObjectField (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value)
 {
+       class_init(clazz);
        fieldID->value.a = value;
 }
 
 
 void SetStaticBooleanField (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticByteField (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticCharField (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticShortField (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticIntField (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value)
 {
+       class_init(clazz);
        fieldID->value.i = value;
 }
 
 
 void SetStaticLongField (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value)
 {
+       class_init(clazz);
        fieldID->value.l = value;
 }
 
 
 void SetStaticFloatField (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value)
 {
+       class_init(clazz);
        fieldID->value.f = value;
 }
 
 
 void SetStaticDoubleField (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value)
 {
+       class_init(clazz);
        fieldID->value.d = value;
 }
 
@@ -2154,3 +2172,16 @@ JNIEnv env =
     &DeleteWeakGlobalRef,
     &ExceptionCheck
     };
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
index 51307463038fef01ef13241f48884ab14d1e736a..e87cc9334e2315dfb9ce86142de574f3188e3b4c 100644 (file)
@@ -29,8 +29,8 @@
 #include <assert.h>
 #include <sys/time.h>
 
-#include "../threads/thread.h"                       /* schani */
-#include "../threads/locks.h"
+#include "threads/thread.h"                       /* schani */
+#include "threads/locks.h"
 
 /* INCLUDE-Files fuer IO-Funktionen */
 
@@ -69,6 +69,8 @@ static classinfo *class_java_io_SyncFailedException;
 static classinfo *class_java_io_IOException;
 static classinfo *class_java_io_UnixFileSystem;
 static classinfo *class_java_security_PrivilegedActionException;
+static classinfo *class_java_net_UnknownHostException;
+static classinfo *class_java_net_SocketException;
 static classinfo *class_java_lang_NoSuchMethodException;
 static classinfo *class_java_lang_Double;
 static classinfo *class_java_lang_Float;
@@ -136,6 +138,11 @@ static void use_class_as_object (classinfo *c)
 #include "nat/BigInteger.c"
 #include "nat/InetAddress.c"
 #include "nat/InetAddressImpl.c"
+#include "nat/DatagramPacket.c"
+#include "nat/PlainDatagramSocketImpl.c"
+#include "nat/PlainSocketImpl.c"
+#include "nat/SocketInputStream.c"
+#include "nat/SocketOutputStream.c"
 #include "nat/AccessController.c"
 #include "nat/ClassLoader_NativeLibrary.c"
 #include "nat/UnixFileSystem.c"
@@ -208,6 +215,10 @@ void native_loadclasses()
                class_new ( utf_new_char ("java/lang/ClassLoader") );   
        class_java_security_PrivilegedActionException =
                class_new( utf_new_char("java/security/PrivilegedActionException"));
+       class_java_net_UnknownHostException = 
+               loader_load( utf_new_char ("java/net/UnknownHostException") );
+       class_java_net_SocketException = 
+               loader_load( utf_new_char ("java/net/SocketException") );
        class_java_lang_IllegalArgumentException =
                class_new( utf_new_char("java/lang/IllegalArgumentException"));
        class_java_lang_ArrayIndexOutOfBoundsException =
index d93aac96016546053e779321d61be998f7ab5fda..5e97c9763493d88f6074f303dc844855959ed5b4 100644 (file)
@@ -19,7 +19,7 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Field_get ( JN
 
   /* The fieldid is used to retrieve the value, for primitive types a new 
      object for wrapping the primitive type is created.  */
-  if (st || obj)   
+  if (st || obj)
     switch (this->slot) {
       case 'I' : {
                   /* create wrapping class */
index 737034c9b51db8770b47f2db4297bb7b8589869b..6b08037941e47b5983e7a2ae7a4253a2ee4818af 100644 (file)
@@ -7,8 +7,8 @@
  */
 JNIEXPORT s4 JNICALL Java_java_lang_Thread_countStackFrames ( JNIEnv *env ,  struct java_lang_Thread* this)
 {
-  log_text ("java_lang_Thread_countStackFrames called");
-  return 0;         /* not yet implemented */
+    log_text ("java_lang_Thread_countStackFrames called");
+    return 0;         /* not yet implemented */
 }
 
 /*
@@ -54,6 +54,7 @@ JNIEXPORT struct java_lang_Thread* JNICALL Java_java_lang_Thread_currentThread (
 JNIEXPORT void JNICALL Java_java_lang_Thread_interrupt0 ( JNIEnv *env ,  struct java_lang_Thread* this)
 {
   log_text("Java_java_lang_Thread_interrupt0  called");
+  /* not yet implemented */
 }
 
 /*
@@ -63,14 +64,14 @@ JNIEXPORT void JNICALL Java_java_lang_Thread_interrupt0 ( JNIEnv *env ,  struct
  */
 JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive ( JNIEnv *env ,  struct java_lang_Thread* this)
 {
-  if (runverbose)
-    log_text ("java_lang_Thread_isAlive called");
-
-  #ifdef USE_THREADS
-       return aliveThread((thread*)this);
-  #else
-       return 0;
-  #endif
+    if (runverbose)
+       log_text ("java_lang_Thread_isAlive called");
+
+#ifdef USE_THREADS
+    return aliveThread((thread*)this);
+#else
+    return 0;
+#endif
 }
 
 /*
@@ -80,7 +81,8 @@ JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive ( JNIEnv *env ,  struct java_
  */
 JNIEXPORT s4 JNICALL Java_java_lang_Thread_isInterrupted ( JNIEnv *env ,  struct java_lang_Thread* this, s4 par1)
 {
-  log_text("Java_java_lang_Thread_isInterrupted  called");
+    log_text("Java_java_lang_Thread_isInterrupted  called");
+    return 0;                  /* not yet implemented */
 }
 
 /*
@@ -100,12 +102,12 @@ JNIEXPORT void JNICALL Java_java_lang_Thread_registerNatives ( JNIEnv *env  )
  */
 JNIEXPORT void JNICALL Java_java_lang_Thread_resume0 ( JNIEnv *env ,  struct java_lang_Thread* this)
 {
-  if (runverbose)
-    log_text ("java_lang_Thread_resume0 called");
+    if (runverbose)
+       log_text ("java_lang_Thread_resume0 called");
 
-  #ifdef USE_THREADS
-       resumeThread((thread*)this);
-  #endif
+#ifdef USE_THREADS
+    resumeThread((thread*)this);
+#endif
 }
 
 /*
@@ -115,12 +117,12 @@ JNIEXPORT void JNICALL Java_java_lang_Thread_resume0 ( JNIEnv *env ,  struct jav
  */
 JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0 ( JNIEnv *env ,  struct java_lang_Thread* this, s4 par1)
 {
-  if (runverbose) 
-    log_text ("java_lang_Thread_setPriority0 called");
+    if (runverbose) 
+       log_text ("java_lang_Thread_setPriority0 called");
 
-  #ifdef USE_THREADS
-  setPriorityThread((thread*)this, par1);
-  #endif
+#ifdef USE_THREADS
+    setPriorityThread((thread*)this, par1);
+#endif
 }
 
 /*
@@ -128,16 +130,14 @@ JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0 ( JNIEnv *env ,  struc
  * Method:    sleep
  * Signature: (J)V
  */
-JNIEXPORT void JNICALL Java_java_lang_Thread_sleep ( JNIEnv *env ,  s8 par1)
+JNIEXPORT void JNICALL Java_java_lang_Thread_sleep (JNIEnv *env, s8 millis)
 {
-  if (runverbose)
-    log_text ("java_lang_Thread_sleep called");
+    if (runverbose)
+       log_text ("java_lang_Thread_sleep called");
 
-  #ifdef USE_THREADS
-       yieldThread();
-  #endif
-       
-  /* not yet implemented */
+#ifdef USE_THREADS
+    sleepThread(millis);
+#endif
 }
 
 /*
index 16b647d50d6561faf857633b05f4b54ccf3a693c..2c62fba62aa02fba4adfa659f9e3008f67313b1f 100644 (file)
@@ -288,6 +288,60 @@ threadedWrite(int fd, char* buf, int len)
     return (ptr - buf);
 }
 
+/*
+ * Receive, but only if we can.
+ */
+int
+threadedRecvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *addrlen)
+{
+    int r;
+
+    DBG(   printf("threadedRecvfrom\n");          )
+
+#if defined(BLOCKING_CALLS)
+    blockOnFile(fd, TH_READ);
+#endif
+    for (;;)
+    {
+       r = recvfrom(fd, buf, len, flags, addr, addrlen);
+       if (r < 0
+           && (errno == EAGAIN || errno == EWOULDBLOCK
+               || errno == EINTR))
+       {
+           blockOnFile(fd, TH_READ);
+           continue;
+       }
+       return (r);
+    }
+}
+
+/*
+ * Send, but only if we can.
+ */
+int
+threadedSendto (int fd, void *buf, size_t len, int flags, struct sockaddr *addr, int addrlen)
+{
+    int r;
+
+    DBG(   printf("threadedSendto\n");          )
+
+#if defined(BLOCKING_CALLS)
+    blockOnFile(fd, TH_WRITE);
+#endif
+    for (;;)
+    {
+       r = sendto(fd, buf, len, flags, addr, addrlen);
+       if (r < 0
+           && (errno == EAGAIN || errno == EWOULDBLOCK
+               || errno == EINTR))
+       {
+           blockOnFile(fd, TH_WRITE);
+           continue;
+       }
+       return (r);
+    }
+}
+
 /*
  * An attempt to access a file would block, so suspend the thread until
  * it will happen.
@@ -303,6 +357,7 @@ DBG(        printf("blockOnFile()\n");                                      )
     {
        maxFd = fd;
     }
+
     if (op == TH_READ)
     {
        FD_SET(fd, &readsPending);
@@ -332,10 +387,47 @@ checkEvents(bool block)
     thread* tid;
     thread* ntid;
     int i;
-    int b;
+    s8 time = -1;
+    struct timeval tv;
+    struct timeval *timeout;
+
+    assert(blockInts > 0);
 
 DBG(   printf("checkEvents block:%d\n", block);                        )
 
+    if (sleepThreads != 0)
+    {
+       time = currentTime();
+       while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
+       {
+           tid = sleepThreads;
+           sleepThreads = sleepThreads->next;
+           tid->next = 0;
+
+           iresumeThread(tid);
+       }
+    }
+
+    if (block)
+    {
+       if (sleepThreads != 0)
+       {
+           s8 wait_time = CONTEXT(sleepThreads).time - time;
+
+           tv.tv_sec = wait_time / 1000;
+           tv.tv_usec = (wait_time % 1000) * 1000;
+           timeout = &tv;
+       }
+       else
+           timeout = 0;
+    }
+    else
+    {
+       tv.tv_sec = 0;
+       tv.tv_usec = 0;
+       timeout = &tv;
+    }
+
 #if defined(FD_COPY)
     FD_COPY(&readsPending, &rd);
     FD_COPY(&writesPending, &wr);
@@ -344,21 +436,7 @@ DBG(       printf("checkEvents block:%d\n", block);                        )
     memcpy(&wr, &writesPending, sizeof(wr));
 #endif
 
-    /* 
-     * If select() is called with indefinite wait, we have to make sure
-     * we can get interrupted by timer events. 
-     */
-    if (block == true)
-    {
-       b = blockInts;
-       blockInts = 0;
-       r = select(maxFd+1, &rd, &wr, 0, 0);
-       blockInts = b;
-    }
-    else
-    {
-       r = select(maxFd+1, &rd, &wr, 0, &tm);
-    }
+    r = select(maxFd+1, &rd, &wr, 0, timeout);
 
     /* We must be holding off interrupts before we start playing with
      * the read and write queues.  This should be already done but a
@@ -368,6 +446,21 @@ DBG(       printf("checkEvents block:%d\n", block);                        )
 
 DBG(   printf("Select returns %d\n", r);                               )
 
+    /* Some threads may have finished sleeping.
+     */
+    if (block && sleepThreads != 0)
+    {
+       time = currentTime();
+       while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
+       {
+           tid = sleepThreads;
+           sleepThreads = sleepThreads->next;
+           tid->next = 0;
+
+           iresumeThread(tid);
+       }
+    }
+
     for (i = 0; r > 0 && i <= maxFd; i++)
     {
        if (readQ[i] != 0 && FD_ISSET(i, &rd))
index 1e9d5c2a2a5fec0ea3476329940f641bed4cfe2d..a04bbf8ee8e6e29586a06721636cc4910bf629a3 100644 (file)
@@ -16,6 +16,8 @@ int threadedConnect(int fd, struct sockaddr* addr, int len);
 int threadedAccept(int fd, struct sockaddr* addr, int* len);
 int threadedRead(int fd, char* buf, int len);
 int threadedWrite(int fd, char* buf, int len);
+int threadedRecvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *addrlen);
+int threadedSendto(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t addrlen);
 #else
 #define threadedFileDescriptor(fd)
 #define threadedRead(fd,buf,len)          read(fd,buf,len)
index a9f45512e3feb2398f51c5995d6a1594df64b48e..ffe7096a92c6514496e864e00dd02ab3733540a2 100644 (file)
@@ -18,6 +18,8 @@
 #include <sys/types.h>
 #include <sys/mman.h>                   /* for mprotect */
 #include <unistd.h>
+#include <signal.h>
+#include <sys/time.h>
 
 #include "thread.h"
 #include "locks.h"
@@ -48,7 +50,7 @@ thread* threadQhead[MAX_THREAD_PRIO + 1];
 thread* threadQtail[MAX_THREAD_PRIO + 1];
 
 thread* liveThreads = NULL;
-thread* alarmList;
+thread* sleepThreads = NULL;
 
 int blockInts;
 bool needReschedule;
@@ -68,6 +70,9 @@ void reschedule(void);
 /* Setup default thread stack size - this can be overwritten if required */
 int threadStackSize = THREADSTACKSIZE;
 
+/* Pointer to the stack of the last killed thread. The free is delayed. */
+void *stack_to_be_freed = 0;
+
 static thread* startDaemon(void* func, char* nm, int stackSize);
 
 /*
@@ -80,7 +85,9 @@ allocThreadStack (thread *tid, int size)
                result;
     unsigned long pageBegin;
 
-    CONTEXT(tid).stackMem = malloc(size + 2 * pageSize);
+       assert(stack_to_be_freed == 0);
+
+    CONTEXT(tid).stackMem = malloc(size + 4 * pageSize);
     assert(CONTEXT(tid).stackMem != 0);
     CONTEXT(tid).stackEnd = CONTEXT(tid).stackMem + size + 2 * pageSize;
     
@@ -94,7 +101,8 @@ allocThreadStack (thread *tid, int size)
 }
 
 /*
- * Free the stack for a thread
+ * Mark the stack for a thread to be freed. We cannot free the stack
+ * immediately because it is still in use!
  */
 void
 freeThreadStack (thread *tid)
@@ -107,12 +115,14 @@ freeThreadStack (thread *tid)
 
                pageBegin = (unsigned long)(CONTEXT(tid).stackMem) + pageSize - 1;
                pageBegin = pageBegin - pageBegin % pageSize;
-       
+
                result = mprotect((void*)pageBegin, pageSize,
                                                  PROT_READ | PROT_WRITE | PROT_EXEC);
                assert(result == 0);
 
-               free(CONTEXT(tid).stackMem);
+               assert(stack_to_be_freed == 0);
+
+               stack_to_be_freed = CONTEXT(tid).stackMem;
     }
     CONTEXT(tid).stackMem = 0;
     CONTEXT(tid).stackBase = 0;
@@ -128,6 +138,8 @@ initThreads(u1 *stackbottom)
        thread *the_main_thread;
     int i;
 
+       signal(SIGPIPE, SIG_IGN);
+
     initLocks();
 
     for (i = 0; i < MAXTHREADS; ++i) {
@@ -165,10 +177,13 @@ initThreads(u1 *stackbottom)
        the_main_thread->daemon = 0;
        the_main_thread->stillborn = 0;
        the_main_thread->target = 0;
-       the_main_thread->interruptRequested = 0;
-       the_main_thread->group =
-               (threadGroup*)builtin_new(loader_load(utf_new_char("java/lang/ThreadGroup")));
-       /* we should call the constructor */
+
+       the_main_thread->contextClassLoader = 0;
+       the_main_thread->inheritedAccessControlContext = 0;
+       the_main_thread->values = 0;
+
+       /* Allocate and init ThreadGroup */
+       the_main_thread->group = (threadGroup*)native_new_and_init(loader_load(utf_new_char("java/lang/ThreadGroup")));
        assert(the_main_thread->group != 0);
 
        talive++;
@@ -204,6 +219,8 @@ startThread (thread* tid)
     if (i == MAXTHREADS)
                panic("Too many threads");
 
+       assert(tid->priority >= MIN_THREAD_PRIO && tid->priority <= MAX_THREAD_PRIO);
+
     tid->PrivateInfo = i + 1;
     CONTEXT(tid).free = false;
        CONTEXT(tid).thread = tid;
@@ -264,7 +281,6 @@ startDaemon(void* func, char* nm, int stackSize)
        tid->daemon = 1;
        tid->stillborn = 0;
        tid->target = 0;
-       tid->interruptRequested = 0;
        tid->group = 0;
 
        /* Construct the initial restore point. */
@@ -372,7 +388,7 @@ yieldThread()
  * (which is set by suspendThread(.))
  */
 void
-resumeThread(thread* tid)
+resumeThread (thread* tid)
 {
     if ((CONTEXT(tid).flags & THREAD_FLAGS_USER_SUSPEND) != 0)
     {
@@ -559,6 +575,8 @@ setPriorityThread(thread* tid, int prio)
 {
     thread** ntid;
 
+       assert(prio >= MIN_THREAD_PRIO && prio <= MAX_THREAD_PRIO);
+
     if (tid->PrivateInfo == 0) {
                tid->priority = prio;
                return;
@@ -598,6 +616,55 @@ setPriorityThread(thread* tid, int prio)
     intsRestore();
 }
 
+/*
+ * Get the current time in milliseconds since 1970-01-01.
+ */
+s8
+currentTime (void)
+{
+       struct timeval tv;
+       s8 time;
+
+       gettimeofday(&tv, 0);
+
+       time = tv.tv_sec;
+       time *= 1000;
+       time += tv.tv_usec / 1000;
+
+       return time;
+}
+
+/*
+ * Put a thread to sleep.
+ */
+void
+sleepThread (s8 time)
+{
+    thread** tidp;
+
+    /* Sleep for no time */
+    if (time <= 0) {
+               return;
+    }
+    
+    intsDisable();
+
+    /* Get absolute time */
+    CONTEXT(currentThread).time = time + currentTime();
+
+    /* Find place in alarm list */
+    for (tidp = &sleepThreads; (*tidp) != 0; tidp = &(*tidp)->next)
+       {
+               if (CONTEXT(*tidp).time > CONTEXT(currentThread).time)
+                       break;
+    }
+
+    /* Suspend thread on it */
+    suspendOnQThread(currentThread, tidp);
+    
+    intsRestore();
+}
+
 /*
  * Is this thread alive?
  */
@@ -654,6 +721,12 @@ reschedule(void)
 
                                        exceptionptr = CONTEXT(currentThread).exceptionptr;
 
+                                       if (stack_to_be_freed != 0)
+                                       {
+                                               free(stack_to_be_freed);
+                                               stack_to_be_freed = 0;
+                                       }
+
                                        /* Alarm signal may be blocked - if so
                                         * unblock it.
                                         */
index 862960a10aa1e3c2b0a202320e7b7e38f09deb7d..d64d3d992807ec3332f30cec49b5f32ba2bb7718 100644 (file)
@@ -74,6 +74,7 @@ typedef struct _threadGroup
     s4                   maxPrio;
     s4                   destroyed;
     s4                   daemon;
+       s4                   vmAllowSuspension;
     s4                   nthreads;
     java_objectheader*   threads;
     s4                   ngroups;
@@ -88,33 +89,35 @@ typedef struct _thread
     s4                       priority;
     struct _thread*          next;
     s8                       PrivateInfo;
-    struct java_lang_Object* eetop;           /* ??? */
     s4                       single_step;
     s4                       daemon;
     s4                       stillborn;
     java_objectheader*       target;
-    s4                       interruptRequested;
     threadGroup*             group;
+       java_objectheader*       contextClassLoader;
+       java_objectheader*       inheritedAccessControlContext;
+       java_objectheader*       values;
 } thread;
 
-void initThreads(u1 *stackbottom);
-void clear_thread_flags(void);
-void startThread(thread*);
-void resumeThread(thread*);
-void iresumeThread(thread*);
-void suspendThread(thread*);
-void suspendOnQThread(thread*, thread**);
-void yieldThread(void);
-void killThread(thread*);
-void setPriorityThread(thread*, int);
+void initThreads (u1 *stackbottom);
+void clear_thread_flags (void);
+void startThread (thread*);
+void resumeThread (thread*);
+void iresumeThread (thread*);
+void suspendThread (thread*);
+void suspendOnQThread (thread*, thread**);
+void yieldThread (void);
+void killThread (thread*);
+void setPriorityThread (thread*, int);
 
-void sleepThread(s8);
-bool aliveThread(thread*);
-long framesThread(thread*);
+s8 currentTime (void);
+void sleepThread (s8);
+bool aliveThread (thread*);
+long framesThread (thread*);
 
-void reschedule(void);
+void reschedule (void);
 
-void checkEvents(bool block);
+void checkEvents (bool block);
 
 extern int blockInts;
 extern bool needReschedule;
@@ -124,6 +127,7 @@ extern ctx contexts[];
 extern int threadStackSize;
 
 extern thread *liveThreads;
+extern thread *sleepThreads;
 
 extern thread *threadQhead[MAX_THREAD_PRIO + 1];
 
index ab89cc25eb7344df25b6d24a22bd487a634ffeb8..f3004a1b8ac235579ff634b797ce5beacf2ed3c2 100644 (file)
@@ -128,18 +128,18 @@ s4 builtin_isanysubclass (classinfo *sub, classinfo *super)
                return (sub->vftbl->interfacetablelength > super->index) &&
                       (sub->vftbl->interfacetable[-super->index] != NULL);
 
+       /*
     while (sub != 0)
                if (sub == super)
                        return 1;
                else
                        sub = sub->super;
-       
+
        return 0;
+       */
 
-       /*
        return (unsigned) (sub->vftbl->baseval - super->vftbl->baseval) <=
               (unsigned) (super->vftbl->diffval);
-       */
 }
 
 
@@ -177,22 +177,22 @@ s4 builtin_instanceof(java_objectheader *obj, classinfo *class)
 
 s4 builtin_checkcast(java_objectheader *obj, classinfo *class)
 {
-       #ifdef DEBUG
+#ifdef DEBUG
        log_text ("builtin_checkcast called");
-       #endif
+#endif
 
        if (obj == NULL)
                return 1;
        if (builtin_isanysubclass (obj->vftbl->class, class))
                return 1;
 
-       #if DEBUG
+       /* #if DEBUG */
        printf ("#### checkcast failed ");
        utf_display (obj->vftbl->class->name);
        printf (" -> ");
        utf_display (class->name);
        printf ("\n");
-       #endif
+       /* #endif */
 
        return 0;
 }
@@ -251,22 +251,40 @@ s4 builtin_checkarraycast(java_objectheader *o, constant_arraydescriptor *desc)
 
        if (!o) return 1;
        if (o->vftbl->class != class_array) {
+#ifdef DEBUG
+               printf ("#### checkarraycast failed 1\n");
+#endif
                return 0;
                }
                
        if (a->arraytype != desc->arraytype) {
+#ifdef DEBUG
+               printf ("#### checkarraycast failed 2\n");
+#endif
                return 0;
                }
        
        switch (a->arraytype) {
                case ARRAYTYPE_OBJECT: {
                        java_objectarray *oa = (java_objectarray*) o;
-                       return builtin_isanysubclass (oa->elementtype, desc->objectclass);
+                       int result = builtin_isanysubclass (oa->elementtype, desc->objectclass);
+
+#ifdef DEBUG
+                       if (!result)
+                               printf ("#### checkarraycast failed 3\n");
+#endif
+                       return result;
                        }
                case ARRAYTYPE_ARRAY: {
                        java_arrayarray *aa = (java_arrayarray*) o;
-                       return builtin_descriptorscompatible
-                          (aa->elementdescriptor, desc->elementdescriptor);
+                       int result = builtin_descriptorscompatible
+                               (aa->elementdescriptor, desc->elementdescriptor);
+
+#ifdef DEBUG
+                       if (!result)
+                               printf ("#### checkarraycast failed 4\n");
+#endif
+                       return result;
                        }
                default:   
                        return 1;
@@ -354,6 +372,8 @@ java_objectheader *builtin_new (classinfo *c)
 {
        java_objectheader *o;
 
+       class_init(c);
+
 #ifdef SIZE_FROM_CLASSINFO
        c->alignedsize = align_size(c->instancesize);
        o = heap_allocate ( c->alignedsize, true, c->finalizer );
index eb7a9f31d7692d7e53af4e2806c1a4e80959815b..bbb66fb8898839e2a3437f1ca8d5629a10df1229 100644 (file)
@@ -8,7 +8,7 @@
        
        Author: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
 
-       Last Change: $Id: parse.c 135 1999-10-04 10:35:09Z roman $
+       Last Change: $Id: parse.c 136 1999-11-09 11:33:46Z schani $
 
 *******************************************************************************/
 
@@ -871,6 +871,10 @@ static void parse()
                                        BUILTIN2((functionptr) asm_builtin_checkarraycast, TYPE_ADR);
                                        }
                                else { /* object type cast-check */
+                                       /*
+                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                                       BUILTIN2((functionptr) asm_builtin_checkcast, TYPE_ADR);
+                                       */
                                        OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
                                        }
                                break;
@@ -884,7 +888,11 @@ static void parse()
                                        BUILTIN2((functionptr) builtin_arrayinstanceof, TYPE_INT);
                                        }
                                else { /* object type cast-check */
-                                       OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
+                                       /*
+                                       LOADCONST_A(class_getconstant(class, i, CONSTANT_Class));
+                                       BUILTIN2((functionptr) builtin_instanceof, TYPE_INT);
+                                       */
+                                       OP2A(opcode, 1, (class_getconstant(class, i, CONSTANT_Class)));
                                        }
                                break;
 
index d40b095cd0e197322426dc892b83c69904a5293f..058609e41eabae571b17ebffe8b24d85eddb09fc 100644 (file)
@@ -289,7 +289,7 @@ bool suck_start (utf *classname)
        }
 
        sprintf (logtext,"Can not open class file '%s'", filename);
-       error();
+       dolog();
 
        return false;
 }
@@ -2254,6 +2254,7 @@ void class_showmethods (classinfo *c)
 /******************* Funktionen fuer den Class-loader generell ****************/
 /******************************************************************************/
 
+static int loader_inited = 0;
 
 /********************* Funktion: loader_load ***********************************
 
@@ -2294,6 +2295,9 @@ classinfo *loader_load (utf *topname)
                loadingtime += (stoptime-starttime);
                }
 
+       if (loader_inited)
+               loader_compute_subclasses();
+
        intsRestore();                          /* schani */
 
        return top; 
@@ -2451,6 +2455,8 @@ void loader_init ()
        proto_java_lang_ThreadDeath =                             /* schani */
                builtin_new(class_java_lang_ThreadDeath);
        heap_addreference ( (void**) &proto_java_lang_ThreadDeath);
+
+       loader_inited = 1;
 }
 
 
@@ -2479,7 +2485,7 @@ void loader_initclasses ()
        intsRestore();                      /* schani */
 }
 
-static s4 classvalue = 0;
+static s4 classvalue;
 
 static void loader_compute_class_values (classinfo *c)
 {
@@ -2511,6 +2517,15 @@ void loader_compute_subclasses ()
        
        intsDisable();                     /* schani */
 
+       c = list_first (&linkedclasses);
+       while (c) {
+               if (!(c->flags & ACC_INTERFACE)) {
+                       c->nextsub = 0;
+                       c->sub = 0;
+                       }
+               c = list_next (&linkedclasses, c);
+               }
+
        c = list_first (&linkedclasses);
        while (c) {
                if (!(c->flags & ACC_INTERFACE) && (c->super != NULL)) {
@@ -2520,6 +2535,7 @@ void loader_compute_subclasses ()
                c = list_next (&linkedclasses, c);
                }
 
+       classvalue = 0;
        loader_compute_class_values(class_java_lang_Object);
 
        intsRestore();                      /* schani */
index 2b30d9c95437c03ec0af17b75671d6f801e296ff..a740c1154747a28619ccad4d6aa472db47d62806 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,6 +49,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -80,12 +81,11 @@ DIST_COMMON =  Makefile.am Makefile.in
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
-all: Makefile
-
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
 .SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu tst/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -108,60 +108,73 @@ distdir: $(DISTFILES)
          && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu tst/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
-info:
-dvi:
-check: all
-       $(MAKE)
-installcheck:
-install-exec: 
-       @$(NORMAL_INSTALL)
-
-install-data: 
-       @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-       @:
-
-uninstall: 
-
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile
+all-redirect: all-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-generic
+mostlyclean-am:  mostlyclean-generic
 
-clean:  clean-generic mostlyclean
+mostlyclean: mostlyclean-am
 
-distclean:  distclean-generic clean
-       -rm -f config.status
+clean-am:  clean-generic mostlyclean-am
 
-maintainer-clean:  maintainer-clean-generic distclean
+clean: clean-am
+
+distclean-am:  distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-generic distclean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
-.PHONY: tags distdir info dvi installcheck install-exec install-data \
-install uninstall all installdirs mostlyclean-generic distclean-generic \
-clean-generic maintainer-clean-generic clean mostlyclean distclean \
-maintainer-clean
+maintainer-clean: maintainer-clean-am
+
+.PHONY: tags distdir info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
 
 
 check: 
diff --git a/tests/network/DemoClient.java b/tests/network/DemoClient.java
new file mode 100644 (file)
index 0000000..1249193
--- /dev/null
@@ -0,0 +1,28 @@
+import java.net.*;
+import java.io.*;
+
+public class DemoClient extends Thread
+{
+       public static void main(String[] args)
+       {
+               DemoClient app = new DemoClient();
+               app.start();
+       }
+
+       public void run()
+       {
+               Socket newSocket;
+
+               try {
+                       newSocket = new Socket("localhost", 5758);
+                       System.out.println("Client connected to server.");
+                       DataOutputStream outStream = new DataOutputStream(
+                               newSocket.getOutputStream());
+                       outStream.writeInt(12345);
+                       System.exit(0);
+               } catch (Exception oops) {
+                       System.out.println("Error connecting to server");
+                       return;
+               }
+       }
+}
diff --git a/tests/network/DemoServer.java b/tests/network/DemoServer.java
new file mode 100644 (file)
index 0000000..fa06feb
--- /dev/null
@@ -0,0 +1,53 @@
+import java.net.*;
+import java.io.*;
+
+public class DemoServer extends Thread
+{
+       ServerSocket listenSock;
+
+       public static void main(String[] args)
+       {
+               DemoServer app = new DemoServer();
+               app.start();
+       }
+
+       public DemoServer()
+       {
+       }
+
+       public void run()
+       {
+               Socket newSocket;
+
+               try {
+                       listenSock = new ServerSocket(5758);
+                       System.out.println(listenSock.toString());
+               } catch (Exception hell) {
+                       System.out.println("Error setting up listen socket:\n");
+                       System.out.println(hell);
+                       return;
+               }
+
+               while (true)
+               {
+                       try {
+                               System.out.println("Trying accept");
+                               newSocket = listenSock.accept();
+                               System.out.println("Accept returned");
+                       } catch (Exception badAccept) {
+                               continue;
+                       }
+                       System.out.println("Accepted new client");
+
+                       try {
+                               DataInputStream inStream = new DataInputStream(
+                                       newSocket.getInputStream());
+                               System.out.println("Client send "+inStream.readInt());
+                               newSocket.close();
+                       } catch (Exception oops) {
+                               System.out.println("Error reading from client");
+                               System.out.println(oops);
+                       }
+               }
+       }
+}
diff --git a/tests/network/FILE.HTM b/tests/network/FILE.HTM
new file mode 100644 (file)
index 0000000..6de7b8c
--- /dev/null
@@ -0,0 +1 @@
+This is a test file.
diff --git a/tests/network/GenericServer.java b/tests/network/GenericServer.java
new file mode 100644 (file)
index 0000000..80d1278
--- /dev/null
@@ -0,0 +1,176 @@
+//     File: GenericServer.java
+//     Author: Thomas Lea  (leat@goodnet.com,  http://www.goodnet.com/~leat)
+//     Date: 12/7/95
+//     Version: 1.0  (for Beta JDK API)
+//
+// Copyright (c) 1995 Thomas Lea. All Rights Reserved.
+//
+
+
+// Please feel free to take this program and modify it to your hearts content.
+// The only thing I ask is that my name and the above version/copyright 
+// information stay at the top of this module.
+
+import java.net.*;
+import java.io.*;
+import java.util.Vector;
+
+class GenericServer
+{
+    private static final int DEFAULT_PORT=8887;
+    private ConnectionManager cm = null;
+
+    public GenericServer(int port)
+    {
+        System.out.println("Server is initializing to port " + port);
+
+        cm = new ConnectionManager(port);
+        cm.start();
+    }
+
+    public static void main(String args[])
+    {
+        int server_port;
+
+        try
+        {
+            server_port = Integer.parseInt(args[0],10);
+        }
+        catch(Exception e)
+        {
+            System.out.println("Defaulting to port " + DEFAULT_PORT);
+                    server_port = DEFAULT_PORT;
+        }
+        new GenericServer(server_port);
+    }
+}
+
+// Waits for a connection then spawns a ServerConnection to deal with it
+class ConnectionManager extends Thread
+{
+    private static int _port;
+    private static Vector _my_threads = new Vector(5,2);
+                                           //size of 5 initially, grow by 2
+    private ServerSocket _main_socket = null;
+
+    public ConnectionManager(int port)
+    {
+        _port = port;
+    }
+
+    public void run()
+    {
+        serveRequests();
+    }
+
+    private void serveRequests()
+    {
+        try {_main_socket = new ServerSocket(_port);}
+        catch(Exception e) { System.err.println(e); System.exit(1);}
+
+        ServerConnection temp_sc = null;
+
+        while (true)
+        {
+            try
+            {
+                Socket this_connection = _main_socket.accept();
+       
+                temp_sc = new ServerConnection(this_connection);
+                temp_sc.start();
+                _my_threads.addElement(temp_sc);
+
+                //clean up the vector if needed
+                for(int i=0;i<ConnectionManager._my_threads.size();i++)
+                if(!((ServerConnection)(_my_threads.elementAt(i))).isAlive())
+                        _my_threads.removeElementAt(i);
+            }
+            catch(Exception e)
+            {
+                System.err.println("Exception:\n" + e);
+            }
+        }
+    }
+}
+
+class ServerConnection extends Thread
+{
+    private Socket _mysocket;
+    private PrintStream _output;
+    private InputStream _input;
+    FileInputStream _dis;
+
+    public ServerConnection(Socket s)
+    {
+        _mysocket = s;
+    }
+
+    private void doServerWork()
+    {
+        //This is where the server actually does its work.
+        //when this method finishes, the socket will be closed
+        //and this thread will exit.
+
+        //This is just some junk... put your real work here.
+        try
+        {
+            byte b[] = new byte[1024];
+            int nbytes = _input.read(b,0,1024);
+            String str = new String(b,0,0,nbytes);
+
+            _dis = new FileInputStream("FILE.HTM");
+            StringBuffer buf = new StringBuffer(4096);
+                       
+            System.out.println("Received for server: " + str);
+
+            nbytes = _dis.available();
+            _output.println("HTTP/1.0 200 OK");
+            _output.println("MIME-Version: 1.0");
+            _output.println("Date: 22Dec95");
+            _output.println("Server: Java_Server_0.01");
+            _output.println("Content-type: text/html");
+//          _output.println("Content-Length: 76");
+            _output.println("");
+//      _output.println("<HEAD><TITLE>Clock 2.0 Title</TITLE></HEAD><BODY>");
+//          _output.println("<H1>Clock 2.0</H1>");
+            b = new byte[nbytes];
+            _dis.read(b, 0, nbytes);
+            str = new String(b, 0, 0, nbytes);
+            _output.println(str);
+//          _output.println("</BODY>");
+            _output.println("");
+//          for(int i=0;i<10;i++)
+//          {
+//              _output.println("This is a message from the server");
+//              sleep((int)(Math.random() * 4000));
+//          }
+        }
+        catch(Exception e)
+        {
+        }
+    }
+
+    public void run()
+    {
+        System.out.println("Connected to: " +
+                   _mysocket.getInetAddress() +":"+ _mysocket.getPort());
+        try
+        {
+            _output = new PrintStream(_mysocket.getOutputStream());
+            _input = _mysocket.getInputStream();
+
+            //Lets get busy!
+            doServerWork();
+
+            //We are outta here....
+            _mysocket.close();
+        }
+        catch ( Exception e )
+        {
+            System.err.println( "Exception:\n" + e );
+        }
+
+        System.out.println("Disconnecting: " + _mysocket.toString());
+        stop();
+    }
+}
diff --git a/tests/network/classloader.java b/tests/network/classloader.java
new file mode 100644 (file)
index 0000000..e21eeda
--- /dev/null
@@ -0,0 +1,49 @@
+import java.security.AccessController;
+import sun.security.action.*;
+import java.io.File;
+
+public class classloader {
+    private static String[] initializePath(String propname) {
+        String ldpath = System.getProperty(propname, "");
+       String ps = File.pathSeparator;
+       int ldlen = ldpath.length();
+       int i, j, n;
+       // Count the separators in the path
+       i = ldpath.indexOf(ps);
+       n = 0;
+       while (i >= 0) {
+           n++;
+           i = ldpath.indexOf(ps, i+1);
+       }
+
+       // allocate the array of paths - n :'s = n + 1 path elements
+       String[] paths = new String[n + 1];
+
+       // Fill the array with paths from the ldpath
+       n = i = 0;
+       j = ldpath.indexOf(ps);
+       while (j >= 0) {
+           if (j - i > 0) {
+               paths[n++] = ldpath.substring(i, j);
+           } else if (j - i == 0) { 
+               paths[n++] = ".";
+           }
+           i = j + 1;
+           j = ldpath.indexOf(ps, i);
+       }
+       paths[n] = ldpath.substring(i, ldlen);
+       return paths;
+    }
+
+    public static void main (String args[]) {
+       /*
+       String dirs[] = initializePath("sun.boot.library.path");
+
+       System.out.println("length: " + dirs.length);
+       for (int i = 0; i < dirs.length; ++i) {
+           System.out.println(dirs[i]);
+       }
+       */
+       AccessController.doPrivileged(new LoadLibraryAction("net"));
+    }
+}
diff --git a/tests/network/httpd/httpd.java b/tests/network/httpd/httpd.java
new file mode 100644 (file)
index 0000000..54c29b1
--- /dev/null
@@ -0,0 +1,219 @@
+import java.net.*;
+import java.io.*;
+
+class ServerThread extends Thread
+{
+    httpd server;
+
+    ServerThread (httpd the_server)
+    {
+       server = the_server;
+    }
+
+    synchronized void wait_till_finished ()
+    {
+       try
+       {
+           wait();
+       }
+       catch (Exception exc)
+       {
+           System.out.println("Exception " + exc + " in wait");
+       }
+    }
+
+    boolean is_info_line (String str)
+    {
+       return str.startsWith("User-Agent: ") || str.startsWith("Host: ")
+           || str.startsWith("Accept: ");
+    }
+
+    static void write_string (OutputStream os, String str) throws IOException
+    {
+       byte buf[] = new byte[str.length()];
+
+       str.getBytes(0, str.length(), buf, 0);
+       os.write(buf);
+    }
+
+    synchronized void handle_request (Socket socket)
+    {
+       System.out.println("begin handle_request");
+
+       try
+       {
+           InputStream is = socket.getInputStream();
+           DataInputStream dis = new DataInputStream(is);
+           String request;
+
+           request = dis.readLine();
+           if (request.startsWith("GET "))
+           {
+               String doc = request.substring(4);
+
+               System.out.println("request: " + doc);
+
+               boolean is_10 = false;
+
+               if (doc.endsWith(" HTTP/1.0"))
+               {
+                   is_10 = true;
+                   
+                   String info;
+
+                   do
+                   {
+                       info = dis.readLine();
+                   } while (is_info_line(info));
+
+                   doc = doc.substring(0, doc.length() - 9);
+               }
+
+               String filename = httpd.document_root + doc;
+               File file = new File(filename);
+
+               if (file.isDirectory())
+                   file = new File(filename + "/index.html");
+               if (file.exists() && file.isFile() && file.canRead())
+               {
+                   OutputStream os = socket.getOutputStream();
+
+                   System.out.println("kurde 1");
+
+                   FileInputStream fis = new FileInputStream(file);
+
+                   System.out.println("kurde 2");
+                   System.out.println("kurde 2a");
+
+                   byte buffer[] = new byte[8192];
+                   byte heusl[] = new byte[8192];
+
+                   System.out.println("kurde 3");
+
+                   if (is_10)
+                       write_string(os,
+                                    "HTTP/1.0 200 OK\n"
+                                    //+ "Content-Length: " + file.length() + "\n"
+                                    + "Content-Type: text/html\n"
+                                    + "Server: Schani's Kurden-Server\n"
+                                    + "\n");
+
+                   System.out.println("begin copy");
+
+                   int result;
+
+                   do
+                   {
+                       result = fis.read(buffer);
+                       if (result > 0)
+                           os.write(buffer, 0, result);
+                   } while (result != -1);
+                   System.out.println("end copy");
+                   
+                   fis.close();
+               }
+               else if (is_10)
+                   write_string(socket.getOutputStream(),
+                                "HTTP/1.0 404 Not Found\n"
+                                + "\n");
+           }
+           else
+               System.out.println("malformed request: " + request);
+       }
+       catch (Exception exc)
+       {
+           System.out.println("Exception " + exc + " in thread");
+       }
+
+       try
+       {
+           InputStream is = socket.getInputStream();
+           int len;
+
+           while ((len = is.available()) > 0)
+           {
+               for (int i = 0; i < len; ++i)
+                   is.read();
+           }
+
+           socket.close();
+       }
+       catch (Exception exc)
+       {
+           System.out.println("Exception " + exc + " in close");
+       }
+
+       server.thread_ready(this);
+       notify();
+
+       System.out.println("end handle_request");
+    }
+}
+
+public class httpd
+{
+
+    static String document_root = "/nethome/hansolo/schani/public_html";
+    static int num_threads = 10;
+
+    ServerThread threads[] = null;
+    boolean threads_ready[] = null;
+
+    void run ()
+    {
+       threads = new ServerThread[num_threads];
+       threads_ready = new boolean[num_threads];
+
+       for (int i = 0; i < num_threads; ++i)
+       {
+           threads[i] = new ServerThread(this);
+           threads_ready[i] = true;
+       }
+
+       try
+       {
+           ServerSocket ss = new ServerSocket(8001, 5);
+
+           while (true)
+           {
+               Socket socket = ss.accept();
+               ServerThread thread = get_ready_thread();
+
+               thread.handle_request(socket);
+           }
+       }
+       catch (Exception exc)
+       {
+           System.out.println("Exception " + exc);
+       }
+    }
+
+    public static void main (String args[])
+    {
+       new httpd().run();
+    }
+
+    synchronized void thread_ready (ServerThread thread)
+    {
+       for (int i = 0; i < num_threads; ++i)
+           if (threads[i] == thread)
+           {
+               threads_ready[i] = true;
+               break;
+           }
+    }
+
+    ServerThread get_ready_thread ()
+    {
+       for (int i = 0; i < num_threads; ++i)
+           if (threads_ready[i])
+           {
+               threads_ready[i] = false;
+               return threads[i];
+           }
+
+       threads[0].wait_till_finished();
+       threads_ready[0] = false;
+       return threads[0];
+    }
+}
diff --git a/tests/network/socktest.java b/tests/network/socktest.java
new file mode 100644 (file)
index 0000000..e05546d
--- /dev/null
@@ -0,0 +1,20 @@
+import java.lang.*;
+import java.net.*;
+import java.io.*;
+class socktest {
+        public static void main(String argv[]) {
+                try {
+                        ServerSocket ss = new ServerSocket(0);
+                        Socket s = new Socket("quinta", 23);
+                        InetAddress a1 = InetAddress.getByName("quinta");
+                        InetAddress a2 = InetAddress.getLocalHost();
+
+                        System.out.println(ss);
+                        System.out.println(s);
+                        System.out.println(a1);
+                        System.out.println(a2);
+                } catch (IOException e) {
+                        System.out.println("error: "+e);
+                }
+        }
+}
diff --git a/tests/network/udp/QuoteClient.java b/tests/network/udp/QuoteClient.java
new file mode 100644 (file)
index 0000000..d3fb9d8
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * and its documentation for NON-COMMERCIAL purposes and without
+ * fee is hereby granted provided that this copyright notice
+ * appears in all copies. Please refer to the file "copyright.html"
+ * for further important copyright and licensing information.
+ *
+ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
+ * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ */
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+public class QuoteClient {
+    public static void main(String[] args) throws IOException {
+
+        if (args.length != 1) {
+             System.out.println("Usage: java QuoteClient <hostname>");
+             return;
+        }
+
+       // get a datagram socket
+        DatagramSocket socket = new DatagramSocket();
+
+       // send request
+       byte[] buf = new byte[256];
+       InetAddress address = InetAddress.getByName(args[0]);
+       DatagramPacket packet = new DatagramPacket(buf, buf.length, address, 4445);
+       socket.send(packet);
+
+       // get response
+       packet = new DatagramPacket(buf, buf.length);
+       socket.receive(packet);
+
+       // display response
+       String received = new String(packet.getData(), 0);
+       System.out.println("Quote of the Moment: " + received);
+
+       socket.close();
+    }
+}
diff --git a/tests/network/udp/QuoteServer.java b/tests/network/udp/QuoteServer.java
new file mode 100644 (file)
index 0000000..f66866f
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * and its documentation for NON-COMMERCIAL purposes and without
+ * fee is hereby granted provided that this copyright notice
+ * appears in all copies. Please refer to the file "copyright.html"
+ * for further important copyright and licensing information.
+ *
+ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
+ * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ */
+public class QuoteServer {
+    public static void main(String[] args) throws java.io.IOException {
+       QuoteServerThread thread = new QuoteServerThread();
+
+        thread.start();
+    }
+}
diff --git a/tests/network/udp/QuoteServerThread.java b/tests/network/udp/QuoteServerThread.java
new file mode 100644 (file)
index 0000000..8af5aee
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * and its documentation for NON-COMMERCIAL purposes and without
+ * fee is hereby granted provided that this copyright notice
+ * appears in all copies. Please refer to the file "copyright.html"
+ * for further important copyright and licensing information.
+ *
+ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
+ * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ */
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+public class QuoteServerThread extends Thread {
+
+    protected DatagramSocket socket = null;
+    protected BufferedReader in = null;
+    protected boolean moreQuotes = true;
+
+    public QuoteServerThread() throws IOException {
+       this("QuoteServerThread");
+    }
+
+    public QuoteServerThread(String name) throws IOException {
+        super(name);
+
+       try {
+           socket = new DatagramSocket(4445);
+       } catch (Exception exc) {
+           System.err.println("Could not create socket: " + exc);
+       }
+
+        try {
+            in = new BufferedReader(new FileReader("one-liners.txt"));
+        } catch (FileNotFoundException e) {
+            System.err.println("Could not open quote file. Serving time instead.");
+        }
+    }
+
+    public void run() {
+
+        while (moreQuotes) {
+            try {
+                byte[] buf = new byte[256];
+
+                    // receive request
+                DatagramPacket packet = new DatagramPacket(buf, buf.length);
+                socket.receive(packet);
+
+                    // figure out response
+                String dString = null;
+                if (in == null)
+                    dString = new Date().toString();
+                else
+                    dString = getNextQuote();
+                buf = dString.getBytes();
+
+                   // send the response to the client at "address" and "port"
+                InetAddress address = packet.getAddress();
+                int port = packet.getPort();
+                packet = new DatagramPacket(buf, buf.length, address, port);
+                socket.send(packet);
+            } catch (IOException e) {
+                e.printStackTrace();
+               moreQuotes = false;
+            }
+        }
+        socket.close();
+    }
+
+    protected String getNextQuote() {
+        String returnValue = null;
+        try {
+            if ((returnValue = in.readLine()) == null) {
+                in.close();
+               moreQuotes = false;
+                returnValue = "No more quotes. Goodbye.";
+            }
+        } catch (IOException e) {
+            returnValue = "IOException occurred in server.";
+        }
+        return returnValue;
+    }
+}
diff --git a/tests/network/udp/one-liners.txt b/tests/network/udp/one-liners.txt
new file mode 100644 (file)
index 0000000..e43d703
--- /dev/null
@@ -0,0 +1,33 @@
+Life is wonderful. Without it we'd all be dead.
+Daddy, why doesn't this magnet pick up this floppy disk?
+Give me ambiguity or give me something else.
+I.R.S.: We've got what it takes to take what you've got!
+We are born naked, wet and hungry. Then things get worse.
+Make it idiot proof and someone will make a better idiot.
+He who laughs last thinks slowest!
+Always remember you're unique, just like everyone else.
+"More hay, Trigger?" "No thanks, Roy, I'm stuffed!"
+A flashlight is a case for holding dead batteries.
+Lottery: A tax on people who are bad at math.
+Error, no keyboard - press F1 to continue.
+There's too much blood in my caffeine system.
+Artificial Intelligence usually beats real stupidity.
+Hard work has a future payoff. Laziness pays off now.
+"Very funny, Scotty. Now beam down my clothes."
+Puritanism: The haunting fear that someone, somewhere may be happy.
+Consciousness: that annoying time between naps.
+Don't take life too seriously, you won't get out alive.
+I don't suffer from insanity. I enjoy every minute of it.
+Better to understand a little than to misunderstand a lot.
+The gene pool could use a little chlorine.
+When there's a will, I want to be in it.
+Okay, who put a "stop payment" on my reality check?
+We have enough youth, how about a fountain of SMART?
+Programming is an art form that fights back.
+"Daddy, what does FORMATTING DRIVE C mean?"
+All wiyht. Rho sritched mg kegtops awound?
+My mail reader can beat up your mail reader.
+Never forget: 2 + 2 = 5 for extremely large values of 2.
+Nobody has ever, ever, EVER learned all of WordPerfect.
+To define recursion, we must first define recursion.
+Good programming is 99% sweat and 1% coffee.
diff --git a/tests/network/urltest.java b/tests/network/urltest.java
new file mode 100644 (file)
index 0000000..38dde2a
--- /dev/null
@@ -0,0 +1,112 @@
+import java.net.*;
+
+public class urltest {
+    public static void main (String args[])
+    {
+       String classes[] =
+       {
+           "w3c.jigsaw.http.httpd",
+           "sun.net.www.protocol.http.Handler",
+           "w3c.tools.store.AttributeHolder",
+           "w3c.tools.store.ResourceStoreState",
+           "w3c.tools.store.Resource",
+           "w3c.jigsaw.formedit.GenericResourceEditor",
+           "w3c.tools.store.BooleanAttribute",
+           "w3c.jigsaw.forms.BooleanField",
+           "w3c.jigsaw.auth.PasswordAttribute",
+           "w3c.jigsaw.auth.PasswordField",
+           "w3c.www.http.HttpCacheControl",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpDate",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpCaseTokenList",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpInteger",
+           "w3c.www.http.HttpString",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpString",
+           "w3c.www.http.HttpString",
+           "w3c.www.http.HttpContentRange",
+           "w3c.www.http.HttpMimeType",
+           "w3c.www.http.HttpEntityTag",
+           "w3c.www.http.HttpDate",
+           "w3c.www.http.HttpDate",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpInteger",
+           "w3c.www.http.HttpString",
+           "w3c.www.http.HttpChallenge",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpDate",
+           "w3c.www.http.HttpString",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpWarningList",
+           "w3c.www.http.HttpChallenge",
+           "w3c.tools.store.Resource",
+           "java.lang.Object",
+           "w3c.tools.store.ResourceStore",
+           "w3c.jigsaw.auth.AuthRealm",
+           "w3c.jigsaw.http.httpd",
+           "w3c.jigsaw.resources.ResourceFilter",
+           "w3c.jigsaw.resources.FilteredResource",
+           "w3c.jigsaw.auth.AuthUser",
+           "w3c.jigsaw.auth.AuthFilter",
+           "w3c.jigsaw.resources.HTTPResource",
+           "w3c.tools.store.Resource",
+           "w3c.jigsaw.http.httpd",
+           "w3c.jigsaw.config.PropertySet",
+           "w3c.www.http.HttpAcceptList",
+           "w3c.www.http.HttpAcceptCharsetList",
+           "w3c.www.http.HttpTokenList",
+           "w3c.www.http.HttpAcceptLanguageList",
+           "w3c.www.http.HttpCredential",
+           "w3c.www.http.HttpString",
+           "w3c.www.http.HttpString",
+           "w3c.www.http.HttpDate",
+           "w3c.www.http.HttpEntityTagList",
+           "w3c.www.http.HttpEntityTagList",
+           "w3c.www.http.HttpDate",
+           "w3c.www.http.HttpInteger",
+           "w3c.www.http.HttpCredential",
+           "w3c.www.http.HttpRangeList",
+           "w3c.www.http.HttpString",
+           "w3c.www.http.HttpString",
+           "w3c.jigsaw.http.GeneralProp",
+           "w3c.jigsaw.http.LoggingProp",
+           "w3c.jigsaw.indexer.Directory",
+           "w3c.jigsaw.resources.NegotiatedResource"
+       };
+
+       try
+       {
+           Object handler;
+
+           for (int i = 0; i < classes.length; ++i)
+               Class.forName(classes[i]).newInstance();
+
+           URL url = new URL("http://www.schani.net/");
+
+           System.out.println("url " + url.toString());
+
+           handler = Class.forName("sun.net.www.protocol.http.Handler").newInstance();
+
+           URLStreamHandler h;
+
+           System.out.println("before");
+           h = (java.net.URLStreamHandler)handler;
+           System.out.println("after");
+
+           handler = Class.forName("sun.net.www.protocol.http.Handler").newInstance();
+
+           System.out.println("before");
+           h = (java.net.URLStreamHandler)handler;
+           System.out.println("after");
+       }
+       catch (Exception exc)
+       {
+       }
+    }
+}
diff --git a/tests/network/whatip2.java b/tests/network/whatip2.java
new file mode 100644 (file)
index 0000000..daeb748
--- /dev/null
@@ -0,0 +1,25 @@
+import java.io.*;
+import java.net.*;
+
+class whatip2 {
+    static void output (InetAddress addr) {
+       if (addr == null) {
+           System.out.println("address is null");
+       } else {
+           System.out.println("inet address is " + addr.toString() );
+       }
+    }
+
+    public static void main(String a[]) throws IOException {
+       try {
+           System.out.println("hostname is " + a[0] );
+
+           output(InetAddress.getByName (a[0]));
+
+           output(InetAddress.getLocalHost());
+       }
+       catch (Throwable t) {
+           System.out.println("Catched error " + t.toString() );
+       }
+    }  
+}
diff --git a/tests/sleep.java b/tests/sleep.java
new file mode 100644 (file)
index 0000000..3aff129
--- /dev/null
@@ -0,0 +1,29 @@
+import java.util.*;
+
+public class sleep extends Thread {
+
+    public sleep (String name) {
+       super(name);
+    }
+
+    public void run() {
+       Random random = new Random();
+
+       try {
+           for (int i = 0; i < 10; ++i) {
+               System.out.println(getName());
+               sleep((long)(random.nextFloat() * 1000));
+           }
+       } catch (Exception exc) {
+           System.out.println("Exception: " + exc);
+       }
+    }
+
+    public static void main (String args[]) {
+       sleep t1 = new sleep("a");
+       sleep t2 = new sleep("b");
+
+       t1.start();
+       t2.start();
+    }
+}
index 6b8cc26671b412d27ebe13323123deb74bbd6ad1..cc0e40c14462a3374ee3b1d43346970dd00a54eb 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,6 +49,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -74,11 +75,10 @@ VERSION = @VERSION@
 noinst_LIBRARIES = @LIBTHREAD@
 EXTRA_LIBRARIES = libthreads.a
 
-libthreads_a_SOURCES = locks.c locks.h \
-                      thread.c thread.h \
-                      threadio.c threadio.h
+libthreads_a_SOURCES = locks.c locks.h                        thread.c thread.h                       threadio.c threadio.h
 
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -93,24 +93,24 @@ libthreads_a_LIBADD =
 libthreads_a_OBJECTS =  locks.o thread.o threadio.o
 AR = ar
 CFLAGS = @CFLAGS@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
 DIST_COMMON =  Makefile.am Makefile.in
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
+TAR = gtar
+GZIP_ENV = --best
 DEP_FILES =  .deps/locks.P .deps/thread.P .deps/threadio.P
 SOURCES = $(libthreads_a_SOURCES)
 OBJECTS = $(libthreads_a_OBJECTS)
 
-all: Makefile $(LIBRARIES)
-
+all: all-redirect
 .SUFFIXES:
 .SUFFIXES: .S .c .o .s
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu threads/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -151,8 +151,12 @@ libthreads.a: $(libthreads_a_OBJECTS) $(libthreads_a_DEPENDENCIES)
 tags: TAGS
 
 ID: $(HEADERS) $(SOURCES) $(LISP)
+       list='$(SOURCES) $(HEADERS)'; \
+       unique=`for i in $$list; do echo $$i; done | \
+         awk '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
        here=`pwd` && cd $(srcdir) \
-         && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
+         && mkid -f$$here/ID $$unique $(LISP)
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
        tags=; \
@@ -185,9 +189,13 @@ distdir: $(DISTFILES)
          && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu threads/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
 
 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
@@ -199,80 +207,98 @@ mostlyclean-depend:
 clean-depend:
 
 distclean-depend:
+       -rm -rf .deps
 
 maintainer-clean-depend:
-       -rm -rf .deps
 
 %.o: %.c
        @echo '$(COMPILE) -c $<'; \
-       $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
+       $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-cp .deps/$(*F).pp .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm .deps/$(*F).pp
 
 %.lo: %.c
        @echo '$(LTCOMPILE) -c $<'; \
-       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
-       @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
-         < .deps/$(*F).p > .deps/$(*F).P
-       @-rm -f .deps/$(*F).p
-info:
-dvi:
-check: all
-       $(MAKE)
-installcheck:
-install-exec: 
-       @$(NORMAL_INSTALL)
-
-install-data: 
-       @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-       @:
-
-uninstall: 
-
+       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
+         < .deps/$(*F).pp > .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(LIBRARIES)
+all-redirect: all-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
+mostlyclean-am:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
                mostlyclean-tags mostlyclean-depend mostlyclean-generic
 
-clean:  clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
-               clean-generic mostlyclean
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
+               clean-generic mostlyclean-am
 
-distclean:  distclean-noinstLIBRARIES distclean-compile distclean-tags \
-               distclean-depend distclean-generic clean
-       -rm -f config.status
+clean: clean-am
 
-maintainer-clean:  maintainer-clean-noinstLIBRARIES \
+distclean-am:  distclean-noinstLIBRARIES distclean-compile \
+               distclean-tags distclean-depend distclean-generic \
+               clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-noinstLIBRARIES \
                maintainer-clean-compile maintainer-clean-tags \
                maintainer-clean-depend maintainer-clean-generic \
-               distclean
+               distclean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
+maintainer-clean: maintainer-clean-am
+
 .PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
 clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
 mostlyclean-compile distclean-compile clean-compile \
 maintainer-clean-compile tags mostlyclean-tags distclean-tags \
 clean-tags maintainer-clean-tags distdir mostlyclean-depend \
-distclean-depend clean-depend maintainer-clean-depend info dvi \
-installcheck install-exec install-data install uninstall all \
-installdirs mostlyclean-generic distclean-generic clean-generic \
+distclean-depend clean-depend maintainer-clean-depend info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
index 3a4535cd881bb3235e5c0a4f608706322662d43a..4ec1d20acb657c97064c0f01a73d39f8ab9ae6ce 100644 (file)
@@ -1,41 +1,5 @@
 /* ------------------------ thread.c -------------------------- */
 
-/*
- * Put a thread to sleep.
- */
-void
-sleepThread(int64 time)
-{
-    thread** tidp;
-
-    /* Sleep for no time */
-    if (time == 0) {
-       return;
-    }
-    
-    intsDisable();
-
-    /* Get absolute time */
-    currentThread->PrivateInfo->time = time + currentTime();
-
-    /* Find place in alarm list */
-    for (tidp = &alarmList; (*tidp) != 0; tidp = &(*tidp)->next) {
-       if ((*tidp)->PrivateInfo->time > currentThread->PrivateInfo->time) {
-           break;
-       }
-    }
-
-    /* If I'm head of alarm list, restart alarm */
-    if (tidp == &alarmList) {
-       MALARM(time);
-    }
-    
-    /* Suspend thread on it */
-    suspendOnQThread(currentThread, tidp);
-    
-    intsRestore();
-}
-
 /*
  * Handle alarm.
  * This routine uses a different meaning of "blockInts". Formerly, it was just
index a9f45512e3feb2398f51c5995d6a1594df64b48e..ffe7096a92c6514496e864e00dd02ab3733540a2 100644 (file)
@@ -18,6 +18,8 @@
 #include <sys/types.h>
 #include <sys/mman.h>                   /* for mprotect */
 #include <unistd.h>
+#include <signal.h>
+#include <sys/time.h>
 
 #include "thread.h"
 #include "locks.h"
@@ -48,7 +50,7 @@ thread* threadQhead[MAX_THREAD_PRIO + 1];
 thread* threadQtail[MAX_THREAD_PRIO + 1];
 
 thread* liveThreads = NULL;
-thread* alarmList;
+thread* sleepThreads = NULL;
 
 int blockInts;
 bool needReschedule;
@@ -68,6 +70,9 @@ void reschedule(void);
 /* Setup default thread stack size - this can be overwritten if required */
 int threadStackSize = THREADSTACKSIZE;
 
+/* Pointer to the stack of the last killed thread. The free is delayed. */
+void *stack_to_be_freed = 0;
+
 static thread* startDaemon(void* func, char* nm, int stackSize);
 
 /*
@@ -80,7 +85,9 @@ allocThreadStack (thread *tid, int size)
                result;
     unsigned long pageBegin;
 
-    CONTEXT(tid).stackMem = malloc(size + 2 * pageSize);
+       assert(stack_to_be_freed == 0);
+
+    CONTEXT(tid).stackMem = malloc(size + 4 * pageSize);
     assert(CONTEXT(tid).stackMem != 0);
     CONTEXT(tid).stackEnd = CONTEXT(tid).stackMem + size + 2 * pageSize;
     
@@ -94,7 +101,8 @@ allocThreadStack (thread *tid, int size)
 }
 
 /*
- * Free the stack for a thread
+ * Mark the stack for a thread to be freed. We cannot free the stack
+ * immediately because it is still in use!
  */
 void
 freeThreadStack (thread *tid)
@@ -107,12 +115,14 @@ freeThreadStack (thread *tid)
 
                pageBegin = (unsigned long)(CONTEXT(tid).stackMem) + pageSize - 1;
                pageBegin = pageBegin - pageBegin % pageSize;
-       
+
                result = mprotect((void*)pageBegin, pageSize,
                                                  PROT_READ | PROT_WRITE | PROT_EXEC);
                assert(result == 0);
 
-               free(CONTEXT(tid).stackMem);
+               assert(stack_to_be_freed == 0);
+
+               stack_to_be_freed = CONTEXT(tid).stackMem;
     }
     CONTEXT(tid).stackMem = 0;
     CONTEXT(tid).stackBase = 0;
@@ -128,6 +138,8 @@ initThreads(u1 *stackbottom)
        thread *the_main_thread;
     int i;
 
+       signal(SIGPIPE, SIG_IGN);
+
     initLocks();
 
     for (i = 0; i < MAXTHREADS; ++i) {
@@ -165,10 +177,13 @@ initThreads(u1 *stackbottom)
        the_main_thread->daemon = 0;
        the_main_thread->stillborn = 0;
        the_main_thread->target = 0;
-       the_main_thread->interruptRequested = 0;
-       the_main_thread->group =
-               (threadGroup*)builtin_new(loader_load(utf_new_char("java/lang/ThreadGroup")));
-       /* we should call the constructor */
+
+       the_main_thread->contextClassLoader = 0;
+       the_main_thread->inheritedAccessControlContext = 0;
+       the_main_thread->values = 0;
+
+       /* Allocate and init ThreadGroup */
+       the_main_thread->group = (threadGroup*)native_new_and_init(loader_load(utf_new_char("java/lang/ThreadGroup")));
        assert(the_main_thread->group != 0);
 
        talive++;
@@ -204,6 +219,8 @@ startThread (thread* tid)
     if (i == MAXTHREADS)
                panic("Too many threads");
 
+       assert(tid->priority >= MIN_THREAD_PRIO && tid->priority <= MAX_THREAD_PRIO);
+
     tid->PrivateInfo = i + 1;
     CONTEXT(tid).free = false;
        CONTEXT(tid).thread = tid;
@@ -264,7 +281,6 @@ startDaemon(void* func, char* nm, int stackSize)
        tid->daemon = 1;
        tid->stillborn = 0;
        tid->target = 0;
-       tid->interruptRequested = 0;
        tid->group = 0;
 
        /* Construct the initial restore point. */
@@ -372,7 +388,7 @@ yieldThread()
  * (which is set by suspendThread(.))
  */
 void
-resumeThread(thread* tid)
+resumeThread (thread* tid)
 {
     if ((CONTEXT(tid).flags & THREAD_FLAGS_USER_SUSPEND) != 0)
     {
@@ -559,6 +575,8 @@ setPriorityThread(thread* tid, int prio)
 {
     thread** ntid;
 
+       assert(prio >= MIN_THREAD_PRIO && prio <= MAX_THREAD_PRIO);
+
     if (tid->PrivateInfo == 0) {
                tid->priority = prio;
                return;
@@ -598,6 +616,55 @@ setPriorityThread(thread* tid, int prio)
     intsRestore();
 }
 
+/*
+ * Get the current time in milliseconds since 1970-01-01.
+ */
+s8
+currentTime (void)
+{
+       struct timeval tv;
+       s8 time;
+
+       gettimeofday(&tv, 0);
+
+       time = tv.tv_sec;
+       time *= 1000;
+       time += tv.tv_usec / 1000;
+
+       return time;
+}
+
+/*
+ * Put a thread to sleep.
+ */
+void
+sleepThread (s8 time)
+{
+    thread** tidp;
+
+    /* Sleep for no time */
+    if (time <= 0) {
+               return;
+    }
+    
+    intsDisable();
+
+    /* Get absolute time */
+    CONTEXT(currentThread).time = time + currentTime();
+
+    /* Find place in alarm list */
+    for (tidp = &sleepThreads; (*tidp) != 0; tidp = &(*tidp)->next)
+       {
+               if (CONTEXT(*tidp).time > CONTEXT(currentThread).time)
+                       break;
+    }
+
+    /* Suspend thread on it */
+    suspendOnQThread(currentThread, tidp);
+    
+    intsRestore();
+}
+
 /*
  * Is this thread alive?
  */
@@ -654,6 +721,12 @@ reschedule(void)
 
                                        exceptionptr = CONTEXT(currentThread).exceptionptr;
 
+                                       if (stack_to_be_freed != 0)
+                                       {
+                                               free(stack_to_be_freed);
+                                               stack_to_be_freed = 0;
+                                       }
+
                                        /* Alarm signal may be blocked - if so
                                         * unblock it.
                                         */
index 862960a10aa1e3c2b0a202320e7b7e38f09deb7d..d64d3d992807ec3332f30cec49b5f32ba2bb7718 100644 (file)
@@ -74,6 +74,7 @@ typedef struct _threadGroup
     s4                   maxPrio;
     s4                   destroyed;
     s4                   daemon;
+       s4                   vmAllowSuspension;
     s4                   nthreads;
     java_objectheader*   threads;
     s4                   ngroups;
@@ -88,33 +89,35 @@ typedef struct _thread
     s4                       priority;
     struct _thread*          next;
     s8                       PrivateInfo;
-    struct java_lang_Object* eetop;           /* ??? */
     s4                       single_step;
     s4                       daemon;
     s4                       stillborn;
     java_objectheader*       target;
-    s4                       interruptRequested;
     threadGroup*             group;
+       java_objectheader*       contextClassLoader;
+       java_objectheader*       inheritedAccessControlContext;
+       java_objectheader*       values;
 } thread;
 
-void initThreads(u1 *stackbottom);
-void clear_thread_flags(void);
-void startThread(thread*);
-void resumeThread(thread*);
-void iresumeThread(thread*);
-void suspendThread(thread*);
-void suspendOnQThread(thread*, thread**);
-void yieldThread(void);
-void killThread(thread*);
-void setPriorityThread(thread*, int);
+void initThreads (u1 *stackbottom);
+void clear_thread_flags (void);
+void startThread (thread*);
+void resumeThread (thread*);
+void iresumeThread (thread*);
+void suspendThread (thread*);
+void suspendOnQThread (thread*, thread**);
+void yieldThread (void);
+void killThread (thread*);
+void setPriorityThread (thread*, int);
 
-void sleepThread(s8);
-bool aliveThread(thread*);
-long framesThread(thread*);
+s8 currentTime (void);
+void sleepThread (s8);
+bool aliveThread (thread*);
+long framesThread (thread*);
 
-void reschedule(void);
+void reschedule (void);
 
-void checkEvents(bool block);
+void checkEvents (bool block);
 
 extern int blockInts;
 extern bool needReschedule;
@@ -124,6 +127,7 @@ extern ctx contexts[];
 extern int threadStackSize;
 
 extern thread *liveThreads;
+extern thread *sleepThreads;
 
 extern thread *threadQhead[MAX_THREAD_PRIO + 1];
 
index 16b647d50d6561faf857633b05f4b54ccf3a693c..2c62fba62aa02fba4adfa659f9e3008f67313b1f 100644 (file)
@@ -288,6 +288,60 @@ threadedWrite(int fd, char* buf, int len)
     return (ptr - buf);
 }
 
+/*
+ * Receive, but only if we can.
+ */
+int
+threadedRecvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *addrlen)
+{
+    int r;
+
+    DBG(   printf("threadedRecvfrom\n");          )
+
+#if defined(BLOCKING_CALLS)
+    blockOnFile(fd, TH_READ);
+#endif
+    for (;;)
+    {
+       r = recvfrom(fd, buf, len, flags, addr, addrlen);
+       if (r < 0
+           && (errno == EAGAIN || errno == EWOULDBLOCK
+               || errno == EINTR))
+       {
+           blockOnFile(fd, TH_READ);
+           continue;
+       }
+       return (r);
+    }
+}
+
+/*
+ * Send, but only if we can.
+ */
+int
+threadedSendto (int fd, void *buf, size_t len, int flags, struct sockaddr *addr, int addrlen)
+{
+    int r;
+
+    DBG(   printf("threadedSendto\n");          )
+
+#if defined(BLOCKING_CALLS)
+    blockOnFile(fd, TH_WRITE);
+#endif
+    for (;;)
+    {
+       r = sendto(fd, buf, len, flags, addr, addrlen);
+       if (r < 0
+           && (errno == EAGAIN || errno == EWOULDBLOCK
+               || errno == EINTR))
+       {
+           blockOnFile(fd, TH_WRITE);
+           continue;
+       }
+       return (r);
+    }
+}
+
 /*
  * An attempt to access a file would block, so suspend the thread until
  * it will happen.
@@ -303,6 +357,7 @@ DBG(        printf("blockOnFile()\n");                                      )
     {
        maxFd = fd;
     }
+
     if (op == TH_READ)
     {
        FD_SET(fd, &readsPending);
@@ -332,10 +387,47 @@ checkEvents(bool block)
     thread* tid;
     thread* ntid;
     int i;
-    int b;
+    s8 time = -1;
+    struct timeval tv;
+    struct timeval *timeout;
+
+    assert(blockInts > 0);
 
 DBG(   printf("checkEvents block:%d\n", block);                        )
 
+    if (sleepThreads != 0)
+    {
+       time = currentTime();
+       while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
+       {
+           tid = sleepThreads;
+           sleepThreads = sleepThreads->next;
+           tid->next = 0;
+
+           iresumeThread(tid);
+       }
+    }
+
+    if (block)
+    {
+       if (sleepThreads != 0)
+       {
+           s8 wait_time = CONTEXT(sleepThreads).time - time;
+
+           tv.tv_sec = wait_time / 1000;
+           tv.tv_usec = (wait_time % 1000) * 1000;
+           timeout = &tv;
+       }
+       else
+           timeout = 0;
+    }
+    else
+    {
+       tv.tv_sec = 0;
+       tv.tv_usec = 0;
+       timeout = &tv;
+    }
+
 #if defined(FD_COPY)
     FD_COPY(&readsPending, &rd);
     FD_COPY(&writesPending, &wr);
@@ -344,21 +436,7 @@ DBG(       printf("checkEvents block:%d\n", block);                        )
     memcpy(&wr, &writesPending, sizeof(wr));
 #endif
 
-    /* 
-     * If select() is called with indefinite wait, we have to make sure
-     * we can get interrupted by timer events. 
-     */
-    if (block == true)
-    {
-       b = blockInts;
-       blockInts = 0;
-       r = select(maxFd+1, &rd, &wr, 0, 0);
-       blockInts = b;
-    }
-    else
-    {
-       r = select(maxFd+1, &rd, &wr, 0, &tm);
-    }
+    r = select(maxFd+1, &rd, &wr, 0, timeout);
 
     /* We must be holding off interrupts before we start playing with
      * the read and write queues.  This should be already done but a
@@ -368,6 +446,21 @@ DBG(       printf("checkEvents block:%d\n", block);                        )
 
 DBG(   printf("Select returns %d\n", r);                               )
 
+    /* Some threads may have finished sleeping.
+     */
+    if (block && sleepThreads != 0)
+    {
+       time = currentTime();
+       while (sleepThreads != 0 && time >= CONTEXT(sleepThreads).time)
+       {
+           tid = sleepThreads;
+           sleepThreads = sleepThreads->next;
+           tid->next = 0;
+
+           iresumeThread(tid);
+       }
+    }
+
     for (i = 0; r > 0 && i <= maxFd; i++)
     {
        if (readQ[i] != 0 && FD_ISSET(i, &rd))
index 1e9d5c2a2a5fec0ea3476329940f641bed4cfe2d..a04bbf8ee8e6e29586a06721636cc4910bf629a3 100644 (file)
@@ -16,6 +16,8 @@ int threadedConnect(int fd, struct sockaddr* addr, int len);
 int threadedAccept(int fd, struct sockaddr* addr, int* len);
 int threadedRead(int fd, char* buf, int len);
 int threadedWrite(int fd, char* buf, int len);
+int threadedRecvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *addrlen);
+int threadedSendto(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t addrlen);
 #else
 #define threadedFileDescriptor(fd)
 #define threadedRead(fd,buf,len)          read(fd,buf,len)
index 898911f6480604c8236b7fbd0557bf6675499192..8476f3954f823475587e205a46b631c16071612c 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,7 +11,7 @@
 # PARTICULAR PURPOSE.
 
 
-SHELL = /bin/sh
+SHELL = @SHELL@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -32,7 +32,7 @@ mandir = @mandir@
 includedir = @includedir@
 oldincludedir = /usr/include
 
-DISTDIR =
+DESTDIR =
 
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,6 +49,7 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
 NORMAL_INSTALL = :
@@ -73,13 +74,10 @@ VERSION = @VERSION@
 
 noinst_LIBRARIES = libtoolbox.a
 
-libtoolbox_a_SOURCES = memory.c memory.h \
-                      loging.c loging.h \
-                      chain.c chain.h \
-                      tree.c tree.h \
-                      list.c list.h
+libtoolbox_a_SOURCES = memory.c memory.h                      loging.c loging.h                       chain.c chain.h                 tree.c tree.h                   list.c list.h
 
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
+
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/@SYSDEP_DIR@
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -94,25 +92,25 @@ libtoolbox_a_LIBADD =
 libtoolbox_a_OBJECTS =  memory.o loging.o chain.o tree.o list.o
 AR = ar
 CFLAGS = @CFLAGS@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
 DIST_COMMON =  Makefile.am Makefile.in
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
-GZIP = --best
+TAR = gtar
+GZIP_ENV = --best
 DEP_FILES =  .deps/chain.P .deps/list.P .deps/loging.P .deps/memory.P \
 .deps/tree.P
 SOURCES = $(libtoolbox_a_SOURCES)
 OBJECTS = $(libtoolbox_a_OBJECTS)
 
-all: Makefile $(LIBRARIES)
-
+all: all-redirect
 .SUFFIXES:
 .SUFFIXES: .S .c .o .s
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu toolbox/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -153,8 +151,12 @@ libtoolbox.a: $(libtoolbox_a_OBJECTS) $(libtoolbox_a_DEPENDENCIES)
 tags: TAGS
 
 ID: $(HEADERS) $(SOURCES) $(LISP)
+       list='$(SOURCES) $(HEADERS)'; \
+       unique=`for i in $$list; do echo $$i; done | \
+         awk '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
        here=`pwd` && cd $(srcdir) \
-         && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
+         && mkid -f$$here/ID $$unique $(LISP)
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
        tags=; \
@@ -187,9 +189,13 @@ distdir: $(DISTFILES)
          && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu toolbox/Makefile
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
-         test -f $(distdir)/$$file \
-         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-         || cp -p $$d/$$file $(distdir)/$$file; \
+         if test -d $$d/$$file; then \
+           cp -pr $$d/$$file $(distdir)/$$file; \
+         else \
+           test -f $(distdir)/$$file \
+           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+           || cp -p $$d/$$file $(distdir)/$$file || :; \
+         fi; \
        done
 
 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
@@ -201,80 +207,98 @@ mostlyclean-depend:
 clean-depend:
 
 distclean-depend:
+       -rm -rf .deps
 
 maintainer-clean-depend:
-       -rm -rf .deps
 
 %.o: %.c
        @echo '$(COMPILE) -c $<'; \
-       $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
+       $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-cp .deps/$(*F).pp .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm .deps/$(*F).pp
 
 %.lo: %.c
        @echo '$(LTCOMPILE) -c $<'; \
-       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
-       @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
-         < .deps/$(*F).p > .deps/$(*F).P
-       @-rm -f .deps/$(*F).p
-info:
-dvi:
-check: all
-       $(MAKE)
-installcheck:
-install-exec: 
-       @$(NORMAL_INSTALL)
-
-install-data: 
-       @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-       @:
-
-uninstall: 
-
+       $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
+         < .deps/$(*F).pp > .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(LIBRARIES)
+all-redirect: all-am
 install-strip:
-       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 
 
 mostlyclean-generic:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
-       -rm -f Makefile $(DISTCLEANFILES)
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
+mostlyclean-am:  mostlyclean-noinstLIBRARIES mostlyclean-compile \
                mostlyclean-tags mostlyclean-depend mostlyclean-generic
 
-clean:  clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
-               clean-generic mostlyclean
+mostlyclean: mostlyclean-am
+
+clean-am:  clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
+               clean-generic mostlyclean-am
 
-distclean:  distclean-noinstLIBRARIES distclean-compile distclean-tags \
-               distclean-depend distclean-generic clean
-       -rm -f config.status
+clean: clean-am
 
-maintainer-clean:  maintainer-clean-noinstLIBRARIES \
+distclean-am:  distclean-noinstLIBRARIES distclean-compile \
+               distclean-tags distclean-depend distclean-generic \
+               clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am:  maintainer-clean-noinstLIBRARIES \
                maintainer-clean-compile maintainer-clean-tags \
                maintainer-clean-depend maintainer-clean-generic \
-               distclean
+               distclean-am
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
 
+maintainer-clean: maintainer-clean-am
+
 .PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
 clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
 mostlyclean-compile distclean-compile clean-compile \
 maintainer-clean-compile tags mostlyclean-tags distclean-tags \
 clean-tags maintainer-clean-tags distdir mostlyclean-depend \
-distclean-depend clean-depend maintainer-clean-depend info dvi \
-installcheck install-exec install-data install uninstall all \
-installdirs mostlyclean-generic distclean-generic clean-generic \
+distclean-depend clean-depend maintainer-clean-depend info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean