Re: [cp-patches] FYI: Fix for PR34991

2009-01-07 Thread Robert Schuster
Hi,
thanks for the hint I will rework it that way.

Regards
Robert

David Gilbert schrieb:
 Robert Schuster wrote:
 
 -draw(new Polygon(xPoints, yPoints, nPoints));
 +for (int i = 1; i  nPoints; i++)
 +  draw(new Line2D.Double(xPoints[i - 1], yPoints[i - 1],
 + xPoints[i], yPoints[i]));
 
 Hi Robert,
 
 Line2D instances are mutable (via setLine() methods) so you could save
 some garbage here by creating one Line2D instance and reusing it within
 the loop...
 
 Regards,
 
 Dave Gilbert
 http://www.jfree.org/
 
 




signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: Fix for PR34991

2009-01-06 Thread Robert Schuster
Hi,
it was already asked whether this patch has been applied. Now it is. :)

Regards
Robert

2009-01-05  Robert Schuster  robertschus...@fsfe.org

  * gnu/java/awt/peer/gtk/CairoGraphics2D.java:
  (drawPolyline): Rewritten.
Index: gnu/java/awt/peer/gtk/CairoGraphics2D.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- gnu/java/awt/peer/gtk/CairoGraphics2D.java	8 Feb 2008 22:17:39 -	1.73
+++ gnu/java/awt/peer/gtk/CairoGraphics2D.java	6 Jan 2009 12:20:25 -	1.74
@@ -1246,7 +1246,9 @@
 
   public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
   {
-draw(new Polygon(xPoints, yPoints, nPoints));
+for (int i = 1; i  nPoints; i++)
+  draw(new Line2D.Double(xPoints[i - 1], yPoints[i - 1],
+ xPoints[i], yPoints[i]));
   }
 
   public void drawOval(int x, int y, int width, int height)
@@ -2171,4 +2173,4 @@
 
 return new Rectangle2D.Double(minX, minY, (maxX - minX), (maxY - minY));
   }
-}
\ No newline at end of file
+}


signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath ChangeLog gnu/java/awt/peer/gtk/Cairo...

2009-01-06 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 09/01/06 12:20:26

Modified files:
.  : ChangeLog 
gnu/java/awt/peer/gtk: CairoGraphics2D.java 

Log message:
Fixes PR #34991

2009-01-05  Robert Schuster  robertschus...@fsfe.org

  * gnu/java/awt/peer/gtk/CairoGraphics2D.java:
  (drawPolyline): Rewritten.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9749r2=1.9750
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java?cvsroot=classpathr1=1.73r2=1.74




org.w3c.dom.html2 package

2008-10-03 Thread Robert Schuster
Hi,
all the classes of the package org.w3c.dom.html2 in GNU Classpath are
living in org.w3c.dom.html in OpenJDK.

Now this is an odd thing and I wonder why this has never caused any
troubles before. I can't compile xerces-j from source with that.

If nobody objects I would like to move all classes to the right package.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: fix for DecimalFormat

2008-09-05 Thread Robert Schuster
Hi,
the attached patch fixes a problem when you numberformat pattern
contains the currency replacement character (/u00a4).

I suggest that this patch should be added to GCJ as well, as it fixes an
annoying issue.

Regards
Robert

ChangeLog:

2008-09-04  Robert Schuster  [EMAIL PROTECTED]

* java/text/DecimalFormat.java:
(scanFix): Use 'i + 1' when looking at following character.
(scanNegativePattern): Dito.


Index: java/text/DecimalFormat.java
===
RCS file: /sources/classpath/classpath/java/text/DecimalFormat.java,v
retrieving revision 1.37
diff -u -r1.37 DecimalFormat.java
--- java/text/DecimalFormat.java	17 Aug 2008 22:31:56 -	1.37
+++ java/text/DecimalFormat.java	3 Sep 2008 23:01:41 -
@@ -1321,7 +1321,7 @@
 currencySymbol = this.symbols.getCurrencySymbol();
 
 // if \u00A4 is doubled, we use the international currency symbol
-if (i  len  pattern.charAt(i + 1) == '\u00A4')
+if ((i + 1)  len  pattern.charAt(i + 1) == '\u00A4')
   {
 currencySymbol = this.symbols.getInternationalCurrencySymbol();
 i++;
@@ -1345,7 +1345,7 @@
 else if (ch == '\'')
   {
 // QUOTE
-if (i  len  pattern.charAt(i + 1) == '\'')
+if ((i + 1)  len  pattern.charAt(i + 1) == '\'')
   {
 // we need to add ' to the buffer 
 buffer.append(ch);
@@ -1717,7 +1717,7 @@
 else if (ch == '\'')
   {
 // QUOTE
-if (i  len  pattern.charAt(i + 1) == '\'')
+if ((i + 1)  len  pattern.charAt(i + 1) == '\'')
   {
 // we need to add ' to the buffer 
 buffer.append(ch);


[cp-patches] FYI: Fix unmappable case in ByteDecodeLoopHelper/ByteEncodeLoopHelper

2008-09-03 Thread Robert Schuster
Hi,
the attached patch fixes the way ByteDecodeLoopHelper and
ByteEncodeLoopHelper deal with the situation of unmappable characters:
With the attached patch the method really returns with a CoderResult
indicating unmappable characters. The former variant overwrote the
return value with either CoderResult.UNDERFLOW or CoderResult.OVERFLOW.

I found and debugged this problem while using mysql connector/j.

Regards
Robert

ChangeLog:

2008-09-04  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/nio/charset/ByteDecodeLoopHelper:
(arrayDecodeLoop): Added new break label, escape to that label.
* gnu/java/nio/charset/ByteEncodeLoopHelper:
(arrayDecodeLoop): Added new break label, escape to that label.

Index: gnu/java/nio/charset/ByteDecodeLoopHelper.java
===
RCS file: /sources/classpath/classpath/gnu/java/nio/charset/ByteDecodeLoopHelper.java,v
retrieving revision 1.1
diff -u -r1.1 ByteDecodeLoopHelper.java
--- gnu/java/nio/charset/ByteDecodeLoopHelper.java	23 Nov 2007 16:11:17 -	1.1
+++ gnu/java/nio/charset/ByteDecodeLoopHelper.java	3 Sep 2008 23:11:29 -
@@ -119,6 +119,8 @@
 int inRemaining = in.remaining();
 int outRemaining = out.remaining();
 CoderResult result;
+
+	bailOut:
 if (inRemaining = outRemaining)
   {
 for (int i = 0; i  inRemaining; i++)
@@ -129,7 +131,7 @@
   {
 inPos--;
 result = CoderResult.unmappableForLength(1);
-break;
+break bailOut;
   }
 char c = mapToChar(b);
 outArray[outPos] = c;
@@ -147,7 +149,7 @@
   {
 inPos--;
 result = CoderResult.unmappableForLength(1);
-break;
+break bailOut;
   }
 char c = mapToChar(b);
 outArray[outPos] = c;
Index: gnu/java/nio/charset/ByteEncodeLoopHelper.java
===
RCS file: /sources/classpath/classpath/gnu/java/nio/charset/ByteEncodeLoopHelper.java,v
retrieving revision 1.1
diff -u -r1.1 ByteEncodeLoopHelper.java
--- gnu/java/nio/charset/ByteEncodeLoopHelper.java	23 Nov 2007 16:11:17 -	1.1
+++ gnu/java/nio/charset/ByteEncodeLoopHelper.java	3 Sep 2008 23:11:29 -
@@ -120,6 +120,8 @@
 int inRemaining = in.remaining();
 int outRemaining = out.remaining();
 CoderResult result;
+
+	bailOut:
 if (inRemaining = outRemaining)
   {
 for (int i = 0; i  inRemaining; i++)
@@ -130,7 +132,7 @@
   {
 inPos--;
 result = CoderResult.unmappableForLength(1);
-break;
+break bailOut;
   }
 byte b = mapToByte(inChar);
 outArray[outPos] = b;
@@ -148,7 +150,7 @@
   {
 inPos--;
 result = CoderResult.unmappableForLength(1);
-break;
+break bailOut;
   }
 byte b = mapToByte(inChar);
 outArray[outPos] = b;


[commit-cp] classpath ChangeLog java/text/DecimalFormat.java

2008-09-03 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 08/09/03 23:06:54

Modified files:
.  : ChangeLog 
java/text  : DecimalFormat.java 

Log message:
Fix problem when using \u00a4 in number format patterns.

2008-09-04  Robert Schuster  [EMAIL PROTECTED]

* java/text/DecimalFormat.java:
(scanFix): Use 'i + 1' when looking at following character.
(scanNegativePattern): Dito.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9714r2=1.9715
http://cvs.savannah.gnu.org/viewcvs/classpath/java/text/DecimalFormat.java?cvsroot=classpathr1=1.37r2=1.38




[commit-cp] classpath ChangeLog gnu/java/nio/charset/ByteDe...

2008-09-03 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 08/09/04 00:06:10

Modified files:
.  : ChangeLog 
gnu/java/nio/charset: ByteDecodeLoopHelper.java 
  ByteEncodeLoopHelper.java 

Log message:
2008-09-04  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/nio/charset/ByteDecodeLoopHelper:
(arrayDecodeLoop): Added new break label, escape to that label.
* gnu/java/nio/charset/ByteEncodeLoopHelper:
(arrayDecodeLoop): Added new break label, escape to that label.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9715r2=1.9716
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/nio/charset/ByteDecodeLoopHelper.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/nio/charset/ByteEncodeLoopHelper.java?cvsroot=classpathr1=1.1r2=1.2




[cp-patches] FYI: fix access out of array bounds

2008-08-12 Thread Robert Schuster
Hi,
today I applied the patch we discussed in June. It fixes the illegal
acces outside the array bounds. Thanks go to GCC which found it in the
first place and Andrew Haley who gave suggestions for that patch.

The patch also works for older classpath release and is needed for
anyone who wants to compile classpath with newer GCCs (~4.3) and
--enable-local-sockets.

ChangeLog:

2008-08-12  Robert Schuster  [EMAIL PROTECTED]

  * native/jni/java-net/local.c
  (local_bind): Removed fprintf call, fixed access outside
  of array bounds.


Regards
Robert
Index: native/jni/java-net/local.c
===
RCS file: /sources/classpath/classpath/native/jni/java-net/local.c,v
retrieving revision 1.4
diff -u -r1.4 local.c
--- native/jni/java-net/local.c	17 Apr 2007 21:46:27 -	1.4
+++ native/jni/java-net/local.c	27 Jun 2008 13:14:40 -
@@ -73,27 +73,18 @@
   return socket (PF_UNIX, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
 }
 
-static int gcc_sucks = 0;
-
 int
 local_bind (int fd, const char *addr)
 {
   struct sockaddr_un saddr;
 
-  /* For some reason, GCC 4.0.1 on Darwin/x86 MODIFIES the `addr'
- pointer in the CALLER's STACK FRAME after calling this function,
- but if we add this statement below, it doesn't!  */
-  if (gcc_sucks)
-fprintf (stderr, bind %p\n, addr);
-
-  if (strlen (addr)  sizeof (saddr.sun_path))
+  if (strlen (addr) = sizeof (saddr.sun_path))
 {
   errno = ENAMETOOLONG;
   return -1;
 }
 
-  strncpy (saddr.sun_path, addr, sizeof (saddr.sun_path));
-  saddr.sun_path[sizeof (saddr.sun_path)] = '\0';
+  strcpy (saddr.sun_path, addr);
   saddr.sun_family = AF_LOCAL;
 
   return bind (fd, (struct sockaddr *) saddr, SUN_LEN (saddr));


signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath ChangeLog native/jni/java-net/local.c

2008-08-12 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 08/08/12 11:14:45

Modified files:
.  : ChangeLog 
native/jni/java-net: local.c 

Log message:
2008-08-12  Robert Schuster  [EMAIL PROTECTED]

  * native/jni/java-net/local.c
  (local_bind): Removed fprintf call, fixed access outside
  of array bounds.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9688r2=1.9689
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/java-net/local.c?cvsroot=classpathr1=1.4r2=1.5




HTTPS/SSL problem

2008-07-17 Thread Robert Schuster
Hi,
a classpath user reported a problem with SSL on the jalimo list.

When connecting to a server through HTTPS/SSL he gets:

java.io.EOFException
   at
gnu.javax.net.ssl.provider.SSLSocketImpl.doHandshake(SSLSocketImpl.java:445)
   at
gnu.javax.net.ssl.provider.SSLSocketImpl$SocketOutputStream.write(SSLSocketImpl.java:91)
   at java.io.OutputStream.write(OutputStream.java:86)

This is caused from SSLSocketImpl.java line 445:

int i = sockIn.read();
if (i == -1)
throw new EOFException();

Now my question is: What can be the reason that the other side closed
the connection (at least I assume that is the case, when sockIn.read()
return -1) What is the best way to debug this?

Has anyone successfully connected to an HTTPS/SSL server using GNU
Classpath already?

Regards
Robert



signature.asc
Description: OpenPGP digital signature


classpath build problems with libtool 2.2.4

2008-07-06 Thread Robert Schuster
Hi,
I am currently trying to build classpath (0.93) in an environment using
libtool 2.2.4.

I basically disable all optional external dependencies and compile with
jikes:

  --with-jikes=jikes \
  --with-fastjar=fastjar \
  --with-glibj \
  --disable-local-sockets \
  --disable-alsa \
  --disable-gconf-peer \
  --disable-gtk-peer \
  --disable-plugin \
  --disable-dssi \
  --disable-examples \
  --disable-tools \
  --with-glibj-dir=${STAGING_DATADIR}/classpath-initial \
  --with-native-libdir=${STAGING_LIBDIR}/classpath-initial \
  --includedir=${STAGING_INCDIR}/classpath-initial \

This is the error I get from libtool:

i686-linux-libtool: link: unsupported hardcode properties
i686-linux-libtool: link: See the libtool documentation for more
information.
i686-linux-libtool: link: Fatal configuration error.

Which is caused by the following command:

make[3]: Entering directory
`/home/rob/oe/beagle/tmp/work/i686-linux/classpath-initial-0.93-r1/classpath-0.93/native/jni/java-net'
/bin/sh ../../../i686-linux-libtool --tag=CC   --mode=link ccache gcc -W
-Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes
-Wno-long-long -Wstrict-prototypes -pedantic -Werror
-isystem/home/rob/oe/beagle/tmp/staging/i686-linux/usr/include -Os
-module -version-info 0:0:0 -no-undefined
-L/home/rob/oe/beagle/tmp/staging/i686-linux/usr/lib
-Wl,-rpath-link,/home/rob/oe/beagle/tmp/staging/i686-linux/usr/lib
-Wl,-rpath,/home/rob/oe/beagle/tmp/staging/i686-linux/usr/lib -Wl,-O1 -o
libjavanet.la -rpath
/home/rob/oe/beagle/tmp/staging/i686-linux/usr/lib/classpath-initial
javanet.lo java_net_VMInetAddress.lo java_net_VMNetworkInterface.lo
java_net_VMURLConnection.lo gnu_java_net_VMPlainSocketImpl.lo
gnu_java_net_local_LocalSocketImpl.lo
../../../native/jni/classpath/jcl.lo
../../../native/jni/native-lib/libclasspathnative.la -lmagic

I debugged this problem to the point where I found out that libtool does
not like the '-lmagic' argument. If I remove that from the makefile the
build continues. However this cannot be the real fix.

What is wrong here and how should I fix it?

Regards
Robert



signature.asc
Description: OpenPGP digital signature


array overflow in local.c

2008-06-27 Thread Robert Schuster
Hi,
gcc found a problem in our native/jni/javanet/local.c.

I changed it to what I think makes sense but I am not sure whether this
is still the intended behavior.

Furthermore since overrunning the bounds of a stack allocated array may
trash other stuff on the stack I wonder whether this fix also prevents
the problem that the workaround above the modified code speaks of. Since
I do not run Darwin-based OS I cannot test it myself.

Regards
Robert
Index: classpath-0.96.1/native/jni/java-net/local.c
===
--- classpath-0.96.1.orig/native/jni/java-net/local.c	2008-06-27 11:21:31.0 +0200
+++ classpath-0.96.1/native/jni/java-net/local.c	2008-06-27 11:21:41.0 +0200
@@ -93,7 +93,7 @@
 }
 
   strncpy (saddr.sun_path, addr, sizeof (saddr.sun_path));
-  saddr.sun_path[sizeof (saddr.sun_path)] = '\0';
+  saddr.sun_path[sizeof (saddr.sun_path) - 1] = '\0';
   saddr.sun_family = AF_LOCAL;
 
   return bind (fd, (struct sockaddr *) saddr, SUN_LEN (saddr));


signature.asc
Description: OpenPGP digital signature


Re: array overflow in local.c

2008-06-27 Thread Robert Schuster
Hi.

Andrew Haley schrieb:
 Furthermore since overrunning the bounds of a stack allocated array may
 trash other stuff on the stack I wonder whether this fix also prevents
 the problem that the workaround above the modified code speaks of. Since
 I do not run Darwin-based OS I cannot test it myself.
 
 That may well be right.
 
 IMO it should be more like
OK.

Casey would you mind testing the attached patch on your Darwin platform?

Regards
Robert
Index: native/jni/java-net/local.c
===
RCS file: /sources/classpath/classpath/native/jni/java-net/local.c,v
retrieving revision 1.4
diff -u -r1.4 local.c
--- native/jni/java-net/local.c	17 Apr 2007 21:46:27 -	1.4
+++ native/jni/java-net/local.c	27 Jun 2008 13:14:40 -
@@ -73,27 +73,18 @@
   return socket (PF_UNIX, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
 }
 
-static int gcc_sucks = 0;
-
 int
 local_bind (int fd, const char *addr)
 {
   struct sockaddr_un saddr;
 
-  /* For some reason, GCC 4.0.1 on Darwin/x86 MODIFIES the `addr'
- pointer in the CALLER's STACK FRAME after calling this function,
- but if we add this statement below, it doesn't!  */
-  if (gcc_sucks)
-fprintf (stderr, bind %p\n, addr);
-
-  if (strlen (addr)  sizeof (saddr.sun_path))
+  if (strlen (addr) = sizeof (saddr.sun_path))
 {
   errno = ENAMETOOLONG;
   return -1;
 }
 
-  strncpy (saddr.sun_path, addr, sizeof (saddr.sun_path));
-  saddr.sun_path[sizeof (saddr.sun_path)] = '\0';
+  strcpy (saddr.sun_path, addr);
   saddr.sun_family = AF_LOCAL;
 
   return bind (fd, (struct sockaddr *) saddr, SUN_LEN (saddr));


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] RFC: @file support for gjavah gjar

2008-06-06 Thread Robert Schuster
Hi Andrew,
thanks a lot for fixing the remaining issues and committing this.

Regards
Robert

Andrew John Hughes schrieb:
 Committed with the amendments suggested by Tom and Mario:
 
 2008-06-06  Andrew John Hughes  [EMAIL PROTECTED]
 
 * tools/gnu/classpath/tools/common/ClasspathToolParser.java:
 Fixed indentation and changed to use OptionException.
 * tools/gnu/classpath/tools/getopt/OptionException.java:
 (OptionException(String,Throwable)): Added.
 
 2008-06-03  Robert Schuster  [EMAIL PROTECTED]
 
 * tools/gnu/classpath/tools/jar/Main.java:
 (run): Call different ClasspathToolParser.parse() variant.
 (getParser): Changed return type to ClasspathToolParser.
 * tools/gnu/classpath/tools/javah/GcjhMain.java:
 (getParser): Changed return type to ClasspathToolParser.
 * tools/gnu/classpath/tools/javah/Main.java:
 (getParser): Changed return type to ClasspathToolParser.
 * tools/gnu/classpath/tools/getopt/Parser.java: Make 'programName'
 protected.
 * tools/gnu/classpath/tools/common/ClasspathToolParser.java:
 (parse(String[], FileArgumentCallback,boolean): New method.
 (parse(String[], boolean): New method.
 (parseFileList): New method.
 (parseLine): New method.
 (AtFileArgumentCallback): New inner class.
 
 




signature.asc
Description: OpenPGP digital signature


[cp-patches] RFC: move from gnu.java.security.action.GetPropertyAction to sun.security.action.GetPropertyAction

2008-06-04 Thread Robert Schuster
Hi,
the attached patch refactors all of Classpath' code to use
sun.security.action.GetPropertyAction instead of
gnu.java.security.action.GetPropertyAction.

Additionally the class in question is moved to its new package.

While I don't like the usage of a non-standard API as much as you I also
think that with OpenJDK being available under the GPL it is equally bad
to have

gnu.java.security.action.GetPropertyAction

or

sun.security.action.GetPropertyAction

But what I think what is even worse is having both. :)

2008-06-04  Robert Schuster  [EMAIL PROTECTED]

  * gnu/java/security/action/GetPropertyAction.java: Removed.
  * sun/security/action/GetPropertyAction.java: Copied content
  from gnu/java/security/action/GetPropertyAction.java.
  * gnu/classpath/debug/Simple1LineFormatter.java: Changed import
  of gnu.java.security.action.GetPropertyAction to
  sun.security.action.GetPropertyAction
  * gnu/classpath/debug/SystemLogger.java: Dito.
  * gnu/java/security/PolicyFile.java: Dito.
  * gnu/java/security/key/dss/DSSKey.java: Dito.
  * gnu/java/security/key/dss/DSSPrivateKey.java: Dito.
  * gnu/java/security/key/dss/DSSPublicKey.java: Dito.
  * gnu/java/security/key/rsa/GnuRSAKey.java: Dito.
  * gnu/java/security/key/rsa/GnuRSAPrivateKey.java: Dito.
  * gnu/java/security/key/rsa/GnuRSAPublicKey.java: Dito.
  * gnu/javax/crypto/key/dh/GnuDHKey.java: Dito.
  * gnu/javax/crypto/key/dh/GnuDHPrivateKey.java: Dito.
  * gnu/javax/crypto/key/dh/GnuDHPublicKey.java: Dito.
  * gnu/javax/crypto/sasl/plain/PasswordFile.java: Dito.
  * gnu/javax/net/ssl/provider/X509TrustManagerFactory.java: Dito.
  * gnu/xml/aelfred2/XmlParser.java: Dito.

Regards
Robert
Index: gnu/classpath/debug/Simple1LineFormatter.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/debug/Simple1LineFormatter.java,v
retrieving revision 1.3
diff -u -r1.3 Simple1LineFormatter.java
--- gnu/classpath/debug/Simple1LineFormatter.java	11 Jul 2006 16:03:59 -	1.3
+++ gnu/classpath/debug/Simple1LineFormatter.java	4 Jun 2008 08:51:55 -
@@ -38,8 +38,6 @@
 
 package gnu.classpath.debug;
 
-import gnu.java.security.action.GetPropertyAction;
-
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.security.AccessController;
@@ -51,6 +49,8 @@
 import java.util.logging.Formatter;
 import java.util.logging.LogRecord;
 
+import sun.security.action.GetPropertyAction;
+
 /**
  * A simple 1-line formatter to use instead of the 2-line SimpleFormatter used
  * by default in the JDK logging handlers.
Index: gnu/classpath/debug/SystemLogger.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/debug/SystemLogger.java,v
retrieving revision 1.3
diff -u -r1.3 SystemLogger.java
--- gnu/classpath/debug/SystemLogger.java	10 Dec 2006 20:25:41 -	1.3
+++ gnu/classpath/debug/SystemLogger.java	4 Jun 2008 08:51:55 -
@@ -38,13 +38,13 @@
 
 package gnu.classpath.debug;
 
-import gnu.java.security.action.GetPropertyAction;
-
 import java.security.AccessController;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import sun.security.action.GetPropertyAction;
+
 public final class SystemLogger extends Logger
 {
   public static final SystemLogger SYSTEM = new SystemLogger();
Index: gnu/java/security/PolicyFile.java
===
RCS file: /sources/classpath/classpath/gnu/java/security/PolicyFile.java,v
retrieving revision 1.10
diff -u -r1.10 PolicyFile.java
--- gnu/java/security/PolicyFile.java	5 May 2008 17:12:40 -	1.10
+++ gnu/java/security/PolicyFile.java	4 Jun 2008 08:51:55 -
@@ -41,7 +41,6 @@
 import gnu.classpath.debug.SystemLogger;
 
 import gnu.java.lang.CPStringBuilder;
-import gnu.java.security.action.GetPropertyAction;
 
 import java.io.File;
 import java.io.IOException;
@@ -74,6 +73,8 @@
 import java.util.StringTokenizer;
 import java.util.logging.Logger;
 
+import sun.security.action.GetPropertyAction;
+
 /**
  * An implementation of a [EMAIL PROTECTED] java.security.Policy} object whose
  * permissions are specified by a empolicy file/em.
Index: gnu/java/security/action/GetPropertyAction.java
===
RCS file: gnu/java/security/action/GetPropertyAction.java
diff -N gnu/java/security/action/GetPropertyAction.java
--- gnu/java/security/action/GetPropertyAction.java	10 Dec 2006 20:25:42 -	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -
@@ -1,89 +0,0 @@
-/* GetPropertyAction.java
-   Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed

Re: [cp-patches] RFC: add a copy of gnu/java/security/action/GetPropertyAction into sun/security/action

2008-06-04 Thread Robert Schuster
Hi.

Andrew Haley schrieb:
 What is the public equivalent for GetPropertyAction?
 
 There isn't any need, is there?
That depends. :)

  It's just a wrapper for
 (String) AccessController.doPrivileged(new PrivilegedAction() {
   public java.lang.Object run() {
   return System.getProperty(prop); }
 });
That is certainly true but has the nasty side effect of creating an
anonymous class per code location. In the PhoneME code I found ~20
occurrences of GetPropertyAction. Even in Classpath we avoided that by
introducing our own wrapper class.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] RFC: changes to java.lang.Integer, Long...

2008-06-03 Thread Robert Schuster
Hi,

Andrew John Hughes schrieb:
  I'd second that.  Are there clear performance benefits to justify
 creating 256 objects ahead of time?
 Not only does that introduce an overhead in initialising the Long
 class, but it also results in increased
 memory usage for all applications.
 
 I'd also prefer that future patches focused on just one change.  This
 seems to be in essence four
 patches in one.

Couldnt we have the best of both world? Instead of initializing the
array with all values explicitly let us do it lazily. Something like:

Integer valueOf(int i)
{
  Integer I = cached[i];
  if (I == null)
   I = cached[i] = new Integer(i);

  return I;
}



signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] FYI: gjar @file fix

2008-06-03 Thread Robert Schuster
Hi Tom,

 I am less sure about adding java-specific file name parsing to the
 generic command-line parser code.  That code is not supposed to be
 specific to java tooling (at least frysk uses it, fwiw).
I will implement the @file handling ClasspathToolParser now. That way
only our Classpath tools are affected.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


[cp-patches] RFC: @file support for gjavah gjar

2008-06-03 Thread Robert Schuster
Hi,
the following patch adds @file support to gjavah and gjar by enhancing
ClasspathToolParser with a few methods and making both tools use those.

The other tools are not affected by this change nor does this modify the
core getopt functionality (except that I made the 'programName' field
protected - was private).

I originally wanted to use StreamTokenizer or StringTokenizer but I
think those are to complex for the task.

2008-06-03  Robert Schuster  [EMAIL PROTECTED]

  * tools/gnu/classpath/tools/jar/Main.java:
  (run): Call different ClasspathToolParser.parse() variant.
  (getParser): Changed return type to ClasspathToolParser.
  * tools/gnu/classpath/tools/javah/GcjhMain.java:
  (getParser): Changed return type to ClasspathToolParser.
  * tools/gnu/classpath/tools/javah/Main.java:
  (getParser): Changed return type to ClasspathToolParser.
  * tools/gnu/classpath/tools/getopt/Parser.java: Make 'programName'
  protected.
  * tools/gnu/classpath/tools/common/ClasspathToolParser.java:
  (parse(String[], FileArgumentCallback,boolean): New method.
  (parse(String[], boolean): New method.
  (parseFileList): New method.
  (parseLine): New method.
  (AtFileArgumentCallback): New inner class.

Regards
Robert
? tools/generated
Index: tools/gnu/classpath/tools/common/ClasspathToolParser.java
===
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/common/ClasspathToolParser.java,v
retrieving revision 1.1
diff -u -r1.1 ClasspathToolParser.java
--- tools/gnu/classpath/tools/common/ClasspathToolParser.java	22 Sep 2006 01:01:26 -	1.1
+++ tools/gnu/classpath/tools/common/ClasspathToolParser.java	3 Jun 2008 16:34:45 -
@@ -38,9 +38,16 @@
 
 package gnu.classpath.tools.common;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.Reader;
 import java.text.MessageFormat;
+import java.util.ArrayList;
 
 import gnu.classpath.Configuration;
+import gnu.classpath.tools.getopt.FileArgumentCallback;
 import gnu.classpath.tools.getopt.Option;
 import gnu.classpath.tools.getopt.OptionException;
 import gnu.classpath.tools.getopt.Parser;
@@ -84,4 +91,137 @@
}
  });
   }
+
+	public void parse(String[] inArgs, FileArgumentCallback files,
+	  boolean handleFileLists)
+	{
+		FileArgumentCallback cb;
+
+		if (handleFileLists)
+			cb = new AtFileArgumentCallback(files);
+		else
+			cb = files;
+
+		parse(inArgs, cb);
+	}
+
+  public String[] parse(String[] inArgs, boolean handleFileLists)
+  {
+final ArrayList fileResult = new ArrayList();
+
+		final FileArgumentCallback cb = new FileArgumentCallback()
+  	{
+	public void notifyFile(String fileArgument)
+	{
+	  fileResult.add(fileArgument);
+	}
+};
+
+		if (handleFileLists)
+			parse(inArgs, new AtFileArgumentCallback(cb));
+		else
+			parse(inArgs, cb);
+
+return (String[]) fileResult.toArray(new String[0]);
+  }
+
+
+  /** Simple function that takes the given [EMAIL PROTECTED] Reader}, treats it like
+   * a textfile and reads all the whitespace separated entries from it
+   * and adds them to the @{link FileArgumentCallback} instance.
+   */
+  public void parseFileList(Reader reader, FileArgumentCallback cb)
+	throws OptionException
+  {
+BufferedReader breader = new BufferedReader(reader);
+String line = null;
+
+try
+  {
+while ((line = breader.readLine()) != null)
+  parseLine(line, cb);
+  
+reader.close();
+  }
+catch (IOException ioe)
+  {
+System.err.println(programName + : IO error while reading from inputstream);
+System.exit(1);
+  }
+  
+  }
+  
+  /** Parses whitespace separated file entries.
+   *
+   * Note: This is not coping with whitespace in files or quoting.
+   */
+  private void parseLine(String line, FileArgumentCallback cb)
+throws IOException, OptionException
+  {
+final int length = line.length();
+int start = 0;
+int end = 0;
+
+		// While not reached end of line ...
+while (start  length)
+  {
+// Search for first non-whitespace character for the start of a word.
+while (Character.isWhitespace(line.codePointAt(start)))
+  {
+start++;
+
+if (start == length)
+  return;
+  }
+
+end = start + 1;
+	
+// Search for first whitespace character for the end of a word.
+while (end  length  !Character.isWhitespace(line.codePointAt(end)))
+  end++;
+  
+cb.notifyFile(line.substring(start, end));
+
+start = end + 1;
+  }
+  }
+
+	/** Implementation of [EMAIL PROTECTED] FileArgumentCallback} that handles
+ 		* file arguments in [EMAIL PROTECTED] #notifyFile} starting with a code@/code
+		* through [EMAIL PROTECTED] ClasspathToolParser#parseFileList}.
+		*/
+	class AtFileArgumentCallback extends

Re: [cp-patches] FYI: gjar @file fix

2008-06-02 Thread Robert Schuster
Hi Andrew,
I am not so happy with that patch. :)

I was trying to get Classpath to build PhoneME today and that requires
our javah to support @-style arguments as well. From my work for MIDPath
I know that we also lack that functionality in gjar that is why I tried
an implementation that can be used in all getopt using classpath tools.

What I am also unhappy is that a simple BufferedReader.readLine() is
used to get the filelist entries. The filelist the phoneme build
generates looks like this: Bla Foo Baz. So a simple parser is needed
that splits at whitespace bounds. My suggested implementation does
exactly that.

What my implementation does not handle is whitespace inside filenames
and quoting. However I am not sure whether this is supported in filelist
 anyway.

It may be possible that some tools need @file support and some not (Does
anyone know more about this?). And such a case I would change the getopt
API to explicitly request @file support in parse().

Please have a look at the attached patch. :)

Regards
Robert

Andrew John Hughes schrieb:
 This adds support in gjar for the @file argument
 as used by the OpenJDK build.
 
 ChangeLog:
 
 2008-06-02  Andrew John Hughes  [EMAIL PROTECTED]
 
   * tools/gnu/classpath/tools/getopt/OptionException.java:
   (OptionException(String,Throwable)): New constructor.
   * tools/gnu/classpath/tools/jar/Main.java:
   (fileLists): New queue for streams containing lists of files.
   (HandleFile.NotifyFile(String)): Check for '@' arguments
   and add to stream queue.
   (parsed(String)): Add stdin to queue instead of setting flag.
   (readNames()): Work with the queue rather than just stdin.
   (run(String[])): Always execute readNames().
 
 

? sun/security
? tools/generated
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.9623
diff -u -r1.9623 ChangeLog
--- ChangeLog	1 Jun 2008 12:01:11 -	1.9623
+++ ChangeLog	2 Jun 2008 22:40:10 -
@@ -1,3 +1,10 @@
+2008-06-03  Robert Schuster  [EMAIL PROTECTED]
+
+  * tools/gnu/classpath/tools/getopt/Parser.java:
+  (parse): Added twos checks for '@' character and calls to parseFileList.
+  (parseFileList): New method.
+  (parseLine): New method.
+
 2008-06-01  Mark Wielaard  [EMAIL PROTECTED]
 
 	* gnu/java/awt/java2d/AbstractGraphics2D.java: Removed XDialogPeer
Index: tools/gnu/classpath/tools/getopt/Parser.java
===
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/getopt/Parser.java,v
retrieving revision 1.10
diff -u -r1.10 Parser.java
--- tools/gnu/classpath/tools/getopt/Parser.java	20 Mar 2008 18:04:44 -	1.10
+++ tools/gnu/classpath/tools/getopt/Parser.java	2 Jun 2008 22:40:11 -
@@ -38,6 +38,10 @@
 
 package gnu.classpath.tools.getopt;
 
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.text.BreakIterator;
 import java.text.MessageFormat;
@@ -442,7 +446,12 @@
 || args[currentIndex].charAt(0) != '-'
 || -.equals(args[currentIndex])) //$NON-NLS-1$
   {
-files.notifyFile(args[currentIndex]);
+// Treat file names starting with @ like a file containing a file list.
+	if (args[currentIndex].codePointAt(0) == '@')
+	  parseFileList(args[currentIndex].substring(1), files);
+	else
+  files.notifyFile(args[currentIndex]);
+  
 continue;
   }
 if (--.equals(args[currentIndex])) //$NON-NLS-1$
@@ -456,7 +465,13 @@
   }
 // Add remaining arguments to leftovers.
 for (++currentIndex; currentIndex  args.length; ++currentIndex)
-  files.notifyFile(args[currentIndex]);
+	  {
+	// Treat file names starting with @ like a file containing a file list.
+	if (args[currentIndex].codePointAt(0) == '@')
+	  parseFileList(args[currentIndex].substring(1), files);
+	else
+  files.notifyFile(args[currentIndex]);
+  }
 // See if something went wrong.
 validate();
   }
@@ -492,4 +507,71 @@
 });
 return (String[]) fileResult.toArray(new String[0]);
   }
+  
+  /** Simple function that takes the given file, treats it as a textfile
+   * and reads all the whitespace separated entries from it notifying
+   * [EMAIL PROTECTED] FileArgumentCallback} instance each time.
+  */
+  private void parseFileList(String fileName, FileArgumentCallback files)
+throws OptionException
+  {
+BufferedReader reader = null;
+String line = null;
+
+try
+  {
+reader = new BufferedReader(new FileReader(fileName));
+  }
+catch (FileNotFoundException fnfe)
+  {
+System.err.println

Re: [cp-patches] FYI: gjar @file fix

2008-06-02 Thread Robert Schuster
Hi Andrew,

  I was trying to get Classpath to build PhoneME today and that requires
  our javah to support @-style arguments as well. From my work for MIDPath
  I know that we also lack that functionality in gjar that is why I tried
  an implementation that can be used in all getopt using classpath tools.

 
 Ok I wasn't aware you were working on this, sorry.
Sorry, I did not announce this anywhere. :)

  What I am also unhappy is that a simple BufferedReader.readLine() is
  used to get the filelist entries. The filelist the phoneme build
  generates looks like this: Bla Foo Baz. So a simple parser is needed
  that splits at whitespace bounds. My suggested implementation does
  exactly that.

 
 So I see.  Is there a reason you didn't use String.split or
 StringTokenizer for this?

I considered String.split() to be to costly (regular expressions).
StringTokenizer would be a good idea ...

  The patch looks
 good, though I wonder how we can still integrate the stdin support
 gjar has.
I just saw that StreamTokenizer might provide a good parser that can
also deal with quoting.

If we use that in the parser and add an optional InputStream argument to
Parser.parse() we could have the best of your and my approach and
additionally get quoting right.

Unfortunately I need some sleep now and will continue with this patch in
~10 hours.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


[cp-patches] RFC: add a copy of gnu/java/security/action/GetPropertyAction into sun/security/action

2008-06-02 Thread Robert Schuster
Hi,
the attached does something very dumb: It makes a copy of an existing
class. Still I need it because otherwise a resulting binary is either
not runnable with classpath or with openjdk's class library.

A better patch would possibly refactor all classpath code to use the
sun/security variant and remove the gnu/java/security one.

Opinions?

2008-06-03  Robert Schuster  [EMAIL PROTECTED]

  * sun/security/action/GetPropertyAction.java: Functional copy
  of gnu/java/security/action/GetPropertyAction.java.

Regards
Robert
Index: sun/security/action/GetPropertyAction.java
===
RCS file: sun/security/action/GetPropertyAction.java
diff -N sun/security/action/GetPropertyAction.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ sun/security/action/GetPropertyAction.java	2 Jun 2008 23:11:06 -
@@ -0,0 +1,93 @@
+/* GetPropertyAction.java
+   Copyright (C) 2004, 2008 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package sun.security.action;
+
+import java.security.PrivilegedAction;
+
+/**
+ * PrivilegedAction implementation that calls System.getProperty() with
+ * the property name passed to its constructor.
+ *
+ * Example of use:
+ * code
+ * GetPropertyAction action = new GetPropertyAction(http.proxyPort);
+ * String port = AccessController.doPrivileged(action);
+ * /code
+ *
+ * Note: Usage of this class is discouraged as it is not a part of the 
+ * J2SE API. This class is (and should always be) a doppelgaenger of
+ * [EMAIL PROTECTED] gnu.java.security.action.GetPropertyAction}.
+ */
+public class GetPropertyAction implements PrivilegedActionString
+{
+  String name;
+  String value = null;
+
+  public GetPropertyAction()
+  {
+  }
+  
+  public GetPropertyAction(String propName)
+  {
+setParameters(propName);
+  }
+
+  public GetPropertyAction(String propName, String defaultValue)
+  {
+setParameters(propName, defaultValue);
+  }
+  
+  public String run()
+  {
+return System.getProperty(name, value);
+  }
+  
+  public GetPropertyAction setParameters(String propName)
+  {
+this.name = propName;
+this.value = null;
+return this;
+  }
+
+  public GetPropertyAction setParameters(String propName, String defaultValue)
+  {
+this.name = propName;
+this.value = defaultValue;
+return this;
+  }
+}


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] [release] FYI: Allow native-only build #06: Regenerate headers by default only when necessary

2008-06-01 Thread Robert Schuster
Hi,
thank you very much for this change!

Regards
Robert

Andrew John Hughes schrieb:
 This changes the default behaviour for a source tree
 which already contains the header files.  It now won't
 regenerate them unless asked.  Generating them by default
 for a development (CVS) tree remains the default.  This
 moves javah to being a dev-only requirement.
 
 ChangeLog:
 
 2008-06-01  Andrew John Hughes  [EMAIL PROTECTED]
 
   * configure.ac: Only regenerate headers by
   default if the headers aren't in the source tree.
 
 




signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] RFC: NetworkInterface - implement some 1.6 methods

2008-05-15 Thread Robert Schuster
Hi,
I committed this today.

2008-05-15  Robert Schuster  [EMAIL PROTECTED]

  * java/net/NetworkInterface.java:
  (isUp): New method.
  (isPointToPoint): Dito.
  (isLoopback): Dito.
  (supportsMulticast): Dito.
  * vm/reference/java/net/VMNetworkInterface.java:
  (isUp): New method.
  (isPointToPoint): Dito.
  (isLoopback): Dito.
  (supportsMulticast): Dito.
  * native/jni/java-net/java_net_VMNetworkInterface.c:
  (isUp): New method.
  (isPointToPoint): Dito.
  (isLoopback): Dito.
  (supportsMulticast): Dito.

Regards
Robert

Robert Schuster schrieb:
 Hi.
 
 Robert Schuster schrieb:
 Hi,
 I fixed the copy and paste error and another flaw. Casting to jboolean
 did not alway returned the correct result. I made the if-flag-set then
 JNI_TRUE otherwise JNI_FALSE explicit. Now it works correctly.
 If no one objects I would like to commit this patch.
 
 Regards
 Robert
 




signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath ChangeLog java/net/NetworkInterface.j...

2008-05-15 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 08/05/15 18:44:37

Modified files:
.  : ChangeLog 
java/net   : NetworkInterface.java 
vm/reference/java/net: VMNetworkInterface.java 
native/jni/java-net: java_net_VMNetworkInterface.c 

Log message:
2008-05-15  Robert Schuster  [EMAIL PROTECTED]

  * java/net/NetworkInterface.java:
  (isUp): New method.
  (isPointToPoint): Dito.
  (isLoopback): Dito.
  (supportsMulticast): Dito.
  * vm/reference/java/net/VMNetworkInterface.java:
  (isUp): New method.
  (isPointToPoint): Dito.
  (isLoopback): Dito.
  (supportsMulticast): Dito.
  * native/jni/java-net/java_net_VMNetworkInterface.c:
  (isUp): New method.
  (isPointToPoint): Dito.
  (isLoopback): Dito.
  (supportsMulticast): Dito.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9615r2=1.9616
http://cvs.savannah.gnu.org/viewcvs/classpath/java/net/NetworkInterface.java?cvsroot=classpathr1=1.24r2=1.25
http://cvs.savannah.gnu.org/viewcvs/classpath/vm/reference/java/net/VMNetworkInterface.java?cvsroot=classpathr1=1.8r2=1.9
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/java-net/java_net_VMNetworkInterface.c?cvsroot=classpathr1=1.6r2=1.7




gnu.xml.datatype.JAXPDatatypeFactory not there

2008-05-13 Thread Robert Schuster
Hi,
javax.xml.datatype.DatatypeFactory declares:

public static final String DATATYPEFACTORY_IMPLEMENTATION_CLASS =
gnu.xml.datatype.JAXPDatatypeFactory;

The value is a fallback value which is treated as a class which is to be
instantiated. Unfortunately this class does not exist.

Has this class been renamed or has it really not been written yet?

Regards
Robert



signature.asc
Description: OpenPGP digital signature


javah in 0.97+ - trouble

2008-05-13 Thread Robert Schuster
Hi,
from 0.97 onwards, classpath needs a working javah tool. Such a program
is provided by classpath' tools.zip but needs a working runtime and
class library first.

Earlier classpath releases had pre-generated header files and needed no
javah program.

Someone with less knowledge of the subtile changes in each classpath
release wanted to introduce 0.97.1 in OE as the class library which runs
the compiler etc. This currently fails because in my previous bootstrap
effort I did not care to provide a working javah (it would be from
classpath 0.93).

I would like to suggest the following way to fix this issue: The build
system should allow using the just built javah application being run
with a provided java executable. This would be less pain for me and
would probably also benefit other cross compilation efforts.

E.g. --enable-builtin-javah should set the javah executable to some
script which is generated (perhaps from the real gjavah) which is run
with the java vm specified by --with-java.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


Re: How to build Classpath without Classpath

2008-05-09 Thread Robert Schuster
Hi,
I am maintaining the Java/Classpath stuff in OpenEmbedded and have
implemented a self-hosting toolchain like this:

jikes 1.21 - classpath 0.93 - cacao 0.98 or jamvm 1.5.0 - ecj-initial -
classpath 0.9x (x = 5) - cacao 0.98+hg20071001 (or newer) -
ecj(-bootstrap)

ecj-initial is just ecj but taught to use classpath 0.93 as its class.
The set of Java classes from ECJ that are really compiled is the same as
found in the Debian package ecj-bootstrap.

ecj-bootstrap is the Java compiler that uses classpath 0.9x and cacao
0.98+hg20071001+. It is called -bootstrap because it only has the basic
'javac' features, no ant integration and whatnot. Again the same classes
as Debian's ecj-bootstrap.

This compiler is used to compile all the Java packages, while
ecj-initial only serves the bootstrapping purposes.

Regards
Robert




signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] RFC: NetworkInterface - implement some 1.6 methods

2008-04-22 Thread Robert Schuster
Hi.

Robert Schuster schrieb:
 Hi,
 I fixed the copy and paste error and another flaw. Casting to jboolean
 did not alway returned the correct result. I made the if-flag-set then
 JNI_TRUE otherwise JNI_FALSE explicit. Now it works correctly.
If no one objects I would like to commit this patch.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] RFC: NetworkInterface - implement some 1.6 methods

2008-04-21 Thread Robert Schuster
Hi,
I fixed the copy and paste error and another flaw. Casting to jboolean
did not alway returned the correct result. I made the if-flag-set then
JNI_TRUE otherwise JNI_FALSE explicit. Now it works correctly.

Christian Thalinger schrieb:
 I wonder if it would be simpler to only have one native method,
 returning the socket flags, and mapping the IFF_ defines in
 java/net/VMNetworkInterface so you could implement it in Java.  But I
 don't know if the flags are consistent between different OS or even libc
 versions.
I would like this, too. I think our POSIX gurus should comment. :)

Regards
Robert

Index: java/net/NetworkInterface.java
===
RCS file: /sources/classpath/classpath/java/net/NetworkInterface.java,v
retrieving revision 1.23
diff -u -r1.23 NetworkInterface.java
--- java/net/NetworkInterface.java	18 Dec 2006 21:37:39 -	1.23
+++ java/net/NetworkInterface.java	21 Apr 2008 10:38:25 -
@@ -1,5 +1,5 @@
 /* NetworkInterface.java --
-   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -265,4 +265,50 @@
 
 return result.toString();
   }
+
+  /**
+   * Determines whether this interface is ready to transfer data.
+   *
+   * @return whether the interface is up
+  */
+  public boolean isUp()
+throws SocketException
+  {
+return VMNetworkInterface.isUp(netif.name);
+  }
+
+  /**
+   * Determines whether this interface does point to point
+   * transmission.
+   *
+   * @return whether the interface does point to point transmission
+  */
+  public boolean isPointToPoint()
+throws SocketException
+  {
+return VMNetworkInterface.isPointToPoint(netif.name);
+  }
+
+  /**
+   * Determines whether this interface is the loopback interface.
+   *
+   * @return whether the interface is the loopback interface
+  */
+  public boolean isLoopback()
+throws SocketException
+  {
+return VMNetworkInterface.isLoopback(netif.name);
+  }
+
+  /**
+   * Determines whether this interface supports multicast transmission.
+   *
+   * @return whether the interface supports multicast transmission.
+  */
+  public boolean supportsMulticast()
+throws SocketException
+  {
+return VMNetworkInterface.supportsMulticast(netif.name);
+  }
+
 }
Index: vm/reference/java/net/VMNetworkInterface.java
===
RCS file: /sources/classpath/classpath/vm/reference/java/net/VMNetworkInterface.java,v
retrieving revision 1.7
diff -u -r1.7 VMNetworkInterface.java
--- vm/reference/java/net/VMNetworkInterface.java	18 Dec 2006 21:37:39 -	1.7
+++ vm/reference/java/net/VMNetworkInterface.java	21 Apr 2008 10:38:25 -
@@ -1,5 +1,5 @@
 /* VMNetworkInterface.java --
-   Copyright (C) 2005  Free Software Foundation, Inc.
+   Copyright (C) 2005, 2008  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -119,4 +119,13 @@
 else
   throw new SocketException(invalid interface address);
   }
+
+  static native boolean isUp(String name) throws SocketException;
+
+  static native boolean isLoopback(String name) throws SocketException;
+
+  static native boolean isPointToPoint(String name) throws SocketException;
+
+  static native boolean supportsMulticast(String name) throws SocketException;
+
 }
Index: native/jni/java-net/java_net_VMNetworkInterface.c
===
RCS file: /sources/classpath/classpath/native/jni/java-net/java_net_VMNetworkInterface.c,v
retrieving revision 1.6
diff -u -r1.6 java_net_VMNetworkInterface.c
--- native/jni/java-net/java_net_VMNetworkInterface.c	5 Apr 2007 12:34:19 -	1.6
+++ native/jni/java-net/java_net_VMNetworkInterface.c	21 Apr 2008 10:38:25 -
@@ -1,5 +1,5 @@
 /* VMNetworkInterface.c - Native methods for NetworkInterface class
-   Copyright (C) 2003, 2005, 2006  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005, 2006, 2008 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -50,11 +50,18 @@
 #include stdio.h
 #include string.h
 
+#include net/if.h
+#include sys/ioctl.h
+
 #include jni.h
 #include jcl.h
 
+#include cpnative.h
+#include cpnet.h
+
 #include java_net_VMNetworkInterface.h
 
+int iff_flags(JNIEnv *, jstring, jint *);
 
 static jmethodID java_net_VMNetworkInterface_init;
 static jmethodID java_net_VMNetworkInterface_addAddress;
@@ -251,4 +258,136 @@
 #endif /* HAVE_IFADDRS_H  HAVE_GETIFADDRS */
 }
 
+int iff_flags(JNIEnv *env, jstring name, jint *flags)
+{
+  struct ifreq iff;
+  const char *iff_name;
+  jint socket;
+  int error, retval;
+
+  if ((error = cpnet_openSocketDatagram(env, socket, AF_INET)))
+  {
+return error;
+  }
+
+  iff_name = JCL_jstring_to_cstring(env, name);
+  memset(iff, 0, sizeof(iff));
+  strcpy(iff.ifr_name, iff_name);
+ 
+  if (ioctl(socket, SIOCGIFFLAGS, 

[cp-patches] RFC: NetworkInterface - implement some 1.6 methods

2008-04-21 Thread Robert Schuster
Hi,
people using Jalimo asked for those methods and I found them simple to
implement.

Since I am lousy non-Java hacker I appreciate comments on the code in
java_net_VMNetworkInterface.c.

Regards
Robert

2008-04-21  Robert Schuster  [EMAIL PROTECTED]

  * java/net/NetworkInterface.java:
  (isUp): New method.
  (isPointToPoint): Dito.
  (isLoopback): Dito.
  (supportsMulticast): Dito.
  * vm/reference/java/net/VMNetworkInterface.java:
  (isUp): New method.
  (isPointToPoint): Dito.
  (isLoopback): Dito.
  (supportsMulticast): Dito.
  * native/jni/java-net/java_net_VMNetworkInterface.c:
  (isUp): New method.
  (isPointToPoint): Dito.
  (isLoopback): Dito.
  (supportsMulticast): Dito.
Index: vm/reference/java/net/VMNetworkInterface.java
===
RCS file: /sources/classpath/classpath/vm/reference/java/net/VMNetworkInterface.java,v
retrieving revision 1.7
diff -u -r1.7 VMNetworkInterface.java
--- vm/reference/java/net/VMNetworkInterface.java	18 Dec 2006 21:37:39 -	1.7
+++ vm/reference/java/net/VMNetworkInterface.java	21 Apr 2008 06:55:11 -
@@ -1,5 +1,5 @@
 /* VMNetworkInterface.java --
-   Copyright (C) 2005  Free Software Foundation, Inc.
+   Copyright (C) 2005, 2008  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -119,4 +119,13 @@
 else
   throw new SocketException(invalid interface address);
   }
+
+  static native boolean isUp(String name) throws SocketException;
+
+  static native boolean isLoopback(String name) throws SocketException;
+
+  static native boolean isPointToPoint(String name) throws SocketException;
+
+  static native boolean supportsMulticast(String name) throws SocketException;
+
 }
Index: native/jni/java-net/java_net_VMNetworkInterface.c
===
RCS file: /sources/classpath/classpath/native/jni/java-net/java_net_VMNetworkInterface.c,v
retrieving revision 1.6
diff -u -r1.6 java_net_VMNetworkInterface.c
--- native/jni/java-net/java_net_VMNetworkInterface.c	5 Apr 2007 12:34:19 -	1.6
+++ native/jni/java-net/java_net_VMNetworkInterface.c	21 Apr 2008 06:55:12 -
@@ -1,5 +1,5 @@
 /* VMNetworkInterface.c - Native methods for NetworkInterface class
-   Copyright (C) 2003, 2005, 2006  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005, 2006, 2008 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -50,11 +50,18 @@
 #include stdio.h
 #include string.h
 
+#include net/if.h
+#include sys/ioctl.h
+
 #include jni.h
 #include jcl.h
 
+#include cpnative.h
+#include cpnet.h
+
 #include java_net_VMNetworkInterface.h
 
+int iff_flags(JNIEnv *, jstring, jint *);
 
 static jmethodID java_net_VMNetworkInterface_init;
 static jmethodID java_net_VMNetworkInterface_addAddress;
@@ -251,4 +258,133 @@
 #endif /* HAVE_IFADDRS_H  HAVE_GETIFADDRS */
 }
 
+int iff_flags(JNIEnv *env, jstring name, jint *flags)
+{
+  struct ifreq iff;
+  const char *iff_name;
+  jint socket;
+  int error, retval;
+
+  if ((error = cpnet_openSocketDatagram(env, socket, AF_INET)))
+  {
+return error;
+  }
+
+  iff_name = JCL_jstring_to_cstring(env, name);
+  memset(iff, 0, sizeof(iff));
+  strcpy(iff.ifr_name, iff_name);
+ 
+  if (ioctl(socket, SIOCGIFFLAGS, iff) = 0)
+  {
+*flags = (jint) iff.ifr_flags;
+
+retval = 0;
+  }
+  else
+  {
+retval = errno;
+  }
+
+  cpnet_close(env, socket);
+
+  JCL_free_cstring(env, name, iff_name);
+
+  return retval;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_java_net_VMNetworkInterface_isUp (JNIEnv *env, jclass class UNUSED,
+   jstring name)
+{
+  jint flags;
+  int error;
+  jboolean retval;
+
+  if ((error = iff_flags(env, name, flags)))
+  {
+JCL_ThrowException(env, java/net/SocketException,
+   cpnative_getErrorString(error));
+
+retval = JNI_FALSE;
+  }
+  else
+  {
+retval = (jboolean) (flags  (IFF_UP | IFF_RUNNING));
+  }
+
+  return retval;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_java_net_VMNetworkInterface_isPointToPoint (JNIEnv *env,
+ jclass class UNUSED,
+ jstring name)
+{
+  jint flags;
+  int error;
+  jboolean retval;
+
+  if ((error = iff_flags(env, name, flags)))
+  {
+JCL_ThrowException(env, java/net/SocketException,
+   cpnative_getErrorString(error));
+
+retval = JNI_FALSE;
+  }
+  else
+  {
+retval = (jboolean) (flags  IFF_POINTOPOINT);
+  }
+
+  return retval;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_java_net_VMNetworkInterface_isLoopback (JNIEnv *env,
+ jclass class UNUSED,
+ jstring name)
+{
+  jint flags;
+  int error;
+  jboolean retval;
+
+  if ((error = iff_flags(env, name, flags)))
+  {
+JCL_ThrowException(env, java/net/SocketException,
+   cpnative_getErrorString

[cp-patches] FYI: fix StAX API incompatibility

2008-03-04 Thread Robert Schuster
Hi,
while trying to compile woodstox 2.0.6 on classpath I stumbled across an
incompatibility in out StAX API. The attached patch fixes the interface
and adjust all implementations within classpath.

Regards
Robert

2008-03-04  Robert Schuster  [EMAIL PROTECTED]

  * gnu/xml/stream/AttributeImpl.java: Changed type field to String.
  (getDTDType): Changed return type to String.
  * gnu/xml/stream/XMLEventAllocatorImpl.java:
  (allocate): Removed wrapping of string in QName object.
  * gnu/xml/stream/XMLEventFactoryImpl.java:
  (createAttribute(String, String)): Removed wrapping of string in
  QName object.
  (createAttribute(QName, String)): Dito.
  (createAttribute(String, String, String, String)): Dito.
  * javax/xml/stream/events/Attribute.java:
  (getDTDType): Changed return type to String.
Index: gnu/xml/stream/AttributeImpl.java
===
RCS file: /sources/classpath/classpath/gnu/xml/stream/AttributeImpl.java,v
retrieving revision 1.1
diff -u -r1.1 AttributeImpl.java
--- gnu/xml/stream/AttributeImpl.java	4 Sep 2005 09:52:10 -	1.1
+++ gnu/xml/stream/AttributeImpl.java	4 Mar 2008 16:02:43 -
@@ -56,11 +56,11 @@
 
   protected final QName name;
   protected final String value;
-  protected final QName type;
+  protected final String type;
   protected final boolean specified;
 
   protected AttributeImpl(Location location,
-  QName name, String value, QName type,
+  QName name, String value, String type,
   boolean specified)
   {
 super(location);
@@ -85,7 +85,7 @@
 return value;
   }
 
-  public QName getDTDType()
+  public String getDTDType()
   {
 return type;
   }
Index: gnu/xml/stream/XMLEventAllocatorImpl.java
===
RCS file: /sources/classpath/classpath/gnu/xml/stream/XMLEventAllocatorImpl.java,v
retrieving revision 1.3
diff -u -r1.3 XMLEventAllocatorImpl.java
--- gnu/xml/stream/XMLEventAllocatorImpl.java	3 Mar 2006 12:30:59 -	1.3
+++ gnu/xml/stream/XMLEventAllocatorImpl.java	4 Mar 2008 16:02:44 -
@@ -165,7 +165,7 @@
   attributes.add(new AttributeImpl(location,
reader.getAttributeName(i),
reader.getAttributeValue(i),
-   QName.valueOf(reader.getAttributeType(i)),
+   reader.getAttributeType(i),
reader.isAttributeSpecified(i)));
 return new StartElementImpl(location,
 reader.getName(),
Index: gnu/xml/stream/XMLEventFactoryImpl.java
===
RCS file: /sources/classpath/classpath/gnu/xml/stream/XMLEventFactoryImpl.java,v
retrieving revision 1.2
diff -u -r1.2 XMLEventFactoryImpl.java
--- gnu/xml/stream/XMLEventFactoryImpl.java	3 Mar 2006 12:30:59 -	1.2
+++ gnu/xml/stream/XMLEventFactoryImpl.java	4 Mar 2008 16:02:44 -
@@ -79,20 +79,20 @@
   {
 return new AttributeImpl(location,
  new QName(namespaceURI, localName, prefix),
- value, QName.valueOf(CDATA), true);
+ value, CDATA, true);
   }
   
   public Attribute createAttribute(String localName, String value)
   {
 return new AttributeImpl(location,
  new QName(localName),
- value, QName.valueOf(CDATA), true);
+ value, CDATA, true);
   }
 
   public Attribute createAttribute(QName name, String value)
   {
 return new AttributeImpl(location, name, value,
- QName.valueOf(CDATA), true);
+ CDATA, true);
   }
 
   public Namespace createNamespace(String namespaceURI)
Index: javax/xml/stream/events/Attribute.java
===
RCS file: /sources/classpath/classpath/javax/xml/stream/events/Attribute.java,v
retrieving revision 1.2
diff -u -r1.2 Attribute.java
--- javax/xml/stream/events/Attribute.java	4 Sep 2005 09:44:30 -	1.2
+++ javax/xml/stream/events/Attribute.java	4 Mar 2008 16:02:48 -
@@ -59,7 +59,7 @@
   /**
* Returns the type of this attribute.
*/
-  QName getDTDType();
+  String getDTDType();
 
   /**
* Indicates whether this attribute was specified in the input source, or


signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath ChangeLog gnu/xml/stream/AttributeImp...

2008-03-04 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 08/03/04 17:40:00

Modified files:
.  : ChangeLog 
gnu/xml/stream : AttributeImpl.java XMLEventAllocatorImpl.java 
 XMLEventFactoryImpl.java 
javax/xml/stream/events: Attribute.java 

Log message:
Fixes an incompatibility with official StAX API.

2008-03-04  Robert Schuster  [EMAIL PROTECTED]

  * gnu/xml/stream/AttributeImpl.java: Changed type field to String.
  (getDTDType): Changed return type to String.
  * gnu/xml/stream/XMLEventAllocatorImpl.java:
  (allocate): Removed wrapping of string in QName object.
  * gnu/xml/stream/XMLEventFactoryImpl.java:
  (createAttribute(String, String)): Removed wrapping of string in
  QName object.
  (createAttribute(QName, String)): Dito.
  (createAttribute(String, String, String, String)): Dito.   
  * javax/xml/stream/events/Attribute.java:
  (getDTDType): Changed return type to String.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9541r2=1.9542
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/xml/stream/AttributeImpl.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/xml/stream/XMLEventAllocatorImpl.java?cvsroot=classpathr1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/xml/stream/XMLEventFactoryImpl.java?cvsroot=classpathr1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/xml/stream/events/Attribute.java?cvsroot=classpathr1=1.2r2=1.3




no generated javadoc fof java/util/concurrent from external/jsr166

2008-03-02 Thread Robert Schuster
Hi,
the classes for java/util/concurrent are mainly inside the
external/jsr166 folder. However this directory is not part of the
directories which are scanned to generate the javadoc. Result is that it
looks that we do not support this API.

File a bug?

Regards
Robert



signature.asc
Description: OpenPGP digital signature


Re: brandweg hacking session on friday

2008-02-20 Thread Robert Schuster
Hi,
I will be in Brussels at around 1pm and would like to join you for a
Brandweg hacking session.

The people in Brussel have a public wireless mesh-network like Freifunk
in Germany. Here is a map with some node locations:
http://boum.no-ip.com/gmap/gmap.php

If we meet in a hotel room, will be near such a node or is the room
sufficiently high?

I have a suitable wireless router as well as a 4quad antenna which I can
bring along.

I can also explain everybody who wants to hear it how public
mesh-networking works, just in case you want to start such a community
in your hometown. :D

Regards
Robert

Dalibor Topic schrieb:
 hi all,
 
 so, since a couple of us want to get some development done on Friday, I
 wanted to ask around who's coming and when, so please reply when you'll
 be around on Friday, if you're interested in poking around at making
 this merge work out. That's how we'll figure out time.
 
 There are two easy options for locations:
 
 a) squatting in someone's hotel (rooms) for a few hours (mhm, wifi!)
 b) taking over a cafe downtown and doing the work there (mhm, waffles!)
 
 or a combination of both (wifi  waffles!).
 
 Preferences, ideas, etc?
 
 fire away,
 dalibor topic
 




signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] RFC: Abstract StringBuilder and StringBuffer

2008-02-17 Thread Robert Schuster
Hi Andrew,

 public final class StringBuilder
 +  extends AbstractStringBuffer
StringBuffer and StringBuilder have Object as their superclass. I think
we are not allowed to break that. If so you should change your
implementation to follow a delegation pattern and make as many methods
'final' as possible. :)

Regards
Robert



signature.asc
Description: OpenPGP digital signature


non-free map data in Java/Classpath/OpenJDK FOSDEM organization page

2008-01-30 Thread Robert Schuster
Hi everyone,
the map excerpts in the Debian Wiki[0] are non-free I think. I made some
replacements with the help of openstreetmap (CC-BY-SA 2.0).

It would be nice if someone with knowledge of brussels can tell us
whether these maps can be used for casual uses already (or contain
misleading information):

http://page.mi.fu-berlin.de/rschuste/osm_brussels_overview.png
http://page.mi.fu-berlin.de/rschuste/osm_brussels_grandplace.png
http://page.mi.fu-berlin.de/rschuste/osm_brussels_ulb.png

Furthermore they need to be made a little bit smaller for the Wiki and
we should paint in our POIs. :)

Regards
Robert

[0] - http://wiki.debian.org/Java/DevJam/2008/Fosdem



signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] [PATCH] libjava: java.net.URI.relativize method results inconsistent with other Java VMs

2008-01-09 Thread Robert Schuster
Hi,


 The second change involved removing a leading '/' from the returned
 relative path to make it consistent with results from other Java VMs.
 
 This patch corrects two issues found in URI.relativize() method in
 libjava/classpath/java/net/URI.java. It applies from gcc 4.1.2 through latest
 trunk:
 
 * does stricter check for a path match while still using String.startsWith()
 * excludes leading '/' if necessary for relative path fragment being returned
Please check whether this does not cause the wrong behavior described
here come up again: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24249

Regards
Robert



signature.asc
Description: OpenPGP digital signature


test for javac

2007-12-20 Thread Robert Schuster
Hi,
when configuring classpath with --with-ecj=something there is still a
test being run to check whether 'javac' exists and whether it is Java5
compatible.

I think the correct behavior would be:
  a) test whether the supplied command (may ecj or whathever) is available
  b) test whether this executable can compile Java5 code

There should be no test for other compilers if I explicitly provide one.

Additionally the current test for Java5 compatibility is IMHO wrong. To
compile Java5 code one needs a suitable compiler and class library. If a
Java5-capable compiler is running on a pre-Java5 class library (e.g. ecj
on gcj 4.2.1) the current test fails.

A better test would IMHO be to compile the following source:

package java.lang;

public class Object
{
  static T void foo()
  {
  }
}

with

javac-to-be-tested -source 1.5 -bootclasspath . -d . java/lang/Object.java

and check the results.

File some bugs?

Regards
Robert



signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: added myself to AUTHORS

2007-12-11 Thread Robert Schuster
Hi,
as expressed by Mark I add myself to the AUTHORS file.

2007-12-11  Robert Schuster  [EMAIL PROTECTED]

  * AUTHORS: Added my name to the list.
Index: AUTHORS
===
RCS file: /sources/classpath/classpath/AUTHORS,v
retrieving revision 1.42
diff -u -r1.42 AUTHORS
--- AUTHORS	23 Nov 2007 14:38:58 -	1.42
+++ AUTHORS	11 Dec 2007 08:32:49 -
@@ -41,6 +41,7 @@
 Aaron M. Renn ([EMAIL PROTECTED])
 Ian Rogers ([EMAIL PROTECTED])
 Andrew Selkirk ([EMAIL PROTECTED])
+Robert Schuster ([EMAIL PROTECTED])
 Christian Thalinger ([EMAIL PROTECTED])
 Andreas Tobler ([EMAIL PROTECTED])
 Mario Torre ([EMAIL PROTECTED])


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] FYI: add myself to THANKYOU

2007-12-11 Thread Robert Schuster
Hi.

Mark Wielaard schrieb:
 But...
 People with active commit rights should be in the AUTHORS file. Really!
Done! :)

Regards
Robert



signature.asc
Description: OpenPGP digital signature


Re: new target milestone for bugzilla

2007-12-11 Thread Robert Schuster
Mark Wielaard schrieb:
 Hi Robert,
 
 On Mon, 2007-12-10 at 23:36 +0100, Robert Schuster wrote:
 I wanted mark a bug as fixed and set the target milestone to the version
 where it will be considered as fixed to 0.97. Unfortunately that number
 is not available in the dropdown box.

 Could someone with the necessary permissions add it?
 
 Done. Also added 0.96.1 as existing version.
Thanks. But I don't see 0.96.1 in the list.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath AUTHORS ChangeLog

2007-12-11 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/12/11 08:34:30

Modified files:
.  : AUTHORS ChangeLog 

Log message:
2007-12-11  Robert Schuster  [EMAIL PROTECTED]

  * AUTHORS: Added my name to the list.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/AUTHORS?cvsroot=classpathr1=1.42r2=1.43
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9449r2=1.9450




[cp-patches] FYI: remove debug output from GlyphView::paint()

2007-12-10 Thread Robert Schuster
Hi,
this little patch removes some debug output from GlyphView::paint().

2007-12-10  Robert Schuster  [EMAIL PROTECTED]

  * javax/swing/text/GlyphView.java:
  (paint): Removed debug output.
Index: javax/swing/text/GlyphView.java
===
RCS file: /sources/classpath/classpath/javax/swing/text/GlyphView.java,v
retrieving revision 1.28
diff -u -r1.28 GlyphView.java
--- javax/swing/text/GlyphView.java	4 Dec 2006 20:26:16 -	1.28
+++ javax/swing/text/GlyphView.java	10 Dec 2007 16:01:25 -
@@ -736,7 +736,6 @@
 if (bg != null)
   {
 g.setColor(bg);
-System.err.println(fill background:  + bg);
 g.fillRect(r.x, r.y, r.width, r.height);
   }
 


signature.asc
Description: OpenPGP digital signature


[cp-patches] RFC: fix for 32516

2007-12-10 Thread Robert Schuster
Hi,
the attached patch removes the dreaded dot - file separator prefixes
from files which should be added to zip (jar) archives. This fixes
32516[0] for me.

ChangeLog:

2007-12-10  Robert Schuster  [EMAIL PROTECTED]

PR classpath/32516:
  * tools/gnu/classpath/tools/jar/Entry.java:
  (Entry(File, String)): Added loop to remove all dot-file separator
  prefixes.
  (Entry(File)): Call Entry(File, String) constructor variant.

[0] - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32516
Index: tools/gnu/classpath/tools/jar/Entry.java
===
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/jar/Entry.java,v
retrieving revision 1.1
diff -u -r1.1 Entry.java
--- tools/gnu/classpath/tools/jar/Entry.java	8 May 2006 18:38:20 -	1.1
+++ tools/gnu/classpath/tools/jar/Entry.java	10 Dec 2007 19:46:18 -
@@ -49,12 +49,22 @@
   public Entry(File file, String name)
   {
 this.file = file;
-this.name = name;
+
+/* Removes any './' prefixes automatically. Those caused trouble
+ * in (boot) classpath use-cases. See #32516.
+ */
+int start = 0;
+while (name.length()  start + 2
+name.codePointAt(start) == '.'
+name.codePointAt(start + 1) == File.separatorChar)
+  start += 2;
+
+this.name = name.substring(start);
   }
 
   public Entry(File file)
   {
-this.file = file;
-this.name = file.toString();
+this(file, file.toString());
   }
+
 }


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] RFC: fix for 32516

2007-12-10 Thread Robert Schuster
Hi.

Robert Schuster schrieb:
 Hi,
 the attached patch removes the dreaded dot - file separator prefixes
from files which should be added to zip (jar) archives. This fixes
 32516[0] for me.
 
 ChangeLog:
 
 2007-12-10  Robert Schuster  [EMAIL PROTECTED]
 
 PR classpath/32516:
   * tools/gnu/classpath/tools/jar/Entry.java:
   (Entry(File, String)): Added loop to remove all dot-file separator
   prefixes.
   (Entry(File)): Call Entry(File, String) constructor variant.
 
 [0] - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32516
 

Tom Tromey confirmed this on IRC. Committing as attached with a small
fix to the copyright line.

ChangeLog:

2007-12-10  Robert Schuster  [EMAIL PROTECTED]

PR classpath/32516:
  * tools/gnu/classpath/tools/jar/Entry.java:
  (Entry(File, String)): Added loop to remove all dot-file separator
  prefixes.
  (Entry(File)): Call Entry(File, String) constructor variant.

Regards
Robert
Index: tools/gnu/classpath/tools/jar/Entry.java
===
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/jar/Entry.java,v
retrieving revision 1.1
diff -u -r1.1 Entry.java
--- tools/gnu/classpath/tools/jar/Entry.java	8 May 2006 18:38:20 -	1.1
+++ tools/gnu/classpath/tools/jar/Entry.java	10 Dec 2007 22:20:05 -
@@ -1,5 +1,5 @@
 /* Entry.java - represent a single file to write to a jar
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
  This file is part of GNU Classpath.
 
@@ -49,12 +49,22 @@
   public Entry(File file, String name)
   {
 this.file = file;
-this.name = name;
+
+/* Removes any './' prefixes automatically. Those caused trouble
+ * in (boot) classpath use-cases. See #32516.
+ */
+int start = 0;
+while (name.length()  start + 2
+name.codePointAt(start) == '.'
+name.codePointAt(start + 1) == File.separatorChar)
+  start += 2;
+
+this.name = name.substring(start);
   }
 
   public Entry(File file)
   {
-this.file = file;
-this.name = file.toString();
+this(file, file.toString());
   }
+
 }


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: add myself to THANKYOU

2007-12-10 Thread Robert Schuster
Hi,
I added myself to the thankyou file. :)

Thank you, too, GNU Classpath and friends. Working on the project has
always been fulfilling for me!

2007-12-10  Robert Schuster  [EMAIL PROTECTED]

  * THANKYOU: Added my name to the list.
Index: THANKYOU
===
RCS file: /sources/classpath/classpath/THANKYOU,v
retrieving revision 1.37
diff -u -r1.37 THANKYOU
--- THANKYOU	17 May 2006 09:06:09 -	1.37
+++ THANKYOU	10 Dec 2007 22:24:03 -
@@ -41,6 +41,7 @@
 Petter Reinholdtsen ([EMAIL PROTECTED])
 Julian Scheid ([EMAIL PROTECTED])
 Martin Schröder ([EMAIL PROTECTED])
+Robert Schuster ([EMAIL PROTECTED])
 Gaute Smaaland ([EMAIL PROTECTED])
 Michael Smith ([EMAIL PROTECTED])
 J. Russell Smyth ([EMAIL PROTECTED])


signature.asc
Description: OpenPGP digital signature


Re: trouble with gjar and ecj

2007-12-10 Thread Robert Schuster
Hi Andrew, hi List

Andrew Haley schrieb:
 Note that gjar adds ./ to the start of the path, and jar does not.
 That's the bug: gjar needs to strip ./ from the start of the path.
Thanks for looking into this and finding it out.

I further investigated the problem and am convinced too that the problem
is in the gjar code. I ruled out the following other situations:

 - classpath' zip code is broken and should handle ./ entries
transparently. This is not the case JDK does the same. I tested this by
using ecj with JDK and a gjar-created jar. You get the same error.

 - classpath' zip code is broken and should remove ./ entries
automatically when creating zip files. This is not the case and I found
this out by running gjar on JDK. Those files contains ./ prefixes, too.

I am already poking around with the code to find a solution. I'll file
bug ASAP.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


Re: trouble with gjar and ecj

2007-12-10 Thread Robert Schuster
Hi all,

 I am already poking around with the code to find a solution. I'll file
 bug ASAP.
The bug is already known:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32516

Regards
Robert



signature.asc
Description: OpenPGP digital signature


new target milestone for bugzilla

2007-12-10 Thread Robert Schuster
Hi,
I wanted mark a bug as fixed and set the target milestone to the version
where it will be considered as fixed to 0.97. Unfortunately that number
is not available in the dropdown box.

Could someone with the necessary permissions add it?

Regards
Robert



signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath ChangeLog javax/swing/text/GlyphView....

2007-12-10 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/12/10 16:03:00

Modified files:
.  : ChangeLog 
javax/swing/text: GlyphView.java 

Log message:
2007-12-10  Robert Schuster  [EMAIL PROTECTED]

  * javax/swing/text/GlyphView.java:
  (paint): Removed debug output.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9445r2=1.9446
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/text/GlyphView.java?cvsroot=classpathr1=1.28r2=1.29




[commit-cp] classpath native/jni/native-lib/cpio.c ChangeLog

2007-12-10 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/12/10 16:10:24

Modified files:
native/jni/native-lib: cpio.c 
.  : ChangeLog 

Log message:
2007-12-10  Robert Schuster  [EMAIL PROTECTED]

  * native/jni/native-lib/cpio.c:
  (cpio_df): Mark arguments as possibly unused.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/native-lib/cpio.c?cvsroot=classpathr1=1.9r2=1.10
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9446r2=1.9447




[commit-cp] classpath ChangeLog tools/gnu/classpath/tools/j...

2007-12-10 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/12/10 22:27:26

Modified files:
.  : ChangeLog 
tools/gnu/classpath/tools/jar: Entry.java 

Log message:
2007-12-10  Robert Schuster  [EMAIL PROTECTED]

PR classpath/32516:
  * tools/gnu/classpath/tools/jar/Entry.java:
  (Entry(File, String)): Added loop to remove all dot-file separator
  prefixes.
  (Entry(File)): Call Entry(File, String) constructor variant.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9447r2=1.9448
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/jar/Entry.java?cvsroot=classpathr1=1.1r2=1.2




trouble with gjar and ecj

2007-11-29 Thread Robert Schuster
Hi guys,
today I tripped on some weird incompatibility between ecj (3.3.1 as
found in Debian Lenny) and gjar 0.95:

gjar creates jars which need zip version 2.0 to extract, while e.g.
fastjar creates files which are readable by version 1.0.

This is what 'file' says:

src1-fastjar.jar: Zip archive data, at least v1.0 to extract
src1-gjar.jar:Zip archive data, at least v2.0 to extract

The problem comes when you want to compile something with ecj and put
such a jar (the gjar-created one) in the classpath or bootclasspath.

It simply does not find the files!

ecj -cp ../src1-gjar.jar use/Test.java

--
1. ERROR in use/Test.java (at line 3)
import base.Base;
   
The import base cannot be resolved
--
2. ERROR in use/Test.java (at line 9)
Base b = new Base(Test);

Base cannot be resolved to a type
--
3. ERROR in use/Test.java (at line 9)
Base b = new Base(Test);
 
Base cannot be resolved to a type
--
3 problems (3 errors)[EMAIL PROTECTED]:~/tmp/jartest/src2$

Looking at the jar's content reveals that a class is there:
gjar -tf src1-gjar.jar

META-INF/MANIFEST.MF
./base/Base.class

Who is the one to blame? Is ecj unable to process version 2.0 zip files
or does gjar create unsuitable files? Is this a known issue?

If you do not believe what you see have a look at the attached sources.
Create the two jars using the two shell scripts in src1 and then try to
compile the class in src2 using the shell scripts within it.

Regards
Robert




jartest.tar.gz
Description: GNU Zip compressed data


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] RFC: fix warning in cpio_df

2007-11-08 Thread Robert Schuster
Hi.

Mario Torre schrieb:
 Il giorno gio, 08/11/2007 alle 13.06 +0100, Mark Wielaard ha scritto:
 Hi Robert,

 On Wed, 2007-11-07 at 22:13 +0100, Robert Schuster wrote:
 this patch marks the parameters of cpio_df as possibly unused and
 silents the warning/lets the build continue with -Wall.
 Which system is this?
 I am not really opposed to the patch, but it would of course be better
 to figure out how to correctly return something for your setup if at all
 possible.
 
 Yes, please, I had troubles figuring out this.
 
 As for the patch, I did that way to catch exactly the systems where no
 statvfs is available.
 
 Can you try using statfs? If it's a system where df is available we can
 try to steal some code from there also.
This is Debian Lenny/Sid x86. I am not sure whether it is normal that
statvfs is not available on it but even then I think the problem is more
a tiny glitch in the code:

JNIEXPORT long long
cpio_df (const char *path, CPFILE_DF_TYPE type)
{
  long long result = 0L;

#if defined(HAVE_STATVFS)

  ... much stuff

#endif

  return result;
}

Now if HAVE_STATVFS is not defined the compiler is correct mourning that
'path' and 'type' are not used. I have seen code (in classpath) where
this issue is solved this way:

JNIEXPORT long long
cpio_df (const char *path, CPFILE_DF_TYPE type)
{
  long long result = 0L;

#if defined(HAVE_STATVFS)

  ... much stuff
#else

 (void) path;
 (void) type;

#endif

  return result;
}

See Java_gnu_java_nio_KqueueSelectorImpl_kevent_1set for example.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


Re: Still Problem with GNU-Classpath 0.96.1 on StrongARM

2007-10-23 Thread Robert Schuster
Hi,

Robert Lougher schrieb:
 Hi Vladimir,
 
 On 10/23/07, Vladimir Nikolov [EMAIL PROTECTED] wrote:
 Hi,

 I have still problems to compile the GNU-Classpath 0.96.1 on the
 StrongARM machine.
 Once again, I would like to use it together with the JamVM 1.4.5, since
 both support now Java Annotations and Generics.

If I understand this[0] page right EABI is not supported on StrongARM
CPUs ... at least not with custom GCC patches.

Regards
Robert

[0] - http://wiki.debian.org/ArmEabiPort






signature.asc
Description: PGP signature


signature.asc
Description: OpenPGP digital signature


Re: Gnu-Classpath on StrongARM

2007-10-19 Thread Robert Schuster
Hi,
 Whats wrong with ecj? Is it not supported for ARMs?
 Do you know any other compiler for ARM which I could use instead of ecj?
ecj is written in Java. There is no ARM specific code in it. You should
check your VM instead.

Regards
Robert



signature.asc
Description: OpenPGP digital signature


fdlibm patch

2007-09-27 Thread Robert Schuster
Hi,
the OE guys still keep this little patch. Does anyone know if it is
correct and should be applied?

Regards
Robert
--- classpath/native/fdlibm/ieeefp.h.orig	2006-04-14 22:33:09.0 -0400
+++ classpath/native/fdlibm/ieeefp.h	2006-04-14 22:41:46.0 -0400
@@ -13,7 +13,7 @@
byte ordering was big or little endian depending upon the target.  
Modern floating-point formats are naturally ordered; in this case
__VFP_FP__ will be defined, even if soft-float.  */
-#ifdef __VFP_FP__
+#ifdef __SOFTFP__
 #ifdef __ARMEL__
 #define __IEEE_LITTLE_ENDIAN
 #else


signature.asc
Description: OpenPGP digital signature


[cp-patches] FIY: build fix for localsockets

2007-09-12 Thread Robert Schuster
Hi,
a C file from the local sockets implementation unconditionally defined
_GNU_SOURCE causing trouble in builds where this is already defined.

Thanks go to Dalibor who helped me to track this down.

Regards
Robert

2007-09-12  Robert Schuster  [EMAIL PROTECTED]

* native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c:
Add #ifndef guard around definition of _GNU_SOURCE.
Index: native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c
===
RCS file: /sources/classpath/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c,v
retrieving revision 1.4
diff -u -r1.4 gnu_java_net_local_LocalSocketImpl.c
--- native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c	21 Aug 2006 09:40:13 -	1.4
+++ native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c	12 Sep 2007 18:55:03 -
@@ -35,8 +35,9 @@
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version.  */
 
-
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 
 #include config.h
 


signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath/native/jni/java-net gnu_java_net_loca...

2007-09-12 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/09/12 19:09:53

Modified files:
native/jni/java-net: gnu_java_net_local_LocalSocketImpl.c 

Log message:
2007-09-12  Robert Schuster  [EMAIL PROTECTED]

* native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c:
Add #ifndef guard around definition of _GNU_SOURCE.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c?cvsroot=classpathr1=1.4r2=1.5




IcedTea - Where is this going to head?

2007-08-02 Thread Robert Schuster
Hi,
on IRC #classpath I read a lot of interesting things are happening
around IcedTea and Classpath. People put Classpath stuff into IcedTea,
Cacao gets support for the latter. Fedora people try to get this working
on all arches (that GCJ supports :) ).

I am wondering what the goals of all these efforts are? I am really
curious about this. If you have some time between your doings I would be
very happy if someone could shed some light on this. :)

What interests me also if there is a future where GCJ can use IcedTea as
its class library and whether the current cacao porting efforts are a
test scenario for this?

Regards
Robert



signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: NPE fix for OpenTypeFont

2007-05-25 Thread Robert Schuster
Hi,
I applied this little patch to prevent a NPE when using a JTextField
with the X peers.

Regards
Robert

2007-05-25  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/font/opentype/OpenTypeFont.java:
(getGlyphIndex): Call getGlyphCharMap() instead of
accessing cmap field directly.
Index: gnu/java/awt/font/opentype/OpenTypeFont.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java,v
retrieving revision 1.7
diff -u -r1.7 OpenTypeFont.java
--- gnu/java/awt/font/opentype/OpenTypeFont.java	8 May 2007 14:40:12 -	1.7
+++ gnu/java/awt/font/opentype/OpenTypeFont.java	25 May 2007 09:44:17 -
@@ -626,7 +626,7 @@
*/
   public int getGlyphIndex(int c)
   {
-return cmap.getGlyph(c);
+return getCharGlyphMap().getGlyph(c);
   }
 
   /**


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: Added translation to XGraphics

2007-05-25 Thread Robert Schuster
Hi,
the following patch adds adding the translation to rawFillRect() and
rawDrawLine() in XGraphics2D. This fixes painting the gradient and
backgrounds for Swing components.

2007-05-25  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XGraphics2D.java:
(rawDrawLine): Added addition of translation.
(rawFillRect): Dito.

Regards
Robert
Index: gnu/java/awt/peer/x/XGraphics2D.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XGraphics2D.java,v
retrieving revision 1.4
diff -u -r1.4 XGraphics2D.java
--- gnu/java/awt/peer/x/XGraphics2D.java	24 May 2007 16:26:55 -	1.4
+++ gnu/java/awt/peer/x/XGraphics2D.java	25 May 2007 10:36:20 -
@@ -94,12 +94,15 @@
 
   protected void rawDrawLine(int x0, int y0, int x1, int y1)
   {
-xdrawable.segment(xgc, x0, y0, x1, y1);
+int tx = (int) transform.getTranslateX();
+int ty = (int) transform.getTranslateY();
+xdrawable.segment(xgc, x0 + tx, y0 + ty, x1 + tx, y1 + ty);
   }
 
   protected void rawFillRect(int x, int y, int w, int h)
   {
-xdrawable.rectangle(xgc, x, y, w, h, true);
+xdrawable.rectangle(xgc, x + (int) transform.getTranslateX(),
+ y + (int) transform.getTranslateY(), w, h, true);
   }
 
   /**
@@ -317,4 +320,7 @@
   }
 return ret;
   }
+
+
 }
+


signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath ChangeLog gnu/java/awt/font/opentype/...

2007-05-25 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/05/25 09:48:48

Modified files:
.  : ChangeLog 
gnu/java/awt/font/opentype: OpenTypeFont.java 

Log message:
Fixes a NPE when displaying a JTextField with the X peers.

2007-05-25  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/font/opentype/OpenTypeFont.java:
(getGlyphIndex): Call getGlyphCharMap() instead of
accessing cmap field directly.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9318r2=1.9319
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/font/opentype/OpenTypeFont.java?cvsroot=classpathr1=1.7r2=1.8




[commit-cp] classpath ChangeLog gnu/java/awt/peer/x/XGraphi...

2007-05-25 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/05/25 11:11:14

Modified files:
.  : ChangeLog 
gnu/java/awt/peer/x: XGraphics2D.java 

Log message:
2007-05-25  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XGraphics2D.java:
(rawDrawLine): Added addition of translation.
(rawFillRect): Dito.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9319r2=1.9320
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XGraphics2D.java?cvsroot=classpathr1=1.4r2=1.5




Re: special zero-length 'gnu.gcj.gcj-compiled' attribute ???

2007-05-24 Thread Robert Schuster
Hi Luigi,
although GCJ uses GNU Classpath you are not supposed to compile it
separately. The GCC tarball already includes a snapshot of Classpath
which is modified slightly to fit to GCJ's requirements.

If you compile gcj correctly it will bring its own 'Classpath' (named
libgcj) and uses that at runtime.

Regards
Robert

Luigi De Donà schrieb:
 Hi all,
 
 I have succesfully (configure, make, make install) installed gnu classpath
 0.95 on my mipsel/debian machine,
 I have exported the adjusted $CLASSPATH $LD_LIBRARY_PATH vaiables but when I
 compile my java code I obtain an error :
 
 gcj x.jar --main=test -o binaries
 java/lang/Object.java:0: fatal error: the 'java.lang.Object' that was found
 in '/usr/local/classpath/share/classpath/glibj.zip' didn't have the special
 zero-length 'gnu.gcj.gcj-compiled' attribute.  This generally means that
 your classpath is incorrectly set.  Use 'info gcj Input Options' to see
 the info page describing how to set the classpath
 compilation terminated.
 
 Intead if I run gij4-1 VM then it run correctly...
 
 Please let me know for an help !
 Many Thanks
 Luigi
 
 
 



signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: XEventPump fix

2007-05-22 Thread Robert Schuster
Hi,
the attached patch makes mouse events work again for the X peers (and
prevent a NPE later).

Regards
Robert

2007-05-22  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Use Input.event_window_id instead of
Input.child_window_id for mouse  key presses/releases.
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.3
diff -u -r1.3 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	30 Apr 2007 20:30:56 -	1.3
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 17:41:57 -
@@ -151,20 +151,19 @@
 
 Integer key = null;
 Window awtWindow = null;
-if (xEvent instanceof Input)
-  {
-key= new Integer(((Input) xEvent).child_window_id);
-awtWindow = (Window) windows.get(key);
-  }
+
 if (XToolkit.DEBUG)
   System.err.println(fetched event:  + xEvent);
 switch (xEvent.code())
 {
 case ButtonPress.CODE:
   ButtonPress bp = (ButtonPress) xEvent;
+  key= new Integer(bp.event_window_id);
+  awtWindow = (Window) windows.get(key);
   // Create and post the mouse event.
   int button = bp.detail();
   drag = button;
+
   MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
  System.currentTimeMillis(), 0,
  bp.event_x(), bp.event_y(),
@@ -173,6 +172,8 @@
   break;
 case ButtonRelease.CODE:
   ButtonRelease br = (ButtonRelease) xEvent;
+  key= new Integer(br.event_window_id);
+  awtWindow = (Window) windows.get(key);
   drag = -1;
   MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
  System.currentTimeMillis(), 0,
@@ -182,6 +183,9 @@
   break;
 case MotionNotify.CODE:
   MotionNotify mn = (MotionNotify) xEvent;
+  key= new Integer(mn.event_window_id);
+  awtWindow = (Window) windows.get(key);
+
   MouseEvent mm;
   if (drag == -1)
 {


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] FYI: X Peers enhancement

2007-05-22 Thread Robert Schuster
Hi,
you forgot to commit the changelog entry. Did that for you.

Regards
Robert

Roman Kennke schrieb:
 This brings the X peers up to the recent enhancement of the rasterizer.
 
 2007-05-22  Roman Kennke  [EMAIL PROTECTED]
 
 * gnu/java/awt/peer/x/XFontPeer2.java
 (XFontMetrics.charWidth): Use cached Point2D instance.
 * gnu/java/awt/peer/x/XGraphics2D.java
 (renderScanline): New method. Renders a scanline according to
 the coverage information.
 (setPaint): Call super, so that the state is updated correctly.
 
 /Roman
 
 
 
 
 Index: gnu/java/awt/peer/x/XFontPeer2.java
 ===
 RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XFontPeer2.java,v
 retrieving revision 1.4
 diff -u -1 -5 -r1.4 XFontPeer2.java
 --- gnu/java/awt/peer/x/XFontPeer2.java   8 May 2007 15:03:07 -   
 1.4
 +++ gnu/java/awt/peer/x/XFontPeer2.java   22 May 2007 13:12:05 -
 @@ -194,31 +194,31 @@
 false, false, false);
  }
  
  public int getHeight()
  {
GlyphVector gv = fontDelegate.createGlyphVector(getFont(),
  new FontRenderContext(IDENDITY, false, false),
  new StringCharacterIterator(m));
Rectangle2D b = gv.getVisualBounds();
return (int) b.getHeight();
  }
  
  public int charWidth(char c)
  {
int code = fontDelegate.getGlyphIndex(c);
 -  Point2D advance = new Point2D.Double();
 +  Point2D advance = cachedPoint;
fontDelegate.getAdvance(code, font.getSize2D(), IDENDITY,
false, false, true, advance);
return (int) advance.getX();
  }
  
  public int charsWidth(char[] chars, int offs, int len)
  {
return stringWidth(new String(chars, offs, len));
  }
  
  public int stringWidth(String s)
  {
GlyphVector gv = fontDelegate.createGlyphVector(getFont(),
  new FontRenderContext(IDENDITY, false, false),
  new StringCharacterIterator(s));
 Index: gnu/java/awt/peer/x/XGraphics2D.java
 ===
 RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XGraphics2D.java,v
 retrieving revision 1.2
 diff -u -1 -5 -r1.2 XGraphics2D.java
 --- gnu/java/awt/peer/x/XGraphics2D.java  30 Apr 2007 20:30:56 -  
 1.2
 +++ gnu/java/awt/peer/x/XGraphics2D.java  22 May 2007 13:12:05 -
 @@ -40,30 +40,31 @@
  import java.awt.Color;
  import java.awt.Graphics;
  import java.awt.GraphicsConfiguration;
  import java.awt.Image;
  import java.awt.Paint;
  import java.awt.Rectangle;
  import java.awt.Shape;
  import java.awt.Toolkit;
  import java.awt.geom.AffineTransform;
  import java.awt.image.ColorModel;
  import java.awt.image.ImageObserver;
  import java.awt.image.Raster;
  import java.util.HashMap;
  
  import gnu.java.awt.java2d.AbstractGraphics2D;
 +import gnu.java.awt.java2d.ScanlineCoverage;
  import gnu.x11.Colormap;
  import gnu.x11.Drawable;
  import gnu.x11.GC;
  import gnu.x11.image.ZPixmap;
  
  public class XGraphics2D
extends AbstractGraphics2D
  {
  
/**
 * The X Drawable to draw on.
 */
private Drawable xdrawable;
  
/**
 @@ -204,52 +205,92 @@
{
  pixel = raster.getPixel(tx, ty, pixel);
  //System.err.println(tx:  + tx + , ty:  + ty + , pixel: 
  + pixel[0] + ,  + pixel[1] + ,  + pixel[2]);
  //  System.err.print(r:  + pixel[0]);
  //  System.err.print(, g:  + pixel[1]);
  //  System.err.println(, b:  + pixel[2]);
  zPixmap.set_red(tx - x, ty - y, pixel[0]);
  zPixmap.set_green(tx - x, ty - y, pixel[1]);
  zPixmap.set_blue(tx - x, ty - y, pixel[2]);
}
}
  xdrawable.put_image(xgc, zPixmap, x, y);
}
}
  
 +  public void renderScanline(int y, ScanlineCoverage c)
 +  {
 +ScanlineCoverage.Coverage start = c.iterate();
 +ScanlineCoverage.Coverage end = c.next();
 +assert (start != null);
 +assert (end != null);
 +int coverageAlpha = 0;
 +int maxCoverage = c.getMaxCoverage();
 +Color old = getColor();
 +Color col = getColor();
 +if (col == null)
 +  col = Color.BLACK;
 +do
 +  {
 +// TODO: Dumb implementation for testing.
 +coverageAlpha = coverageAlpha + start.getCoverageDelta();
 +if (coverageAlpha  0)
 +  {
 +int red = col.getRed();
 +int green = col.getGreen();
 +int blue = col.getBlue();
 +if (coverageAlpha  c.getMaxCoverage())
 +  {
 +float alpha = coverageAlpha / maxCoverage;
 +red = 255 - (int) ((255 - red) * alpha);

Re: [cp-patches] FYI: XEventPump fix

2007-05-22 Thread Robert Schuster
Hi,
actually the changelog should read:

2007-05-22  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Use Input.event_window_id instead of
Input.child_window_id for mouse presses/releases 
movement.

Sorry for the inconvenience.


Regards
Robert

Robert Schuster schrieb:
 Hi,
 the attached patch makes mouse events work again for the X peers (and
 prevent a NPE later).
 
 Regards
 Robert
 
 2007-05-22  Robert Schuster  [EMAIL PROTECTED]
 
 * gnu/java/awt/peer/x/XEventQueue.java:
 (handleEvent): Use Input.event_window_id instead of
 Input.child_window_id for mouse  key presses/releases.
 
 
 
 
 Index: gnu/java/awt/peer/x/XEventPump.java
 ===
 RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
 retrieving revision 1.3
 diff -u -r1.3 XEventPump.java
 --- gnu/java/awt/peer/x/XEventPump.java   30 Apr 2007 20:30:56 -  
 1.3
 +++ gnu/java/awt/peer/x/XEventPump.java   22 May 2007 17:41:57 -
 @@ -151,20 +151,19 @@
  
  Integer key = null;
  Window awtWindow = null;
 -if (xEvent instanceof Input)
 -  {
 -key= new Integer(((Input) xEvent).child_window_id);
 -awtWindow = (Window) windows.get(key);
 -  }
 +
  if (XToolkit.DEBUG)
System.err.println(fetched event:  + xEvent);
  switch (xEvent.code())
  {
  case ButtonPress.CODE:
ButtonPress bp = (ButtonPress) xEvent;
 +  key= new Integer(bp.event_window_id);
 +  awtWindow = (Window) windows.get(key);
// Create and post the mouse event.
int button = bp.detail();
drag = button;
 +
MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
   System.currentTimeMillis(), 0,
   bp.event_x(), bp.event_y(),
 @@ -173,6 +172,8 @@
break;
  case ButtonRelease.CODE:
ButtonRelease br = (ButtonRelease) xEvent;
 +  key= new Integer(br.event_window_id);
 +  awtWindow = (Window) windows.get(key);
drag = -1;
MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
   System.currentTimeMillis(), 0,
 @@ -182,6 +183,9 @@
break;
  case MotionNotify.CODE:
MotionNotify mn = (MotionNotify) xEvent;
 +  key= new Integer(mn.event_window_id);
 +  awtWindow = (Window) windows.get(key);
 +
MouseEvent mm;
if (drag == -1)
  {



signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: fix key events for X peers

2007-05-22 Thread Robert Schuster
Hi,
I was missing the keyboard part in my last patch. Here it is.

2007-05-22  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Use Input.event_window_id for
key presses/releases.

Regards
Robert
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.4
diff -u -r1.4 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	22 May 2007 17:54:43 -	1.4
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 18:40:57 -
@@ -241,6 +241,8 @@
   break;
 case KeyPress.CODE:
 case KeyRelease.CODE:
+  key = new Integer(((Input) xEvent).event_window_id);
+  awtWindow = (Window) windows.get(key);
   handleKeyEvent(xEvent, awtWindow);
   break;
 default:


signature.asc
Description: OpenPGP digital signature


[cp-patches] RFC: calculate button modifiers for X peers

2007-05-22 Thread Robert Schuster
Hi,
the attached patch properly calculates the modifiers for mouse press
and release events.

Ok, to commit?

2007-05-22  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Calculate modifier value for mouse presse
and release events.
(buttonToModifier): New method.
* gnu/java/awt/peer/x/KeyboardMapping.java:
(mapModifiers): Added cases for alt gr and the meta key.

Regards
Robert

Index: gnu/java/awt/peer/x/KeyboardMapping.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/KeyboardMapping.java,v
retrieving revision 1.1
diff -u -r1.1 KeyboardMapping.java
--- gnu/java/awt/peer/x/KeyboardMapping.java	29 Jun 2006 15:15:56 -	1.1
+++ gnu/java/awt/peer/x/KeyboardMapping.java	22 May 2007 21:37:43 -
@@ -405,8 +405,12 @@
 
 if ((xMods  Input.SHIFT_MASK) != 0)
   mods |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
+if ((xMods  Input.META_MASK) != 0)
+  mods |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
 if ((xMods  Input.ALT_MASK) != 0)
   mods |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
+if ((xMods  Input.MOD5_MASK) != 0)
+  mods |= KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK;
 if ((xMods  Input.CONTROL_MASK) != 0)
   mods |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
 
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.5
diff -u -r1.5 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	22 May 2007 18:45:13 -	1.5
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 21:37:43 -
@@ -48,6 +48,8 @@
 import java.awt.event.PaintEvent;
 import java.util.HashMap;
 
+import gnu.java.awt.EventModifier;
+
 import gnu.x11.Display;
 import gnu.x11.event.ButtonPress;
 import gnu.x11.event.ButtonRelease;
@@ -162,10 +164,15 @@
   awtWindow = (Window) windows.get(key);
   // Create and post the mouse event.
   int button = bp.detail();
+
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button = 3)
+button = 0;
   drag = button;
 
   MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(bp.state()) | buttonToModifier(button),
  bp.event_x(), bp.event_y(),
  1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp);
@@ -174,11 +181,17 @@
   ButtonRelease br = (ButtonRelease) xEvent;
   key= new Integer(br.event_window_id);
   awtWindow = (Window) windows.get(key);
+
+  button = br.detail();
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button = 3)
+button = 0;
   drag = -1;
   MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(br.state()) | buttonToModifier(button),
  br.event_x(), br.event_y(),
- 1, false, br.detail());
+ 1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr);
   break;
 case MotionNotify.CODE:
@@ -297,6 +310,23 @@
 
   }
 
+  /** Translates an X button identifier to the AWT's MouseEvent modifier
+   *  mask. As the AWT cannot handle more than 3 buttons those return
+   *  code0/code.
+   */
+  static int buttonToModifier(int button)
+  {
+switch (button)
+{
+  case 1:
+return MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON1_MASK;
+  case 2:
+return MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON2_MASK;
+  case 3:
+return MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.BUTTON3_MASK;
+}
 
-}
+return 0;
+  }
 
+}



signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: mouse event modifiers fix for the X peers

2007-05-22 Thread Robert Schuster
Hi,
the attached patch fixes the modifiers for the X peers.

Changes since my last RFC are: Removed a superfluous import, changed all
number literals to constant names and mentioned the button clipping in
the changelog.

2007-05-22  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Calculate modifier value for mouse presse
and release events, clip button values.
(buttonToModifier): New method.
* gnu/java/awt/peer/x/KeyboardMapping.java:
(mapModifiers): Added cases for alt gr and the meta key.

Regards
Robert
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.5
diff -u -r1.5 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	22 May 2007 18:45:13 -	1.5
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 22:21:58 -
@@ -162,10 +162,15 @@
   awtWindow = (Window) windows.get(key);
   // Create and post the mouse event.
   int button = bp.detail();
+
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button = gnu.x11.Input.BUTTON3)
+button = 0;
   drag = button;
 
   MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(bp.state()) | buttonToModifier(button),
  bp.event_x(), bp.event_y(),
  1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp);
@@ -174,11 +179,17 @@
   ButtonRelease br = (ButtonRelease) xEvent;
   key= new Integer(br.event_window_id);
   awtWindow = (Window) windows.get(key);
+
+  button = br.detail();
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button = gnu.x11.Input.BUTTON3)
+button = 0;
   drag = -1;
   MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(br.state()) | buttonToModifier(button),
  br.event_x(), br.event_y(),
- 1, false, br.detail());
+ 1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr);
   break;
 case MotionNotify.CODE:
@@ -297,6 +308,23 @@
 
   }
 
+  /** Translates an X button identifier to the AWT's MouseEvent modifier
+   *  mask. As the AWT cannot handle more than 3 buttons those return
+   *  code0/code.
+   */
+  static int buttonToModifier(int button)
+  {
+switch (button)
+{
+  case gnu.x11.Input.BUTTON1:
+return MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON1_MASK;
+  case gnu.x11.Input.BUTTON2:
+return MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON2_MASK;
+  case gnu.x11.Input.BUTTON3:
+return MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.BUTTON3_MASK;
+}
 
-}
+return 0;
+  }
 
+}
Index: gnu/java/awt/peer/x/KeyboardMapping.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/KeyboardMapping.java,v
retrieving revision 1.1
diff -u -r1.1 KeyboardMapping.java
--- gnu/java/awt/peer/x/KeyboardMapping.java	29 Jun 2006 15:15:56 -	1.1
+++ gnu/java/awt/peer/x/KeyboardMapping.java	22 May 2007 22:21:58 -
@@ -405,8 +405,12 @@
 
 if ((xMods  Input.SHIFT_MASK) != 0)
   mods |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
+if ((xMods  Input.META_MASK) != 0)
+  mods |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
 if ((xMods  Input.ALT_MASK) != 0)
   mods |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
+if ((xMods  Input.MOD5_MASK) != 0)
+  mods |= KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK;
 if ((xMods  Input.CONTROL_MASK) != 0)
   mods |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
 


signature.asc
Description: OpenPGP digital signature


RFC: calculate button modifiers for X peers

2007-05-22 Thread Robert Schuster
Hi,
the attached patch properly calculates the modifiers for mouse press
and release events.

Ok, to commit?

2007-05-22  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Calculate modifier value for mouse presse
and release events.
(buttonToModifier): New method.
* gnu/java/awt/peer/x/KeyboardMapping.java:
(mapModifiers): Added cases for alt gr and the meta key.

Regards
Robert
Index: gnu/java/awt/peer/x/KeyboardMapping.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/KeyboardMapping.java,v
retrieving revision 1.1
diff -u -r1.1 KeyboardMapping.java
--- gnu/java/awt/peer/x/KeyboardMapping.java	29 Jun 2006 15:15:56 -	1.1
+++ gnu/java/awt/peer/x/KeyboardMapping.java	22 May 2007 21:37:43 -
@@ -405,8 +405,12 @@
 
 if ((xMods  Input.SHIFT_MASK) != 0)
   mods |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
+if ((xMods  Input.META_MASK) != 0)
+  mods |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
 if ((xMods  Input.ALT_MASK) != 0)
   mods |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
+if ((xMods  Input.MOD5_MASK) != 0)
+  mods |= KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK;
 if ((xMods  Input.CONTROL_MASK) != 0)
   mods |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
 
Index: gnu/java/awt/peer/x/XEventPump.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.5
diff -u -r1.5 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	22 May 2007 18:45:13 -	1.5
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 21:37:43 -
@@ -48,6 +48,8 @@
 import java.awt.event.PaintEvent;
 import java.util.HashMap;
 
+import gnu.java.awt.EventModifier;
+
 import gnu.x11.Display;
 import gnu.x11.event.ButtonPress;
 import gnu.x11.event.ButtonRelease;
@@ -162,10 +164,15 @@
   awtWindow = (Window) windows.get(key);
   // Create and post the mouse event.
   int button = bp.detail();
+
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button = 3)
+button = 0;
   drag = button;
 
   MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(bp.state()) | buttonToModifier(button),
  bp.event_x(), bp.event_y(),
  1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp);
@@ -174,11 +181,17 @@
   ButtonRelease br = (ButtonRelease) xEvent;
   key= new Integer(br.event_window_id);
   awtWindow = (Window) windows.get(key);
+
+  button = br.detail();
+  // AWT cannot handle more than 3 buttons and expects 0 instead.
+  if (button = 3)
+button = 0;
   drag = -1;
   MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
- System.currentTimeMillis(), 0,
+ System.currentTimeMillis(),
+ KeyboardMapping.mapModifiers(br.state()) | buttonToModifier(button),
  br.event_x(), br.event_y(),
- 1, false, br.detail());
+ 1, false, button);
   Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr);
   break;
 case MotionNotify.CODE:
@@ -297,6 +310,23 @@
 
   }
 
+  /** Translates an X button identifier to the AWT's MouseEvent modifier
+   *  mask. As the AWT cannot handle more than 3 buttons those return
+   *  code0/code.
+   */
+  static int buttonToModifier(int button)
+  {
+switch (button)
+{
+  case 1:
+return MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON1_MASK;
+  case 2:
+return MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON2_MASK;
+  case 3:
+return MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.BUTTON3_MASK;
+}
 
-}
+return 0;
+  }
 
+}


signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath ChangeLog gnu/java/awt/peer/x/XEventP...

2007-05-22 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/05/22 17:54:43

Modified files:
.  : ChangeLog 
gnu/java/awt/peer/x: XEventPump.java 

Log message:
Makes mouse events working for the X peers.

2007-05-22  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Use Input.event_window_id instead of
Input.child_window_id for mouse  key presses/releases.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9309r2=1.9310
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XEventPump.java?cvsroot=classpathr1=1.3r2=1.4




[commit-cp] classpath ChangeLog

2007-05-22 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/05/22 18:19:46

Modified files:
.  : ChangeLog 

Log message:
- added Roman's ChangeLog entry

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9310r2=1.9311




[commit-cp] classpath ChangeLog gnu/java/awt/peer/x/XEventP...

2007-05-22 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/05/22 18:45:13

Modified files:
.  : ChangeLog 
gnu/java/awt/peer/x: XEventPump.java 

Log message:
Fixes non-working key event for X peers.

2007-05-22  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Use Input.event_window_id for
key presses/releases.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9311r2=1.9312
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XEventPump.java?cvsroot=classpathr1=1.4r2=1.5




[commit-cp] classpath gnu/java/awt/peer/x/XEventPump.java g...

2007-05-22 Thread Robert Schuster
CVSROOT:/sources/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 07/05/22 22:25:16

Modified files:
gnu/java/awt/peer/x: XEventPump.java KeyboardMapping.java 
.  : ChangeLog 

Log message:
Makes modifiers for button events work correctly.

2007-05-22  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/awt/peer/x/XEventQueue.java:
(handleEvent): Calculate modifier value for mouse presse
and release events, clip button values.
(buttonToModifier): New method.
* gnu/java/awt/peer/x/KeyboardMapping.java:
(mapModifiers): Added cases for alt gr and the meta key.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/XEventPump.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/x/KeyboardMapping.java?cvsroot=classpathr1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.9312r2=1.9313




Re: Compilation Time | More questions -Charsets

2007-04-26 Thread Robert Schuster
Hi,

 There is no rule here as far as I know.  We just register all the
 charsets we have.  Adding a charset is done either because it is
 specified by the standard, or because someone needed it.
I know I should have answered earlier. The standard charsets are chosen
according to Sun's specification:
http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/Charset.html

There is a set of standard charsets which must be available. For
everything else we just made available what we had and what others
requested (I remember that certain asian charsets where requested).

Regards
Robert



signature.asc
Description: OpenPGP digital signature


Re: Non-POSIX port

2007-03-03 Thread Robert Schuster
Hi Chris,
of course GNU Classpath is interested in non-POSIX ports of the native
stuff. :)

Chris Cole schrieb:
 Hi Folks,
 
 I have the first cut of a port to an exotic platform (non-POSIX).
  Network support and process management are TBD.
 
 I'd like to investigate the possibility of getting my changes adopted
 into the project.
Great!

Ports are a great way to see whether Classpath' native interface fits
the task good or may be further adjusted.

 What's the best way to start that process?
Just send your patch to classpath-patches@gnu.org along with a GNU-style
ChangeLog and a short description of your work.

On the legal side the GNU project needs a copyright assignment to the
FSF from you. Mark Wielaard, GNU Classpath' maintainer, takes care of
those (CCed). Drop him a line if you want to contribute or have
questions regarding the process. Some notes about the assignment are in
our Wiki[0].

As the assignment usually takes some weeks I suggest posting your patch
along with a GNU-style changelog and a description to
classpath-patches@gnu.org and receive technical suggestion from the rest
of the Classpath team (some info about the patch submission process[1]).

Regards
Robert

[0] -
http://developer.classpath.org/mediation/ClasspathFirstSteps#head-5584bc97b740bd0935fac1a3feeffe9614d42b6e
[1] -
http://developer.classpath.org/mediation/ClasspathFirstSteps#head-a8b2520531202f1acefb9cb1c8b540999e4eaf21



signature.asc
Description: OpenPGP digital signature


Re: Swing AWT demo troubles

2007-02-27 Thread Robert Schuster
I filed 3 separate bugs for the issues I mentioned below.

Regards
Robert

Roman Kennke schrieb:
 Hi Robert,
 
 actually I wanted to test an XML patch on an application but while
 running an IzPack created installer with a Cacao+Classpath CVS HEAD
 I saw a lot of layout/drawing errors.

 Running the AWT demo resulted in:
 cacao -cp examples.zip gnu/classpath/examples/awt/Demo
 Exception in thread main java.lang.ClassCastException
at java.lang.Class.asSubclass(Class.java:1304)
at
 gnu.java.awt.peer.gtk.GtkToolkit.createDragGestureRecognizer(GtkToolkit.java:637)
at
 java.awt.dnd.DragSource.createDragGestureRecognizer(DragSource.java:235)
at
 java.awt.dnd.DragSource.createDefaultDragGestureRecognizer(DragSource.java:244)
at
 gnu.classpath.examples.awt.Demo$DragDropWindow$DragLabel.init(Demo.java:946)
at gnu.classpath.examples.awt.Demo$DragDropWindow.init(Demo.java:867)
at gnu.classpath.examples.awt.Demo$MainWindow.init(Demo.java:218)
at gnu.classpath.examples.awt.Demo.main(Demo.java:92)

 And the TextAreaDemo produces:

 cacao -cp examples.zip gnu/classpath/examples/swing/TextAreaDemo
 Exception during event dispatch:
 java.lang.ArithmeticException: / by zero
at javax.swing.text.PlainView.paint(PlainView.java:298)
at
 javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:388)
at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:1154)
at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:1105)
at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:1183)

 Has anyone a quick idea or should I post bug reports for both issues?
 
 Probably all of them (or at least most of them) could have been induced
 by my patches. Unfortunately I'm very busy with my thesis thingy right
 now and can fix them as fast as usual. I'll really try hard to have a
 look and do something about them before the release. It would indeed be
 useful if you'd file bug reports and flag them as blocker or so. Would
 look pretty bad if we ship half-broken demos.
 
 /Roman
 



signature.asc
Description: OpenPGP digital signature


Swing AWT demo troubles

2007-02-26 Thread Robert Schuster
Hi,
actually I wanted to test an XML patch on an application but while
running an IzPack created installer with a Cacao+Classpath CVS HEAD
I saw a lot of layout/drawing errors.

Running the AWT demo resulted in:
cacao -cp examples.zip gnu/classpath/examples/awt/Demo
Exception in thread main java.lang.ClassCastException
   at java.lang.Class.asSubclass(Class.java:1304)
   at
gnu.java.awt.peer.gtk.GtkToolkit.createDragGestureRecognizer(GtkToolkit.java:637)
   at
java.awt.dnd.DragSource.createDragGestureRecognizer(DragSource.java:235)
   at
java.awt.dnd.DragSource.createDefaultDragGestureRecognizer(DragSource.java:244)
   at
gnu.classpath.examples.awt.Demo$DragDropWindow$DragLabel.init(Demo.java:946)
   at gnu.classpath.examples.awt.Demo$DragDropWindow.init(Demo.java:867)
   at gnu.classpath.examples.awt.Demo$MainWindow.init(Demo.java:218)
   at gnu.classpath.examples.awt.Demo.main(Demo.java:92)

And the TextAreaDemo produces:

cacao -cp examples.zip gnu/classpath/examples/swing/TextAreaDemo
Exception during event dispatch:
java.lang.ArithmeticException: / by zero
   at javax.swing.text.PlainView.paint(PlainView.java:298)
   at
javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:388)
   at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:1154)
   at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:1105)
   at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:1183)

Has anyone a quick idea or should I post bug reports for both issues?

Regards
Robert



signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: add offset to memcpy operation

2006-11-09 Thread Robert Schuster
Hi,
the memcpy operation in gnu_java_nio_VMChannel.c::getsockname() for the
IPv6 case was copying the port value into the same space as the IPv6
address. I fixed this by adding an offset (like its done in the IPv4 case).

ChangeLog:

2006-11-09  Robert Schuster  [EMAIL PROTECTED]

* native/jni/java-nio/gnu_java_nio_VMChannel.c:
(getsockname): Added 16 byte offset to memcpy operation.

cya
Robert



signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: add offset to memcpy operation - getpeername

2006-11-09 Thread Robert Schuster
Hi,
gnu_java_nio_VMChannel.c::getpeername() the memcpy operation in the IPv6
case is missing an offset when copying the port value in. This patch
fixes that.

ChangeLog:

2006-11-09  Robert Schuster  [EMAIL PROTECTED]

* native/jni/java-nio/gnu_java_nio_VMChannel.c:
(getpeername): Added 16 byte offset to memcpy operation.

cya
Robert




signature.asc
Description: PGP signature
Index: native/jni/java-nio/gnu_java_nio_VMChannel.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c,v
retrieving revision 1.8
diff -u -r1.8 gnu_java_nio_VMChannel.c
--- native/jni/java-nio/gnu_java_nio_VMChannel.c	9 Nov 2006 11:10:55 -	1.8
+++ native/jni/java-nio/gnu_java_nio_VMChannel.c	9 Nov 2006 11:26:09 -
@@ -1331,7 +1331,7 @@
 {
   addr6 = (struct sockaddr_in6 *) sockaddr;
   memcpy (nameptr, (addr6-sin6_addr.s6_addr), 16);
-  memcpy (nameptr, (addr6-sin6_port), 2);
+  memcpy (nameptr + 16, (addr6-sin6_port), 2);
   return 16;
 }
 #endif /* HAVE_INET6 */


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] FYI: add offset to memcpy operation

2006-11-09 Thread Robert Schuster
Oh and here is the patch.

cya
Robert

Robert Schuster schrieb:
 Hi,
 the memcpy operation in gnu_java_nio_VMChannel.c::getsockname() for the
 IPv6 case was copying the port value into the same space as the IPv6
 address. I fixed this by adding an offset (like its done in the IPv4 case).
 
 ChangeLog:
 
 2006-11-09  Robert Schuster  [EMAIL PROTECTED]
 
 * native/jni/java-nio/gnu_java_nio_VMChannel.c:
 (getsockname): Added 16 byte offset to memcpy operation.
 
 cya
 Robert
 
Index: native/jni/java-nio/gnu_java_nio_VMChannel.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c,v
retrieving revision 1.7
diff -u -r1.7 gnu_java_nio_VMChannel.c
--- native/jni/java-nio/gnu_java_nio_VMChannel.c	25 Oct 2006 00:33:26 -	1.7
+++ native/jni/java-nio/gnu_java_nio_VMChannel.c	9 Nov 2006 11:10:22 -
@@ -1272,7 +1272,7 @@
 {
   addr6 = (struct sockaddr_in6 *) sockaddr;
   memcpy (nameptr, (addr6-sin6_addr.s6_addr), 16);
-  memcpy (nameptr, (addr6-sin6_port), 2);
+  memcpy (nameptr + 16, (addr6-sin6_port), 2);
   return 16;
 }
 #endif /* HAVE_INET6 */


signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath native/jni/java-nio/gnu_java_nio_VMCh...

2006-11-09 Thread Robert Schuster
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 06/11/09 11:10:57

Modified files:
native/jni/java-nio: gnu_java_nio_VMChannel.c 
.  : ChangeLog 

Log message:
2006-11-09  Robert Schuster  [EMAIL PROTECTED]

* native/jni/java-nio/gnu_java_nio_VMChannel.c:
(getsockname): Added 16 byte offset to memcpy operation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c?cvsroot=classpathr1=1.7r2=1.8
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8775r2=1.8776




[commit-cp] classpath native/jni/java-nio/gnu_java_nio_VMCh...

2006-11-09 Thread Robert Schuster
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 06/11/09 11:26:58

Modified files:
native/jni/java-nio: gnu_java_nio_VMChannel.c 
.  : ChangeLog 

Log message:
2006-11-09  Robert Schuster  [EMAIL PROTECTED]

* native/jni/java-nio/gnu_java_nio_VMChannel.c:
(getpeername): Added 16 byte offset to memcpy operation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c?cvsroot=classpathr1=1.8r2=1.9
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8776r2=1.8777




[cp-patches] FYI: Fix for PR29576

2006-10-24 Thread Robert Schuster
Hi,
the attached patch partly fixes PR29576. Without redesigning VMNetworkInterface
I just added a constructor which sets the field name to null and adds the
ANY_ADDR to the address list. NetworkInterface got a new package private method
which is to be called by MulticastSocket. Some other methods learned to deal
with the field name of an VMNetworkInterface instance being null.

ChangeLog:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

Fixes PR29576
* java/net/NetworkInterface.java:
(createAnyInterface): New method.
(equals): Added if-statement to handle case where netif.name is null.
* vm/reference/java/net/VMNetworkInterface.java:
(hashCode): Rewritten.
(VMNetworkInterface): New constructor.


cya
Robert
Index: java/net/NetworkInterface.java
===
RCS file: /cvsroot/classpath/classpath/java/net/NetworkInterface.java,v
retrieving revision 1.20
diff -u -r1.20 NetworkInterface.java
--- java/net/NetworkInterface.java	17 Sep 2006 07:31:42 -	1.20
+++ java/net/NetworkInterface.java	24 Oct 2006 23:17:23 -
@@ -67,6 +67,16 @@
 this.netif = netif;
   }
   
+  /** Creates an NetworkInterface instance which
+   * represents any interface in the system. Its only
+   * address is code0.0.0.0/0.0.0.0/code. This
+   * method is needed by [EMAIL PROTECTED] MulticastSocket#getNetworkInterface}
+   */
+  static NetworkInterface createAnyInterface()
+  {
+return new NetworkInterface(new VMNetworkInterface());
+  }
+  
   /**
* Returns the name of the network interface
*
@@ -206,6 +216,9 @@
   return false;
 
 NetworkInterface tmp = (NetworkInterface) obj;
+
+if (netif.name == null)
+  return tmp.netif.name == null;
 
 return (netif.name.equals(tmp.netif.name)
  (netif.addresses.equals(tmp.netif.addresses)));
@@ -219,7 +232,12 @@
   public int hashCode()
   {
 // FIXME: hash correctly
-return netif.name.hashCode() + netif.addresses.hashCode();
+int hc = netif.addresses.hashCode();
+
+if (netif.name != null)
+  hc += netif.name.hashCode();
+
+return hc;
   }
 
   /**
Index: vm/reference/java/net/VMNetworkInterface.java
===
RCS file: /cvsroot/classpath/classpath/vm/reference/java/net/VMNetworkInterface.java,v
retrieving revision 1.5
diff -u -r1.5 VMNetworkInterface.java
--- vm/reference/java/net/VMNetworkInterface.java	17 Sep 2006 07:31:43 -	1.5
+++ vm/reference/java/net/VMNetworkInterface.java	24 Oct 2006 23:17:23 -
@@ -66,6 +66,23 @@
 addresses = new HashSet();
   }
   
+  /**
+   * Creates a dummy instance which represents any network
+   * interface.
+   */
+  public VMNetworkInterface()
+  {
+addresses = new HashSet();
+try
+  {
+addresses.add(InetAddress.getByName(0.0.0.0));
+  }
+catch (UnknownHostException _)
+  {
+// Cannot happen.
+  }
+  }
+  
   static
   {
 if (Configuration.INIT_LOAD_LIBRARY)


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: final fix for PR29576

2006-10-24 Thread Robert Schuster
Hi,
with this small change to MulticastSocket a proper instance is returned when the
socket's multicast interface results to any.

I know: Test would be nice. I am working on it. :)

ChangeLog:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

Fixes PR29576
* java/net/MulticastSocket.java:
(getNetworkInterface): Return a special NetworkInterface instance
if the socket's multicast interface is set to any.

cya
Robert


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: Inet6Address fix

2006-10-24 Thread Robert Schuster
Hi,
byte value comparisons in Java are evil. Adding a cast to a byte of the right
value fixes the Inet6Address.isMulticastAddress method.

ChangeLog:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

* java/net/Inet6Address.java:
(isMulticastAddress): Fixed check.


cya
Robert
Index: java/net/Inet6Address.java
===
RCS file: /cvsroot/classpath/classpath/java/net/Inet6Address.java,v
retrieving revision 1.16
diff -u -r1.16 Inet6Address.java
--- java/net/Inet6Address.java	11 Sep 2006 11:44:24 -	1.16
+++ java/net/Inet6Address.java	24 Oct 2006 23:45:19 -
@@ -121,7 +121,7 @@
*/
   public boolean isMulticastAddress()
   {
-return ipaddress[0] == 0xFF;
+return ipaddress[0] == (byte) 0xFF;
   }
 
   /**


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] FYI: final fix for PR29576

2006-10-24 Thread Robert Schuster
Ahem,
and here is the patch.

Robert Schuster wrote:
 Hi,
 with this small change to MulticastSocket a proper instance is returned when 
 the
 socket's multicast interface results to any.
 
 I know: Test would be nice. I am working on it. :)
 
 ChangeLog:
 2006-10-25  Robert Schuster  [EMAIL PROTECTED]
 
 Fixes PR29576
 * java/net/MulticastSocket.java:
 (getNetworkInterface): Return a special NetworkInterface instance
 if the socket's multicast interface is set to any.
 
 cya
 Robert
Index: java/net/MulticastSocket.java
===
RCS file: /cvsroot/classpath/classpath/java/net/MulticastSocket.java,v
retrieving revision 1.26
diff -u -r1.26 MulticastSocket.java
--- java/net/MulticastSocket.java	2 Jul 2005 20:32:39 -	1.26
+++ java/net/MulticastSocket.java	24 Oct 2006 23:28:09 -
@@ -230,6 +258,10 @@
 
 InetAddress address =
   (InetAddress) getImpl().getOption(SocketOptions.IP_MULTICAST_IF);
+
+if (address.isAnyLocalAddress())
+  return NetworkInterface.createAnyInterface();
+
 NetworkInterface netIf = NetworkInterface.getByInetAddress(address);
 
 return netIf;


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: Java NIO/NET/Socket fixes

2006-10-24 Thread Robert Schuster
Hi,
this patch contains the bulk of my recent work on java.nio/java.net, the
respective VM classes and their native counterparts.

It consists of:
- adding multicast stuff
- fixing exception classes (IOException - SocketException)
- removing the need for VMPlainDatagramSocketImpl and the removal of that class
- a missing case in getOptions (SO_REUSEADDR)
- a wrong constant in leave6
- a rework of accept along with a new method isThreadInterrupted()
- filtering of unwanted options for TCP in PlainSocketImpl
- using the user-given address of a remote host instead of the one provided by a
DNS lookup
- correctly handling SO_LINGER on the Java and the native side
- automatically closing of Socket whose connect() inside the constructor fails.
- documentation of the VM interface changes
- using 'Integer.valueOf()' instead of 'new Integer()'

I got positive feedback for the bigger changes and think that the minor fixes
are just ok.

ChangeLog:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/net/PlainDatagramSocketImpl.java:
(connect): Use VMChannel instance for connect call.
(getTimeToLive): Call VMPlainSocketImpl.getTimeToLive.
(setTimeToLive): Call VMPlainSocketImpl.setTimeToLive.
(setOption): Handle multicast options.
(getOption): Handle multicast options.
* gnu/java/net/PlainSocketImpl.java:
(getTimeToLive): Call VMPlainSocketImpl.getTimeToLive.
(setTimeToLive): Call VMPlainSocketImpl.setTimeToLive.
(setOption): Filter unappropriate options.
(getOption): Filter unappropriate options.
(connect): Use given SocketAddress.
(close): Reset address and port.
(getInetAddress):
* include/Makefile.am: Removed all occurences of
gnu_java_net_VMPlainDatagramSocketImpl.h.
* include/gnu_java_net_VMPlainDatagramSocketImpl.h: Removed.
* native/jni/java-net/Makefile.am: Removed
gnu_java_net_VMPlainDatagramSocketImpl.c from sources.
* native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c:
Removed.
as SocketException, declare to throw SocketException.
* native/jni/java-nio/gnu_java_nio_VMChannel.c: Added definitions
for SocketException and ConnectException.
(Java_gnu_java_nio_VMChannel_connect): Throw SocketException instead
of IOException.
(Java_gnu_java_nio_VMChannel_connect6): Throw SocketException instead
of IOException.
(Java_gnu_java_nio_VMChannel_accept): Rewritten.
(JCL_thread_interrupted): New function.
(initIDs): Added initialisation for isThreadInterrupted method id.
* native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c: Added
CPNET_IP_TTL to java_sockopt enum.
(Java_gnu_java_net_VMPlainSocketImpl_setOption): Handle CPNET_IP_TTL
case, handle SO_LINGER case properly.
(Java_gnu_java_net_VMPlainSocketImpl_getOption): Handle CPNET_IP_TTL
case, handle SO_LINGER case properly.
(Java_gnu_java_net_VMPlainSocketImpl_getMulticastInterface): New
function.
(Java_gnu_java_net_VMPlainSocketImpl_setMulticastInterface): New
function.
(Java_gnu_java_net_VMPlainSocketImpl_setMulticastInterface6): New
function.
(Java_gnu_java_net_VMPlainSocketImpl_leave6): Fixed constant to be
IPV6_LEAVE_GROUP.
* vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java: Removed.
* vm/reference/gnu/java/nio/VMChannel.java:
(connect(int, byte[], int, int)): Declare to throw SocketException.
(connect6): Declare to throw SocketException.
(connect(InetSocketAddress, int)): Catch IOException and rethrow
(isThreadInterrupted): New method.
* vm/reference/gnu/java/net/VMPlainSocketImpl.java: Added CP_IP_TTL
field.
(setTimeToLive): New method.
(getTimeToLive): New method.
(setMulticastInterface(int, InetAddress)): New method.
(setMulticastInterface(int, int, Inet4Address): New method.
(setMulticastInterface6(int, int, Inet6Address): New method.
(setOptions): Handle SO_LINGER case.
(getOptions): Add missing SO_REUSEADDR case.
* java/net/Socket.java:
(Socket(InetAddress, int, InetAddress, int, boolean)): Close socket
when exception was thrown out of connect().
(setSoLinger): Replaced instantiations with valueOf calls, replaced
Boolean.FALSE with Integer.valueOf(-1).
* native/jni/native-lib/cpio.h: Added cpio_closeOnExec declaration.
* native/jni/native-lib/cpio.c: Added cpio_closeOnExec implementation.
* NEWS: Documented VM interface changes.

That was a big one. :)

cya
Robert
Index: gnu/java/net/PlainSocketImpl.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/net/PlainSocketImpl.java,v
retrieving revision 1.14
diff -u -r1.14

[cp-patches] FYI: make _javanet_create_inetaddress accessable

2006-10-24 Thread Robert Schuster
Hi,
my last patch need _javanet_create_inetaddress from javanet.c to be accessable
from another compilation unit. This patch does that.

ChangeLog:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

* native/jni/java-net/javanet.h: Added declaration for
_javanet_create_inetaddress.
* native/jni/java-net/javanet.c:
(_javanet_create_inetaddress): Removed static keyword.

cya
Robert
Index: native/jni/java-net/javanet.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/javanet.c,v
retrieving revision 1.36
diff -u -r1.36 javanet.c
--- native/jni/java-net/javanet.c	21 Aug 2006 23:34:45 -	1.36
+++ native/jni/java-net/javanet.c	25 Oct 2006 00:36:06 -
@@ -232,7 +232,7 @@
 /*
  * Builds an InetAddress object from a 32 bit address in host byte order
  */
-static jobject
+jobject
 _javanet_create_inetaddress (JNIEnv * env, cpnet_address *netaddr)
 {
 #ifndef WITHOUT_NETWORK
Index: native/jni/java-net/javanet.h
===
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/javanet.h,v
retrieving revision 1.15
diff -u -r1.15 javanet.h
--- native/jni/java-net/javanet.h	21 Aug 2006 23:34:46 -	1.15
+++ native/jni/java-net/javanet.h	25 Oct 2006 00:36:06 -
@@ -81,6 +81,7 @@
 
 extern int _javanet_get_int_field(JNIEnv *, jobject, const char *);
 extern cpnet_address *_javanet_get_ip_netaddr(JNIEnv *, jobject);
+extern jobject _javanet_create_inetaddress (JNIEnv *, cpnet_address *);
 extern void _javanet_create(JNIEnv *, jobject, jboolean);
 extern void _javanet_close(JNIEnv *, jobject, int);
 extern void _javanet_connect(JNIEnv *, jobject, jobject, jint, jboolean);


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: MulticastSocket.setNetworkInterface fix

2006-10-24 Thread Robert Schuster
Hi,
I partly rewrote this method because it failed to set an IPv4 address on a
Socket connected to an IPv4 multicast group. This happened because on my system
the interface's IPv6 address seems to come before its IPv4 address and the
method took the first one in the old implementation.

While this doesn't fix the problems with MulticastSockets which should deal with
IPv6 multicast groups (see my mail to classpath@gnu.org) it makes at least the
IPv4 case working completely. However the patch shows what kind of unelegant
code is needed to get stuff working at all in an environment with mixed IP 
versions.

ChangeLog:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

* java/net/MulticastSocket.java:
(setNetworkInterface): Rewritten.

cya
Robert
Index: java/net/MulticastSocket.java
===
RCS file: /cvsroot/classpath/classpath/java/net/MulticastSocket.java,v
retrieving revision 1.27
diff -u -r1.27 MulticastSocket.java
--- java/net/MulticastSocket.java	24 Oct 2006 23:32:25 -	1.27
+++ java/net/MulticastSocket.java	25 Oct 2006 00:42:42 -
@@ -202,13 +202,41 @@
   {
 if (isClosed())
   throw new SocketException(socket is closed);
-
-Enumeration e = netIf.getInetAddresses();
-
-if (! e.hasMoreElements())
-  throw new SocketException(no network devices found);
-
-InetAddress address = (InetAddress) e.nextElement();
+
+InetAddress address;
+if (netIf != null)
+  out:
+  {
+Enumeration e = netIf.getInetAddresses();
+if (getLocalAddress() instanceof Inet4Address)
+  {
+// Search for a IPv4 address.
+while (e.hasMoreElements())
+  {
+address = (InetAddress) e.nextElement();
+if (address instanceof Inet4Address)
+  break out;
+  }
+throw new SocketException(interface  + netIf.getName() +  has no IPv6 address);
+  }
+else if (getLocalAddress() instanceof Inet6Address)
+  {
+// Search for a IPv6 address.
+while (e.hasMoreElements())
+  {
+address = (InetAddress) e.nextElement();
+if (address instanceof Inet6Address)
+  break out;
+  }
+throw new SocketException(interface  + netIf.getName() +  has no IPv6 address);
+  }
+else
+  throw new SocketException(interface  + netIf.getName() +  has no suitable IP address);
+  }
+else
+  address = InetAddress.ANY_IF;
+
+
 getImpl().setOption(SocketOptions.IP_MULTICAST_IF, address);
   }
 


signature.asc
Description: OpenPGP digital signature


switch to IPv6-only

2006-10-24 Thread Robert Schuster
Hi,
some days ago I posted a question where I was wondering why the RI calls all
their network stuff with AF_INET6 even if the user explicitly wants to do
IPv4-only stuff.

I think I found the reason and am here to ask for going the same route in GNU
Classpath. Let me try to explain the situation:

When a new socket is created the native code will currently call socket(AF_INET,
...) at some place. Usually the user then configures the socket and binds it to
a specific inet address. Not until this binding operation is started we know
whether the user wants an IPv4 socket or an IPv6 one. However the current
implementation has decided this already and it is AF_INET (== IPv4).

Consequently stuff like connecting to IPv6 servers fails.

For multicast sockets the situation is even more worse: If you do a 'new
MulticastSocket()' the socket is created as AF_INET and is bound automatically
to the IPv4 ANY_ADDR. Doing a joinGroup()/leaveGroup() with an IPv6 address is
quite pointless.

What I am proposing is that we do all our native interaction as if the addresses
where IPv6. As IP4v is a subset of IPv6 there should be no problem: Prepend 12
zeros before an IP4v address and you're done.

But what about the platforms that do not natively support IPv6? Bad luck, they
have to use a little hack: Skip the first 12 bytes in a buffer containing an
address and call the system function with AF_INET instead. Additionally they
have to adjust VMPlainSocketImpl's methods to throw some error when someone
passes an Inet6Address to them.

Questions, opinions, suggestions?

cya
Robert


signature.asc
Description: OpenPGP digital signature


[commit-cp] classpath java/net/NetworkInterface.java vm/ref...

2006-10-24 Thread Robert Schuster
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 06/10/24 23:19:48

Modified files:
java/net   : NetworkInterface.java 
vm/reference/java/net: VMNetworkInterface.java 
.  : ChangeLog 

Log message:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

Fixes PR29576
* java/net/NetworkInterface.java:
(createAnyInterface): New method.
(equals): Added if-statement to handle case where netif.name is 
null.
* vm/reference/java/net/VMNetworkInterface.java:
(hashCode): Rewritten.
(VMNetworkInterface): New constructor.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/java/net/NetworkInterface.java?cvsroot=classpathr1=1.20r2=1.21
http://cvs.savannah.gnu.org/viewcvs/classpath/vm/reference/java/net/VMNetworkInterface.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8719r2=1.8720




[commit-cp] classpath ChangeLog java/net/MulticastSocket.java

2006-10-24 Thread Robert Schuster
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 06/10/24 23:32:25

Modified files:
.  : ChangeLog 
java/net   : MulticastSocket.java 

Log message:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

Fixes PR29576
* java/net/MulticastSocket.java:
(getNetworkInterface): Return a special NetworkInterface 
instance
if the socket's multicast interface is set to any.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8720r2=1.8721
http://cvs.savannah.gnu.org/viewcvs/classpath/java/net/MulticastSocket.java?cvsroot=classpathr1=1.26r2=1.27




[commit-cp] classpath java/net/Inet6Address.java ChangeLog

2006-10-24 Thread Robert Schuster
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 06/10/24 23:46:05

Modified files:
java/net   : Inet6Address.java 
.  : ChangeLog 

Log message:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

* java/net/Inet6Address.java:
(isMulticastAddress): Fixed check.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/java/net/Inet6Address.java?cvsroot=classpathr1=1.16r2=1.17
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8721r2=1.8722




[commit-cp] classpath gnu/java/net/PlainSocketImpl.java gnu...

2006-10-24 Thread Robert Schuster
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 06/10/25 00:33:28

Modified files:
gnu/java/net   : PlainSocketImpl.java 
 PlainDatagramSocketImpl.java 
include: Makefile.am 
native/jni/java-net: Makefile.am 
 gnu_java_net_VMPlainSocketImpl.c 
native/jni/java-nio: gnu_java_nio_VMChannel.c 
native/jni/native-lib: cpio.c cpio.h 
vm/reference/gnu/java/nio: VMChannel.java 
vm/reference/gnu/java/net: VMPlainSocketImpl.java 
java/net   : Socket.java 
.  : NEWS ChangeLog 

Log message:
Lots of changes.

2006-10-25  Robert Schuster  [EMAIL PROTECTED]

* gnu/java/net/PlainDatagramSocketImpl.java:
(connect): Use VMChannel instance for connect call.
(getTimeToLive): Call VMPlainSocketImpl.getTimeToLive.
(setTimeToLive): Call VMPlainSocketImpl.setTimeToLive.
(setOption): Handle multicast options.
(getOption): Handle multicast options.
* gnu/java/net/PlainSocketImpl.java:
(getTimeToLive): Call VMPlainSocketImpl.getTimeToLive.
(setTimeToLive): Call VMPlainSocketImpl.setTimeToLive.
(setOption): Filter unappropriate options.
(getOption): Filter unappropriate options.
(connect): Use given SocketAddress.
(close): Reset address and port.
(getInetAddress): 
* include/Makefile.am: Removed all occurences of
gnu_java_net_VMPlainDatagramSocketImpl.h.
* include/gnu_java_net_VMPlainDatagramSocketImpl.h: Removed.
* native/jni/java-net/Makefile.am: Removed
gnu_java_net_VMPlainDatagramSocketImpl.c from sources.
* native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c:
Removed.
as SocketException, declare to throw SocketException.
* native/jni/java-nio/gnu_java_nio_VMChannel.c: Added 
definitions
for SocketException and ConnectException.
(Java_gnu_java_nio_VMChannel_connect): Throw SocketException 
instead
of IOException.
(Java_gnu_java_nio_VMChannel_connect6): Throw SocketException 
instead
of IOException.
(Java_gnu_java_nio_VMChannel_accept): Rewritten.
(JCL_thread_interrupted): New function.
(initIDs): Added initialisation for isThreadInterrupted method 
id.
* native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c: Added
CPNET_IP_TTL to java_sockopt enum.
(Java_gnu_java_net_VMPlainSocketImpl_setOption): Handle 
CPNET_IP_TTL
case, handle SO_LINGER case properly.
(Java_gnu_java_net_VMPlainSocketImpl_getOption): Handle 
CPNET_IP_TTL
case, handle SO_LINGER case properly.
(Java_gnu_java_net_VMPlainSocketImpl_getMulticastInterface): New
function.
(Java_gnu_java_net_VMPlainSocketImpl_setMulticastInterface): New
function.
(Java_gnu_java_net_VMPlainSocketImpl_setMulticastInterface6): 
New
function.
(Java_gnu_java_net_VMPlainSocketImpl_leave6): Fixed constant to 
be
IPV6_LEAVE_GROUP.
* vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java: 
Removed.
* vm/reference/gnu/java/nio/VMChannel.java:
(connect(int, byte[], int, int)): Declare to throw 
SocketException.
(connect6): Declare to throw SocketException.
(connect(InetSocketAddress, int)): Catch IOException and rethrow
(isThreadInterrupted): New method.
* vm/reference/gnu/java/net/VMPlainSocketImpl.java: Added 
CP_IP_TTL
field.
(setTimeToLive): New method.
(getTimeToLive): New method.
(setMulticastInterface(int, InetAddress)): New method.
(setMulticastInterface(int, int, Inet4Address): New method.
(setMulticastInterface6(int, int, Inet6Address): New method.
(setOptions): Handle SO_LINGER case.
(getOptions): Add missing SO_REUSEADDR case.
* java/net/Socket.java:
(Socket(InetAddress, int, InetAddress, int, boolean)): Close 
socket
when exception was thrown out of connect().
(setSoLinger): Replaced instantiations with valueOf calls, 
replaced
Boolean.FALSE with Integer.valueOf(-1).
* native/jni/native-lib/cpio.h: Added cpio_closeOnExec 
declaration.
* native/jni/native-lib/cpio.c: Added

[commit-cp] classpath native/jni/java-net/javanet.c native/...

2006-10-24 Thread Robert Schuster
CVSROOT:/cvsroot/classpath
Module name:classpath
Changes by: Robert Schuster rschuster 06/10/25 00:39:02

Modified files:
native/jni/java-net: javanet.c javanet.h 
.  : ChangeLog 

Log message:
2006-10-25  Robert Schuster  [EMAIL PROTECTED]

* native/jni/java-net/javanet.h: Added declaration for
_javanet_create_inetaddress.
* native/jni/java-net/javanet.c:
(_javanet_create_inetaddress): Removed static keyword.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/java-net/javanet.c?cvsroot=classpathr1=1.36r2=1.37
http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/java-net/javanet.h?cvsroot=classpathr1=1.15r2=1.16
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8723r2=1.8724




  1   2   3   4   5   6   >