Re: [cp-patches] FYI: New BasicLookAndFeel methods

2005-12-16 Thread Tom Tromey
> "Roman" == Roman Kennke <[EMAIL PROTECTED]> writes:

Roman> Note that for real acoustic feedback we still need to fix the
Roman> UI classes to trigger these methods on certain events and of
Roman> course we need some javax.sound.sampled provider and some audio
Roman> files :-(.

Would you mind filing a PR for the provider and another with a list of
what audio samples we would need?

Tom


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: New BasicLookAndFeel methods

2005-12-16 Thread Roman Kennke
I implemented some missing methods in
javax.swing.plaf.basic.BasicLookAndFeel. This are the three audio
related methods that can be used to implement acoustic feedback for look
and feels. Note that for real acoustic feedback we still need to fix the
UI classes to trigger these methods on certain events and of course we
need some javax.sound.sampled provider and some audio files :-(.

2005-12-17  Roman Kennke  <[EMAIL PROTECTED]>

* javax/swing/plaf/basic/BasicLookAndFeel.java
(AudioAction): New inner class.
(audioActionMap): New field.
(getAudioActionMap): New method.
(createAudioAction): New method.
(playSound): New method.

/Roman
Index: javax/swing/plaf/basic/BasicLookAndFeel.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,v
retrieving revision 1.68
diff -u -r1.68 BasicLookAndFeel.java
--- javax/swing/plaf/basic/BasicLookAndFeel.java	15 Nov 2005 21:35:04 -	1.68
+++ javax/swing/plaf/basic/BasicLookAndFeel.java	17 Dec 2005 01:33:33 -
@@ -41,16 +41,28 @@
 import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Font;
+import java.awt.event.ActionEvent;
 import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
+import java.io.IOException;
+import java.io.InputStream;
 import java.io.Serializable;
 import java.util.Enumeration;
 import java.util.ResourceBundle;
 
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.Clip;
+import javax.sound.sampled.LineUnavailableException;
+import javax.sound.sampled.UnsupportedAudioFileException;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.ActionMap;
 import javax.swing.BorderFactory;
 import javax.swing.KeyStroke;
 import javax.swing.LookAndFeel;
 import javax.swing.UIDefaults;
+import javax.swing.UIManager;
 import javax.swing.border.BevelBorder;
 import javax.swing.border.Border;
 import javax.swing.plaf.BorderUIResource;
@@ -68,8 +80,68 @@
 public abstract class BasicLookAndFeel extends LookAndFeel
   implements Serializable
 {
+  /**
+   * An action that can play an audio file.
+   *
+   * @author Roman Kennke ([EMAIL PROTECTED])
+   */
+  private class AudioAction extends AbstractAction
+  {
+/**
+ * The UIDefaults key that specifies the sound.
+ */
+Object key;
+
+/**
+ * Creates a new AudioAction.
+ *
+ * @param key the key that describes the audio action, normally a filename
+ *of an audio file relative to the current package
+ */
+AudioAction(Object key)
+{
+  this.key = key;
+}
+
+/**
+ * Plays the sound represented by this action.
+ *
+ * @param event the action event that triggers this audio action
+ */
+public void actionPerformed(ActionEvent event)
+{
+  // We only can handle strings for now.
+  if (key instanceof String)
+{
+  String name = UIManager.getString(key);
+  InputStream stream = getClass().getResourceAsStream(name);
+  try
+{
+  Clip clip = AudioSystem.getClip();
+  AudioInputStream audioStream =
+AudioSystem.getAudioInputStream(stream);
+  clip.open(audioStream);
+}
+  catch (LineUnavailableException ex)
+{
+  // Nothing we can do about it.
+}
+  catch (IOException ex)
+{
+  // Nothing we can do about it.
+}
+  catch (UnsupportedAudioFileException e)
+{
+  // Nothing we can do about it.
+}
+}
+}
+  }
+
   static final long serialVersionUID = -6096995660290287879L;
 
+  private ActionMap audioActionMap;
+
   /**
* Creates a new instance of the Basic look and feel.
*/
@@ -1174,4 +1246,67 @@
 };
 defaults.putDefaults(uiDefaults);
   }
-} // class BasicLookAndFeel
+
+  /**
+   * Returns the ActionMap that stores all the actions that are
+   * responsibly for rendering auditory cues.
+   *
+   * @return the action map that stores all the actions that are
+   * responsibly for rendering auditory cues
+   *
+   * @see #createAudioAction
+   * @see #playSound
+   *
+   * @since 1.4
+   */
+  protected ActionMap getAudioActionMap()
+  {
+if (audioActionMap != null)
+  audioActionMap = new ActionMap();
+return audioActionMap;
+  }
+
+  /**
+   * Creates an Action that can play an auditory cue specified by
+   * the key. The UIDefaults value for the key is normally a String that points
+   * to an audio file relative to the current package.
+   *
+   * @param key a UIDefaults key that specifies the sound
+   *
+   * @return an action that can play the sound
+   *
+   * @see #playSound
+   *
+   * @since 1.4
+   */
+  protected Action createAudioAction(Object key)
+  {
+return new AudioActi

[cp-patches] FYI: New JTable methods

2005-12-16 Thread Roman Kennke
I implemented the remaining missing methods in javax.swing.JTable. These
are the last missing methods in the javax.swing package wrt JDK1.4
completeness. :-D

2005-12-16  Roman Kennke  <[EMAIL PROTECTED]>

* javax/swing/JTable.java
(AccessibleJTable.getAccessibleRowAtIndex): New method.
(AccessibleJTable.getAccessibleColumnAtIndex): New method.
(AccessibleJTable.getAccessibleColumnAtIndex): New method.
(surrendersFocusOnKeystroke): New field.
(setSurrendersFocusOnKeystroke): New method.
(getSurrendersFocusOnKeystroke): New method.

/Roman
Index: javax/swing/JTable.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.63
diff -u -r1.63 JTable.java
--- javax/swing/JTable.java	21 Nov 2005 22:03:17 -	1.63
+++ javax/swing/JTable.java	17 Dec 2005 00:50:03 -
@@ -927,7 +927,47 @@
   // TODO Auto-generated method stub
   return null;
 }
-  
+
+/**
+ * Returns the accessible row at the specified index.
+ *
+ * @param index the index for which to query the row
+ *
+ * @return the row number at the specified table index
+ */
+public int getAccessibleRowAtIndex(int index)
+{
+  // TODO: Back this up by a Mauve test and update API docs accordingly.
+  return index / getColumnCount();
+}
+
+/**
+ * Returns the accessible column at the specified index.
+ *
+ * @param index the index for which to query the column
+ *
+ * @return the column number at the specified table index
+ */
+public int getAccessibleColumnAtIndex(int index)
+{
+  // TODO: Back this up by a Mauve test and update API docs accordingly.
+  return index % getColumnCount();
+}
+
+/**
+ * Returns the accessible child index at the specified column and row.
+ *
+ * @param row the row
+ * @param column the column
+ *
+ * @return the index of the accessible child at the specified row and
+ * column
+ */
+public int getAccessibleIndexAt(int row, int column)
+{
+  // TODO: Back this up by a Mauve test and update API docs accordingly.
+  return row * getColumnCount() + column;
+}
   }
   /**
* Handles property changes from the TableColumns of this
@@ -1464,6 +1504,12 @@
 new TableColumnPropertyChangeHandler();
 
   /**
+   * Whether cell editors should receive keyboard focus when the table is
+   * activated.
+   */
+  private boolean surrendersFocusOnKeystroke = false;
+
+  /**
* Creates a new JTable instance.
*/
   public JTable ()
@@ -3281,4 +3327,37 @@
 revalidate();
 repaint();
   }
+
+  /**
+   * Sets whether cell editors of this table should receive keyboard focus
+   * when the editor is activated by a keystroke. The default setting is
+   * false which means that the table should keep the keyboard
+   * focus until the cell is selected by a mouse click.
+   *
+   * @param value the value to set
+   *
+   * @since 1.4
+   */
+  public void setSurrendersFocusOnKeystroke(boolean value)
+  {
+// TODO: Implement functionality of this property (in UI impl).
+surrendersFocusOnKeystroke = value;
+  }
+
+  /**
+   * Returns whether cell editors of this table should receive keyboard focus
+   * when the editor is activated by a keystroke. The default setting is
+   * false which means that the table should keep the keyboard
+   * focus until the cell is selected by a mouse click.
+   *
+   * @return whether cell editors of this table should receive keyboard focus
+   * when the editor is activated by a keystroke
+   *
+   * @since 1.4
+   */
+  public boolean getSurrendersFocusOnKeystroke()
+  {
+// TODO: Implement functionality of this property (in UI impl).
+return surrendersFocusOnKeystroke;
+  }
 }
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: SwingUtilities.processKeyBindings() implemented

2005-12-16 Thread Roman Kennke
Hi,

thanks to the work done by Anthony Balkissoon (KeyboardManager) I finally
could make some sense out of the method
SwingUtilities.processKeyBindings() which previously caused headaches to
me :-)

What I think what this method actually should do (and this is how I
implemented it) is, that it processes key bindings for a
java.awt.Component (that is not derived from JComponent) that are in the
WHEN_IN_FOCUSED_WINDOW scope. This is necessary because otherwise such
events would get lost without notifying components with such bindings.
However, I am not sure how this method should be triggered. From within
Component.processKeyEvent() maybe, but calling into Swing code from AWT
seems so ugly...

2005-12-16  Roman Kennke  <[EMAIL PROTECTED]>

* javax/swing/SwingUtilities.java
(processKeyBindings): New method. Processes keybindings for
non-JComponent derived components.


/Roman
Index: javax/swing/SwingUtilities.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/SwingUtilities.java,v
retrieving revision 1.39
diff -u -r1.39 SwingUtilities.java
--- javax/swing/SwingUtilities.java	8 Nov 2005 20:35:43 -	1.39
+++ javax/swing/SwingUtilities.java	17 Dec 2005 00:22:06 -
@@ -1395,4 +1395,30 @@
 else
   return null;
   }
+
+  /**
+   * Processes key bindings for the component that is associated with the 
+   * key event. Note that this method does not make sense for
+   * JComponent-derived components, except when
+   * [EMAIL PROTECTED] JComponent#processKeyEvent(KeyEvent)} is overridden and super is
+   * not called.
+   *
+   * This method searches through the component hierarchy of the component's
+   * top-level container to find a JComponent that has a binding
+   * for the key event in the WHEN_IN_FOCUSED_WINDOW scope.
+   *
+   * @param ev the key event
+   *
+   * @return true if a binding has been found and processed,
+   * false otherwise
+   *
+   * @since 1.4
+   */
+  public static boolean processKeyBindings(KeyEvent ev)
+  {
+Component c = ev.getComponent();
+KeyStroke s = KeyStroke.getKeyStrokeForEvent(ev);
+KeyboardManager km = KeyboardManager.getManager();
+return km.processKeyStroke(c, s, ev);
+  }
 }
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Re: [commit-cp] classpath ./ChangeLog vm/reference/gnu/classpat...

2005-12-16 Thread Keith Seitz

Mark Wielaard wrote:


Please fix.


Indeed! I got a little ahead of myself. I've committed the attached 
patch which should fix it. (This time I even waited for the build to 
finish. O:-)


Keith

2005-12-16  Keith Seitz  <[EMAIL PROTECTED]>

* gnu/classpath/jdwp/event/EventManager.java (EventManager): Catch
all JdwpExceptions when initializing the event table.
(requestEvent): Update to allow throwing JdwpException from
VMVirtualMachine methods.
(deleteRequest): Likewise.
(clearRequests): Likewise.
* gnu/classpath/jdwp/Jdwp.java (notify): Catch exceptions
from sendEvent and _enforceSuspendPolicy.
Index: gnu/classpath/jdwp/Jdwp.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/Jdwp.java,v
retrieving revision 1.1
diff -u -p -r1.1 Jdwp.java
--- gnu/classpath/jdwp/Jdwp.java	3 Sep 2005 00:17:50 -	1.1
+++ gnu/classpath/jdwp/Jdwp.java	16 Dec 2005 23:10:32 -
@@ -42,6 +42,7 @@ package gnu.classpath.jdwp;
 import gnu.classpath.jdwp.event.Event;
 import gnu.classpath.jdwp.event.EventManager;
 import gnu.classpath.jdwp.event.EventRequest;
+import gnu.classpath.jdwp.exception.JdwpException;
 import gnu.classpath.jdwp.id.ThreadId;
 import gnu.classpath.jdwp.processor.PacketProcessor;
 import gnu.classpath.jdwp.transport.ITransport;
@@ -206,7 +207,20 @@ public class Jdwp
 	EventManager em = EventManager.getDefault ();
 	EventRequest request = em.getEventRequest (event);
 	if (request != null)
-	  sendEvent (request, event);
+	  {
+	try
+	  {
+		System.out.println ("Jdwp.notify: sending event " + event);
+		sendEvent (request, event);
+		jdwp._enforceSuspendPolicy (request.getSuspendPolicy ());
+	  }
+	catch (Exception e)
+	  {
+		/* Really not much we can do. For now, just print out
+		   a warning to the user. */
+		System.out.println ("Jdwp.notify: caught exception: " + e);
+	  }
+	  }
   }
   }
   
@@ -217,32 +231,25 @@ public class Jdwp
*
* @param  request  the debugger request for the event
* @param  eventthe event to send
+   * @throws IOException if a communications failure occurs
*/
   public static void sendEvent (EventRequest request, Event event)
+  throws IOException
   {
 Jdwp jdwp = getDefault ();
 if (jdwp != null)
   {
-	try
-	  {
-	// !! May need to implement send queue?
-	synchronized (jdwp._connection)
-	  {
-		jdwp._connection.sendEvent (request, event);
-	  }
-	
-	// Follow suspend policy
-	jdwp._enforceSuspendPolicy (request.getSuspendPolicy ());
-	  }
-	catch (IOException ie)
+	// !! May need to implement send queue?
+	synchronized (jdwp._connection)
 	  {
-	System.out.println ("Jdwp.notify: caught exception: " + ie);
+	jdwp._connection.sendEvent (request, event);
 	  }
   }
   }
 
   // Helper function to enforce suspend policies on event notification
   private void _enforceSuspendPolicy (byte suspendPolicy)
+throws JdwpException
   {
 switch (suspendPolicy)
   {
Index: gnu/classpath/jdwp/event/EventManager.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/EventManager.java,v
retrieving revision 1.2
diff -u -p -r1.2 EventManager.java
--- gnu/classpath/jdwp/event/EventManager.java	2 Sep 2005 20:48:25 -	1.2
+++ gnu/classpath/jdwp/event/EventManager.java	16 Dec 2005 23:10:32 -
@@ -41,6 +41,7 @@ package gnu.classpath.jdwp.event;
 
 import gnu.classpath.jdwp.VMVirtualMachine;
 import gnu.classpath.jdwp.exception.InvalidEventTypeException;
+import gnu.classpath.jdwp.exception.JdwpException;
 
 import java.util.Collection;
 import java.util.Hashtable;
@@ -133,7 +134,7 @@ public class EventManager
 	EventRequest.EVENT_VM_DEATH,
 	EventRequest.SUSPEND_NONE));
   }
-catch (InvalidEventTypeException e)
+catch (JdwpException e)
   {
 	// This can't happen
   }
@@ -187,9 +188,10 @@ public class EventManager
*
* @param request  the request to monitor
* @throws InvalidEventTypeException for invalid event kind
+   * @throws JdwpException for other errors involving request
*/
   public void requestEvent (EventRequest request)
-throws InvalidEventTypeException
+throws JdwpException
   {
 // Add request to request list
 Hashtable requests;
@@ -212,8 +214,10 @@ public class EventManager
* @param  kind  the event kind
* @param  idthe ID of the request to delete
* @throws IllegalArgumentException for invalid event kind
+   * @throws JdwpException for other errors deleting request
*/
   public void deleteRequest (byte kind, int id)
+throws JdwpException
   {
 Hashtable requests;
 requests = (Hashtable) _requests.get (new Byte (kind));
@@ -237,8 +241,10 @@ public class EventManager
*
* @param  kind  the event kind
* @throws IllegalArgumentException for invali

[cp-patches] RFC : modifiers in java/lang/Class

2005-12-16 Thread Nicolas Geoffray

Hi,

The access flag of a class might have the synchronized bit set, even if 
it's not
appropriate for a class. The java file attached prints "public 
synchronized" as

modifiers with jamvm, whereas it prints "public" with sun. This patch just
changes the return of Class.getModifiers to return only interesting bits.

OK to commit?

2005-12-17  Nicolas Geoffray <[EMAIL PROTECTED]>

* java/lang/Class.java (getModifiers): Only returns
interesting bits.

import java.io.ObjectStreamClass;
import java.lang.reflect.Modifier;
public class Serial implements java.io.Serializable{
  
  public static void main(String[]args) throws Exception{
System.out.println(Modifier.toString(Serial.class.getModifiers()));
System.out.println(Serial.class.getModifiers());
System.out.println(ObjectStreamClass.lookup(Serial.class).getSerialVersionUID());
  }
}

  
Index: java/lang/Class.java
===
RCS file: /cvsroot/classpath/classpath/java/lang/Class.java,v
retrieving revision 1.42
diff -u -r1.42 Class.java
--- java/lang/Class.java16 Dec 2005 18:06:52 -  1.42
+++ java/lang/Class.java16 Dec 2005 23:03:40 -
@@ -836,7 +836,10 @@
*/
   public int getModifiers()
   {
-return VMClass.getModifiers (this, false);
+int mod = VMClass.getModifiers (this, false);
+return (mod & (Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
+  Modifier.FINAL | Modifier.STATIC | Modifier.ABSTRACT |
+  Modifier.INTERFACE));
   }
   
   /**
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] [PATCH/JDWP] VMVirtualMachine methods throw common exception

2005-12-16 Thread Mark Wielaard
Hi Keith,

On Fri, 2005-12-16 at 13:04 -0800, Keith Seitz wrote:
> I've been hoarding several classpath patches w.r.t. JDWP while I've been 
>   away, and I think it is time I start committing some of them before 
> they get out of hand. [Of course, it should also help to put some 
> people's minds at some ease -- as far as I know, neither I nor Red Hat 
> has yet abandoned our commitment to getting interpreted debugging in gcj 
> working.]

Yeah! Good to see action on the JDWP front. And it is always a good idea
to have some more eyes look at code in progress.

> I assume that I may still commit these changes. Someone please speak up 
> if I am assuming too much.

You may. Certainly for this kind of trivial updates to the jdwp code of
which you are the main author. You may not however break the build! :)

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Re: [commit-cp] classpath ./ChangeLog vm/reference/gnu/classpat...

2005-12-16 Thread Mark Wielaard
Hi Keith,

On Fri, 2005-12-16 at 21:04 +, Keith Seitz wrote:
>   * vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
>   (VMVirtualMachine): All methods now throw JdwpException.

That breaks the build since JdwpException is a checked exception and we
now have several places that call these methods but don't expect such an
exception:

Found 3 semantic errors compiling
"../gnu/classpath/jdwp/event/EventManager.jav:
   205. VMVirtualMachine.registerEvent (request);
^--^
*** Semantic Error: The method "void
registerEvent(gnu.classpath.jdwp.event.Eve.

   230. VMVirtualMachine.unregisterEvent (request);
^^
*** Semantic Error: The method "void
unregisterEvent(gnu.classpath.jdwp.event.E.

   250. VMVirtualMachine.clearEvents (kind);
^-^
*** Semantic Error: The method "void clearEvents(byte kind) throws
gnu.classpat.
Found 2 semantic errors compiling "../gnu/classpath/jdwp/Jdwp.java":

   254. VMVirtualMachine.suspendThread (this);
^---^
*** Semantic Error: The method "void suspendThread(java.lang.Thread
thread) thr.

   258. VMVirtualMachine.suspendAllThreads ();
^---^
*** Semantic Error: The method "void suspendAllThreads() throws
gnu.classpath.j.

Please fix.

Thanks,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: Api doc updates for IntegerSyntax based printing attributes.

2005-12-16 Thread Wolfgang Baer

Hi all,

only api doc updates except one minor fix to return the correct
name of the attribute class.

Regards,
Wolfgang

2005-12-16  Wolfgang Baer  <[EMAIL PROTECTED]>

* javax/print/attribute/standard/JobImpressionsCompleted.java:
Added and updated javadocs to class and methods.
(getName): Fixed name returned by this attribute class.
* javax/print/attribute/standard/JobMediaSheetsCompleted.java,
* javax/print/attribute/standard/JobKOctetsProcessed.java,
* javax/print/attribute/standard/JobImpressions.java,
* javax/print/attribute/standard/JobKOctets.java,
* javax/print/attribute/standard/JobMediaSheets.java,
* javax/print/attribute/standard/NumberOfInterveningJobs.java,
* javax/print/attribute/standard/JobPriority.java,
* javax/print/attribute/standard/JobPrioritySupported.java,
* javax/print/attribute/standard/NumberOfDocuments.java,
* javax/print/attribute/standard/QueuedJobCount.java,
* javax/print/attribute/standard/NumberUp.java,
* javax/print/attribute/standard/PagesPerMinuteColor.java,
* javax/print/attribute/standard/PagesPerMinute.java,
* javax/print/attribute/standard/Copies.java:
Added and updated javadocs to class and methods.

Index: javax/print/attribute/standard/JobImpressionsCompleted.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/JobImpressionsCompleted.java,v
retrieving revision 1.5
diff -u -r1.5 JobImpressionsCompleted.java
--- javax/print/attribute/standard/JobImpressionsCompleted.java	2 Jul 2005 20:32:46 -	1.5
+++ javax/print/attribute/standard/JobImpressionsCompleted.java	16 Dec 2005 22:01:03 -
@@ -1,5 +1,5 @@
 /* JobImpressionsCompleted.java -- 
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,6 +41,23 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
+ * The JobImpressionsCompleted printing attribute reports
+ * the number of impressions already processed.
+ * 
+ * An impression is specified by the IPP specification as the image imposed 
+ * onto a single media sheet. This attribute will not include a multiplication 
+ * factor from the number of copies.
+ * 
+ * 
+ * This attribute belongs to a group of job progress attributes which are 
+ * reporting on the progress of a print job.
+ * 
+ * 
+ * IPP Compatibility: JobImpressionsCompleted is an IPP 1.1 attribute.
+ * 
+ * @see javax.print.attribute.standard.JobMediaSheetsCompleted
+ * @see javax.print.attribute.standard.JobKOctetsProcessed
+ * 
  * @author Michael Koch ([EMAIL PROTECTED])
  */
 public final class JobImpressionsCompleted extends IntegerSyntax
@@ -53,7 +70,7 @@
*
* @param value the number of completed impressions
*
-   * @exception IllegalArgumentException if value < 0
+   * @exception IllegalArgumentException if value < 0
*/
   public JobImpressionsCompleted(int value)
   {
@@ -64,11 +81,12 @@
   }
   
   /**
-   * Tests of obj is equal to this object.
+   * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
-   * @return true if both objects are equal, false otherwise.
+   * @return true if both objects are equal, 
+   * false otherwise.
*/
   public boolean equals(Object obj)
   {
@@ -81,7 +99,7 @@
   /**
* Returns category of this class.
*
-   * @return the class JobImpressionsCompleted itself
+   * @return The class JobImpressionsCompleted itself.
*/
   public Class getCategory()
   {
@@ -89,12 +107,12 @@
   }
 
   /**
-   * Returns name of this class.
+   * Returns the name of this attribute.
*
-   * @return the string "job-impressions-completed"
+   * @return The name "job-impressions-completed".
*/
   public String getName()
   {
-return "job-impressions";
+return "job-impressions-completed";
   }
 }
Index: javax/print/attribute/standard/JobMediaSheetsCompleted.java
===
RCS file: /cvsroot/classpath/classpath/javax/print/attribute/standard/JobMediaSheetsCompleted.java,v
retrieving revision 1.5
diff -u -r1.5 JobMediaSheetsCompleted.java
--- javax/print/attribute/standard/JobMediaSheetsCompleted.java	2 Jul 2005 20:32:46 -	1.5
+++ javax/print/attribute/standard/JobMediaSheetsCompleted.java	16 Dec 2005 22:01:03 -
@@ -1,5 +1,5 @@
 /* JobMediaSheetsCompleted.java -- 
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,6 +41,18 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
+ * The JobMediaSheetsCompleted printing attribute reports
+ * the number of media sheets already processed. 
+ * 
+ * This attribute belongs to a group of job pr

[cp-patches] Patch: StyledEditorKit fix

2005-12-16 Thread Lillian Angel
Fixed a few things that differed from what the API stated.

2005-12-16  Lillian Angel  <[EMAIL PROTECTED]>

* javax/swing/text/StyledEditorKit.java
(createInputAttributes): This should copy the element
attributes into the set, not clear out the set. Fixed
to match the API spec.
* javax/swing/text/html/HTMLEditorKit.java
(getInputAttributes): Added API documentation. Fixed
implementation. Combining all input attributes should
not be done here.

Index: javax/swing/text/StyledEditorKit.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/StyledEditorKit.java,v
retrieving revision 1.17
diff -u -r1.17 StyledEditorKit.java
--- javax/swing/text/StyledEditorKit.java	13 Dec 2005 22:15:16 -	1.17
+++ javax/swing/text/StyledEditorKit.java	16 Dec 2005 21:46:06 -
@@ -714,9 +714,7 @@
   protected void createInputAttributes(Element element,
    MutableAttributeSet set)
   {
-AttributeSet atts = element.getAttributes();
-set.removeAttributes(set);
 // FIXME: Filter out component, icon and element name attributes.
-set.addAttributes(atts);
+set.addAttributes(element.getAttributes());
   }
 }
Index: javax/swing/text/html/HTMLEditorKit.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/HTMLEditorKit.java,v
retrieving revision 1.20
diff -u -r1.20 HTMLEditorKit.java
--- javax/swing/text/html/HTMLEditorKit.java	16 Dec 2005 21:35:06 -	1.20
+++ javax/swing/text/html/HTMLEditorKit.java	16 Dec 2005 21:46:06 -
@@ -1131,12 +1131,13 @@
 defaultCursor = cursor;
   }
   
+  /**
+   * Gets the input attributes used for the styled editing actions.
+   * 
+   * @return the attribute set
+   */
   public MutableAttributeSet getInputAttributes()
   {
-if (inputAttributes != null)
-  inputAttributes.addAttributes(super.getInputAttributes());
-else
-  inputAttributes = super.getInputAttributes();
 return inputAttributes;
   }
   
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: HTML default StyleSheet

2005-12-16 Thread Lillian Angel
Implemented more of HTML to use the default style sheet. I have, also,
created/committed the default style sheet (default.css) with all the
correct values.

2005-12-16  Lillian Angel  <[EMAIL PROTECTED]>

* javax/swing/text/html/HTMLDocument.java
(HTMLDocument): Fixed. The style sheet is initialized
using HTMLEditorKit.
(HTMLDocument): Fixed to call this with null as the
style sheet.
* javax/swing/text/html/HTMLEditorKit.java:
Added new fields.
(LinkController): Calls super constructor.
(InsertHTMLTextAction): Added comment.
(actionPerformed): Partially implemented.
(HTMLEditorKit): Fixed to initialize style sheet to
default.css.
(getParser): Fixed field name.
(read): Added code to set base for document.
(getContentType): Fixed to return field.
(createInputAttributes): Partially implemented.
(install): Added FIXME.
(deinstall): set field to null.
(getInputAttributes): Implemented.
* javax/swing/text/html/StyleSheet.java
(importStyleSheet): Partially implemented.
* javax/swing/text/html/default.css: New file. Default style
sheet for HTML.


Index: javax/swing/text/html/HTMLDocument.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/HTMLDocument.java,v
retrieving revision 1.16
diff -u -r1.16 HTMLDocument.java
--- javax/swing/text/html/HTMLDocument.java	15 Dec 2005 20:20:40 -	1.16
+++ javax/swing/text/html/HTMLDocument.java	16 Dec 2005 21:27:51 -
@@ -83,8 +83,7 @@
*/
   public HTMLDocument()
   {
-// FIXME: Should be using default style sheet from HTMLEditorKit
-this(new StyleSheet());
+this(null);
   }
   
   /**
@@ -108,6 +107,12 @@
   public HTMLDocument(AbstractDocument.Content c, StyleSheet styles)
   {
 this.content = c;
+if (styles == null)
+  {
+styles = new StyleSheet();
+styles.importStyleSheet(getClass().getResource(HTMLEditorKit.
+   DEFAULT_CSS));
+  }
 this.styleSheet = styles;
   }
   
Index: javax/swing/text/html/HTMLEditorKit.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/HTMLEditorKit.java,v
retrieving revision 1.19
diff -u -r1.19 HTMLEditorKit.java
--- javax/swing/text/html/HTMLEditorKit.java	15 Dec 2005 20:20:41 -	1.19
+++ javax/swing/text/html/HTMLEditorKit.java	16 Dec 2005 21:27:51 -
@@ -38,6 +38,7 @@
 
 package javax.swing.text.html;
 
+
 import java.awt.event.ActionEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
@@ -96,7 +97,7 @@
*/
   public LinkController() 
   {
-// Nothing to do here.
+super();
   }
   
   /**
@@ -229,6 +230,8 @@
   HTML.Tag alternateAddTag) 
   {
 super(name);
+// Fields are for easy access when the action is applied to an actual
+// document.
 this.html = html;
 this.parentTag = parentTag;
 this.addTag = addTag;
@@ -350,13 +353,21 @@
*/
   public void actionPerformed(ActionEvent ae)
   {
-// FIXME: Not implemented.
+Object source = ae.getSource();
+if (source instanceof JEditorPane)
+  {
+JEditorPane pane = ((JEditorPane) source);
+Document d = pane.getDocument();
+if (d instanceof HTMLDocument)
+  insertHTML(pane, (HTMLDocument) d, 0, html, 0, 0, addTag);
+// FIXME: is this correct parameters?
+  }
+// FIXME: else not implemented
   }
-}
+  }
   
   /**
-   * Abstract Action class that helps inserting HTML
-   * into an existing document.
+   * Abstract Action class that helps inserting HTML into an existing document.
*/
   public abstract static class HTMLTextAction
 extends StyledEditorKit.StyledTextAction
@@ -815,7 +826,7 @@
   /**
* The parser.
*/
-  Parser parserDel;
+  Parser parser;
   
   /**
* The mouse listener used for links.
@@ -826,6 +837,15 @@
* Style context for this editor.
*/
   StyleContext styleContext;
+  
+  /** The content type */
+  String contentType = "text/html";
+  
+  /** The input attributes defined by default.css */
+  MutableAttributeSet inputAttributes;
+  
+  /** The editor pane used. */
+  JEditorPane editorPane;
 
   /**
* Constructs an HTMLEditorKit, creates a StyleContext, and loads the style sheet.
@@ -834,9 +854,9 @@
   {
 super();
 styleContext = new StyleContext();
-// FIXME: Should load default.css for style sheet,
-// javax/swing/text/html/default.css
 styleSheet = new StyleSheet();
+styleSheet.importStyleSheet(getClass().getResource(DEFAULT_CSS));
+// FIXME: Set inputAttributes with default.css
   

[cp-patches] [PATCH/JDWP] VMVirtualMachine methods throw common exception

2005-12-16 Thread Keith Seitz

Hi,

I've been hoarding several classpath patches w.r.t. JDWP while I've been 
 away, and I think it is time I start committing some of them before 
they get out of hand. [Of course, it should also help to put some 
people's minds at some ease -- as far as I know, neither I nor Red Hat 
has yet abandoned our commitment to getting interpreted debugging in gcj 
working.]


So here's a pretty simple one that got overlooked: all methods of 
VMVirtualMachine should be allowed to throw an exception. This is useful 
when, e.g., an illegal parameter is passed into the JDWP back-end and 
the generic code (gnu.classpath.jdwp.processor.*) has no way of 
validating the data.


Of course, this necessitates a follow-on patch which removes 
ID-to-object resolution in gnu.classpath.jdwp.processor.*, which will 
follow shortly.


I assume that I may still commit these changes. Someone please speak up 
if I am assuming too much.


Keith

ChangeLog
2005-12-16  Keith Seitz  <[EMAIL PROTECTED]>

* vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
(VMVirtualMachine): All methods now throw JdwpException.
Index: vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
===
RCS file: /sources/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java,v
retrieving revision 1.1
diff -u -p -r1.1 VMVirtualMachine.java
--- vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java	3 Sep 2005 00:17:50 -	1.1
+++ vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java	16 Dec 2005 20:54:22 -
@@ -42,6 +42,7 @@ exception statement from your version. *
 package gnu.classpath.jdwp;
 
 import gnu.classpath.jdwp.event.EventRequest;
+import gnu.classpath.jdwp.exception.JdwpException;
 import gnu.classpath.jdwp.exception.InvalidClassException;
 import gnu.classpath.jdwp.exception.InvalidObjectException;
 import gnu.classpath.jdwp.id.ObjectId;
@@ -68,12 +69,14 @@ public class VMVirtualMachine
*
* @param  thread  the thread to suspend
*/
-  public static native void suspendThread (Thread thread);
+  public static native void suspendThread (Thread thread)
+throws JdwpException;
 
   /**
* Suspend all threads
*/
   public static void suspendAllThreads ()
+throws JdwpException
   {
 // Our JDWP thread group -- don't suspend any of those threads
 Thread current = Thread.currentThread ();
@@ -118,7 +121,8 @@ public class VMVirtualMachine
*
* @param  thread  the thread to resume
*/
-  public static native void resumeThread (Thread thread);
+  public static native void resumeThread (Thread thread)
+throws JdwpException;
 
   /**
* Resume all threads. This simply decrements the thread's
@@ -126,6 +130,7 @@ public class VMVirtualMachine
* to run.
*/
   public static void resumeAllThreads ()
+throws JdwpException
   {
 // Our JDWP thread group -- don't resume
 Thread current = Thread.currentThread ();
@@ -167,17 +172,20 @@ public class VMVirtualMachine
* @param  thread  the thread whose suspend count is desired
* @return the number of times the thread has been suspended
*/
-  public static native int getSuspendCount (Thread thread);
+  public static native int getSuspendCount (Thread thread)
+throws JdwpException;
  
   /**
* Returns a count of the number of loaded classes in the VM
*/
-  public static native int getAllLoadedClassesCount ();
+  public static native int getAllLoadedClassesCount ()
+throws JdwpException;
 
   /**
* Returns an iterator over all the loaded classes in the VM
*/
-  public static native Iterator getAllLoadedClasses ();
+  public static native Iterator getAllLoadedClasses ()
+throws JdwpException;
 
   /**
* Returns the status of the given class
@@ -186,7 +194,8 @@ public class VMVirtualMachine
* @return a flag containing the class's status
* @see JdwpConstants.ClassStatus
*/
-  public static native int getClassStatus (Class clazz);
+  public static native int getClassStatus (Class clazz)
+throws JdwpException;
 
 
   /**
@@ -198,7 +207,8 @@ public class VMVirtualMachine
* @return a list of frames
*/
   public static native ArrayList getFrames (Thread thread, int strart,
-	int length);
+	int length)
+throws JdwpException;
 
   /**
* Returns the frame for a given thread with the frame ID in
@@ -210,7 +220,8 @@ public class VMVirtualMachine
* @param  bb  buffer containing the frame's ID
* @return the desired frame
*/
-  public static native VMFrame getFrame (Thread thread, ByteBuffer bb);
+  public static native VMFrame getFrame (Thread thread, ByteBuffer bb)
+throws JdwpException;
 
   /**
* Returns the number of frames in the thread's stack
@@ -218,7 +229,8 @@ public class VMVirtualMachine
* @param  thread  the thread for which to get a frame count
* @return the number of frames in the thread's stack
*/
-  public static native int getFram

Re: [cp-patches] RFC: new VM interface for Socket impls

2005-12-16 Thread Guilhem Lavaux

Hi Roman,

I have a few problem concerning the VM interface.

1) accept() & close() may be called at the same time. Calling close() in 
another thread should stop the accept() call this is perfectly valid and 
implemented in kaffe/gcj/jdk. I know that in general we must authorize 
the user to use the same socket for different operations in different 
threads at the same time because that is authorized by the JDK.


2) I have a comment concerning the use of SO_TIMEOUT. At least on Unix 
this option is not generally implemented correctly (consistently ?) by 
the OS. So generally implementations relies on select/poll to really 
have operations which have a time out. Either the native will have to 
take care of this either we change this default implementation (I have 
seen it in connect)


Regards,

Guilhem.

Roman Kennke wrote:

Hi there,

I have put together a new proposal for the VM interface for
Plain(Datagram)SocketImpl. I incorporated most of Marks suggestions.
Also I introduced an optimization for
VMPlainDatagramSocketImpl.receive() which turns out to be significantly
faster than before because it avoids copying stuff back and forth from
java to native and vice versa.

Am Mittwoch, den 07.12.2005, 13:35 +0100 schrieb Mark Wielaard:


On Fri, 2005-11-11 at 17:53 +0100, Mark Wielaard wrote:


On Wed, 2005-11-09 at 21:16 +, Roman Kennke wrote:


Ingo has abstracted out the native code from gnu.java.net.PlainSocketImpl
and gnu.java.net.PlainDatagramSocketImpl into a new VM interface. This
allows VM implementors to provide a different implementation for the
native parts of these classes if they wish. Is this ok to commit as it
is? Do you have any suggestions/improvements to the interface? We would
like to have a stable VM interface for this area, so maybe it would be
helpful to discuss this with other VM implementors...


A first comment is that for the VM reference implementation I would just
make all methods native directly, no need to chain them to some helper
method here. Is there a reason that only nativeLeave() is synchronized?



I changed that.



After we agree on this VM interface (and I think it is good, I just want
to try it out first) we can discuss the rest of the patch. Just one
quick nitpick now already: please keep the boilerplate at the top of the
file intact, some of the files in the patch have the old FSF address.



Fixed.



- Do we need the boolean stream argument in
 VMPlainSocketImpl.create()?



No we don't. I have changed the VM interface.



- VMPlainSocketImpl.bind() has as comment
  How bind to INADDR_ANY 
 Should we make a convention for that one? For example just use null
 add addr?



The API docs for Socket.bind() seem to suggest that null means
INADDR_ANY. So I would do it like this too.



- There is a PlainSocketImpl.connect() method that takes a timeout
 argument. We provide a default implementation now, but shouldn't this
 version move to the VMPlainSocketImpl? I don't know if our default
 implementation is actually that create, maybe you want to do the
 actual timeout in a more specific way.



I pulled that into the VM interface.



- Should we provide wrappers/unwrappers for the Integer and Boolean
 arguments/return values of setOption() and getOption() that call the
 VM versions with primitive types? That would make the JNI code much
 cleaner.



I haven't done this yet because this would mean to change the native
code significantly.



- PlainSocketImpl.sendUrgentData() should delegate to VMPlainSocketImpl.



Pulled into the VM interface.



- It might makes sense to have a no argument read() and write() method
 in the VM interface instead of just the byte[] versions.



Pulled in, however still wraps things up into byte[] to avoid heavy
adjustments in native code at this point.



- We should explicitly document the new constant IP_TTL we use in
 PlainDatagramSocketImpl for the VM interface since it isn't defined as
 SocketOption. Or should we just make a special VM interface to set/get
 the TTL?



I have pulled the constant into the VM interface.



- The PlainDatagramSocket multicast opertations join(Group),
 leave(Group) etc, need to go through to the VM interface.



Pulled in.

Is this ok to check in?

2005-12-16  Roman Kennke  <[EMAIL PROTECTED]>

* vm/reference/gnu/java/net/VMPlainSocketImpl.java: New VM
class.
* vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java:
New VM class.
* native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c: New
file.
* native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c:
New file.
* native/jni/java-net/gnu_java_net_PlainDatagramSocketImpl.c:
Removed.
* native/jni/java-net/gnu_java_net_PlainSocketImpl.c: Removed.
* native/jni/java-net/Makefile.am: Adjusted for new source
files.
* gnu/java/net/PlainDatagramSocketImpl.java: Use new VM
interface.
* gnu/java/net/PlainSocketImpl.java: Use new VM interface.
  

[cp-patches] FYI: Patch for EnumSyntax attributes in the print api

2005-12-16 Thread Wolfgang Baer

Hi all,

this patch completes the classes extending javax.print.attribute.EnumSyntax
which are needing some methods to be overriden. There are also several fixes 
found during work on the internals.


Regards,
Wolfgang


2005-12-16  Wolfgang Baer  <[EMAIL PROTECTED]>

* javax/print/attribute/standard/MediaSizeName.java:
Added and updated javadocs to class and methods.
(getStringTable): Implemented.
(getEnumValueTable): Implemented.
(stringTable): New field.
(enumValueTable): New field.
* javax/print/attribute/standard/MediaName.java:
Added and updated javadocs to class and methods.
(getStringTable): Implemented.
(getEnumValueTable): Implemented.
(stringTable): New field.
(enumValueTable): New field.
(NA_LETTER_WHITE): Fixed value of enum.
(NA_LETTER_TRANSPARENT): Likewise.
(ISO_A4_WHITE): Likewise.
(ISO_A4_TRANSPARENT): Likewise.
(serialVersionUID): New field.
* javax/print/attribute/standard/Media.java:
Added and updated javadocs to class and methods.
(equals): New overridden method.
* javax/print/attribute/standard/MediaTray.java:
Added and updated javadocs to class and methods.
(getStringTable): Implemented.
(getEnumValueTable): Implemented.
(stringTable): New field.
(enumValueTable): New field.
(TOP): Fixed value of enum.
(MIDDLE): Likewise.
(BOTTOM): Likewise.
(ENVELOPE): Likewise.
(LARGE_CAPACITY): Likewise.
(MAIN): Likewise.
(SIDE): Likewise.
(serialVersionUID): New field.
* javax/print/attribute/standard/PrinterState.java:
Added and updated javadocs to class and methods.
(getStringTable): New overridden method.
(getEnumValueTable): New overridden method.
(stringTable): New field.
(enumValueTable): New field.
(IDLE): Fixed value of enum.
(PROCESSING): Likewise.
(STOPPED): Likewise.
* javax/print/attribute/standard/JobState.java:
Added and updated javadocs to class and methods.
(getStringTable): New overridden method.
(getEnumValueTable): New overridden method.
(stringTable): New field.
(enumValueTable): New field.
(PENDING): Fixed value of enum.
(PENDING_HELD): Likewise.
(PROCESSING): Likewise.
(PROCESSING_STOPPED): Likewise.
(CANCELED): Likewise.
(ABORTED): Likewise.
(COMPLETED): Likewise.
* javax/print/attribute/standard/SheetCollate.java,
* javax/print/attribute/standard/PresentationDirection.java,
* javax/print/attribute/standard/ReferenceUriSchemesSupported.java,
* javax/print/attribute/standard/PrinterStateReason.java,
* javax/print/attribute/standard/JobStateReason.java,
* javax/print/attribute/standard/JobSheets.java:
Added and updated javadocs to class and methods.
(getStringTable): New overridden method.
(getEnumValueTable): New overridden method.
(stringTable): New field.
(enumValueTable): New field.




EnumSyntaxSubclasses_2.patch.gz
Description: GNU Zip compressed data
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: Removed java_nio.c

2005-12-16 Thread Roman Kennke

I removed this obsolete file. According to ChangeLog-2003 it was excluded
from compilation since 2003-07-02 by Michael.


2005-12-16  Roman Kennke  <[EMAIL PROTECTED]>

* native/jni/java-nio/java_nio.c
Removed obsolete file.

/Roman


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: FYI: javadoc fix in Class

2005-12-16 Thread Tom Tromey
I'm checking this in.

This updates some javadoc in java.lang.Class to more accurately
reflect reality.

Tom

2005-12-16  Tom Tromey  <[EMAIL PROTECTED]>

* java/lang/Class.java (getPackage): Javadoc fix.

Index: java/lang/Class.java
===
RCS file: /cvsroot/classpath/classpath/java/lang/Class.java,v
retrieving revision 1.41
diff -u -r1.41 Class.java
--- java/lang/Class.java28 Oct 2005 09:26:48 -  1.41
+++ java/lang/Class.java16 Dec 2005 18:00:53 -
@@ -583,8 +583,7 @@
   /**
* Returns the Package in which this class is defined
* Returns null when this information is not available from the
-   * classloader of this class or when the classloader of this class
-   * is null.
+   * classloader of this class.
*
* @return the package for this class, if it is available
* @since 1.2


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: Fix for __attribute__ handling

2005-12-16 Thread Roman Kennke
In jcl.c we redefine __attribute__(x) for non-GCC compilers. This can be
improved a little by redefining it only if it's not already defined.

2005-12-16  Roman Kennke  <[EMAIL PROTECTED]>

* native/jni/classpath/jcl.c:
Only redefine __attribute__ if it's not already defined.

/Roman
Index: native/jni/classpath/jcl.c
===
RCS file: /cvsroot/classpath/classpath/native/jni/classpath/jcl.c,v
retrieving revision 1.18
diff -u -r1.18 jcl.c
--- native/jni/classpath/jcl.c	17 Sep 2005 21:41:33 -	1.18
+++ native/jni/classpath/jcl.c	16 Dec 2005 17:46:43 -
@@ -43,7 +43,9 @@
 #include 
 
 #ifndef __GNUC__
-#define __attribute__(x)	/* nothing */
+  #ifndef __attribute__
+#define __attribute__(x)	/* nothing */
+  #endif
 #endif
 
 JNIEXPORT void JNICALL
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: DatagramSocket fix

2005-12-16 Thread Roman Kennke
Hi,

the DatagramSocket supports setting a factory for DatagramSocketImpls,
but seems to never actually use it. This patch fixes this. A mauve test
is following soon.

2005-12-16  Roman Kennke  <[EMAIL PROTECTED]>

* java/net/DatagramSocket.java
(DatagramSocket(SocketAddress)): Actually use the factory if one
is installed.


/Roman
Index: java/net/DatagramSocket.java
===
RCS file: /cvsroot/classpath/classpath/java/net/DatagramSocket.java,v
retrieving revision 1.47
diff -u -r1.47 DatagramSocket.java
--- java/net/DatagramSocket.java	2 Oct 2005 22:58:42 -	1.47
+++ java/net/DatagramSocket.java	16 Dec 2005 17:08:36 -
@@ -176,7 +176,12 @@
   {
 String propVal = SystemProperties.getProperty("impl.prefix");
 if (propVal == null || propVal.equals(""))
-  impl = new PlainDatagramSocketImpl();
+  {
+if (factory != null)
+  impl = factory.createDatagramSocketImpl();
+else
+  impl = new PlainDatagramSocketImpl();
+  }
 else
   try
 {
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: FYI: warning fixlet

2005-12-16 Thread Tom Tromey
I'm checking this in.

This fixes a warning in the core that I happened to come across.  (I
try to keep java.lang and other core packages more or less warning
free in the Eclipse build...)

Tom

2005-12-16  Tom Tromey  <[EMAIL PROTECTED]>

* java/io/ObjectInputStream.java: Organized imports.

Index: java/io/ObjectInputStream.java
===
RCS file: /cvsroot/classpath/classpath/java/io/ObjectInputStream.java,v
retrieving revision 1.72
diff -u -r1.72 ObjectInputStream.java
--- java/io/ObjectInputStream.java  12 Nov 2005 18:19:34 -  1.72
+++ java/io/ObjectInputStream.java  16 Dec 2005 15:54:35 -
@@ -50,7 +50,6 @@
 import java.lang.reflect.Proxy;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.Arrays;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.TreeSet;


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] RFC: new VM interface for Socket impls

2005-12-16 Thread Roman Kennke
Hi there,

I have put together a new proposal for the VM interface for
Plain(Datagram)SocketImpl. I incorporated most of Marks suggestions.
Also I introduced an optimization for
VMPlainDatagramSocketImpl.receive() which turns out to be significantly
faster than before because it avoids copying stuff back and forth from
java to native and vice versa.

Am Mittwoch, den 07.12.2005, 13:35 +0100 schrieb Mark Wielaard:
> On Fri, 2005-11-11 at 17:53 +0100, Mark Wielaard wrote:
> > On Wed, 2005-11-09 at 21:16 +, Roman Kennke wrote:
> > > Ingo has abstracted out the native code from gnu.java.net.PlainSocketImpl
> > > and gnu.java.net.PlainDatagramSocketImpl into a new VM interface. This
> > > allows VM implementors to provide a different implementation for the
> > > native parts of these classes if they wish. Is this ok to commit as it
> > > is? Do you have any suggestions/improvements to the interface? We would
> > > like to have a stable VM interface for this area, so maybe it would be
> > > helpful to discuss this with other VM implementors...
> > 
> > A first comment is that for the VM reference implementation I would just
> > make all methods native directly, no need to chain them to some helper
> > method here. Is there a reason that only nativeLeave() is synchronized?

I changed that.

> > After we agree on this VM interface (and I think it is good, I just want
> > to try it out first) we can discuss the rest of the patch. Just one
> > quick nitpick now already: please keep the boilerplate at the top of the
> > file intact, some of the files in the patch have the old FSF address.

Fixed.

> - Do we need the boolean stream argument in
>   VMPlainSocketImpl.create()?

No we don't. I have changed the VM interface.

> - VMPlainSocketImpl.bind() has as comment
>    How bind to INADDR_ANY 
>   Should we make a convention for that one? For example just use null
>   add addr?

The API docs for Socket.bind() seem to suggest that null means
INADDR_ANY. So I would do it like this too.

> - There is a PlainSocketImpl.connect() method that takes a timeout
>   argument. We provide a default implementation now, but shouldn't this
>   version move to the VMPlainSocketImpl? I don't know if our default
>   implementation is actually that create, maybe you want to do the
>   actual timeout in a more specific way.

I pulled that into the VM interface.

> - Should we provide wrappers/unwrappers for the Integer and Boolean
>   arguments/return values of setOption() and getOption() that call the
>   VM versions with primitive types? That would make the JNI code much
>   cleaner.

I haven't done this yet because this would mean to change the native
code significantly.

> - PlainSocketImpl.sendUrgentData() should delegate to VMPlainSocketImpl.

Pulled into the VM interface.

> - It might makes sense to have a no argument read() and write() method
>   in the VM interface instead of just the byte[] versions.

Pulled in, however still wraps things up into byte[] to avoid heavy
adjustments in native code at this point.

> - We should explicitly document the new constant IP_TTL we use in
>   PlainDatagramSocketImpl for the VM interface since it isn't defined as
>   SocketOption. Or should we just make a special VM interface to set/get
>   the TTL?

I have pulled the constant into the VM interface.

> - The PlainDatagramSocket multicast opertations join(Group),
>   leave(Group) etc, need to go through to the VM interface.

Pulled in.

Is this ok to check in?

2005-12-16  Roman Kennke  <[EMAIL PROTECTED]>

* vm/reference/gnu/java/net/VMPlainSocketImpl.java: New VM
class.
* vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java:
New VM class.
* native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c: New
file.
* native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c:
New file.
* native/jni/java-net/gnu_java_net_PlainDatagramSocketImpl.c:
Removed.
* native/jni/java-net/gnu_java_net_PlainSocketImpl.c: Removed.
* native/jni/java-net/Makefile.am: Adjusted for new source
files.
* gnu/java/net/PlainDatagramSocketImpl.java: Use new VM
interface.
* gnu/java/net/PlainSocketImpl.java: Use new VM interface.
* include/gnu_java_net_PlainDatagramSocketImpl.h: Removed.
* include/gnu_java_net_PlainSocketImpl.h: Removed.
* include/gnu_java_net_VMPlainDatagramSocketImpl.h: New header
file.
* include/gnu_java_net_VMPlainSocketImpl.h: New header file.


/Roman



patch-VM-net.diff.gz
Description: GNU Zip compressed data


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] RFC: new VM interface for Socket impls

2005-12-16 Thread Roman Kennke
Hi Mark,

Am Mittwoch, den 07.12.2005, 13:35 +0100 schrieb Mark Wielaard:
> On Fri, 2005-11-11 at 17:53 +0100, Mark Wielaard wrote:
> > On Wed, 2005-11-09 at 21:16 +, Roman Kennke wrote:
> > > Ingo has abstracted out the native code from gnu.java.net.PlainSocketImpl
> > > and gnu.java.net.PlainDatagramSocketImpl into a new VM interface. This
> > > allows VM implementors to provide a different implementation for the
> > > native parts of these classes if they wish. Is this ok to commit as it
> > > is? Do you have any suggestions/improvements to the interface? We would
> > > like to have a stable VM interface for this area, so maybe it would be
> > > helpful to discuss this with other VM implementors...
> > 
> > A first comment is that for the VM reference implementation I would just
> > make all methods native directly, no need to chain them to some helper
> > method here. Is there a reason that only nativeLeave() is synchronized?

Ok, then lets make them native directly. This is only a habit, because
in many cases it turned out to be more convenient to wrap a native
method in a java method, i.e. to prepare arguments or do some additional
things on the java side. It doesn't matter much here I guess.

> This isn't a full review, just some additional comments in addition to
> my earlier remarks after studying the libgcj versions. Maybe others
> (Guilhem said Kaffe also doesn't have this part merged) have some
> comments and then you can sent an updated proposal/patch. (I realize
> some of the comments are just reflections on previous design mistakes,
> but lets try clean them up now.)

yeah.

> - Do we need the boolean stream argument in
>   VMPlainSocketImpl.create()?

I think not, datagram sockets are handled separately in
VMDatagramSocketImpl AFAICS.

> - VMPlainSocketImpl.bind() has as comment
>    How bind to INADDR_ANY 
>   Should we make a convention for that one? For example just use null
>   add addr?

I don't really know. I am not really familiar with the net code...

> - There is a PlainSocketImpl.connect() method that takes a timeout
>   argument. We provide a default implementation now, but shouldn't this
>   version move to the VMPlainSocketImpl? I don't know if our default
>   implementation is actually that create, maybe you want to do the
>   actual timeout in a more specific way.

Agreed. So we would have two connect() methods in the VMPlainSocketImpl.

> - Should we provide wrappers/unwrappers for the Integer and Boolean
>   arguments/return values of setOption() and getOption() that call the
>   VM versions with primitive types? That would make the JNI code much
>   cleaner.

Sounds reasonable. I would think that value always is some primitive
type, so we don't really need Object there, right?

> - PlainSocketImpl.sendUrgentData() should delegate to VMPlainSocketImpl.

Agreed.

> - It might makes sense to have a no argument read() and write() method
>   in the VM interface instead of just the byte[] versions.

Also agreed.

> - We should explicitly document the new constant IP_TTL we use in
>   PlainDatagramSocketImpl for the VM interface since it isn't defined as
>   SocketOption. Or should we just make a special VM interface to set/get
>   the TTL?

I vote for documenting the constant.

> - The PlainDatagramSocket multicast opertations join(Group),
>   leave(Group) etc, need to go through to the VM interface.

Agreed.

I will put together a new patch that incorporates the suggested changes.

Cheers, Roman



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches