This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] New files for native functionalities in gnu.java.nio


Hello list,


I commited the attached new files to gnu.java.nio.


Michael
-- 
Homepage: http://www.worldforge.org/
GPG-key: http://konqueror.dyndns.org/~mkoch/michael.gpg
#include <config.h>

#include <gcj/cni.h>
#include <jvm.h>

#include <gnu/java/nio/ByteBufferImpl.h>

JArray<jbyte>*
gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jbyte>*)
{
  return NULL;
}

JArray<jbyte>*
gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jshort>*)
{
  return NULL;
}

JArray<jbyte>*
gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jint>*)
{
  return NULL;
}

JArray<jbyte>*
gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jlong>*)
{
  return NULL;
}

JArray<jbyte>*
gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jchar>*)
{
  return NULL;
}

JArray<jbyte>*
gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jfloat>*)
{
  return NULL;
}

JArray<jbyte>*
gnu::java::nio::ByteBufferImpl::nio_cast(JArray<jdouble>*)
{
  return NULL;
}

void
gnu::java::nio::ByteBufferImpl::nio_put_Byte(gnu::java::nio::ByteBufferImpl*, jint, jint, jbyte)
{
}

void
gnu::java::nio::ByteBufferImpl::nio_put_Char(gnu::java::nio::ByteBufferImpl*, jint, jint, jchar)
{
}

void
gnu::java::nio::ByteBufferImpl::nio_put_Short(gnu::java::nio::ByteBufferImpl*, jint, jint, jshort)
{
}

void
gnu::java::nio::ByteBufferImpl::nio_put_Int(gnu::java::nio::ByteBufferImpl*, jint, jint, jint)
{
}

void
gnu::java::nio::ByteBufferImpl::nio_put_Long(gnu::java::nio::ByteBufferImpl*, jint, jint, jlong)
{
}

void
gnu::java::nio::ByteBufferImpl::nio_put_Float(gnu::java::nio::ByteBufferImpl*, jint, jint, jfloat)
{
}

void
gnu::java::nio::ByteBufferImpl::nio_put_Double(gnu::java::nio::ByteBufferImpl*, jint, jint, jdouble)
{
}

jbyte
gnu::java::nio::ByteBufferImpl::nio_get_Byte(gnu::java::nio::ByteBufferImpl*, jint, jint)
{
  return 0;
}

jchar
gnu::java::nio::ByteBufferImpl::nio_get_Char(gnu::java::nio::ByteBufferImpl*, jint, jint)
{
  return ' ';
}

jshort
gnu::java::nio::ByteBufferImpl::nio_get_Short(gnu::java::nio::ByteBufferImpl*, jint, jint)
{
  return 0;
}

jint
gnu::java::nio::ByteBufferImpl::nio_get_Int(gnu::java::nio::ByteBufferImpl*, jint, jint)
{
  return 0;
}

jlong
gnu::java::nio::ByteBufferImpl::nio_get_Long(gnu::java::nio::ByteBufferImpl*, jint, jint)
{
  return 0;
}

jfloat
gnu::java::nio::ByteBufferImpl::nio_get_Float(gnu::java::nio::ByteBufferImpl*, jint, jint)
{
  return 0.0;
}

jdouble
gnu::java::nio::ByteBufferImpl::nio_get_Double(gnu::java::nio::ByteBufferImpl*, jint, jint)
{
  return 0.0;
}
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1564
diff -b -u -r1.1564 ChangeLog
--- ChangeLog	29 Nov 2002 07:50:45 -0000	1.1564
+++ ChangeLog	29 Nov 2002 07:55:42 -0000
@@ -1,5 +1,19 @@
 2002-11-29  Michael Koch <konqueror@gmx.de>
 
+	* gnu/java/nio/natByteBufferImpl.cc,
+	gnu/java/nio/natCharBufferImpl.cc,
+	gnu/java/nio/natDoubleBufferImpl.cc,
+	gnu/java/nio/natFloatBufferImpl.cc,
+	gnu/java/nio/natIntBufferImpl.cc,
+	gnu/java/nio/natLongBufferImpl.cc,
+	gnu/java/nio/natSelectorImpl.cc,
+	gnu/java/nio/natServerSocketChannelImpl.cc,
+	gnu/java/nio/natShortBufferImpl.cc,
+	gnu/java/nio/natSocketChannelImpl.cc:
+	New files that implement native functionalities.
+
+2002-11-29  Michael Koch <konqueror@gmx.de>
+
 	* gnu/java/nio/ByteBufferImpl.java
 	(ByteBufferImpl): Moved position() after limit.
 	(nio_*): Use native implementation.
#include <config.h>

#include <gcj/cni.h>
#include <jvm.h>

#include <gnu/java/nio/CharBufferImpl.h>

JArray<jchar>*
gnu::java::nio::CharBufferImpl::nio_cast(JArray<jbyte>*)
{
  return NULL;
}

JArray<jchar>*
gnu::java::nio::CharBufferImpl::nio_cast(JArray<jshort>*)
{
  return NULL;
}

JArray<jchar>*
gnu::java::nio::CharBufferImpl::nio_cast(JArray<jint>*)
{
  return NULL;
}

JArray<jchar>*
gnu::java::nio::CharBufferImpl::nio_cast(JArray<jlong>*)
{
  return NULL;
}

JArray<jchar>*
gnu::java::nio::CharBufferImpl::nio_cast(JArray<jchar>*)
{
  return NULL;
}

JArray<jchar>*
gnu::java::nio::CharBufferImpl::nio_cast(JArray<jfloat>*)
{
  return NULL;
}

JArray<jchar>*
gnu::java::nio::CharBufferImpl::nio_cast(JArray<jdouble>*)
{
  return NULL;
}

void
gnu::java::nio::CharBufferImpl::nio_put_Byte(gnu::java::nio::CharBufferImpl*, jint, jint, jbyte)
{
}

void
gnu::java::nio::CharBufferImpl::nio_put_Char(gnu::java::nio::CharBufferImpl*, jint, jint, jchar)
{
}

void
gnu::java::nio::CharBufferImpl::nio_put_Short(gnu::java::nio::CharBufferImpl*, jint, jint, jshort)
{
}

void
gnu::java::nio::CharBufferImpl::nio_put_Int(gnu::java::nio::CharBufferImpl*, jint, jint, jint)
{
}

void
gnu::java::nio::CharBufferImpl::nio_put_Long(gnu::java::nio::CharBufferImpl*, jint, jint, jlong)
{
}

void
gnu::java::nio::CharBufferImpl::nio_put_Float(gnu::java::nio::CharBufferImpl*, jint, jint, jfloat)
{
}

void
gnu::java::nio::CharBufferImpl::nio_put_Double(gnu::java::nio::CharBufferImpl*, jint, jint, jdouble)
{
}

jbyte
gnu::java::nio::CharBufferImpl::nio_get_Byte(gnu::java::nio::CharBufferImpl*, jint, jint)
{
  return 0;
}

jchar
gnu::java::nio::CharBufferImpl::nio_get_Char(gnu::java::nio::CharBufferImpl*, jint, jint)
{
  return ' ';
}

jshort
gnu::java::nio::CharBufferImpl::nio_get_Short(gnu::java::nio::CharBufferImpl*, jint, jint)
{
  return 0;
}

jint
gnu::java::nio::CharBufferImpl::nio_get_Int(gnu::java::nio::CharBufferImpl*, jint, jint)
{
  return 0;
}

jlong
gnu::java::nio::CharBufferImpl::nio_get_Long(gnu::java::nio::CharBufferImpl*, jint, jint)
{
  return 0;
}

jfloat
gnu::java::nio::CharBufferImpl::nio_get_Float(gnu::java::nio::CharBufferImpl*, jint, jint)
{
  return 0.0;
}

jdouble
gnu::java::nio::CharBufferImpl::nio_get_Double(gnu::java::nio::CharBufferImpl*, jint, jint)
{
  return 0.0;
}
#include <config.h>

#include <gcj/cni.h>
#include <jvm.h>

#include <gnu/java/nio/DoubleBufferImpl.h>

JArray<jdouble>*
gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jbyte>*)
{
  return NULL;
}

JArray<jdouble>*
gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jshort>*)
{
  return NULL;
}

JArray<jdouble>*
gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jint>*)
{
  return NULL;
}

JArray<jdouble>*
gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jlong>*)
{
  return NULL;
}

JArray<jdouble>*
gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jchar>*)
{
  return NULL;
}

JArray<jdouble>*
gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jfloat>*)
{
  return NULL;
}

JArray<jdouble>*
gnu::java::nio::DoubleBufferImpl::nio_cast(JArray<jdouble>*)
{
  return NULL;
}

void
gnu::java::nio::DoubleBufferImpl::nio_put_Byte(gnu::java::nio::DoubleBufferImpl*, jint, jint, jbyte)
{
}

void
gnu::java::nio::DoubleBufferImpl::nio_put_Char(gnu::java::nio::DoubleBufferImpl*, jint, jint, jchar)
{
}

void
gnu::java::nio::DoubleBufferImpl::nio_put_Short(gnu::java::nio::DoubleBufferImpl*, jint, jint, jshort)
{
}

void
gnu::java::nio::DoubleBufferImpl::nio_put_Int(gnu::java::nio::DoubleBufferImpl*, jint, jint, jint)
{
}

void
gnu::java::nio::DoubleBufferImpl::nio_put_Long(gnu::java::nio::DoubleBufferImpl*, jint, jint, jlong)
{
}

void
gnu::java::nio::DoubleBufferImpl::nio_put_Float(gnu::java::nio::DoubleBufferImpl*, jint, jint, jfloat)
{
}

void
gnu::java::nio::DoubleBufferImpl::nio_put_Double(gnu::java::nio::DoubleBufferImpl*, jint, jint, jdouble)
{
}

jbyte
gnu::java::nio::DoubleBufferImpl::nio_get_Byte(gnu::java::nio::DoubleBufferImpl*, jint, jint)
{
  return 0;
}

jchar
gnu::java::nio::DoubleBufferImpl::nio_get_Char(gnu::java::nio::DoubleBufferImpl*, jint, jint)
{
  return ' ';
}

jshort
gnu::java::nio::DoubleBufferImpl::nio_get_Short(gnu::java::nio::DoubleBufferImpl*, jint, jint)
{
  return 0;
}

jint
gnu::java::nio::DoubleBufferImpl::nio_get_Int(gnu::java::nio::DoubleBufferImpl*, jint, jint)
{
  return 0;
}

jlong
gnu::java::nio::DoubleBufferImpl::nio_get_Long(gnu::java::nio::DoubleBufferImpl*, jint, jint)
{
  return 0;
}

jfloat
gnu::java::nio::DoubleBufferImpl::nio_get_Float(gnu::java::nio::DoubleBufferImpl*, jint, jint)
{
  return 0.0;
}

jdouble
gnu::java::nio::DoubleBufferImpl::nio_get_Double(gnu::java::nio::DoubleBufferImpl*, jint, jint)
{
  return 0.0;
}
#include <config.h>

#include <gcj/cni.h>
#include <jvm.h>

#include <gnu/java/nio/FloatBufferImpl.h>

JArray<jfloat>*
gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jbyte>*)
{
  return NULL;
}

JArray<jfloat>*
gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jshort>*)
{
  return NULL;
}

JArray<jfloat>*
gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jint>*)
{
  return NULL;
}

JArray<jfloat>*
gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jlong>*)
{
  return NULL;
}

JArray<jfloat>*
gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jchar>*)
{
  return NULL;
}

JArray<jfloat>*
gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jfloat>*)
{
  return NULL;
}

JArray<jfloat>*
gnu::java::nio::FloatBufferImpl::nio_cast(JArray<jdouble>*)
{
  return NULL;
}

void
gnu::java::nio::FloatBufferImpl::nio_put_Byte(gnu::java::nio::FloatBufferImpl*, jint, jint, jbyte)
{
}

void
gnu::java::nio::FloatBufferImpl::nio_put_Char(gnu::java::nio::FloatBufferImpl*, jint, jint, jchar)
{
}

void
gnu::java::nio::FloatBufferImpl::nio_put_Short(gnu::java::nio::FloatBufferImpl*, jint, jint, jshort)
{
}

void
gnu::java::nio::FloatBufferImpl::nio_put_Int(gnu::java::nio::FloatBufferImpl*, jint, jint, jint)
{
}

void
gnu::java::nio::FloatBufferImpl::nio_put_Long(gnu::java::nio::FloatBufferImpl*, jint, jint, jlong)
{
}

void
gnu::java::nio::FloatBufferImpl::nio_put_Float(gnu::java::nio::FloatBufferImpl*, jint, jint, jfloat)
{
}

void
gnu::java::nio::FloatBufferImpl::nio_put_Double(gnu::java::nio::FloatBufferImpl*, jint, jint, jdouble)
{
}

jbyte
gnu::java::nio::FloatBufferImpl::nio_get_Byte(gnu::java::nio::FloatBufferImpl*, jint, jint)
{
  return 0;
}

jchar
gnu::java::nio::FloatBufferImpl::nio_get_Char(gnu::java::nio::FloatBufferImpl*, jint, jint)
{
  return ' ';
}

jshort
gnu::java::nio::FloatBufferImpl::nio_get_Short(gnu::java::nio::FloatBufferImpl*, jint, jint)
{
  return 0;
}

jint
gnu::java::nio::FloatBufferImpl::nio_get_Int(gnu::java::nio::FloatBufferImpl*, jint, jint)
{
  return 0;
}

jlong
gnu::java::nio::FloatBufferImpl::nio_get_Long(gnu::java::nio::FloatBufferImpl*, jint, jint)
{
  return 0;
}

jfloat
gnu::java::nio::FloatBufferImpl::nio_get_Float(gnu::java::nio::FloatBufferImpl*, jint, jint)
{
  return 0.0;
}

jdouble
gnu::java::nio::FloatBufferImpl::nio_get_Double(gnu::java::nio::FloatBufferImpl*, jint, jint)
{
  return 0.0;
}
#include <config.h>

#include <gcj/cni.h>
#include <jvm.h>

#include <gnu/java/nio/IntBufferImpl.h>

JArray<jint>*
gnu::java::nio::IntBufferImpl::nio_cast(JArray<jbyte>*)
{
  return NULL;
}

JArray<jint>*
gnu::java::nio::IntBufferImpl::nio_cast(JArray<jshort>*)
{
  return NULL;
}

JArray<jint>*
gnu::java::nio::IntBufferImpl::nio_cast(JArray<jint>*)
{
  return NULL;
}

JArray<jint>*
gnu::java::nio::IntBufferImpl::nio_cast(JArray<jlong>*)
{
  return NULL;
}

JArray<jint>*
gnu::java::nio::IntBufferImpl::nio_cast(JArray<jchar>*)
{
  return NULL;
}

JArray<jint>*
gnu::java::nio::IntBufferImpl::nio_cast(JArray<jfloat>*)
{
  return NULL;
}

JArray<jint>*
gnu::java::nio::IntBufferImpl::nio_cast(JArray<jdouble>*)
{
  return NULL;
}

void
gnu::java::nio::IntBufferImpl::nio_put_Byte(gnu::java::nio::IntBufferImpl*, jint, jint, jbyte)
{
}

void
gnu::java::nio::IntBufferImpl::nio_put_Char(gnu::java::nio::IntBufferImpl*, jint, jint, jchar)
{
}

void
gnu::java::nio::IntBufferImpl::nio_put_Short(gnu::java::nio::IntBufferImpl*, jint, jint, jshort)
{
}

void
gnu::java::nio::IntBufferImpl::nio_put_Int(gnu::java::nio::IntBufferImpl*, jint, jint, jint)
{
}

void
gnu::java::nio::IntBufferImpl::nio_put_Long(gnu::java::nio::IntBufferImpl*, jint, jint, jlong)
{
}

void
gnu::java::nio::IntBufferImpl::nio_put_Float(gnu::java::nio::IntBufferImpl*, jint, jint, jfloat)
{
}

void
gnu::java::nio::IntBufferImpl::nio_put_Double(gnu::java::nio::IntBufferImpl*, jint, jint, jdouble)
{
}

jbyte
gnu::java::nio::IntBufferImpl::nio_get_Byte(gnu::java::nio::IntBufferImpl*, jint, jint)
{
  return 0;
}

jchar
gnu::java::nio::IntBufferImpl::nio_get_Char(gnu::java::nio::IntBufferImpl*, jint, jint)
{
  return ' ';
}

jshort
gnu::java::nio::IntBufferImpl::nio_get_Short(gnu::java::nio::IntBufferImpl*, jint, jint)
{
  return 0;
}

jint
gnu::java::nio::IntBufferImpl::nio_get_Int(gnu::java::nio::IntBufferImpl*, jint, jint)
{
  return 0;
}

jlong
gnu::java::nio::IntBufferImpl::nio_get_Long(gnu::java::nio::IntBufferImpl*, jint, jint)
{
  return 0;
}

jfloat
gnu::java::nio::IntBufferImpl::nio_get_Float(gnu::java::nio::IntBufferImpl*, jint, jint)
{
  return 0.0;
}

jdouble
gnu::java::nio::IntBufferImpl::nio_get_Double(gnu::java::nio::IntBufferImpl*, jint, jint)
{
  return 0.0;
}
#include <config.h>

#include <gcj/cni.h>
#include <jvm.h>

#include <gnu/java/nio/LongBufferImpl.h>

JArray<jlong>*
gnu::java::nio::LongBufferImpl::nio_cast(JArray<jbyte>*)
{
  return NULL;
}

JArray<jlong>*
gnu::java::nio::LongBufferImpl::nio_cast(JArray<jshort>*)
{
  return NULL;
}

JArray<jlong>*
gnu::java::nio::LongBufferImpl::nio_cast(JArray<jint>*)
{
  return NULL;
}

JArray<jlong>*
gnu::java::nio::LongBufferImpl::nio_cast(JArray<jlong>*)
{
  return NULL;
}

JArray<jlong>*
gnu::java::nio::LongBufferImpl::nio_cast(JArray<jchar>*)
{
  return NULL;
}

JArray<jlong>*
gnu::java::nio::LongBufferImpl::nio_cast(JArray<jfloat>*)
{
  return NULL;
}

JArray<jlong>*
gnu::java::nio::LongBufferImpl::nio_cast(JArray<jdouble>*)
{
  return NULL;
}

void
gnu::java::nio::LongBufferImpl::nio_put_Byte(gnu::java::nio::LongBufferImpl*, jint, jint, jbyte)
{
}

void
gnu::java::nio::LongBufferImpl::nio_put_Char(gnu::java::nio::LongBufferImpl*, jint, jint, jchar)
{
}

void
gnu::java::nio::LongBufferImpl::nio_put_Short(gnu::java::nio::LongBufferImpl*, jint, jint, jshort)
{
}

void
gnu::java::nio::LongBufferImpl::nio_put_Int(gnu::java::nio::LongBufferImpl*, jint, jint, jint)
{
}

void
gnu::java::nio::LongBufferImpl::nio_put_Long(gnu::java::nio::LongBufferImpl*, jint, jint, jlong)
{
}

void
gnu::java::nio::LongBufferImpl::nio_put_Float(gnu::java::nio::LongBufferImpl*, jint, jint, jfloat)
{
}

void
gnu::java::nio::LongBufferImpl::nio_put_Double(gnu::java::nio::LongBufferImpl*, jint, jint, jdouble)
{
}

jbyte
gnu::java::nio::LongBufferImpl::nio_get_Byte(gnu::java::nio::LongBufferImpl*, jint, jint)
{
  return 0;
}

jchar
gnu::java::nio::LongBufferImpl::nio_get_Char(gnu::java::nio::LongBufferImpl*, jint, jint)
{
  return ' ';
}

jshort
gnu::java::nio::LongBufferImpl::nio_get_Short(gnu::java::nio::LongBufferImpl*, jint, jint)
{
  return 0;
}

jint
gnu::java::nio::LongBufferImpl::nio_get_Int(gnu::java::nio::LongBufferImpl*, jint, jint)
{
  return 0;
}

jlong
gnu::java::nio::LongBufferImpl::nio_get_Long(gnu::java::nio::LongBufferImpl*, jint, jint)
{
  return 0;
}

jfloat
gnu::java::nio::LongBufferImpl::nio_get_Float(gnu::java::nio::LongBufferImpl*, jint, jint)
{
  return 0.0;
}

jdouble
gnu::java::nio::LongBufferImpl::nio_get_Double(gnu::java::nio::LongBufferImpl*, jint, jint)
{
  return 0.0;
}
// natSelectorImpl.cc

/* Copyright (C) 2002  Free Software Foundation

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

#include <config.h>
#include <platform.h>

#include <errno.h>
#include <string.h>

#if HAVE_BSTRING_H
// Needed for bzero, implicitly used by FD_ZERO on IRIX 5.2 
#include <bstring.h>
#endif

//#include <gcj/cni.h>
#include <gnu/java/nio/SelectorImpl.h>
#include <java/io/IOException.h>

void
helper_put_filedescriptors (jintArray java_fd_array, fd_set& fds, int& max_fd)
{
  int counter;
  jint* java_fds;

  java_fds = elements (java_fd_array);

  for (counter = 0; counter < JvGetArrayLength (java_fd_array); counter++)
    {
      FD_SET (java_fds [counter], &fds);

      if (java_fds [counter] > max_fd)
        {
          max_fd = java_fds [counter];
        }
    }
}

void
helper_get_filedescriptors (jintArray& java_fd_array, fd_set fds)
{
  int counter;
  int counter_fds;
  jint* java_fds;
  jintArray new_array_fds;
  jint* new_data_fds;

  counter_fds = 0;
  java_fds = elements (java_fd_array);

  for (counter = 0; counter < JvGetArrayLength (java_fd_array); counter++)
    {
      if (FD_ISSET (java_fds[counter], &fds))
        {
          counter_fds++;
        }
    }

  new_array_fds = JvNewIntArray (counter_fds);
  new_data_fds = elements (new_array_fds);

  for (counter = 0; counter < JvGetArrayLength (java_fd_array); counter++)
    {
      if (FD_ISSET (java_fds[counter], &fds))
        {
          new_data_fds[counter] = java_fds[counter];
        }      
    }

  java_fd_array = new_array_fds;
}

jint
gnu::java::nio::SelectorImpl::java_do_select (jintArray read, jintArray write,
                                              jintArray except, jlong timeout)
{
  jint result;
  int max_fd = 0;
  fd_set read_fds;
  fd_set write_fds;
  fd_set except_fds;
  struct timeval real_time_data;
  struct timeval *time_data = NULL;

  real_time_data.tv_sec = 0;
  real_time_data.tv_usec = timeout;

  // If not legal timeout value is given, use NULL.
  // This means an infinite timeout.
  if (timeout >= 0)
    {
      time_data = &real_time_data;
    }

  // Reset all fd_set structures
  FD_ZERO (&read_fds);
  FD_ZERO (&write_fds);
  FD_ZERO (&except_fds);

  // Fill the fd_set data structures for the _Jv_select() call.
  helper_put_filedescriptors (read, read_fds, max_fd);
  helper_put_filedescriptors (write, write_fds, max_fd);
  helper_put_filedescriptors (except, except_fds, max_fd);

  // Actually do the select
  result = _Jv_select (max_fd + 1, &read_fds, &write_fds, &except_fds, time_data);

  if (result < 0)
    {
      char* strerr = strerror (errno);
      throw new ::java::io::IOException (JvNewStringUTF (strerr));
    }

  // Set the file descriptors according to the values returned from select().
  helper_get_filedescriptors (read, read_fds);
  helper_get_filedescriptors (write, write_fds);
  helper_get_filedescriptors (except, except_fds);

  return result;
}
// natSelectorImpl.cc

/* Copyright (C) 2002  Free Software Foundation

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

#include <config.h>
#include <platform.h>

#include <errno.h>
#include <netinet/in.h>

#include <gcj/cni.h>
#include <gnu/java/nio/ServerSocketChannelImpl.h>
#include <gnu/java/nio/SocketChannelImpl.h>
#include <java/io/IOException.h>
#include <java/net/InetSocketAddress.h>
#include <java/net/SocketException.h>

union SockAddr
{
  struct sockaddr_in address;
#ifdef HAVE_INET6
  struct sockaddr_in6 address6;
#endif
};

jint
gnu::java::nio::ServerSocketChannelImpl::SocketAccept (
                                           ServerSocketChannelImpl* socket,
                                           SocketChannelImpl* s)
{
  union SockAddr u;
  struct sockaddr *ptr = (struct sockaddr *) &u.address;
  socklen_t addrlen = sizeof(struct sockaddr);
/*
  jbyteArray haddress = socket->sa->getAddress ()->addr;
  jbyte *bytes = elements (haddress);
  int len = haddress->length;

  if (len == 4)
    {
      u.address.sin_family = AF_INET;
      memcpy (&u.address.sin_addr, bytes, len);
      len = sizeof (struct sockaddr_in);
      u.address.sin_port = htons ( socket->sa->getPort ());
    }
#ifdef HAVE_INET6
  else if (len == 16)
    {
      u.address6.sin6_family = AF_INET6;
      memcpy (&u.address6.sin6_addr, bytes, len);
      len = sizeof (struct sockaddr_in6);
      u.address6.sin6_port = htons (socket->sa->getPort ());
    }
#endif
  else
    throw new ::java::net::SocketException (JvNewStringUTF ("invalid length"));
*/

  int sock = _Jv_accept (socket->fd, ptr, &addrlen);

  // FIXME: write address/port in ptr into java variables

  if (sock < 0)
    {
      char* strerr = strerror (errno);
      throw new ::java::io::IOException (JvNewStringUTF (strerr));
    }

  s->fd = sock;
  return sock;
}
#include <config.h>

#include <gcj/cni.h>
#include <jvm.h>

#include <gnu/java/nio/ShortBufferImpl.h>

JArray<jshort>*
gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jbyte>*)
{
  return NULL;
}

JArray<jshort>*
gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jshort>*)
{
  return NULL;
}

JArray<jshort>*
gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jint>*)
{
  return NULL;
}

JArray<jshort>*
gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jlong>*)
{
  return NULL;
}

JArray<jshort>*
gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jchar>*)
{
  return NULL;
}

JArray<jshort>*
gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jfloat>*)
{
  return NULL;
}

JArray<jshort>*
gnu::java::nio::ShortBufferImpl::nio_cast(JArray<jdouble>*)
{
  return NULL;
}

void
gnu::java::nio::ShortBufferImpl::nio_put_Byte(gnu::java::nio::ShortBufferImpl*, jint, jint, jbyte)
{
}

void
gnu::java::nio::ShortBufferImpl::nio_put_Char(gnu::java::nio::ShortBufferImpl*, jint, jint, jchar)
{
}

void
gnu::java::nio::ShortBufferImpl::nio_put_Short(gnu::java::nio::ShortBufferImpl*, jint, jint, jshort)
{
}

void
gnu::java::nio::ShortBufferImpl::nio_put_Int(gnu::java::nio::ShortBufferImpl*, jint, jint, jint)
{
}

void
gnu::java::nio::ShortBufferImpl::nio_put_Long(gnu::java::nio::ShortBufferImpl*, jint, jint, jlong)
{
}

void
gnu::java::nio::ShortBufferImpl::nio_put_Float(gnu::java::nio::ShortBufferImpl*, jint, jint, jfloat)
{
}

void
gnu::java::nio::ShortBufferImpl::nio_put_Double(gnu::java::nio::ShortBufferImpl*, jint, jint, jdouble)
{
}

jbyte
gnu::java::nio::ShortBufferImpl::nio_get_Byte(gnu::java::nio::ShortBufferImpl*, jint, jint)
{
  return 0;
}

jchar
gnu::java::nio::ShortBufferImpl::nio_get_Char(gnu::java::nio::ShortBufferImpl*, jint, jint)
{
  return ' ';
}

jshort
gnu::java::nio::ShortBufferImpl::nio_get_Short(gnu::java::nio::ShortBufferImpl*, jint, jint)
{
  return 0;
}

jint
gnu::java::nio::ShortBufferImpl::nio_get_Int(gnu::java::nio::ShortBufferImpl*, jint, jint)
{
  return 0;
}

jlong
gnu::java::nio::ShortBufferImpl::nio_get_Long(gnu::java::nio::ShortBufferImpl*, jint, jint)
{
  return 0;
}

jfloat
gnu::java::nio::ShortBufferImpl::nio_get_Float(gnu::java::nio::ShortBufferImpl*, jint, jint)
{
  return 0.0;
}

jdouble
gnu::java::nio::ShortBufferImpl::nio_get_Double(gnu::java::nio::ShortBufferImpl*, jint, jint)
{
  return 0.0;
}
// natSelectorImpl.cc

/* Copyright (C) 2002  Free Software Foundation

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

#include <config.h>
#include <platform.h>

#include <errno.h>

#include <gcj/cni.h>
#include <gnu/java/nio/SocketChannelImpl.h>
#include <java/io/IOException.h>
#include <java/net/InetAddress.h>
#include <java/net/SocketException.h>

jint
gnu::java::nio::SocketChannelImpl::SocketCreate ()
{
  int sock = _Jv_socket (AF_INET, SOCK_STREAM, 0);

  if (sock < 0)
    {
      char* strerr = strerror (errno);
      throw new ::java::io::IOException (JvNewStringUTF (strerr));
    }

  return sock;
}

jint
gnu::java::nio::SocketChannelImpl::SocketConnect (jint fd,
                                                  ::java::net::InetAddress *addr,
                                                  jint port)
{
  int result = _Jv_connect_address (fd, addr, port, addr, port);

  if (result < 0)
    {
      char* strerr = strerror (errno);
      throw new ::java::io::IOException (JvNewStringUTF (strerr));
    }

  return result;
}

jint
gnu::java::nio::SocketChannelImpl::SocketBind (jint fd,
                                               ::java::net::InetAddress *addr,
                                               jint port)
{
  int result = _Jv_bind_address (fd, addr, port);

  if (result < 0)
    {
      char* strerr = strerror (errno);
      throw new ::java::io::IOException (JvNewStringUTF (strerr));
    }

  return result;
}

jint
gnu::java::nio::SocketChannelImpl::SocketListen (jint fd, jint backlog)
{
  int result = _Jv_listen (fd, backlog);

  if (result < 0)
    {
      char* strerr = strerror (errno);
      throw new ::java::io::IOException (JvNewStringUTF (strerr));
    }

  return result;
}

jint
gnu::java::nio::SocketChannelImpl::SocketAvailable (jint /*fd*/)
{
  throw new ::java::net::SocketException (JvNewStringLatin1 ("SocketAvailable: not implemented"));
}

jint
gnu::java::nio::SocketChannelImpl::SocketClose (jint fd)
{
  int result = _Jv_close (fd);

  if (result < 0)
    {
      char* strerr = strerror (errno);
      throw new ::java::io::IOException (JvNewStringUTF (strerr));
    }

  return result;
}

jint
gnu::java::nio::SocketChannelImpl::SocketRead (jint fd, jbyteArray data,
                                               jint offset, jint length)
{
  int result = ::recv (fd, data, offset, length);

  if (result < 0)
    {
      char* strerr = strerror (errno);
      throw new ::java::io::IOException (JvNewStringUTF (strerr));
    }

  return result;
}

jint
gnu::java::nio::SocketChannelImpl::SocketWrite (jint fd, jbyteArray data,
                                                jint offset, jint length)
{
  int result = ::send (fd, data, offset, length);

  if (result < 0)
    {
      char* strerr = strerror (errno);
      throw new ::java::io::IOException (JvNewStringUTF (strerr));
    }

  return result;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]